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

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.  * Game.c
  39.  *
  40.  * Project:
  41.  * --------
  42.  *   Maui
  43.  *
  44.  * Description:
  45.  * ------------
  46.  *   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.  *------------------------------------------------------------------------------
  87.  * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  88.  *============================================================================
  89.  ****************************************************************************/
  90. #include "MMI_features.h"
  91. #ifdef __MMI_GAME__
  92. #include "GlobalConstants.h"
  93. #include "GlobalDefs.h"
  94. #include "gui.h"
  95. #include "CustDataRes.h"
  96. #include "CustMenuRes.h"
  97. #include "CustResDef.h"
  98. #include "HistoryGprot.h"
  99. #include "MiscFunctions.h"
  100. #include "Unicodexdcl.h"
  101. #include "GameDefs.h"
  102. #include "GameProts.h"
  103. #include "FunAndGamesDefs.h"
  104. #include "MainMenuDef.h"
  105. #include "GameFramework.h"
  106. #include "SettingProfile.h"     /* SUCCESS_TONE define */
  107. #include "NVRAMType.h"
  108. #include "NVRAMProt.h"
  109. #include "NVRAMEnum.h"
  110. #include "Commonscreens.h"
  111. #ifdef IS_F1RACE_BASE_GAME
  112. #include "F1raceDefs.h"
  113. #include "F1raceProts.h"
  114. #endif /* IS_F1RACE_BASE_GAME */ 
  115. #ifdef IS_HANOI_BASE_GAME
  116. #include "TohDefs.h"
  117. #include "TohProts.h"
  118. #endif /* IS_HANOI_BASE_GAME */ 
  119. #ifdef IS_RICHES_BASE_GAME
  120. #include "RichesDefs.h"
  121. #include "RichesProts.h"
  122. #endif /* IS_RICHES_BASE_GAME */ 
  123. #ifdef IS_COLORBALL_BASE_GAME
  124. #include "ColorballsDefs.h"
  125. #include "ColorballsProts.h"
  126. #endif /* IS_COLORBALL_BASE_GAME */ 
  127. #ifdef IS_SNAKE_BASE_GAME
  128. #include "SnakeDefs.h"
  129. #include "SnakeProts.h"
  130. #endif /* IS_SNAKE_BASE_GAME */ 
  131. #ifdef IS_SMASH_BASE_GAME
  132. #include "SmashDefs.h"
  133. #include "SmashProts.h"
  134. #endif /* IS_SMASH_BASE_GAME */ 
  135. #ifdef IS_DOLL_BASE_GAME
  136. #include "DollDefs.h"
  137. #include "DollProts.h"
  138. #endif /* IS_DOLL_BASE_GAME */ 
  139. #ifdef IS_NINJA_BASE_GAME
  140. #include "NinjaDefs.h"
  141. #include "NinjaProts.h"
  142. #endif /* IS_NINJA_BASE_GAME */ 
  143. #ifdef IS_MAJUNG_BASE_GAME
  144. #include "MajungDefs.h"
  145. #include "MajungProts.h"
  146. #endif /* IS_MAJUNG_BASE_GAME */ 
  147. #ifdef IS_MEMORY_BASE_GAME
  148. #include "MemoryDefs.h"
  149. #include "MemoryProts.h"
  150. #endif /* IS_MEMORY_BASE_GAME */ 
  151. #ifdef IS_COPTER_BASE_GAME
  152. #include "CopterDefs.h"
  153. #include "CopterProts.h"
  154. #endif /* IS_COPTER_BASE_GAME */ 
  155. #ifdef IS_PUZZLE_BASE_GAME
  156. #include "PuzzleDefs.h"
  157. #include "PuzzleProts.h"
  158. #endif /* IS_PUZZLE_BASE_GAME */ 
  159. #ifdef IS_PANDA_BASE_GAME
  160. #include "PandaDefs.h"
  161. #include "PandaProts.h"
  162. #endif /* IS_PANDA_BASE_GAME */ 
  163. #ifdef IS_STAIR_BASE_GAME
  164. #include "StairDefs.h"
  165. #include "StairProts.h"
  166. #endif /* IS_STAIR_BASE_GAME */ 
  167. #ifdef IS_UFO_BASE_GAME
  168. #include "UfoDefs.h"
  169. #include "UfoProts.h"
  170. #endif /* IS_UFO_BASE_GAME */ 
  171. #ifdef IS_DANCE_BASE_GAME
  172. #include "DanceDefs.h"
  173. #include "DanceProts.h"
  174. #endif /* IS_DANCE_BASE_GAME */ 
  175. #ifdef IS_MAGICSUSHI_BASE_GAME
  176. #include "MagicsushiDefs.h"
  177. #include "MagicsushiProts.h"
  178. #endif /* IS_MAGICSUSHI_BASE_GAME */ 
  179. #ifdef IS_FRUIT_BASE_GAME
  180. #include "FruitDefs.h"
  181. #include "FruitProts.h"
  182. #endif /* IS_FRUIT_BASE_GAME */ 
  183. #ifdef IS_VSMJ_BASE_GAME
  184. #include "VsmjDefs.h"
  185. #include "VsmjProts.h"
  186. #endif /* IS_VSMJ_BASE_GAME */ 
  187. #include "DateTimeType.h"
  188. #include "App_DateTime.h"
  189. /****************************************************************************
  190. * Macro                                                                
  191. *****************************************************************************/
  192. #define GAME_SWITCH(index, func_ptr)                             
  193. {                                                                
  194.    case index:                                                   
  195.       {                                                          
  196.          SetLeftSoftkeyFunction(func_ptr,KEY_EVENT_UP);          
  197.          SetKeyHandler(func_ptr, KEY_RIGHT_ARROW,KEY_EVENT_DOWN);
  198.       }                                                          
  199.       break;                                                     
  200. }
  201. typedef enum
  202. {
  203. #if defined(__MMI_GAME__)
  204. #ifdef __MMI_GAME_MULTICHANNEL_SOUND__
  205.     MMI_GAME_SETTING_BACKGROUND,
  206.     MMI_GAME_SETTING_SOUND_EFFECTS,
  207. #else /* __MMI_GAME_MULTICHANNEL_SOUND__ */ /* /__MMI_GAME_MULTICHANNEL_SOUND__ */
  208.     MMI_GAME_SETTING_AUD,
  209. #endif /* __MMI_GAME_MULTICHANNEL_SOUND__ */ 
  210.     MMI_GAME_SETTING_VIB,
  211. #endif /* defined(__MMI_GAME__) */ 
  212.     MMI_GAME_SETTING_ITEM_COUNT
  213. } mmi_game_setting_inline_enum;
  214. typedef struct
  215. {
  216.     /* strings for inline selection display */
  217. #ifdef __MMI_GAME_MULTICHANNEL_SOUND__
  218.     UI_string_type background_music_str[2];
  219.     UI_string_type sound_effect_str[2];
  220. #else /* __MMI_GAME_MULTICHANNEL_SOUND__ */ 
  221.     UI_string_type aud_str[2];
  222. #endif /* __MMI_GAME_MULTICHANNEL_SOUND__ */ 
  223.     UI_string_type vib_str[2];
  224. #ifdef __MMI_GAME_MULTICHANNEL_SOUND__
  225.     S32 bgm_selected;
  226.     S32 sound_effect_selected;
  227. #else /* __MMI_GAME_MULTICHANNEL_SOUND__ */ 
  228.     S32 aud_selected;
  229. #endif /* __MMI_GAME_MULTICHANNEL_SOUND__ */ 
  230.     S32 vib_selected;
  231.     /* inline selection item */
  232.     InlineItem inline_game_items[MMI_GAME_SETTING_ITEM_COUNT *2];      /* one for caption, one for selection */
  233. } mmi_game_cntx_struct;
  234. mmi_game_cntx_struct g_mmi_game_cntx;
  235. /****************************************************************************
  236. * Local Functions                                                        
  237. *****************************************************************************/
  238. static void mmi_game_highlight_hdlr(S32 index);
  239. static void mmi_game_entry_app_screen(void);
  240. static void mmi_game_exit_setting_screen(void);
  241. static void mmi_game_setting_highlight_hdlr(S32 index);
  242. static void mmi_game_setting_done_hdlr(void);
  243. static void mmi_game_entry_setting_screen(void);
  244. /*****************************************************************************
  245.  * FUNCTION
  246.  *  mmi_game_highlight_hdlr
  247.  * DESCRIPTION
  248.  *  highlight hdlr for games
  249.  * PARAMETERS
  250.  *  index       [IN]        Highlighted index
  251.  * RETURNS
  252.  *  void
  253.  *****************************************************************************/
  254. static void mmi_game_highlight_hdlr(S32 index)
  255. {
  256.     /*----------------------------------------------------------------*/
  257.     /* Local Variables                                                */
  258.     /*----------------------------------------------------------------*/
  259.     /*----------------------------------------------------------------*/
  260.     /* Code Body                                                      */
  261.     /*----------------------------------------------------------------*/
  262.     switch (index)
  263.     {
  264.     #ifdef IS_F1RACE_BASE_GAME
  265.             GAME_SWITCH(game_f1race, mmi_gx_f1race_enter_gfx);
  266.     #endif 
  267.     #ifdef IS_HANOI_BASE_GAME
  268.             GAME_SWITCH(game_toh, mmi_gx_toh_enter_gfx);
  269.     #endif 
  270.     #ifdef IS_RICHES_BASE_GAME
  271.             GAME_SWITCH(game_riches, mmi_gx_riches_enter_gfx);
  272.     #endif 
  273.     #ifdef IS_COLORBALL_BASE_GAME
  274.             GAME_SWITCH(game_colorballs, mmi_gx_colorballs_enter_gfx);
  275.     #endif 
  276.     #ifdef IS_SNAKE_BASE_GAME
  277.             GAME_SWITCH(game_snake, mmi_gx_snake_enter_gfx);
  278.     #endif 
  279.     #ifdef IS_SMASH_BASE_GAME
  280.             GAME_SWITCH(game_smash, mmi_gx_smash_enter_gfx);
  281.     #endif 
  282.     #ifdef IS_DOLL_BASE_GAME
  283.             GAME_SWITCH(game_doll, mmi_gx_doll_enter_gfx);
  284.     #endif 
  285.     #ifdef IS_NINJA_BASE_GAME
  286.             GAME_SWITCH(game_ninja, mmi_gx_ninja_enter_gfx);
  287.     #endif 
  288.     #ifdef IS_MAJUNG_BASE_GAME
  289.             GAME_SWITCH(game_majung, mmi_gx_majung_enter_gfx);
  290.     #endif 
  291.     #ifdef IS_MEMORY_BASE_GAME
  292.             GAME_SWITCH(game_memory, mmi_gx_memory_enter_gfx);
  293.     #endif 
  294.     #ifdef IS_COPTER_BASE_GAME
  295.             GAME_SWITCH(game_copter, mmi_gx_copter_enter_gfx);
  296.     #endif 
  297.     #ifdef IS_PUZZLE_BASE_GAME
  298.             GAME_SWITCH(game_puzzle, mmi_gx_puzzle_enter_gfx);
  299.     #endif 
  300.     #ifdef IS_PANDA_BASE_GAME
  301.             GAME_SWITCH(game_panda, mmi_gx_panda_enter_gfx);
  302.     #endif 
  303.     #ifdef IS_STAIR_BASE_GAME
  304.             GAME_SWITCH(game_stair, mmi_gx_stair_enter_gfx);
  305.     #endif 
  306.     #ifdef IS_UFO_BASE_GAME
  307.             GAME_SWITCH(game_ufo, mmi_gx_ufo_enter_gfx);
  308.     #endif 
  309.     #ifdef IS_DANCE_BASE_GAME
  310.             GAME_SWITCH(game_dance, mmi_gx_dance_enter_gfx);
  311.     #endif 
  312.     #ifdef IS_MAGICSUSHI_BASE_GAME
  313.             GAME_SWITCH(game_magicsushi, mmi_gx_magicsushi_enter_gfx);
  314.     #endif 
  315.     #ifdef IS_FRUIT_BASE_GAME
  316.             GAME_SWITCH(game_fruit, mmi_gx_fruit_enter_gfx);
  317.     #endif 
  318.     #ifdef IS_VSMJ_BASE_GAME
  319.             GAME_SWITCH(game_vsmj, mmi_gx_vsmj_enter_gfx);
  320.     #endif 
  321.         default:
  322.             SetLeftSoftkeyFunction(mmi_game_entry_setting_screen, KEY_EVENT_UP);
  323.             SetKeyHandler(mmi_game_entry_setting_screen, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  324.             break;
  325.     }
  326. }
  327. /*****************************************************************************
  328.  * FUNCTION
  329.  *  mmi_game_highlight_app
  330.  * DESCRIPTION
  331.  *  highlight game app menitem
  332.  * PARAMETERS
  333.  *  void
  334.  * RETURNS
  335.  *  void
  336.  *****************************************************************************/
  337. #if defined(__MMI_GAME__)
  338. void mmi_game_highlight_app(void)
  339. {
  340.     /*----------------------------------------------------------------*/
  341.     /* Local Variables                                                */
  342.     /*----------------------------------------------------------------*/
  343.     /*----------------------------------------------------------------*/
  344.     /* Code Body                                                      */
  345.     /*----------------------------------------------------------------*/
  346.     SetLeftSoftkeyFunction(mmi_game_entry_app_screen, KEY_EVENT_UP);
  347.     SetKeyHandler(mmi_game_entry_app_screen, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  348. }
  349. #endif /* defined(__MMI_GAME__) */ 
  350. /*****************************************************************************
  351.  * FUNCTION
  352.  *  mmi_game_entry_app_screen
  353.  * DESCRIPTION
  354.  *  entry game app screen
  355.  * PARAMETERS
  356.  *  void
  357.  * RETURNS
  358.  *  void
  359.  *****************************************************************************/
  360. static void mmi_game_entry_app_screen(void)
  361. {
  362.     /*----------------------------------------------------------------*/
  363.     /* Local Variables                                                */
  364.     /*----------------------------------------------------------------*/
  365.     U8 *guiBuffer;
  366.     UI_time t;
  367.     U16 menu_str[game_list_count + 1];
  368.     U16 menu_img[game_list_count + 1];
  369.     U16 index = 0;
  370.     /*----------------------------------------------------------------*/
  371.     /* Code Body                                                      */
  372.     /*----------------------------------------------------------------*/
  373.     /* str and img +1 for setting */
  374. #ifdef IS_F1RACE_BASE_GAME
  375.     menu_str[index] = STR_GX_F1RACE_GAME_NAME;
  376.     menu_img[index++] = IMG_GX_F1RACE_GAME_ICON;
  377. #endif /* IS_F1RACE_BASE_GAME */ 
  378. #ifdef IS_HANOI_BASE_GAME
  379.     menu_str[index] = STR_GX_TOH_GAME_NAME;
  380.     menu_img[index++] = IMG_GX_TOH_GAME_ICON;
  381. #endif /* IS_HANOI_BASE_GAME */ 
  382. #ifdef IS_RICHES_BASE_GAME
  383.     menu_str[index] = STR_GX_RICHES_GAME_NAME;
  384.     menu_img[index++] = IMG_GX_RICHES_GAME_ICON;
  385. #endif /* IS_RICHES_BASE_GAME */ 
  386. #ifdef IS_COLORBALL_BASE_GAME
  387.     menu_str[index] = STR_GX_COLORBALLS_GAME_NAME;
  388.     menu_img[index++] = IMG_GX_COLORBALLS_GAME_ICON;
  389. #endif /* IS_COLORBALL_BASE_GAME */ 
  390. #ifdef IS_SNAKE_BASE_GAME
  391.     menu_str[index] = STR_GX_SNAKE_GAME_NAME;
  392.     menu_img[index++] = IMG_GX_SNAKE_GAME_ICON;
  393. #endif /* IS_SNAKE_BASE_GAME */ 
  394. #ifdef IS_SMASH_BASE_GAME
  395.     menu_str[index] = STR_GX_SMASH_GAME_NAME;
  396.     menu_img[index++] = IMG_GX_SMASH_GAME_ICON;
  397. #endif /* IS_SMASH_BASE_GAME */ 
  398. #ifdef IS_DOLL_BASE_GAME
  399.     menu_str[index] = STR_GX_DOLL_GAME_NAME;
  400.     menu_img[index++] = IMG_GX_DOLL_GAME_ICON;
  401. #endif /* IS_DOLL_BASE_GAME */ 
  402. #ifdef IS_NINJA_BASE_GAME
  403.     menu_str[index] = STR_GX_NINJA_GAME_NAME;
  404.     menu_img[index++] = IMG_GX_NINJA_GAME_ICON;
  405. #endif /* IS_NINJA_BASE_GAME */ 
  406. #ifdef IS_MAJUNG_BASE_GAME
  407.     menu_str[index] = STR_GX_MAJUNG_GAME_NAME;
  408.     menu_img[index++] = IMG_GX_MAJUNG_GAME_ICON;
  409. #endif /* IS_MAJUNG_BASE_GAME */ 
  410. #ifdef IS_MEMORY_BASE_GAME
  411.     menu_str[index] = STR_GX_MEMORY_GAME_NAME;
  412.     menu_img[index++] = IMG_GX_MEMORY_GAME_ICON;
  413. #endif /* IS_MEMORY_BASE_GAME */ 
  414. #ifdef IS_COPTER_BASE_GAME
  415.     /* copter */
  416. #if defined(__MMI_GAME_COPTER_128x128__) || defined(__MMI_GAME_COPTER_128x160__) || defined(__MMI_GAME_COPTER_176x220__)
  417.     menu_str[index] = STR_ID_GX_COPTER_GAME_NAME;
  418.     /* sub */
  419. #elif defined(__MMI_GAME_SUBMARINE_128x128__) || defined(__MMI_GAME_SUBMARINE_128x160__) || defined(__MMI_GAME_SUBMARINE_176x220__)
  420.     menu_str[index] = STR_ID_GX_COPTER_GAME_NAME_SUBMARINE;
  421.     /* jet */
  422. #elif defined(__MMI_GAME_JET_128x128__) || defined(__MMI_GAME_JET_128x160__) || defined(__MMI_GAME_JET_176x220__)
  423.     menu_str[index] = STR_ID_GX_COPTER_GAME_NAME_JET;
  424. #endif 
  425.     menu_img[index++] = IMG_ID_GX_COPTER_GAME_ICON;
  426. #endif /* IS_COPTER_BASE_GAME */ 
  427. #ifdef IS_PUZZLE_BASE_GAME
  428.     menu_str[index] = STR_ID_GX_PUZZLE_GAME_NAME;
  429.     menu_img[index++] = IMG_ID_GX_PUZZLE_GAME_ICON;
  430. #endif /* IS_PUZZLE_BASE_GAME */ 
  431. #ifdef IS_PANDA_BASE_GAME
  432.     /* panda */
  433. #if defined(__MMI_GAME_PANDA_128x128__) || defined(__MMI_GAME_PANDA_128x160__) || defined(__MMI_GAME_PANDA_176x220__) || defined(__MMI_GAME_PANDA_240x320__)     //KP Jerry add "__MMI_GAME_PANDA_240x320__" on 2007-3-23
  434.     menu_str[index] = STR_ID_GX_PANDA_GAME_NAME;
  435.     /* monkey */
  436. #elif defined(__MMI_GAME_MONKEY_128x128__) || defined(__MMI_GAME_MONKEY_128x160__) || defined(__MMI_GAME_MONKEY_176x220__) || defined(__MMI_GAME_MONKEY_240x320__)     //KP Jerry add "__MMI_GAME_MONKEY_240x320__" on 2007-3-23
  437.     menu_str[index] = STR_ID_GX_PANDA_GAME_NAME_MONKEY;
  438. #endif 
  439.     menu_img[index++] = IMG_ID_GX_PANDA_GAME_ICON;
  440. #endif /* IS_PANDA_BASE_GAME */ 
  441. #ifdef IS_STAIR_BASE_GAME
  442. #if defined(__MMI_GAME_CHICKEN_128x160__) || defined(__MMI_GAME_CHICKEN_128x128__)
  443.     menu_str[index] = STR_ID_GX_STAIR_GAME_NAME_CHICKEN;
  444. #elif defined(__MMI_GAME_ROBOT_176x220__) || defined(__MMI_GAME_ROBOT_128x160__)
  445.     menu_str[index] = STR_ID_GX_STAIR_GAME_NAME_ROBOT;
  446. #endif 
  447.     menu_img[index++] = IMG_ID_GX_STAIR_GAME_ICON;
  448. #endif /* IS_STAIR_BASE_GAME */ 
  449. #ifdef IS_UFO_BASE_GAME
  450. #if defined(__MMI_GAME_UFO_128x160__) || defined(__MMI_GAME_UFO_128x128__) || defined(__MMI_GAME_UFO_176x220__)
  451.     menu_str[index] = STR_ID_GX_UFO_GAME_NAME;
  452. #elif defined(__MMI_GAME_AIRFORCE_128x160__) || defined(__MMI_GAME_AIRFORCE_128x128__)
  453.     menu_str[index] = STR_ID_GX_UFO_GAME_NAME;
  454. #endif 
  455.     menu_img[index++] = IMG_ID_GX_UFO_GAME_ICON;
  456. #endif /* IS_UFO_BASE_GAME */ 
  457. #ifdef IS_DANCE_BASE_GAME
  458.     menu_str[index] = STR_ID_GX_DANCE_GAME_NAME;
  459.     menu_img[index++] = IMG_ID_GX_DANCE_GAME_ICON;
  460. #endif /* IS_DANCE_BASE_GAME */ 
  461. #ifdef IS_MAGICSUSHI_BASE_GAME
  462.     menu_str[index] = STR_ID_GX_MAGICSUSHI_GAME_NAME;
  463.     menu_img[index++] = IMG_ID_GX_MAGICSUSHI_GAME_ICON;
  464. #endif /* IS_MAGICSUSHI_BASE_GAME */ 
  465. #ifdef IS_FRUIT_BASE_GAME
  466.     menu_str[index] = STR_ID_GX_FRUIT_GAME_NAME;
  467.     menu_img[index++] = IMG_ID_GX_FRUIT_GAME_ICON;
  468. #endif /* IS_FRUIT_BASE_GAME */ 
  469. #ifdef IS_VSMJ_BASE_GAME
  470.     menu_str[index] = STR_ID_GX_VSMJ_GAME_NAME;
  471.     menu_img[index++] = IMG_ID_GX_VSMJ_GAME_ICON;
  472. #endif /* IS_VSMJ_BASE_GAME */ 
  473.     menu_str[index] = STR_ID_GAME_SETTING;
  474.     menu_img[index++] = IMG_ID_GAME_SETTING;
  475.     /* Set random seed */
  476.     GetDateTime(&t);
  477.     srand(t.nMin);
  478.     EntryNewScreen(SCR_ID_GAME, NULL, mmi_game_entry_app_screen, NULL);
  479.     guiBuffer = GetCurrGuiBuffer(SCR_ID_GAME);
  480.     RegisterHighlightHandler(mmi_game_highlight_hdlr);
  481.     ShowCategory15Screen(
  482.         STR_GAME_CAPTION,
  483.         MAIN_MENU_TITLE_FUNANDGAMES_ICON,
  484.         STR_GLOBAL_OK,
  485.         IMG_GLOBAL_OK,
  486.         STR_GLOBAL_BACK,
  487.         IMG_GLOBAL_BACK,
  488.         index,
  489.         menu_str,
  490.         menu_img,
  491.         1,
  492.         0,
  493.         guiBuffer);
  494.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  495.     /* load game settings */
  496.     mmi_gfx_load_setting();
  497. }
  498. /*****************************************************************************
  499.  * FUNCTION
  500.  *  mmi_game_entry_setting_screen
  501.  * DESCRIPTION
  502.  *  entry point for game setting screen
  503.  * PARAMETERS
  504.  *  void
  505.  * RETURNS
  506.  *  void
  507.  *****************************************************************************/
  508. static void mmi_game_entry_setting_screen(void)
  509. {
  510. #if defined(__MMI_GAME__)
  511.     /*----------------------------------------------------------------*/
  512.     /* Local Variables                                                */
  513.     /*----------------------------------------------------------------*/
  514.     U8 *guiBuffer;
  515.     U8 *inputBuffer;
  516.     U16 inputBufferSize;
  517.     S32 item_offset = 0;
  518.     MMI_ID_TYPE item_icons[] = 
  519.     {
  520.     #if defined(__MMI_GAME__)
  521.     #ifdef __MMI_GAME_MULTICHANNEL_SOUND__
  522.         IMG_ID_GAME_SETTING_BACK_AUD,
  523.         0,
  524.         IMG_ID_GAME_SETTING_AUD,
  525.         0,
  526.     #else /* __MMI_GAME_MULTICHANNEL_SOUND__ */ 
  527.         IMG_ID_GAME_SETTING_AUD,
  528.         0,
  529.     #endif /* __MMI_GAME_MULTICHANNEL_SOUND__ */ 
  530.         IMG_ID_GAME_SETTING_VIB,
  531.         0,
  532.     #endif /* defined(__MMI_GAME__) */ 
  533.     };
  534.     /*----------------------------------------------------------------*/
  535.     /* Code Body                                                      */
  536.     /*----------------------------------------------------------------*/
  537.     /* load setting */
  538. #if defined(__MMI_GAME__)
  539.     mmi_gfx_load_setting();
  540. #endif 
  541.     EntryNewScreen(SCR_ID_GAME_SETTING, mmi_game_exit_setting_screen, NULL, NULL);
  542.    /***************************************************************************** 
  543.    * Game  
  544.    *****************************************************************************/
  545. #if defined(__MMI_GAME__)
  546.     /* TRUE (1) is on */
  547. #ifdef __MMI_GAME_MULTICHANNEL_SOUND__
  548.     g_mmi_game_cntx.bgm_selected = GFX.is_background_music_on;
  549.     g_mmi_game_cntx.sound_effect_selected = GFX.is_sound_effect_on;
  550. #else /* __MMI_GAME_MULTICHANNEL_SOUND__ */ 
  551.     g_mmi_game_cntx.aud_selected = GFX.is_aud_on;
  552. #endif /* __MMI_GAME_MULTICHANNEL_SOUND__ */ 
  553.     g_mmi_game_cntx.vib_selected = GFX.is_vib_on;
  554. #ifdef __MMI_GAME_MULTICHANNEL_SOUND__
  555.     g_mmi_game_cntx.background_music_str[0] = (UI_string_type) GetString((U16) (STR_GLOBAL_OFF));
  556.     g_mmi_game_cntx.background_music_str[1] = (UI_string_type) GetString((U16) (STR_GLOBAL_ON));
  557.     g_mmi_game_cntx.sound_effect_str[0] = (UI_string_type) GetString((U16) (STR_GLOBAL_OFF));
  558.     g_mmi_game_cntx.sound_effect_str[1] = (UI_string_type) GetString((U16) (STR_GLOBAL_ON));
  559. #else /* __MMI_GAME_MULTICHANNEL_SOUND__ */ 
  560.     g_mmi_game_cntx.aud_str[0] = (UI_string_type) GetString((U16) (STR_GLOBAL_OFF));
  561.     g_mmi_game_cntx.aud_str[1] = (UI_string_type) GetString((U16) (STR_GLOBAL_ON));
  562. #endif /* __MMI_GAME_MULTICHANNEL_SOUND__ */ 
  563.     g_mmi_game_cntx.vib_str[0] = (UI_string_type) GetString((U16) (STR_GLOBAL_OFF));
  564.     g_mmi_game_cntx.vib_str[1] = (UI_string_type) GetString((U16) (STR_GLOBAL_ON));
  565.     memset((void*)g_mmi_game_cntx.inline_game_items, 0, sizeof(InlineItem) * MMI_GAME_SETTING_ITEM_COUNT * 2);
  566.     InitializeCategory57Screen();
  567. #ifdef __MMI_GAME_MULTICHANNEL_SOUND__
  568.     /* background music */
  569.     SetInlineItemCaption(
  570.         &g_mmi_game_cntx.inline_game_items[item_offset++],
  571.         (PU8) GetString((U16) (STR_ID_GAME_SETTING_MULTICHANNEL_BACKGROUND_MUSIC)));
  572.     SetInlineItemActivation(&g_mmi_game_cntx.inline_game_items[item_offset], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
  573.     SetInlineItemSelect(
  574.         &g_mmi_game_cntx.inline_game_items[item_offset++],
  575.         2,
  576.         (U8 **) g_mmi_game_cntx.background_music_str,
  577.         &g_mmi_game_cntx.bgm_selected);
  578.     /* sound effect */
  579.     SetInlineItemCaption(
  580.         &g_mmi_game_cntx.inline_game_items[item_offset++],
  581.         (PU8) GetString((U16) (STR_ID_GAME_SETTING_MULTICHANNEL_SOUND_EFFECT)));
  582.     SetInlineItemActivation(&g_mmi_game_cntx.inline_game_items[item_offset], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
  583.     SetInlineItemSelect(
  584.         &g_mmi_game_cntx.inline_game_items[item_offset++],
  585.         2,
  586.         (U8 **) g_mmi_game_cntx.sound_effect_str,
  587.         &g_mmi_game_cntx.sound_effect_selected);
  588. #else /* __MMI_GAME_MULTICHANNEL_SOUND__ */ 
  589.     /* game audio */
  590.     SetInlineItemCaption(
  591.         &g_mmi_game_cntx.inline_game_items[item_offset++],
  592.         (PU8) GetString((U16) (STR_ID_GAME_SETTING_AUD)));
  593.     SetInlineItemActivation(&g_mmi_game_cntx.inline_game_items[item_offset], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
  594.     SetInlineItemSelect(
  595.         &g_mmi_game_cntx.inline_game_items[item_offset++],
  596.         2,
  597.         (U8 **) g_mmi_game_cntx.aud_str,
  598.         &g_mmi_game_cntx.aud_selected);
  599. #endif /* __MMI_GAME_MULTICHANNEL_SOUND__ */ 
  600.     /* game vib */
  601.     SetInlineItemCaption(
  602.         &g_mmi_game_cntx.inline_game_items[item_offset++],
  603.         (PU8) GetString((U16) (STR_ID_GAME_SETTING_VIB)));
  604.     SetInlineItemActivation(&g_mmi_game_cntx.inline_game_items[item_offset], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
  605.     SetInlineItemSelect(
  606.         &g_mmi_game_cntx.inline_game_items[item_offset++],
  607.         2,
  608.         (U8 **) g_mmi_game_cntx.vib_str,
  609.         &g_mmi_game_cntx.vib_selected);
  610. #endif /* defined(__MMI_GAME__) */ 
  611.     guiBuffer = GetCurrGuiBuffer(SCR_ID_GAME_SETTING);
  612.     inputBuffer = GetCurrNInputBuffer(SCR_ID_GAME_SETTING, &inputBufferSize);
  613.     if (inputBuffer != NULL)
  614.     {
  615.         SetCategory57Data(g_mmi_game_cntx.inline_game_items, MMI_GAME_SETTING_ITEM_COUNT * 2, inputBuffer);
  616.     }
  617.     RegisterHighlightHandler(mmi_game_setting_highlight_hdlr);
  618.     /* show category */
  619.     ShowCategory57Screen(
  620.         STR_ID_GAME_SETTING,
  621.         MAIN_MENU_TITLE_FUNANDGAMES_ICON,
  622.         STR_GLOBAL_OK,
  623.         IMG_GLOBAL_OK,
  624.         STR_GLOBAL_BACK,
  625.         IMG_GLOBAL_BACK,
  626.         item_offset,
  627.         item_icons,
  628.         g_mmi_game_cntx.inline_game_items,
  629.         0,
  630.         guiBuffer);
  631.     /* set key hdlr */
  632.     SetCategory57LeftSoftkeyFunction(mmi_game_setting_done_hdlr);
  633.     SetCategory57RightSoftkeyFunctions(GoBackHistory, GoBackHistory);
  634.     DisableCategory57ScreenDone();
  635. #endif /* defined(__MMI_GAME__) */ 
  636. }
  637. /*****************************************************************************
  638.  * FUNCTION
  639.  *  mmi_game_setting_done_hdlr
  640.  * DESCRIPTION
  641.  *  done hdlr for game setting
  642.  * PARAMETERS
  643.  *  void
  644.  * RETURNS
  645.  *  void
  646.  *****************************************************************************/
  647. static void mmi_game_setting_done_hdlr(void)
  648. {
  649. #if defined(__MMI_GAME__)
  650.     /*----------------------------------------------------------------*/
  651.     /* Local Variables                                                */
  652.     /*----------------------------------------------------------------*/
  653.     /*----------------------------------------------------------------*/
  654.     /* Code Body                                                      */
  655.     /*----------------------------------------------------------------*/
  656.     /* game effect */
  657. #ifdef __MMI_GAME_MULTICHANNEL_SOUND__
  658.     GFX.is_background_music_on = g_mmi_game_cntx.bgm_selected;
  659.     GFX.is_sound_effect_on = g_mmi_game_cntx.sound_effect_selected;
  660. #else /* __MMI_GAME_MULTICHANNEL_SOUND__ */ 
  661.     GFX.is_aud_on = g_mmi_game_cntx.aud_selected;
  662. #endif /* __MMI_GAME_MULTICHANNEL_SOUND__ */ 
  663.     GFX.is_vib_on = g_mmi_game_cntx.vib_selected;
  664.     mmi_gfx_store_setting();
  665.     DisplayPopup((PU8) GetString(STR_GLOBAL_DONE), IMG_GLOBAL_ACTIVATED, 1, ST_NOTIFYDURATION, SUCCESS_TONE);
  666.     DeleteNHistory(1);
  667. #endif /* defined(__MMI_GAME__) */ 
  668. }
  669. /*****************************************************************************
  670.  * FUNCTION
  671.  *  mmi_game_setting_highlight_hdlr
  672.  * DESCRIPTION
  673.  *  highlight hdlr
  674.  * PARAMETERS
  675.  *  index       [IN]        
  676.  * RETURNS
  677.  *  void
  678.  *****************************************************************************/
  679. static void mmi_game_setting_highlight_hdlr(S32 index)
  680. {
  681. #if defined(__MMI_GAME__)
  682.     /*----------------------------------------------------------------*/
  683.     /* Local Variables                                                */
  684.     /*----------------------------------------------------------------*/
  685.     /*----------------------------------------------------------------*/
  686.     /* Code Body                                                      */
  687.     /*----------------------------------------------------------------*/
  688.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
  689.     SetCategory57LeftSoftkeyFunction(mmi_game_setting_done_hdlr);
  690. #endif /* defined(__MMI_GAME__) */ 
  691. }
  692. /*****************************************************************************
  693.  * FUNCTION
  694.  *  mmi_game_exit_setting_screen
  695.  * DESCRIPTION
  696.  *  exit point for game setting screen
  697.  * PARAMETERS
  698.  *  void
  699.  *  viud(?)     [IN]        
  700.  * RETURNS
  701.  *  void
  702.  *****************************************************************************/
  703. static void mmi_game_exit_setting_screen(void)
  704. {
  705.     /*----------------------------------------------------------------*/
  706.     /* Local Variables                                                */
  707.     /*----------------------------------------------------------------*/
  708.     U16 inputBufferSize;
  709.     history h;
  710.     S16 nHistory = 0;
  711.     /*----------------------------------------------------------------*/
  712.     /* Code Body                                                      */
  713.     /*----------------------------------------------------------------*/
  714.     h.scrnID = SCR_ID_GAME_SETTING;
  715.     CloseCategory57Screen();
  716.     h.entryFuncPtr = mmi_game_entry_setting_screen;
  717.     pfnUnicodeStrcpy((S8*) h.inputBuffer, (S8*) & nHistory);
  718.     GetCategory57History(h.guiBuffer);
  719.     inputBufferSize = (U16) GetCategory57DataSize();
  720.     GetCategory57Data((U8*) h.inputBuffer);
  721.     AddNHistory(h, inputBufferSize);
  722. }
  723. #endif /* __MMI_GAME__ */