summaryrefslogtreecommitdiffstats
path: root/game/code/presentation/tutorialmanager.cpp
blob: f78e952671cbb425f5fa9a20a29834c1f1a63313 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
//=============================================================================
// Copyright (C) 2002 Radical Entertainment Ltd.  All rights reserved.
//
// File:        presentation.cpp
//
// Description: Implement PresentationManager
//
// History:     16/04/2002 + Created -- NAME
//
//=============================================================================

//========================================
// System Includes
//========================================

//========================================
// Project Includes
//========================================
#include <data/gamedatamanager.h>
#include <events/eventmanager.h>
#include <gameflow/gameflow.h>
#include <main/commandlineoptions.h>
#include <memory/srrmemory.h>
#include <meta/locatorevents.h>
#include <mission/mission.h>
#include <mission/missionmanager.h>
#include <mission/gameplaymanager.h>
#include <mission/objectives/missionobjective.h>
#include <presentation/gui/guisystem.h>
#include <presentation/gui/ingame/guimanageringame.h>
#include <presentation/gui/ingame/guiscreenhud.h>
#include <presentation/tutorialmanager.h>
#include <presentation/tutorialmode.h>
#include <worldsim/redbrick/vehicle.h>

#include <string.h>

//******************************************************************************
//
// Global Data, Local Data, Local Classes
//
//******************************************************************************

// Static pointer to instance of singleton.
TutorialManager* TutorialManager::spInstance = NULL;
//#define NUMBER_OF_MISSION_OBJECTIVE_MESSAGES 300

//******************************************************************************
//
// Public Member Functions
//
//******************************************************************************

//=============================================================================
// TutorialManager::CreateInstance
//=============================================================================
// Description: creats an instance of the singleton
//
// Parameters:  ()
//
// Return:      TutorialManager
//
//=============================================================================
TutorialManager* TutorialManager::CreateInstance()
{
    MEMTRACK_PUSH_GROUP( "TutorialManager" );
    if( spInstance == NULL )
    {
        spInstance = new TutorialManager;
        rAssert( spInstance );
    }
    size_t size = sizeof( TutorialManager );
    MEMTRACK_POP_GROUP( "TutorialManager" );
    return spInstance;
}

//=============================================================================
// TutorialManager::GetInstance
//=============================================================================
// Description: gets the instance of the singleton
//
// Parameters:  ()
//
// Return:      TutorialManager
//
//=============================================================================
TutorialManager* TutorialManager::GetInstance()
{
    return spInstance;
}

//=============================================================================
// TutorialManager::AddToQueue
//=============================================================================
// Description: adds an item to the queue of events to process
//
// Parameters:  event - the tutorial event that we want to show as soon as 
//                      possible
//
// Return:      void 
//
//=============================================================================
void TutorialManager::AddToQueue( TutorialMode event )
{
    m_Queue.push_back( event );
}

//=============================================================================
// TutorialManager::DestroyInstance
//=============================================================================
// Description: destroys the only instance of the singleton
//
// Parameters:  ()
//
// Return:      void 
//
//=============================================================================
void TutorialManager::DestroyInstance()
{
    if( spInstance != NULL )
    {
        delete spInstance;
        spInstance = NULL;
    }
}

//==============================================================================
// TutorialManager::TutorialManager
//==============================================================================
// Description: Constructor.
//
// Parameters: None.
//
// Return:      N/A.
//
//==============================================================================
TutorialManager::TutorialManager() :
    m_EnableTutorialMode( false ),
    m_EnableTutorialEvents( true ),
    m_DialogCurrentlyPlaying( false ),
    m_TimeSinceDialogStart( 0.0f ),
    m_tutorialsSeen( 0 )
{
#ifndef FINAL
    // We're going to be passing enums in void* messages - they'd better be the
    // same size or else we're in big trouble
    size_t sizeOfEnum = sizeof( TutorialMode );
    size_t sizeOfVoid = sizeof( void* );
    rReleaseAssert( sizeOfEnum == sizeOfVoid );
#endif
    m_Queue.reserve( 16 );

    GetGameDataManager()->RegisterGameData( this, 1 + sizeof( m_tutorialsSeen ), "Tutorial Manager" );

    if( CommandLineOptions::Get( CLO_NO_TUTORIAL ) )
    {
        m_EnableTutorialEvents = false;
    }
}

