- (id) init {

//NSLog(@"Main init");

    self = [super init];

    if (self != nil) {

fWindowWidth = 0.0f;

fWindowHeight = 0.0f;


[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(orientationChanged:) name:@"UIDeviceOrientationDidChangeNotification" object:nil];

NSString *sVersion = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"];

//NSLog(@"main init  sVersion=%@", sVersion);

VersionMajor = [[global GetFromList:sVersion ItemNumber:1 Delim:@"."] intValue];

VersionMinor = [[global GetFromList:sVersion ItemNumber:2 Delim:@"."] intValue];


//0.1 - Initial beta release


bGameInProgress = NO;

mcGamePopup = nil;

mcHintPopup = nil;

mcChapterBanner = nil;

AppStoreURL = @"http://freecloud.com/c/TP/";

[AppStoreURL retain];


sTempMissionData = @"";

[sTempMissionData retain];

bLiteVersion = NO;

#ifdef LITE_VERSION

bLiteVersion = YES;

#endif


if ([global AppIsHakd]) { 

NSLog(@"Main init  APP IS HAKD!!!!!");

bLiteVersion = YES; 

}


if (bLiteVersion) {

//Limit the game for the lite version...

}

CurrentOrientation = 0;

ChangeOrientation = YES;

mcBlackScreen = nil;

CurrentScreen = nil;

PreviousScreen = nil;

Transitioning = NO;

SeenBungeeInstructions = NO;

MemoryWarning = NO;

ShowingAd = NO;

iLastMissonCategory = -1;

bMenuShowing = NO;

fShowMenuTimer = -1.0f;

mcTutorial = nil;

[self schedule: @selector(Update:)];

//[self FirstTime];

    }

    return self;

}





-(void) FirstTime

{

[self FirstTime: 0.0f WindowHeight:0.0f];

}


-(void) FirstTime: (float) pWindowWidth WindowHeight: (float) pWindowHeight

{

//NSLog(@"Main FirstTime");

bFirstTime = YES;


float fControlScale = 0.0f;

mcButtonExit = nil;

mcButtonHint = nil;

#ifdef MAC_VERSION

float fMainScaleX = pWindowWidth / 1024.0f;

float fMainScaleY = pWindowHeight / 768.0f;

float fMainScale = fMainScaleX;

if (fMainScaleY < fMainScaleX) { fMainScale = fMainScaleY; }

fControlScale = 1024.0f / pWindowWidth;

//NSLog(@"fMainScaleX=%f, fMainScaleY=%f, fMainScale=%f", fMainScaleX, fMainScaleY, fMainScale);

//NSLog(@"Main FirstTime  fControlScale=%f", fControlScale);

#endif

mcButtonMain = [DanSprite spriteWithFile: @"ButtonMain.png"];

[mcButtonMain setPosition: ccp(17.0f + 1.0f, 768.0f - 16.0f - 1.0f)];

mcButtonMain.opacity = 0;

[self addChild: mcButtonMain z: 3100];




oPlayerData = [PlayerData node];

[oPlayerData Set];

[oPlayerData retain];


oSounds = [Sounds node];

[self addChild: oSounds z:1];

[oSounds Set];

oSounds.visible = NO;

mcGameControls = [Controls node];

[mcGameControls Set: fControlScale];

[mcGameControls setPosition:ccp(0, 0)];

mcGameControls.visible = NO;

[self addChild: mcGameControls z:2999];

mcInventory = [Inventory node];

[self addChild:mcInventory z: 3000];

[mcInventory Set];

mcInventory.position = ccp(0, 0);

oHintGenerator = [HintGenerator node];

[oHintGenerator Set];

[self addChild:oHintGenerator];


mcReviewPopup = nil;

#ifdef MAC_VERSION

[self setAnchorPoint:ccp(0.0f, 0.0f)];

[self setScale:fMainScale];

[self setPosition:ccp(0.0f,0.0f)];

#else

mcReviewPopup = [ReviewPopup node];

[self addChild:mcReviewPopup];

[mcReviewPopup Set];

#endif


[self NewScreen: @"DRP Splash" Direction: @"next" Data1: @"" Data2: @""];

//NSLog(@"Main FirstTime  END");

}