iBOOL mwRunLevelChoose( void ) { static iU8 Flag = iFALSE; int i; //iU32 ImageId[9] = { // ModeLeadBathe00,ModeLeadBathe01,ModeLeadBathe02, // ModeLeadBathe03,ModeLeadBathe04,ModeLeadBathe05, // ModeLeadBathe06,ModeLeadBathe07,ModeLeadBathe08 //}; iRECT SrcRect; iRECT DesRect; int X,Y; iU16 PenDownX = 0; iU16 PenDownY = 0; #ifdef PKIG_SCREEN_240X320 iS16 Bath_X = 0; iS16 Bath_Y = 231; iS16 Bath_W = SCREEN_WIDTH; iS16 Bath_H = 90; iS16 Word_X = 56; iS16 Word_Y = 192; iS16 Word_W = 171; iS16 Word_H = 24; iS16 Block_W = 61; iS16 Block_H = 61; iS16 Block_StartX = 0; iS16 Block_StartY = 120; #elif defined PKIG_SCREEN_240X400 iS16 Bath_X = 0; iS16 Bath_Y = 300; iS16 Bath_W = SCREEN_WIDTH; iS16 Bath_H = 100; iS16 Word_X = 54; iS16 Word_Y = 239; iS16 Word_W = 171; iS16 Word_H = 24; iS16 Block_W = 61; iS16 Block_H = 61; iS16 Block_StartX = 0; iS16 Block_StartY = 120; #elif defined PKIG_SCREEN_320X480 iS16 Bath_X = 0; iS16 Bath_Y = 360; iS16 Bath_W = SCREEN_WIDTH; iS16 Bath_H = 120; //iS16 Word_X = 75; //iS16 Word_Y = 268; //iS16 Word_W = 171; //iS16 Word_H = 24; iS16 Block_W = 81; iS16 Block_H = 81; iS16 Block_StartX = 0; iS16 Block_StartY = 160; #ifdef LANGUAGE_ENGLISH iS16 Word_X = 75; iS16 Word_Y = 268; iS16 Word_W = 187; iS16 Word_H = 28; #else iS16 Word_X = 75; iS16 Word_Y = 268; iS16 Word_W = 171; iS16 Word_H = 24; #endif #endif // iS16 Bath_X = 0; // iS16 Bath_Y = 360; // iS16 Bath_W = SCREEN_WIDTH; // iS16 Bath_H = 120; // //#ifdef LANGUAGE_ENGLISH // iS16 Word_X = 75; // iS16 Word_Y = 268; // iS16 Word_W = 187; // iS16 Word_H = 28; // //#else // iS16 Word_X = 75; // iS16 Word_Y = 268; // iS16 Word_W = 171; // iS16 Word_H = 24; // //#endif // // // iS16 Block_W = 81; // iS16 Block_H = 81; // iS16 Block_StartX = 0; // iS16 Block_StartY = 160; if( iFALSE == Flag ) { Flag = iTRUE; AniModeLeadBathe.Container = mwContainer; AniModeLeadBathe.CurrPlayFrame = 0; AniModeLeadBathe.DesRect.X = ModeLeadBathe_X; AniModeLeadBathe.DesRect.Y = ModeLeadBathe_Y; AniModeLeadBathe.DesRect.Width = ModeLeadBathe_W; AniModeLeadBathe.DesRect.Height = ModeLeadBathe_H; AniModeLeadBathe.FrameTimeMul = 250; for( i=0; i<9; i++ ) { //AniModeLeadBathe.ImageId[i] = ImageId[i]; } AniModeLeadBathe.ImageTotalFrame = 9; AniModeLeadBathe.ImageWidth = ModeLeadBathe_W; AniModeLeadBathe.OldPlayTime = i51AdeOsGetTick(); Water1.X = MODE_WATER_X1; Water1.Y = MODE_WATER_Y1; Water1.Width= MODE_WATER_W1; Water1.Height= MODE_WATER_H1; Water2.X = (SCREEN_WIDTH-MODE_WATER_W2); Water2.Y = MODE_WATER_Y2; Water2.Width= MODE_WATER_W2; Water2.Height= MODE_WATER_H2; //ImageId[0] = ChooseBKBlock; //ImageId[2] = ChsLvBath; //ImageId[4] = ChooseWater; //ImageId[6] = XiaoWanPiWord; //i51KitG2SetImageMemoryCopy(mwContainer, 8, ImageId ); } for( Y = Block_StartY; Y<=SCREEN_HEIGHT; Y+=Block_H ) { for( X = Block_StartX; X<=SCREEN_WIDTH; X+=Block_W ) { DesRect.X = X; DesRect.Y = Y; DesRect.Width= Block_W; DesRect.Height= Block_H; SrcRect.X = 0; SrcRect.Y = 0; SrcRect.Width = Block_W; SrcRect.Height = Block_H; if( DesRect.Y<ModeLeadBathe_Y ) { DesRect.Height -= ModeLeadBathe_Y - DesRect.Y; SrcRect.Y += ModeLeadBathe_Y - DesRect.Y; DesRect.Y = ModeLeadBathe_Y; } SWMW_i51KitG2DrawImage(&iMageInfo[ChooseBKBlock], &DesRect, &SrcRect); } } DesRect.X = Bath_X; DesRect.Y = Bath_Y; DesRect.Width= Bath_W; DesRect.Height= Bath_H; //i51KitG2DrawImage(mwContainer, ChsLvBath, &DesRect, iNULL); SWMW_i51KitG2DrawImage(&iMageInfo[ChsLvBath], &DesRect, iNULL); DesRect.X = Word_X; DesRect.Y = Word_Y; DesRect.Width= Word_W; DesRect.Height= Word_H; //i51KitG2SetAlpha(178); LocalG2AlphaSys = 178; SrcRect.X = 0; SrcRect.Y = 0; SrcRect.Width = MODE_WATER_W1; SrcRect.Height = MODE_WATER_H1; //i51KitG2DrawImage(mwContainer, ChooseWater, &Water1, &SrcRect); SWMW_i51KitG2DrawImage(&iMageInfo[ChooseWater], &Water1, &SrcRect); DesRect.X = Water1.X+MODE_WATER_W1; DesRect.Y = Water1.Y; DesRect.Width= Water1.Width; DesRect.Height= Water1.Height; //i51KitG2DrawImage(mwContainer, ChooseWater, &DesRect, &SrcRect); SWMW_i51KitG2DrawImage(&iMageInfo[ChooseWater],&DesRect, &SrcRect); Water1.X -= 8; if( Water1.X <= -MODE_WATER_W1 ) { Water1.X += MODE_WATER_W1; } //i51KitG2SetAlpha(i51KITG2_ALPHA_NONEED); LocalG2AlphaSys = i51KITG2_ALPHA_NONEED; mwPublicAnimation(&AniModeLeadBathe); //i51KitG2SetAlpha(178); LocalG2AlphaSys = 178; SrcRect.X = 0; SrcRect.Y = MODE_WATER_H2; SrcRect.Width = MODE_WATER_W2; SrcRect.Height = MODE_WATER_H2; //i51KitG2DrawImage(mwContainer, ChooseWater, &Water2, &SrcRect); SWMW_i51KitG2DrawImage(&iMageInfo[ChooseWater],&Water2, &SrcRect); DesRect.X = Water2.X-MODE_WATER_W1; DesRect.Y = Water2.Y; DesRect.Width= Water2.Width; DesRect.Height= Water2.Height; //i51KitG2DrawImage(mwContainer, ChooseWater, &DesRect, &SrcRect); SWMW_i51KitG2DrawImage(&iMageInfo[ChooseWater],&DesRect, &SrcRect); Water2.X += 8; if( Water2.X >= SCREEN_WIDTH) { Water2.X -= MODE_WATER_W1; } //i51KitG2SetAlpha(i51KITG2_ALPHA_NONEED); LocalG2AlphaSys = i51KITG2_ALPHA_NONEED; if(ChooseErrFlag) { if( mwPublicDrawPrompt(Prompt_Time, ChooseErrTime, 0) ) { mwLevelChooseInitDraw(); ChooseErrFlag = iFALSE; } } if( ChooseErrFlag==iFALSE && mwKeyData.type==LLP_PEN_INPUT&& mwKeyData.u.pen.type==i51_MSG_PADDOWN ) { PenDownX = mwKeyData.u.pen.x; PenDownY = mwKeyData.u.pen.y; if(mwLevelPressReturn(PenDownX, PenDownY)) { CurrGameState = GAME_STATE_MAIN; //i51KitG2UnsetImageMemoryCopy(mwContainer, iNULL, iNULL); wmw_image_destroy(); wmw_main_page(); Flag = iFALSE; } else if( ((PenDownX-LEVEL_START_LEVEL1_X)%LEVEL_START_LEVEL_ADDX < ICON_WIDTH) &&( (PenDownX-LEVEL_START_LEVEL1_X)/LEVEL_START_LEVEL_ADDX < ICON_NUM_ONELINE) &&( (PenDownY-LEVEL_START_LEVEL1_Y)%LEVEL_START_LEVEL_ADDY < ICON_HEIGHT) &&( (PenDownY-LEVEL_START_LEVEL1_Y)/LEVEL_START_LEVEL_ADDY < ICON_NUM_MAXLINE) &&( (PenDownX>=LEVEL_START_LEVEL1_X && PenDownX<= (LEVEL_START_LEVEL1_X +LEVEL_START_LEVEL_ADDX*4 + ICON_WIDTH ))) &&( (PenDownY>=LEVEL_START_LEVEL1_Y && PenDownY<= (LEVEL_START_LEVEL1_Y +LEVEL_START_LEVEL_ADDY*2 + ICON_HEIGHT))) ) { // iLog("Choose level"); iU16 CurrChooseLevel = ((PenDownY-LEVEL_START_LEVEL1_Y)/LEVEL_START_LEVEL_ADDY)*ICON_NUM_ONELINE + ((PenDownX-LEVEL_START_LEVEL1_X)/LEVEL_START_LEVEL_ADDX); // iLog("CurrChooseLevel:%d",CurrChooseLevel); if( CurrChooseLevel<UnlockMaxLevel ) { //iU32 ICON_NUM_ID[4] = {ChsLvPrs0,ChsLvPrs1,ChsLvPrs2,ChsLvPrs3}; iRECT DesRect; DesRect.Width = ICON_WIDTH; //iLog("DesRect.Width:%d",DesRect.Width); DesRect.Height= ICON_HEIGHT; //iLog("DesRect.Height:%d",DesRect.Height); DesRect.X = LEVEL_START_LEVEL1_X + (((int)CurrChooseLevel)%((int)ICON_NUM_ONELINE))*LEVEL_START_LEVEL_ADDX; //iLog("DesRect.X:%d",DesRect.X); DesRect.Y = LEVEL_START_LEVEL1_Y + (((int)CurrChooseLevel)/((int)ICON_NUM_ONELINE))*LEVEL_START_LEVEL_ADDY; //iLog("DesRect.Y:%d",DesRect.Y); // mwLevelChooseInitDraw(); SrcRect.X = 0; SrcRect.Y = (LevelDuckNum[CurrChooseLevel] * 2 + 1) * ICON_HEIGHT; SrcRect.Width = ICON_WIDTH; SrcRect.Height = ICON_HEIGHT; //i51KitG2DrawImage(mwContainer, ChsLv, &DesRect, &SrcRect); CurrLevelNum = (mwLevelNum)(CurrChooseLevel + 1); CurrLevelState = MW_LEVEL_INIT; wmw_image_destroy(); //i51KitG2UnsetImageMemoryCopy(mwContainer, iNULL, iNULL); Flag = iFALSE; public_audio_stop(AUDIO_PLAYER_MP3); //SoundWinPlay = iFALSE; SoundChoosePlay = iFALSE; //xie //iLog("CurrLevelNum:%d,CurrLevelState:%d",CurrLevelNum,CurrLevelState); // mwWordPause = iFALSE; // i51KitG2UnsetImageMemoryCopy(mwContainer, iNULL, iNULL); // iU32 ImageId[13] = {DuckMud,DuckGet,LeadWait00,LeadWait01, // LeadWait02,LeadWait03,LeadWait04,LeadWait05, // LeadWait06,LeadWait07,LeadWait08,LeadWait09,LeadWait10}; // i51KitG2SetImageMemoryCopy(mwContainer, 13, ImageId); } else { // ChooseErrTime = i51AdeOsGetTick(); // ChooseErrFlag = iTRUE; } } } return iTRUE; }
iBOOL mwStatePartol() { iRECT desRect; //iRECT srcRect; iU16 PenDownX = 0; iU16 PenDownY = 0; //SWMW_i51KitG2DrawImage(&iMageInfo[Main], iNULL, iNULL); if(iScreenFlag == iTRUE) { LocalG2AlphaSys = 128; //i51KitG2CleanScreen(0X0, iNULL); AlphaNeed = iTRUE; AlphaSrc = 128; i51KitG2CleanScreenEx(0X0, iNULL); //i51KitG2SetAlpha(i51KITG2_ALPHA_NONEED); LocalG2AlphaSys = i51KITG2_ALPHA_NONEED; iScreenFlag = iFALSE; } #ifdef PKIG_SCREEN_320X480 desRect.X = 32; desRect.Y = 112; desRect.Width = 256; desRect.Height = 256; #elif defined PKIG_SCREEN_240X400 desRect.X = 32; desRect.Y = 112; desRect.Width = 256; desRect.Height = 256; #elif defined PKIG_SCREEN_240X320 desRect.X = 20; desRect.Y = 60; desRect.Width = 199; desRect.Height = 200; #endif SWMW_i51KitG2DrawImage(&iMageInfo[PromptFrame], &desRect, iNULL); if(mwKeyData.type==LLP_PEN_INPUT&& mwKeyData.u.pen.type==i51_MSG_PADDOWN ) { PenDownX = mwKeyData.u.pen.x; PenDownY = mwKeyData.u.pen.y; if (PenDownX < PK_SCREEN_WIDTH / 2) { //½øÈë partol //i51AdeOsScreenAlwaysLight(1); //portal_entry(game_aid, portal_cb); CurrGameState = GAME_PARTOL_ENTRY; wmw_image_destroy(); public_audio_all_exit(); } else if (PenDownX > PK_SCREEN_WIDTH / 2) { CurrGameState = GAME_STATE_MAIN; wmw_image_destroy(); wmw_main_page(); } } return iTRUE; }