//==============================================================================
// TutorialManager::~TutorialManager
//==============================================================================
// Description: Destructor.
//
// Parameters: None.
//
// Return:      N/A.
//
//==============================================================================
TutorialManager::~TutorialManager()
{
    GetEventManager()->RemoveAll( this );
}

//==============================================================================
// TutorialManager::HandleEvent
//==============================================================================
// Description: Handles events that are passed to this listener
//
// Parameters:  id - the event id
//              pEventData - any data that tags along for the ride
//
// Return:      N/A.
//
//==============================================================================
void TutorialManager::HandleEvent( EventEnum id, void* pEventData )
{
    if( id == EVENT_TUTORIAL_DIALOG_DONE )
    {
        MarkDialogFinished();

        return;
    }

    if( !m_EnableTutorialMode || !m_EnableTutorialEvents )
    {
        return;
    }

    switch( id )
    {
        case EVENT_CARD_COLLECTED:
        {
            AddToQueue( TUTORIAL_COLLECTOR_CARD );
            GetEventManager()->RemoveListener( this, EVENT_CARD_COLLECTED );
            break;
        }
        case EVENT_COLLECTED_COINS:
        {
            AddToQueue( TUTORIAL_COLLECTOR_COIN );
            GetEventManager()->RemoveListener( this, EVENT_COLLECTED_COINS );
            break;
        }
        case static_cast< EventEnum >( EVENT_LOCATOR + LocatorEvent::INTERIOR_ENTRANCE ):
        {
            AddToQueue( TUTORIAL_INTERIOR_ENTERED );
            GetEventManager()->RemoveListener( this, static_cast< EventEnum >( EVENT_LOCATOR + LocatorEvent::INTERIOR_ENTRANCE ) );
            break;
        }
        case static_cast< EventEnum >( EVENT_LOCATOR + LocatorEvent::CAR_DOOR ):
        {
            AddToQueue( TUTORIAL_AT_CAR_DOOR );
            GetEventManager()->RemoveListener( this, static_cast< EventEnum >( EVENT_LOCATOR + LocatorEvent::CAR_DOOR ) );
            break;
        }
        case static_cast< EventEnum >( EVENT_INTERACTIVE_GAG ):
        {
            AddToQueue( TUTORIAL_INTERACTIVE_GAG );
            GetEventManager()->RemoveListener( this, static_cast< EventEnum >( EVENT_INTERACTIVE_GAG ) );
            break;
        }
        case EVENT_ENTERING_PLAYER_CAR:
        {
            AddToQueue( TUTORIAL_GETTING_INTO_PLAYER_CAR );
            GetEventManager()->RemoveListener( this, EVENT_ENTERING_PLAYER_CAR );
    	    break;
        }
        case EVENT_ENTERING_TRAFFIC_CAR:
        {
            //
            // Have we played the player car tutorial message yet?
            //
            bool seenDrivingTutorial = QueryTutorialSeen( TUTORIAL_GETTING_INTO_PLAYER_CAR );
            if( seenDrivingTutorial )
            {
                AddToQueue( TUTORIAL_GETTING_INTO_TRAFFIC_CAR );
                GetEventManager()->RemoveListener( this, EVENT_ENTERING_TRAFFIC_CAR );
            }
            else
            {
                 AddToQueue( TUTORIAL_GETTING_INTO_PLAYER_CAR );
                 SetTutorialSeen( TUTORIAL_GETTING_INTO_TRAFFIC_CAR, true );
                 GetEventManager()->RemoveListener( this, EVENT_ENTERING_TRAFFIC_CAR );
                 GetEventManager()->RemoveListener( this, EVENT_ENTERING_PLAYER_CAR );
            }
            break;
        }
        case EVENT_ANIMATED_CAM_SHUTDOWN:
        {
            AddToQueue( TUTORIAL_START_GAME );
            GetEventManager()->RemoveListener( this, EVENT_ANIMATED_CAM_SHUTDOWN );
            break;
        }
        case EVENT_BONUS_MISSION_CHARACTER_APPROACHED:
        {
            int missionNum = reinterpret_cast< int >( pEventData );
            Mission* mission = GetMissionManager()->GetMission( missionNum );
            bool raceMission = mission->IsRaceMission();
            bool wagerMission = mission->IsWagerMission();

            if( wagerMission )
            {
                AddToQueue( TUTORIAL_WAGER_MISSION );
            }
            else if( raceMission ) 
            {
                AddToQueue( TUTORIAL_RACE );
            }
            else
            {
                AddToQueue( TUTORIAL_BONUS_MISSION );
            }

            bool seenRace  = QueryTutorialSeen( TUTORIAL_RACE );
            bool seenBonus = QueryTutorialSeen( TUTORIAL_BONUS_MISSION );
            bool seenWager = QueryTutorialSeen( TUTORIAL_WAGER_MISSION );
            if( seenRace && seenBonus && seenWager )
            {
                GetEventManager()->RemoveListener( this, EVENT_MISSION_START );
            }
            break;
        }
        case EVENT_HIT_BREAKABLE:
        {
            AddToQueue( TUTORIAL_BREAKABLE_DESTROYED );
            GetEventManager()->RemoveListener( this, EVENT_HIT_BREAKABLE );
            break;
        }
        case EVENT_UNLOCKED_CAR:
        {
            AddToQueue( TUTORIAL_UNLOCKED_CAR );
            GetEventManager()->RemoveListener( this, EVENT_UNLOCKED_CAR );
            break;
        }
        case EVENT_VEHICLE_DESTROYED:
        {
            //
            // Check if this is a user vehicle
            //
            Vehicle* vehicle = reinterpret_cast< Vehicle* >( pEventData );
            rAssert( vehicle != NULL );
            if( vehicle->mVehicleType == VT_USER )
            {
                AddToQueue( TUTORIAL_VEHICLE_DESTROYED );
                GetEventManager()->RemoveListener( this, EVENT_VEHICLE_DESTROYED );
            }
            break;
        }
        case EVENT_COLLECTED_WRENCH:
        {
            AddToQueue( TUTORIAL_WRENCH );
            GetEventManager()->RemoveListener( this, EVENT_COLLECTED_WRENCH );
            break;
        }
        case EVENT_WASP_APPROACHED:
        {
            AddToQueue( TUTORIAL_BREAK_CAMERA );
            GetEventManager()->RemoveListener( this, EVENT_WASP_APPROACHED );
            break;
        }
        default:
        {
            rAssertMsg( false, "TutorialManager: why are we registered for messages we don't care about?" );
            break;
        }
    }

//    ProcessQueue();
}

