Game3D.c
上传用户:lqx1163
上传日期:2014-08-13
资源大小:9183k
文件大小:12k
源码类别:

MTK

开发平台:

C/C++

  1. /*****************************************************************************
  2. *  Copyright Statement:
  3. *  --------------------
  4. *  This software is protected by Copyright and the information contained
  5. *  herein is confidential. The software may not be copied and the information
  6. *  contained herein may not be used or disclosed except with the written
  7. *  permission of MediaTek Inc. (C) 2005
  8. *
  9. *  BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
  10. *  THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
  11. *  RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
  12. *  AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
  13. *  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
  14. *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
  15. *  NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
  16. *  SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
  17. *  SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
  18. *  THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
  19. *  NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
  20. *  SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
  21. *
  22. *  BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
  23. *  LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
  24. *  AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
  25. *  OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
  26. *  MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. 
  27. *
  28. *  THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
  29. *  WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
  30. *  LAWS PRINCIPLES.  ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
  31. *  RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
  32. *  THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
  33. *
  34. *****************************************************************************/
  35. /*****************************************************************************
  36.  * Filename:
  37.  * ---------
  38.  *  Game3D.c
  39.  *
  40.  * Project:
  41.  * --------
  42.  *  Maui
  43.  *
  44.  * Description:
  45.  * ------------
  46.  *  3D Game Menu
  47.  *
  48.  * Author:
  49.  * -------
  50.  * -------
  51.  *
  52.  *============================================================================
  53.  *             HISTORY
  54.  * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  55.  *------------------------------------------------------------------------------
  56.  * removed!
  57.  *
  58.  * removed!
  59.  * removed!
  60.  * removed!
  61.  *
  62.  * removed!
  63.  * removed!
  64.  * removed!
  65.  *
  66.  * removed!
  67.  * removed!
  68.  * removed!
  69.  *
  70.  * removed!
  71.  * removed!
  72.  * removed!
  73.  *
  74.  * removed!
  75.  * removed!
  76.  * removed!
  77.  *
  78.  * removed!
  79.  * removed!
  80.  * removed!
  81.  *
  82.  * removed!
  83.  * removed!
  84.  * removed!
  85.  *
  86.  * removed!
  87.  * removed!
  88.  * removed!
  89.  *
  90.  * removed!
  91.  * removed!
  92.  * removed!
  93.  *
  94.  *------------------------------------------------------------------------------
  95.  * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  96.  *============================================================================
  97.  ****************************************************************************/
  98. #include "MMI_features.h"
  99. #ifdef __MMI_3D_GAME__
  100. #include "GlobalConstants.h"
  101. #include "GlobalDefs.h"
  102. #include "gui.h"
  103. #include "CustDataRes.h"
  104. #include "CustMenuRes.h"
  105. #include "CustResDef.h"
  106. #include "HistoryGprot.h"
  107. #include "MiscFunctions.h"
  108. #include "Unicodexdcl.h"
  109. #include "GameDefs.h"
  110. #include "GameProts.h"
  111. #include "FunAndGamesDefs.h"
  112. #include "MainMenuDef.h"
  113. #include "GameFramework.h"
  114. #include "SettingProfile.h"     /* SUCCESS_TONE define */
  115. #include "NVRAMType.h"
  116. #include "NVRAMProt.h"
  117. #include "NVRAMEnum.h"
  118. #include "Commonscreens.h"
  119. #include "DebugInitDef.h"
  120. #include "DateTimeGprot.h"
  121. #ifdef GE_BROGENT
  122. #include "BrogentGameGprot.h"
  123. #endif
  124. #ifdef GE_INTERGRAFX
  125. #include "IntergraphxGameGprot.h"
  126. #endif 
  127. /* TODO: shall remove, test only */
  128. //#undef __MMI_3D_GAME_BROGENT_HB2_176x220__
  129. //#undef __MMI_3D_GAME_BROGENT_GGR2_176x220__
  130. //#undef __MMI_3D_GAME_BROGENT_HB2_240x320__
  131. //#undef __MMI_3D_GAME_BROGENT_GGR2_240x320__
  132. //#undef __MMI_3D_GAME_INTERGRAFX_DEMOGAME_240x320__
  133. //#undef __MMI_3D_GAME_INTERGRAFX_DEMOGAME_176x220__
  134. /****************************************************************************
  135. * Macro                                                                
  136. *****************************************************************************/
  137. #define MMI_3D_GAME_SWITCH(_index, func_ptr)                     
  138. {                                                                
  139.    case _index:                                                  
  140.       {                                                          
  141.          SetLeftSoftkeyFunction(func_ptr,KEY_EVENT_UP);          
  142.          SetKeyHandler(func_ptr, KEY_RIGHT_ARROW,KEY_EVENT_DOWN);
  143.       }                                                          
  144.       break;                                                     
  145. }
  146. typedef enum
  147. {
  148. #if defined(__MMI_3D_GAME_BROGENT_GGR2_240x320__) || defined(__MMI_3D_GAME_BROGENT_GGR2_176x220__)
  149.     MMI_3D_GAME_BROGENT_GOGOROBOT,
  150. #endif 
  151. #if defined(__MMI_3D_GAME_BROGENT_HB2_240x320__) || defined(__MMI_3D_GAME_BROGENT_HB2_176x220__)
  152.     MMI_3D_GAME_BROGENT_HEATBREAKER2,
  153. #endif 
  154. #if defined(__MMI_3D_GAME_INTERGRAFX_DEMOGAME_240x320__) || defined(__MMI_3D_GAME_INTERGRAFX_DEMOGAME_176x220__)
  155.     MMI_3D_GAME_INTERGRAFX_DEMOGAME,
  156. #endif 
  157. #if defined(__MMI_3D_GAME_INTERGRAFX_PETFISH_240x320__) || defined(__MMI_3D_GAME_INTERGRAFX_PETFISH_176x220__)
  158.     MMI_3D_GAME_INTERGRAFX_PETFISH,
  159. #endif 
  160. #if defined(__MMI_3D_GAME_INTERGRAFX_ROLLINGBALL_240x320__) || defined(__MMI_3D_GAME_INTERGRAFX_ROLLINGBALL_176x220__)
  161.     MMI_3D_GAME_INTERGRAFX_ROLLINGBALL,
  162. #endif
  163.     MMI_3D_GAME_MAX_COUNT
  164. } MMI_3D_GAME_LIST_ENUM;
  165. /****************************************************************************
  166. * Local Functions                                                        
  167. *****************************************************************************/
  168. static void mmi_game3d_highlight_hdlr(S32 index);
  169. static void mmi_game3d_entry_game_list(void);
  170. /*****************************************************************************
  171.  * FUNCTION
  172.  *  mmi_game3d_highlight_hdlr
  173.  * DESCRIPTION
  174.  *  highlight hdlr for games
  175.  * PARAMETERS
  176.  *  index       [IN]        Highlighted index
  177.  * RETURNS
  178.  *  void
  179.  *****************************************************************************/
  180. static void mmi_game3d_highlight_hdlr(S32 index)
  181. {
  182.     /*----------------------------------------------------------------*/
  183.     /* Local Variables                                                */
  184.     /*----------------------------------------------------------------*/
  185.     /*----------------------------------------------------------------*/
  186.     /* Code Body                                                      */
  187.     /*----------------------------------------------------------------*/
  188.     switch (index)
  189.     {
  190.     #if defined(__MMI_3D_GAME_BROGENT_GGR2_240x320__) || defined(__MMI_3D_GAME_BROGENT_GGR2_176x220__)
  191.         MMI_3D_GAME_SWITCH(MMI_3D_GAME_BROGENT_GOGOROBOT, mmi_game3d_entry_gogorobot);
  192.     #endif 
  193.     #if defined(__MMI_3D_GAME_BROGENT_HB2_240x320__) || defined(__MMI_3D_GAME_BROGENT_HB2_176x220__)
  194.         MMI_3D_GAME_SWITCH(MMI_3D_GAME_BROGENT_HEATBREAKER2, mmi_game3d_entry_heatbreaker2);
  195.     #endif 
  196.     #if defined(__MMI_3D_GAME_INTERGRAFX_DEMOGAME_240x320__) || defined(__MMI_3D_GAME_INTERGRAFX_DEMOGAME_176x220__)
  197.         MMI_3D_GAME_SWITCH(MMI_3D_GAME_INTERGRAFX_DEMOGAME, mmi_game3d_entry_demogame);
  198.     #endif 
  199.     #if defined(__MMI_3D_GAME_INTERGRAFX_PETFISH_240x320__) || defined(__MMI_3D_GAME_INTERGRAFX_PETFISH_176x220__)
  200.         MMI_3D_GAME_SWITCH(MMI_3D_GAME_INTERGRAFX_PETFISH, mmi_game3d_entry_petfish);
  201.     #endif 
  202.     #if defined(__MMI_3D_GAME_INTERGRAFX_ROLLINGBALL_240x320__) || defined(__MMI_3D_GAME_INTERGRAFX_ROLLINGBALL_176x220__)
  203.         MMI_3D_GAME_SWITCH(MMI_3D_GAME_INTERGRAFX_ROLLINGBALL, mmi_game3d_entry_rollingball);
  204.     #endif
  205.     
  206.         default:
  207.             /* shall not enter here */
  208.             MMI_ASSERT(0);
  209.             break;
  210.     }
  211. }
  212. /*****************************************************************************
  213.  * FUNCTION
  214.  *  mmi_game3d_highlight_app
  215.  * DESCRIPTION
  216.  *  highlight game app menitem
  217.  * PARAMETERS
  218.  *  void
  219.  * RETURNS
  220.  *  void
  221.  *****************************************************************************/
  222. void mmi_game3d_highlight_app(void)
  223. {
  224.     /*----------------------------------------------------------------*/
  225.     /* Local Variables                                                */
  226.     /*----------------------------------------------------------------*/
  227.     /*----------------------------------------------------------------*/
  228.     /* Code Body                                                      */
  229.     /*----------------------------------------------------------------*/
  230.     SetLeftSoftkeyFunction(mmi_game3d_entry_game_list, KEY_EVENT_UP);
  231.     SetKeyHandler(mmi_game3d_entry_game_list, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  232. }
  233. /*****************************************************************************
  234.  * FUNCTION
  235.  *  mmi_game3d_entry_game_lsit
  236.  * DESCRIPTION
  237.  *  entry game app screen
  238.  * PARAMETERS
  239.  *  void
  240.  * RETURNS
  241.  *  void
  242.  *****************************************************************************/
  243. static void mmi_game3d_entry_game_list(void)
  244. {
  245.     /*----------------------------------------------------------------*/
  246.     /* Local Variables                                                */
  247.     /*----------------------------------------------------------------*/
  248.     U8 *guiBuffer;
  249.     UI_time t;
  250.     U16 menu_str[MMI_3D_GAME_MAX_COUNT + 1];
  251.     U16 menu_img[MMI_3D_GAME_MAX_COUNT + 1];
  252.     U16 index = 0;
  253.     /*----------------------------------------------------------------*/
  254.     /* Code Body                                                      */
  255.     /*----------------------------------------------------------------*/
  256. #if defined(__MMI_3D_GAME_BROGENT_GGR2_240x320__) || defined(__MMI_3D_GAME_BROGENT_GGR2_176x220__)
  257.     menu_str[index] = STR_ID_3D_GAME_BROGENT_GOGOROBOT;
  258.     menu_img[index++] = IMG_ID_3D_GAME_BROGENT_GOGOROBOT;
  259. #endif 
  260. #if defined(__MMI_3D_GAME_BROGENT_HB2_240x320__) || defined(__MMI_3D_GAME_BROGENT_HB2_176x220__)
  261.     menu_str[index] = STR_ID_3D_GAME_BROGENT_HEATBREAKER2;
  262.     menu_img[index++] = IMG_ID_3D_GAME_BROGENT_HEATBREAKER2;
  263. #endif 
  264. #if defined(__MMI_3D_GAME_INTERGRAFX_DEMOGAME_240x320__) || defined(__MMI_3D_GAME_INTERGRAFX_DEMOGAME_176x220__)
  265.     menu_str[index] = STR_ID_3D_GAME_INTERGRAFX_DEMOGAME;
  266.     menu_img[index++] = IMG_ID_3D_GAME_INTERGRAFX_DEMOGAME;
  267. #endif 
  268. #if defined(__MMI_3D_GAME_INTERGRAFX_PETFISH_240x320__) || defined(__MMI_3D_GAME_INTERGRAFX_PETFISH_176x220__)
  269.     menu_str[index] = STR_ID_3D_GAME_INTERGRAFX_PETFISH;
  270.     menu_img[index++] = IMG_ID_3D_GAME_INTERGRAFX_PETFISH;
  271. #endif 
  272. #if defined(__MMI_3D_GAME_INTERGRAFX_ROLLINGBALL_240x320__) || defined(__MMI_3D_GAME_INTERGRAFX_ROLLINGBALL_176x220__)
  273.     menu_str[index] = STR_ID_3D_GAME_INTERGRAFX_ROLLINGBALL;
  274.     menu_img[index++] = IMG_ID_3D_GAME_INTERGRAFX_ROLLINGBALL;
  275. #endif
  276.     /* Set random seed */
  277.     GetDateTime(&t);
  278.     srand(t.nMin);
  279.     EntryNewScreen(SCR_ID_3D_GAME_LIST, NULL, mmi_game3d_entry_game_list, NULL);
  280.     guiBuffer = GetCurrGuiBuffer(SCR_ID_3D_GAME_LIST);
  281.     RegisterHighlightHandler(mmi_game3d_highlight_hdlr);
  282.     ShowCategory15Screen(
  283.         STR_ID_3D_GAME,
  284.         MAIN_MENU_TITLE_FUNANDGAMES_ICON,
  285.         STR_GLOBAL_OK,
  286.         IMG_GLOBAL_OK,
  287.         STR_GLOBAL_BACK,
  288.         IMG_GLOBAL_BACK,
  289.         MMI_3D_GAME_MAX_COUNT,
  290.         menu_str,
  291.         menu_img,
  292.         1,
  293.         0,
  294.         guiBuffer);
  295.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  296. }
  297. #endif /* __MMI_3D_GAME__ */