//==============================================================================
// TutorialManager::Initialize
//==============================================================================
// Description: Initializes this manager as a listener to various event types
//
// Parameters:  None
//
// Return:      N/A.
//
//==============================================================================
void TutorialManager::Initialize()
{
    while( !m_Queue.empty() )
    {
        m_Queue.pop_back();
    }

    GetEventManager()->AddListener( this, EVENT_CARD_COLLECTED                );
    GetEventManager()->AddListener( this, EVENT_COLLECTED_COINS               );
    GetEventManager()->AddListener( this, EVENT_COLLECTED_WRENCH              );
    GetEventManager()->AddListener( this, static_cast< EventEnum >( EVENT_LOCATOR + LocatorEvent::INTERIOR_ENTRANCE ) );
    GetEventManager()->AddListener( this, static_cast< EventEnum >( EVENT_LOCATOR + LocatorEvent::CAR_DOOR          ) );
    GetEventManager()->AddListener( this, EVENT_INTERACTIVE_GAG               );
    GetEventManager()->AddListener( this, EVENT_ENTERING_PLAYER_CAR           );
    GetEventManager()->AddListener( this, EVENT_ENTERING_TRAFFIC_CAR          );
    GetEventManager()->AddListener( this, EVENT_ANIMATED_CAM_SHUTDOWN         );
    GetEventManager()->AddListener( this, EVENT_BONUS_MISSION_CHARACTER_APPROACHED );
    GetEventManager()->AddListener( this, EVENT_HIT_BREAKABLE              );
    GetEventManager()->AddListener( this, EVENT_TUTORIAL_DIALOG_DONE          );
    GetEventManager()->AddListener( this, EVENT_UNLOCKED_CAR                  );
    GetEventManager()->AddListener( this, EVENT_VEHICLE_DESTROYED             );
    GetEventManager()->AddListener( this, EVENT_WASP_APPROACHED               );
}

//==============================================================================
// TutorialManager::MarkDialogFinished
//==============================================================================
// Description: when a piece of dialog is finished playing, you may need to play
//              another
//
// Parameters:  None
//
// Return:      N/A.
//
//==============================================================================
void TutorialManager::MarkDialogFinished()
{
/*
    CGuiScreenHud* hud = GetCurrentHud();
    if( hud != NULL )
    {
        hud->TutorialBitmapInitOutro();
    }
*/
    m_DialogCurrentlyPlaying = false;
//    ProcessQueue();
}

//==============================================================================
// TutorialManager::ProcessQueue
//==============================================================================
// Description: takes an item out of the queue, and processes it
//
// Parameters:  None
//
// Return:      N/A.
//
//==============================================================================
void TutorialManager::ProcessQueue()
{
/*
    CGuiScreenHud* hud = GetCurrentHud();
    if( hud == NULL )
    {
        return;
    }
*/
    if( m_DialogCurrentlyPlaying )
    {
        return;
    }

    //
    // return if there's nothing in the queue
    //
    size_t size = m_Queue.size();
    if( size <= 0 )
    {
        return;
    }

    TutorialMode event = m_Queue.front();

    //
    // Check if the event is marked in the character sheet as "already played"
    //
    bool alreadySeen = this->QueryTutorialSeen( event );
    if( !alreadySeen )
    {
        //
        // Make sure we never see this message again
        //
        this->SetTutorialSeen( event, true );

#ifndef RAD_WIN32
        switch( event )
        {
        case TUTORIAL_BREAK_CAMERA:
            {
                m_DialogCurrentlyPlaying = true;
                m_TimeSinceDialogStart = 0;
                TutorialMode mode = TUTORIAL_BREAK_CAMERA;
                GetEventManager()->TriggerEvent( EVENT_TUTORIAL_DIALOG_PLAY, &mode );
                break;
            }
        case TUTORIAL_BONUS_MISSION:
            {
                m_DialogCurrentlyPlaying = true;
                m_TimeSinceDialogStart = 0;
                TutorialMode mode = TUTORIAL_BONUS_MISSION;
                GetEventManager()->TriggerEvent( EVENT_TUTORIAL_DIALOG_PLAY, &mode );
                break;
            }
        case TUTORIAL_BREAKABLE_DESTROYED:
            {
                m_DialogCurrentlyPlaying = true;
                m_TimeSinceDialogStart = 0;
                TutorialMode mode = TUTORIAL_BREAKABLE_DESTROYED;
                GetEventManager()->TriggerEvent( EVENT_TUTORIAL_DIALOG_PLAY, &mode );
                break;
            }
        case TUTORIAL_COLLECTOR_CARD: 
            {
                m_DialogCurrentlyPlaying = true;
                m_TimeSinceDialogStart = 0;
                TutorialMode mode = TUTORIAL_COLLECTOR_CARD;
                GetEventManager()->TriggerEvent( EVENT_TUTORIAL_DIALOG_PLAY, &mode );
                break;
            }
        case TUTORIAL_COLLECTOR_COIN:
            {
                m_DialogCurrentlyPlaying = true;
                m_TimeSinceDialogStart = 0;
                TutorialMode mode = TUTORIAL_COLLECTOR_COIN;
                GetEventManager()->TriggerEvent( EVENT_TUTORIAL_DIALOG_PLAY, &mode );
                break;
            }
        case TUTORIAL_INTERACTIVE_GAG:
            {
                m_DialogCurrentlyPlaying = true;
                m_TimeSinceDialogStart = 0;
                TutorialMode mode = TUTORIAL_INTERACTIVE_GAG;
                GetEventManager()->TriggerEvent( EVENT_TUTORIAL_DIALOG_PLAY, &mode );
                break;
            }
        case TUTORIAL_INTERIOR_ENTERED:
            {
                m_DialogCurrentlyPlaying = true;
                m_TimeSinceDialogStart = 0;
                TutorialMode mode = TUTORIAL_INTERIOR_ENTERED;
                GetEventManager()->TriggerEvent( EVENT_TUTORIAL_DIALOG_PLAY, &mode);
                break;
            }
        case TUTORIAL_GETTING_INTO_PLAYER_CAR:
            {
                m_DialogCurrentlyPlaying = true;
                m_TimeSinceDialogStart = 0;
                TutorialMode mode = TUTORIAL_GETTING_INTO_PLAYER_CAR;
                GetEventManager()->TriggerEvent( EVENT_TUTORIAL_DIALOG_PLAY, &mode );
                break;
            }
        case TUTORIAL_GETTING_INTO_TRAFFIC_CAR:
            {
                m_DialogCurrentlyPlaying = true;
                m_TimeSinceDialogStart = 0;
                TutorialMode mode = TUTORIAL_GETTING_INTO_TRAFFIC_CAR;
                GetEventManager()->TriggerEvent( EVENT_TUTORIAL_DIALOG_PLAY, &mode );
                break;
            }
        case TUTORIAL_GETTING_OUT_OF_CAR:
            {
                m_DialogCurrentlyPlaying = true;
                m_TimeSinceDialogStart = 0;
                TutorialMode mode = TUTORIAL_GETTING_OUT_OF_CAR;
                GetEventManager()->TriggerEvent( EVENT_TUTORIAL_DIALOG_PLAY, &mode );
                break;
            }
        case TUTORIAL_RACE:
            {
                m_DialogCurrentlyPlaying = true;
                m_TimeSinceDialogStart = 0;
                TutorialMode mode = TUTORIAL_RACE;
                GetEventManager()->TriggerEvent( EVENT_TUTORIAL_DIALOG_PLAY, &mode );
                break;
            }
        case TUTORIAL_START_GAME:
            {
                m_DialogCurrentlyPlaying = true;
                m_TimeSinceDialogStart = 0;
                TutorialMode mode = TUTORIAL_START_GAME;
                GetEventManager()->TriggerEvent( EVENT_TUTORIAL_DIALOG_PLAY, &mode );
                break;
            }
        case TUTORIAL_VEHICLE_DESTROYED:
            {
                m_DialogCurrentlyPlaying = true;
                m_TimeSinceDialogStart = 0;
                TutorialMode mode = TUTORIAL_VEHICLE_DESTROYED;
                GetEventManager()->TriggerEvent( EVENT_TUTORIAL_DIALOG_PLAY, &mode );
                break;
            }
        case TUTORIAL_REWARD:
            {
                m_DialogCurrentlyPlaying = true;
                m_TimeSinceDialogStart = 0;
                TutorialMode mode = TUTORIAL_REWARD;
                GetEventManager()->TriggerEvent( EVENT_TUTORIAL_DIALOG_PLAY, &mode );
                break;
            }
        case TUTORIAL_UNLOCKED_CAR:
            {
                m_DialogCurrentlyPlaying = true;
                m_TimeSinceDialogStart = 0;
                TutorialMode mode = TUTORIAL_UNLOCKED_CAR;
                GetEventManager()->TriggerEvent( EVENT_TUTORIAL_DIALOG_PLAY, &mode );
                break;
            }
        case TUTORIAL_WAGER_MISSION:
            {
                m_DialogCurrentlyPlaying = true;
                m_TimeSinceDialogStart = 0;
                TutorialMode mode = TUTORIAL_WAGER_MISSION;
                GetEventManager()->TriggerEvent( EVENT_TUTORIAL_DIALOG_PLAY, &mode );
                break;
            }
        case TUTORIAL_WRENCH:
            {
                m_DialogCurrentlyPlaying = true;
                m_TimeSinceDialogStart = 0;
                TutorialMode mode = TUTORIAL_WRENCH;
                GetEventManager()->TriggerEvent( EVENT_TUTORIAL_DIALOG_PLAY, &mode );
                break;
            }
        case TUTORIAL_AT_CAR_DOOR:
            {
                m_DialogCurrentlyPlaying = true;
                m_TimeSinceDialogStart = 0;
                TutorialMode mode = TUTORIAL_AT_CAR_DOOR;
                GetEventManager()->TriggerEvent( EVENT_TUTORIAL_DIALOG_PLAY, &mode );
                break;
            }
        case TUTORIAL_INTERACTIVE_GAG_APPROACHED:
            {
                m_DialogCurrentlyPlaying = true;
                m_TimeSinceDialogStart = 0;
                TutorialMode mode = TUTORIAL_INTERACTIVE_GAG_APPROACHED;
                GetEventManager()->TriggerEvent( EVENT_TUTORIAL_DIALOG_PLAY, &mode );
                break;
            }
        default:
            {
                rAssertMsg( false, "Why don't we process this message" );
                return;

                break;
            }
        }
#endif

//        hud->SetTutorialMessage( event );
//        hud->TutorialBitmapShow();

        GetGuiSystem()->GotoScreen( CGuiWindow::GUI_SCREEN_ID_TUTORIAL, 0, 0,
                                    CLEAR_WINDOW_HISTORY | FORCE_WINDOW_CHANGE_IMMEDIATE );

#ifdef RAD_WIN32
        m_DialogCurrentlyPlaying = false;
#endif
        GetGameFlow()->SetContext( CONTEXT_PAUSE );

    }

    //
    // Pop an item off the queue
    //
    m_Queue.erase( m_Queue.begin() );
}

//==============================================================================
// TutorialManager::Update
//==============================================================================
// Description: takes an item out of the queue, and processes it
//
// Parameters:  None
//
// Return:      N/A.
//
//==============================================================================
void TutorialManager::Update( const float deltaT )
{
    CGuiScreenHud* currentHud = GetCurrentHud();
    if( currentHud != NULL && currentHud->IsActive() )
    {
        // only update tutorial manager if the HUD is currently active
        //
//        m_TimeSinceDialogStart += deltaT;
//        if( m_TimeSinceDialogStart > 10000.0f )
        {
            m_TimeSinceDialogStart = 0;
            m_DialogCurrentlyPlaying = false;
/*
            CGuiScreenHud* hud = GetCurrentHud();
            if( hud != NULL )
            {
                hud->TutorialBitmapInitOutro();
            }
*/
        }

        ProcessQueue();
    }
}

void
TutorialManager::LoadData( const GameDataByte* dataBuffer, unsigned int numBytes )
{
    m_EnableTutorialEvents = ( dataBuffer[ 0 ] != 0 );

    memcpy( &m_tutorialsSeen, dataBuffer + 1, sizeof( m_tutorialsSeen ) );
}

void
TutorialManager::SaveData( GameDataByte* dataBuffer, unsigned int numBytes )
{
    dataBuffer[ 0 ] = m_EnableTutorialEvents ? ~0 : 0;

    memcpy( dataBuffer + 1, &m_tutorialsSeen, sizeof( m_tutorialsSeen ) );
}

void
TutorialManager::ResetData()
{
#ifdef RAD_WIN32

    if( !GetInputManager()->GetController(0)->IsTutorialDisabled() )
    {
#endif       
        m_EnableTutorialEvents = true;
        m_tutorialsSeen = 0;
#ifdef RAD_WIN32
    }
#endif 

#ifndef FINAL
    if( CommandLineOptions::Get( CLO_NO_TUTORIAL ) )
    {
        m_EnableTutorialEvents = false;
    }
#endif

    // re-add event listeners
    //
    GetEventManager()->RemoveAll( this );
    this->Initialize();
}

//=============================================================================
// TutorialManager::QueryTutorialSeen
//=============================================================================
// Description: checks to see if a given tutorial has already been played
//
// Parameters:  tutorial - enum of the tutorial in question
//
// Return:      bool - has the tutorial been shown
//
//=============================================================================
bool TutorialManager::QueryTutorialSeen( const TutorialMode tutorial )
{
    return (m_tutorialsSeen & (1 << tutorial)) > 0;

}

//=============================================================================
// TutorialManager::SetTutorialSeen
//=============================================================================
// Description: sets the status of a specific tutorial
//
// Parameters:  tutorial - enum of the tutorial in question
//
// Return:      bool - has the tutorial been shown
//
//=============================================================================
void TutorialManager::SetTutorialSeen( const TutorialMode tutorial, const bool seen )
{
    if ( seen )
    {
        m_tutorialsSeen |= (1 << tutorial);
    }
    else
    {
        m_tutorialsSeen &= ~(1 << tutorial);
    }
}