Vsmj.c
上传用户:lqx1163
上传日期:2014-08-13
资源大小:9183k
文件大小:150k
- /*****************************************************************************
- * Copyright Statement:
- * --------------------
- * This software is protected by Copyright and the information contained
- * herein is confidential. The software may not be copied and the information
- * contained herein may not be used or disclosed except with the written
- * permission of MediaTek Inc. (C) 2002
- *
- *****************************************************************************/
- /*****************************************************************************
- * Filename:
- * ---------
- * vsmj.c
- *
- * Project:
- * --------
- * Maui
- *
- * Description:
- * ------------
- * Game
- *
- * Author:
- * -------
- * -------
- * -------
- *
- ****************************************************************************/
- #include "MMI_features.h"
- #include "GameDefs.h"
- #ifdef IS_VSMJ_BASE_GAME
- #include "GameInc.h"
- #include "VsmjProts.h"
- #include "VsmjDefs.h"
- /* gdi */
- #include "lcd_sw_rnd.h"
- #include "gdi_include.h"
- #include "gd_primitive.h"
- /* gdi */
- #ifdef __MMI_TVOUT__
- #include "mdi_datatype.h"
- #include "mdi_tv.h"
- #endif /* __MMI_TVOUT__ */
- #ifdef __MMI_TOUCH_SCREEN__
- #include "wgui_touch_screen.h"
- #endif
- /* debug term */
- //#define VSMJ_DEBUG_ON
- /* debug term */
- /*****************************************************************************
- * Define // 2players
- *****************************************************************************/
- #define TABLE_NUM (144)
- #define NUM_PLAYER (2)
- /* render part,frame */
- #define SCORE_POS_X (30)
- #define SCORE_POS_Y (30)
- #define SCORE_UNIT_HEIGHT (30)
- #define SCORE_FRAME (5)
- #define SCORE_WIDTH (200)
- #define SCORE_HEIGHT (270)
- #define USER_TILE_WIDTH (18)
- #define USER_TILE_HEIGHT (25)
- #define TABLE_TILE_WIDTH (7)
- #define TABLE_TILE_HEIGHT (10)
- #define TABLE_UPDOWN_POS_X (280)
- #define TABLE_UP_POS_Y (50)
- #define TABLE_DOWN_POS_Y (200)
- #define TABLE_LEFTRIGHT_POS_Y (180)
- #define TABLE_LEFT_POS_X (40)
- #define TABLE_RIGHT_POS_X (195)
- #define GRAVE_POS_X (7)
- #define GRAVE_POS_Y (53)
- const S16 USER_LOCK_POS_X[2]={1,301};
- const S16 USER_LOCK_POS_Y[2]={215,1};
- const S16 USER_FLOWER_POS_X[2]={1,175};
- const S16 USER_FLOWER_POS_Y[2]={179,27};
- const S16 USER_OWN_POS_X[2]={1,31};
- const S16 USER_OWN_POS_Y[2]={215,1};
- const S16 USER_HIGHLIGHT_POS_X[2]={301,1};
- const S16 USER_HIGHLIGHT_POS_Y[2]={215,1};
- #define MMI_GX_VSMJ_NUM_POSITION_X (188)
- #define MMI_GX_VSMJ_NUM_POSITION_Y (181)
- #define MMI_GX_VSMJ_RECT_POS_X1 (144)
- #define MMI_GX_VSMJ_RECT_POS_Y1 (172)
- #define MMI_GX_VSMJ_RECT_POS_X2 (201)
- #define MMI_GX_VSMJ_RECT_POS_Y2 (205)
- #define MMI_GX_VSMJ_LEFT_BRICK_POS_X (148)
- #define MMI_GX_VSMJ_LEFT_BRICK_POS_Y (176)
- #define SIGN_POS_X (10)
- #define SIGN_POS_Y (110)
- #define PLAYER_SPECIAL_POS_X (40)
- #define PLAYER_SPECIAL_POS_Y (70)
- #define PLAYER_SPECIAL_UNIT_WIDTH (30)
- #define PLAYER_SPECIAL_UNIT_HEIGHT (30)
- const S16 HIGHLIGHT_FREE_POS_X[2]={301,1};
- const S16 HIGHLIGHT_FREE_POS_Y[2]= {185,27};
- #define DICES13_OFFSET 27 //KP Jerry add for 13dices on 2007-3-22
- /*****************************************************************************
- * Typedef
- *****************************************************************************/
- /* enum */
- typedef enum{
- MOVE_PICK_TILE=0,
- MOVE_PICK_CHECK,
- MOVE_PICK_SPECIAL,
- MOVE_REPLENISH_TILE,
- MOVE_DISCARD_TILE,
- MOVE_DISCARD_CHECK_START,
- MOVE_DISCARD_CHECK_CONTINUE,
- MOVE_DISCARD_SPECIAL,
- MOVE_DECLARE_HOU,
- MOVE_RESULT,
- MOVE_LIOU_GU
- } gx_vsmj_gamemove_enum;
- typedef enum{
- PLAYER_1=0,
- COM_1,
- COM_2,
- COM_3
- } gx_vsmj_user_id_enum;
- typedef enum{
- PP_OWN_0=0,
- PP_OWN_1,
- PP_OWN_2,
- PP_OWN_3,
- PP_OWN_4,
- PP_OWN_5,
- PP_OWN_6,
- PP_OWN_7,
- PP_OWN_8,
- PP_OWN_9,
- PP_OWN_10,
- PP_OWN_11,
- PP_OWN_12,
- PP_OWN_13,
- PP_OWN_14,
- PP_OWN_15,
- PP_OWN_16,
- PP_HIGHLIGHT,
- PP_SPECIAL_HOU,
- PP_SPECIAL_PON,
- PP_SPECIAL_EAT_0,
- PP_SPECIAL_EAT_1,
- PP_SPECIAL_EAT_2,
- PP_SPECIAL_BUGUN,
- PP_SPECIAL_HANDGUN_0,
- PP_SPECIAL_HANDGUN_1,
- PP_SPECIAL_HANDGUN_2,
- PP_SPECIAL_HANDGUN_3,
- PP_SPECIAL_CANCEL,
- PP_ELSE,
- PP_PENNOTDOWN
- } gx_vsmj_pen_pos_enum;
- typedef enum{
- TE_EAST=0,
- TE_WEST,
- TE_SOUTH,
- TE_NORTH,
- TE_CHUNG,
- TE_FA,
- TE_BAI,
-
- NU_1W,
- NU_2W,
- NU_3W,
- NU_4W,
- NU_5W,
- NU_6W,
- NU_7W,
- NU_8W,
- NU_9W,
-
- NU_1S,
- NU_2S,
- NU_3S,
- NU_4S,
- NU_5S,
- NU_6S,
- NU_7S,
- NU_8S,
- NU_9S,
-
- NU_1T,
- NU_2T,
- NU_3T,
- NU_4T,
- NU_5T,
- NU_6T,
- NU_7T,
- NU_8T,
- NU_9T,
-
- FL_SPRING,
- FL_SUMMER,
- FL_AUTUMN,
- FL_WINTER,
-
- FL_M,
- FL_L,
- FL_Z,
- FL_J,
-
- TILE_TOTALID,
-
- TILE_EMPTY,
- WALL_EAT,
- WALL_PON,
- WALL_GUNSHOW,
- WALL_GUNHIDE,
- WALL_END
- } gx_vsmj_tile_id_enum;
- typedef enum{
- CHK_NOTUSED=0,
- CHK_USED,
- CHK_QUAD,
- CHK_TRIPLE,
- CHK_LINE_L,
- CHK_LINE_M,
- CHK_LINE_R,
- CHK_PAIR,
- CHK_INHLINE_L,
- CHK_INHLINE_R,
- CHK_OUTHLINE_L,
- CHK_OUTHLINE_R,
- CHK_SINGLE,
- CHK_MISSION_OCCUPY,
- CHK_END,
- POS_DESK,
- POS_GRAVE,
- POS_HAND,
- POS_HIGH,
- POS_LOCK
- } gx_vsmj_chk_status_enum;
- typedef enum{
- SIGN_OFF=0,
- SIGN_EAT,
- SIGN_PON,
- SIGN_GUN,
- SIGN_HOU,
- SIGN_LIOU_GU
- } gx_vsmj_sign_enum;
-
- typedef enum{
- SCORE_8_FLOWER=0,
- SCORE_7_1_FLOWER,
- SCORE_PICK_BY_OWN,
- SCORE_PICK_BY_REPLENISH,
- SCORE_MEN_CHIN,
- SCORE_MEN_CHIN_ZE_MO,
- SCORE_FLOWER_SEASON_SET,
- SCORE_FLOWER_PLANT_SET,
- SCORE_SEA_MOON,
- SCORE_CHUAN_CHIO,
- SCORE_BIG_3_YUANG,
- SCORE_SMALL_3_YUANG,
- SCORE_3_YUANG_CHUNG,
- SCORE_3_YUANG_FA,
- SCORE_3_YUANG_BAI,
- SCORE_BIG_4_WIND,
- SCORE_SMALL_4_WIND,
- SCORE_3_ENKE,
- SCORE_4_ENKE,
- SCORE_5_ENKE,
- SCORE_NUM_1_COLOR,
- SCORE_MIX_1_COLOR,
- SCORE_PAIR_PAIR_HOU,
- SCORE_TOTALNUM
- } gx_vsmj_score_enum;
-
- typedef enum{
- COM_STRATEGY_1,
- COM_STRATEGY_2
- } gx_vsmj_com_strategy_enum;
- /* basic game variable struct */
- typedef struct{
- BOOL is_gameover;
- BOOL is_new_game;
- U8 game_level;
- U8 game_type; //KP Jerry add on 2007-3-23
- S16 game_grade;
- U16 timer_elapse;
- } gx_vsmj_context_struct;
- /* struct */
- typedef struct{
- gx_vsmj_tile_id_enum id;
- gx_vsmj_chk_status_enum pos;
- } gx_vsmj_tile_struct;
- typedef struct{
- gx_vsmj_tile_struct *hand[18];
- gx_vsmj_tile_struct *flower[9];
- gx_vsmj_tile_struct *lock[26];
- gx_vsmj_user_id_enum id;
- BOOL can_hou;
- BOOL can_bugun;
- BOOL can_handgun[4];
- BOOL can_pon;
- BOOL can_eat[3];
- gx_vsmj_tile_id_enum handgun_id[4];
- U16 start_pos_x;
- U16 hand_left;
- } gx_vsmj_user_struct;
-
-
- /*****************************************************************************
- * Local Function
- *****************************************************************************/
- void mmi_gx_vsmj_enter_game(void); /* entry function of the game */
- void mmi_gx_vsmj_init_game(void);
- void mmi_gx_vsmj_exit_game(void);
- void mmi_gx_vsmj_render(void);
- void mmi_gx_vsmj_framemove(void);
- void mmi_gx_vsmj_draw_gameover(void);
- void mmi_gx_vsmj_gameover(void);
- S16 mmi_gx_vsmj_calc_best_grade(S16 old_grade, S16 new_grade);
- void mmi_gx_vsmj_cyclic_timer(void);
- BOOL mmi_gx_vsmj_check_eat(gx_vsmj_user_struct *user_ptr,U8 type);
- BOOL mmi_gx_vsmj_check_pon(gx_vsmj_user_struct *user_ptr);
- BOOL mmi_gx_vsmj_check_bugun(gx_vsmj_user_struct *user_ptr);
- BOOL mmi_gx_vsmj_check_handgun(gx_vsmj_user_struct *user_ptr);
- BOOL mmi_gx_vsmj_check_hou(gx_vsmj_user_struct *user_ptr);
- BOOL mmi_gx_vsmj_check_multi(U8 multi_time,gx_vsmj_tile_id_enum target_id,gx_vsmj_tile_struct* tile_set_ptr[]);
- BOOL mmi_gx_vsmj_check_link(U8 link_time,gx_vsmj_tile_id_enum target_id, gx_vsmj_tile_struct* tile_set_ptr[]);
- void mmi_gx_vsmj_player_move(gx_vsmj_user_struct *user_ptr);
- void mmi_gx_vsmj_com_move(gx_vsmj_user_struct *user_ptr);
- void mmi_gx_vsmj_com_think_count_value(gx_vsmj_chk_status_enum status,S16 *value);
- void mmi_gx_vsmj_stagegen(void);
- void mmi_gx_vsmj_throwdice(void);
- void mmi_gx_vsmj_sendtile(void); /* send tiles to player and com at game start */
- void mmi_gx_vsmj_render_table(void);
- void mmi_gx_vsmj_render_user(gx_vsmj_user_struct *user_ptr);
- void mmi_gx_vsmj_render_highlight(void);
- void mmi_gx_vsmj_render_special_bar(void);
- void mmi_gx_vsmj_render_sign(void);
- void mmi_gx_vsmj_render_pen_cursor(void);
- void mmi_gx_vsmj_render_scorescreen(void);
- void mmi_gx_vsmj_discard_tile(gx_vsmj_tile_id_enum target_id,gx_vsmj_user_struct *user_ptr);
- void mmi_gx_vsmj_pick_tile(gx_vsmj_user_struct *user_ptr);
- void mmi_gx_vsmj_replenish_tile(gx_vsmj_user_struct *user_ptr);
- void mmi_gx_vsmj_handgun(gx_vsmj_tile_id_enum target_id,gx_vsmj_user_struct *user_ptr);
- void mmi_gx_vsmj_pon(gx_vsmj_user_struct *user_ptr);
- void mmi_gx_vsmj_eat(gx_vsmj_user_struct *user_ptr,U8 type);
- void mmi_gx_vsmj_bugun(gx_vsmj_user_struct *user_ptr);
- void mmi_gx_vsmj_declare_hou(gx_vsmj_user_struct *user_ptr);
- void mmi_gx_vsmj_count_score(gx_vsmj_user_struct *user_ptr);
- void mmi_gx_vsmj_com_think_st_1(gx_vsmj_user_struct *user_ptr);
- void mmi_gx_vsmj_com_think_st_2(gx_vsmj_user_struct *user_ptr);
- S16 mmi_gx_vsmj_find_no_with_tile_id(gx_vsmj_tile_id_enum target_id,gx_vsmj_tile_struct* tile_set_ptr[]);
- void mmi_gx_vsmj_insert_tile(gx_vsmj_tile_struct *tile_target_ptr,gx_vsmj_tile_struct *tile_set_ptr[]);
- BOOL mmi_gx_vsmj_eliminate_tile(gx_vsmj_tile_id_enum target_id ,gx_vsmj_tile_struct* tile_set_ptr[]);
- void mmi_gx_vsmj_sort_tile(gx_vsmj_tile_struct* tile_set_ptr[]);
- void mmi_gx_vsmj_pick_tile(gx_vsmj_user_struct *user_ptr);
- BOOL mmi_gx_vsmj_hou_trial(gx_vsmj_tile_struct *tile_set_ptr[],BOOL pair_used);
- BOOL mmi_gx_vsmj_set_chk(gx_vsmj_tile_id_enum target_id, gx_vsmj_chk_status_enum original_status,
- gx_vsmj_chk_status_enum to_status,gx_vsmj_tile_struct *tile_set_ptr[]);
- S16 mmi_gx_vsmj_com_think_check_ting_num(gx_vsmj_tile_struct *tile_set[]);
- void mmi_gx_vsmj_check_connection(gx_vsmj_tile_struct *tile_set_ptr[], gx_vsmj_chk_status_enum *temp_ptr);
- void mmi_gx_vsmj_com_think_count_value(gx_vsmj_chk_status_enum status,S16 *value);
- void mmi_gx_vsmj_reset_chk_all_stat_only(gx_vsmj_chk_status_enum *chk_set_ptr);
- void mmi_gx_vsmj_reset_chk(gx_vsmj_tile_struct *tile_set_ptr[]);
- void mmi_gx_vsmj_reset_chk_all(gx_vsmj_tile_struct *tile_set_ptr[]);
- #ifdef VSMJ_DEBUG_ON
- void mmi_gx_vsmj_debug(void);
- #endif
- /* Game play functions */
- /* key functions */
- #ifdef __MMI_TOUCH_SCREEN__
- void mmi_gx_vsmj_pen_down_hdlr(mmi_pen_point_struct pos);
- void mmi_gx_vsmj_pen_up_hdlr(mmi_pen_point_struct pos);
- #endif
- /* key functions */
- /*****************************************************************************
- * Local Variable
- *****************************************************************************/
- static gx_vsmj_context_struct g_gx_vsmj_context =
- {
- FALSE, /* is_gameover */
- TRUE, /* is_new_game */
- 0, /* game_level */
- 0, /* game_type */ //KP Jerry add on 2007-3-23
- 0, /* game_grade */
- 200 /* timer_elapse */
- };
- gx_vsmj_tile_struct tile_table[TABLE_NUM];
- gx_vsmj_tile_struct wall_eat =
- {
- WALL_EAT,
- POS_HAND
- };
- gx_vsmj_tile_struct wall_pon =
- {
- WALL_PON,
- POS_HAND
- };
- gx_vsmj_tile_struct wall_gunshow =
- {
- WALL_GUNSHOW,
- POS_HAND
- };
- gx_vsmj_tile_struct wall_gunhide =
- {
- WALL_GUNHIDE,
- POS_HAND
- };
- gx_vsmj_tile_struct wall_end =
- {
- WALL_END,
- CHK_END
- };
- gx_vsmj_tile_struct tile_empty =
- {
- TILE_EMPTY,
- POS_HAND
- };
- gx_vsmj_user_struct user[NUM_PLAYER];
- gx_vsmj_com_strategy_enum com_strategy[NUM_PLAYER];
- gx_vsmj_user_struct *last_user= &user[0];
- gx_vsmj_user_struct *current_user = &user[0];
- gx_vsmj_tile_struct *highlight = &wall_end;
- gx_vsmj_tile_struct *grave[96]; /*at most 144-16-16-2*8(liou gu) =96 */
- S16 start_index=0; /* save the position of table to pick (num acc. to scr) */
- S16 end_index=TABLE_NUM-1; /* save the position of table to replenish (num acc. to scr )*/
- S16 grave_index=0;
- S16 table_offset=0;
- S16 gun_times=0; /* used to determine how many tiles left on table => liou gu */
- S16 game_delay=0;
- gx_vsmj_gamemove_enum game_move;
- gx_vsmj_pen_pos_enum pen_pos=PP_PENNOTDOWN;
- gx_vsmj_sign_enum sign;
- U8 sign_delay=0;
- S16 pen_last_x=0;
- S16 pen_last_y=0;
- /*score relative */ /*haven't put in init!!!!!!!!*/
- BOOL score_8_flower;
- BOOL score_7_1_flower;
- BOOL score_last_by_own;
- BOOL score_hou_by_replenish;
- BOOL bonus_hou[SCORE_TOTALNUM];
- /*score relative */ /*haven't put in init!!!!!!!!*/
- #ifdef VSMJ_DEBUG_ON
- S16 gx_vsmj_debug[40];
- #endif
- //KP Jerry add for avoid screen-display-error when vsmj is playing on 2007-3-24 start
- BOOL VsmjPlayFlag = 0;
- BOOL mmi_gx_vsmj_getplaystate(void)
- {
- //return ((!g_gx_vsmj_context.is_gameover)&&(*(GFX.game_data.is_new_game)));
- return VsmjPlayFlag;
- }
- void mmi_gx_vsmj_setplaystate(void)
- {
- VsmjPlayFlag = 1;
- }
- void mmi_gx_vsmj_clearplaystate(void)
- {
- VsmjPlayFlag = 0;
- }
- //KP Jerry add for avoid screen-display-error when vsmj is playing on 2007-3-24 end
- /**************************************************************
- FUNCTION NAME : mmi_gx_vsmj_enter_gfx()
- PURPOSE : Set Game Framework (GFX) Parameter
- INPUT PARAMETERS : nil
- OUTPUT PARAMETERS : nil
- RETURNS : void
- REMARKS : nil
- ***************************************************************/
- void mmi_gx_vsmj_enter_gfx(void)
- {
- /* Game menu */
- GFX.game_data.game_img_id = IMG_ID_GX_VSMJ_GAME_ICON; /* game icon img ID */
- GFX.game_data.game_str_id = STR_ID_GX_VSMJ_GAME_NAME; /* game name string ID */
- GFX.game_data.menu_resume_str_id = STR_GAME_RESUME; /* "Resume" string ID */
- GFX.game_data.menu_new_str_id = STR_GAME_NEW; /* "New Game" string ID */
- GFX.game_data.menu_level_str_id = STR_GAME_LEVEL; /* "Game Level" string ID */
- GFX.game_data.menu_grade_str_id = STR_GAME_GRADE; /* "Best Grade" string ID */
- GFX.game_data.menu_help_str_id = STR_GAME_HELP; /* "Game Help" string ID */
- //KP Jerry add for vsmj type 2007-3-21 start
- GFX.game_data.menu_type_str_id = STR_GAME_TYPE; /* "Game type" string ID */
- GFX.game_data.type_count = 2;
- GFX.game_data.type_str_id_list[0] = STR_ID_GX_VSMJ_TYPE_13DICES; /* type string ID */
- GFX.game_data.type_str_id_list[1] = STR_ID_GX_VSMJ_TYPE_16DICES; /* type string ID */
- //GFX.game_data.type_nvram_id = NVRAM_GX_VSMJ_TYPE; /* current lvl idnex in NVRAM (byte) */
- GFX.game_data.type_index_ptr = (U8*)(&g_gx_vsmj_context.game_type); /* ptr to current type index (U8*) */
- //KP Jerry add for vsmj type 2007-3-21 end
-
- /* level / grade */
- GFX.game_data.level_count = 2; /* how many levels */
- GFX.game_data.level_str_id_list[0] = STR_ID_GX_VSMJ_LEVEL_NORMAL; /* level string ID */
- GFX.game_data.level_str_id_list[1] = STR_ID_GX_VSMJ_LEVEL_CPUVSCPU; /* level string ID */
- /* add slot in NVRAMEnum.h */
- GFX.game_data.grade_nvram_id_list[0] = NVRAM_GX_VSMJ_NORMAL_SCORE; /* grade slot in NVRAM (short)*/
- GFX.game_data.grade_nvram_id_list[1] = NVRAM_GX_VSMJ_CPUVSCPU_SCORE; /* grade slot in NVRAM */
- GFX.game_data.level_nvram_id = NVRAM_GX_VSMJ_LEVEL; /* current lvl idnex in NVRAM (byte) */
- /* help */
- GFX.game_data.help_str_id = STR_ID_GX_VSMJ_HELP_DESCRIPTION; /* help description string id */
- /* misc */
- GFX.game_data.grade_value_ptr = (S16*)(&g_gx_vsmj_context.game_grade); /* current level's grade (S16*) */
- GFX.game_data.level_index_ptr = (U8*)(&g_gx_vsmj_context.game_level); /* ptr to current level index (U8*) */
- GFX.game_data.is_new_game = (BOOL*)(&g_gx_vsmj_context.is_new_game); /* ptr to new game flag (BOOL*) */
-
- /* function ptr */
- GFX.game_data.best_grade_func_ptr = mmi_gx_vsmj_calc_best_grade; /* function to calculate best grade */
- GFX.game_data.enter_game_func_ptr = mmi_gx_vsmj_enter_game; /* function to enter new game */
- GFX.game_data.exit_game_func_ptr = mmi_gx_vsmj_exit_game; /* function to exit game */
- GFX.game_data.draw_gameover_func_ptr = mmi_gx_vsmj_draw_gameover; /* function to draw gameover screen */
- /* some flags */
- GFX.game_data.is_keypad_audio_enable = FALSE; /* play keypad tone or not */
- mmi_gfx_entry_menu_screen();
- }
- /**************************************************************
- FUNCTION NAME : mmi_gx_vsmj_calc_best_grade()
- PURPOSE : Calculate new best grade [Callback required by GFX]
- INPUT PARAMETERS : S32 old_grade
- S32 new_grade
- OUTPUT PARAMETERS : nil
- RETURNS : void
- REMARKS : nil
- ***************************************************************/
- S16 mmi_gx_vsmj_calc_best_grade(S16 old_grade, S16 new_grade)
- {
- return (old_grade+new_grade);
- }
- /**************************************************************
- FUNCTION NAME : mmi_gx_vsmj_gameover()
- PURPOSE : Draw Gameover Screen [Callback required by GFX]
- INPUT PARAMETERS : nil
-
- OUTPUT PARAMETERS : nil
- RETURNS : void
- REMARKS : nil
- ***************************************************************/
- void mmi_gx_vsmj_gameover(void)
- {
- g_gx_vsmj_context.is_gameover = TRUE;
- g_gx_vsmj_context.is_new_game = TRUE;
- /* call this function to draw gameover screen */
- // gui_cancel_timer(mmi_gx_vsmj_cyclic_timer); /* cancle the looping timer */
- // gdi_draw_solid_rect(0,0,240,320,GDI_COLOR_WHITE);
- mmi_gfx_entry_gameover_screen();
-
- }
- /**************************************************************
- FUNCTION NAME : mmi_gx_vsmj_draw_gameover()
- PURPOSE : Draw Gameover Screen [Callback required by GFX]
- INPUT PARAMETERS : nil
-
- OUTPUT PARAMETERS : nil
- RETURNS : void
- REMARKS : nil
- ***************************************************************/
- void mmi_gx_vsmj_draw_gameover(void)
- {
- /* put gameover sound here*/
- mmi_gfx_draw_gameover_screen(IMG_ID_GX_VSMJ_GOTEXT, IMG_ID_GX_VSMJ_GRADESMAP, IMG_ID_GX_VSMJ_GOPIC, g_gx_vsmj_context.game_grade);
- }
- /**************************************************************
- FUNCTION NAME : mmi_gx_vsmj_enter_game()
- PURPOSE : Enter Game [Callback required by GFX]
- INPUT PARAMETERS : nil
-
- OUTPUT PARAMETERS : nil
- RETURNS : void
- REMARKS : nil
- ***************************************************************/
- void mmi_gx_vsmj_enter_game(void)
- {
- gdi_layer_set_rotate(1); /* dont write 1 !! use enum */
- gdi_layer_resize(LCD_HEIGHT,LCD_WIDTH);
- mmi_gx_vsmj_setplaystate(); //KP Jerry add for avoid screen-display-error when vsmj is playing on 2007-3-24
- #ifdef __MMI_TVOUT__
- if(mdi_tvout_is_enable())
- {
- mdi_tvout_set_owner(MDI_TV_OWNER_MMI);
- mdi_tvout_set_mode(MDI_TV_MODE_OWNER_DRAW, LCD_HEIGHT, LCD_WIDTH);
- }
- #endif
- if(g_gx_vsmj_context.is_new_game == TRUE )
- mmi_gx_vsmj_init_game(); /* is new game, otherwise resume game */
- g_gx_vsmj_context.is_new_game = FALSE;
- g_gx_vsmj_context.is_gameover = FALSE;
- /* keyhandler */
- #ifdef __MMI_TOUCH_SCREEN__
- wgui_register_pen_down_handler(mmi_gx_vsmj_pen_down_hdlr);
- wgui_register_pen_up_handler(mmi_gx_vsmj_pen_up_hdlr);
- #endif
- /* keyhandler */
- //KP Jerry add for vsmj type 2007-3-21 start
- if( *GFX.game_data.type_index_ptr == 0) ////13dices
- g_gx_vsmj_context.timer_elapse = 400;
- else
- g_gx_vsmj_context.timer_elapse = 200;
- //KP Jerry add for vsmj type 2007-3-21 end
- mmi_gx_vsmj_cyclic_timer();
- }
- /**************************************************************
- FUNCTION NAME : mmi_gx_vsmj_exit_game()
- PURPOSE : Exit Game [Callback required by GFX]
- INPUT PARAMETERS : nil
-
- OUTPUT PARAMETERS : nil
- RETURNS : void
- REMARKS : nil
- ***************************************************************/
- void mmi_gx_vsmj_exit_game(void)
- {
- gdi_layer_set_rotate(0);
- gdi_layer_resize(LCD_WIDTH,LCD_HEIGHT);
- mmi_gx_vsmj_clearplaystate(); //KP Jerry add for avoid screen-display-error when vsmj is playing on 2007-3-24
-
- #ifdef __MMI_TVOUT__
- mdi_tvout_set_owner(MDI_TV_OWNER_GDI);
- mdi_tvout_set_mode(MDI_TV_MODE_LCD_SCREEN, 0, 0);
- #endif
- gui_cancel_timer(mmi_gx_vsmj_cyclic_timer); /* cancle the looping timer */
- }
- /**************************************************************
- FUNCTION NAME : mmi_gx_vsmj_init_game()
- PURPOSE : Game initilization
- INPUT PARAMETERS : nil
-
- OUTPUT PARAMETERS : nil
- RETURNS : void
- REMARKS : nil
- ***************************************************************/
- void mmi_gx_vsmj_init_game(void)
- {
- S16 i;
- /* basic game variable */
- g_gx_vsmj_context.is_new_game = FALSE;
- g_gx_vsmj_context.is_gameover = FALSE;
- g_gx_vsmj_context.game_grade = 0;
- /* basic game variable */
-
- /* set id*/
- user[0].id = PLAYER_1;
- user[1].id = COM_1;
- /* set id*/
- for (i=0 ; i<NUM_PLAYER ; i++)
- {
- user[i].flower[0] = &wall_end;
- user[i].hand[0] = &wall_end;
- user[i].lock[0]=&wall_end;
- user[i].can_hou=FALSE;
- user[i].can_bugun=FALSE;
- user[i].can_handgun[0]=FALSE;
- user[i].can_handgun[1]=FALSE;
- user[i].can_handgun[2]=FALSE;
- user[i].can_handgun[3]=FALSE;
- user[i].can_pon=FALSE;
- user[i].can_eat[0]=FALSE;
- user[i].can_eat[1]=FALSE;
- user[i].can_eat[2]=FALSE;
- user[i].handgun_id[0]=TILE_EMPTY;
- user[i].handgun_id[1]=TILE_EMPTY;
- user[i].handgun_id[2]=TILE_EMPTY;
- user[i].handgun_id[3]=TILE_EMPTY;
- user[i].start_pos_x = 0;
- user[i].hand_left = 17;
- }
- for (i=0 ; i<NUM_PLAYER ; i++)
- {
- com_strategy[i]=COM_STRATEGY_1;
- }
-
- start_index=0;
- end_index=TABLE_NUM-1;
- grave_index=0;
- grave[grave_index] = &wall_end;
- table_offset=0;
- gun_times=0;
- highlight = &wall_end;
-
- mmi_gx_vsmj_stagegen();
- mmi_gx_vsmj_throwdice();
- mmi_gx_vsmj_sendtile();
-
- game_move = MOVE_PICK_CHECK;
- current_user= &user[0];
- pen_last_x=100;
- pen_last_y=200;
- sign_delay=0;
- sign=SIGN_OFF;
- game_delay=0;
- }
- /**************************************************************
- FUNCTION NAME : mmi_gx_vsmj_render()
- PURPOSE : Render the game images
- INPUT PARAMETERS : nil
-
- OUTPUT PARAMETERS : nil
- RETURNS : void
- REMARKS : nil
- ***************************************************************/
- void mmi_gx_vsmj_render(void)
- {
- #ifdef __MMI_TVOUT__
- GDI_HANDLE layer_handle;
- GDI_HANDLE base_layer;
- #endif
-
- // gdi_draw_solid_rect(0,0,LCD_WIDTH-1,LCD_HEIGHT-1,gd_color_from_rgb_24(0,59,169,25));
- switch (game_move)
- {
- case MOVE_RESULT:
- gdi_draw_solid_rect(0,0,LCD_HEIGHT-1,LCD_WIDTH-1,GDI_COLOR_BLUE);
- mmi_gx_vsmj_render_scorescreen();
- break;
-
- default:
- gdi_draw_solid_rect(0,0,LCD_HEIGHT-1,LCD_WIDTH-1,gd_color_from_rgb_24(0,59,169,25));
- mmi_gx_vsmj_render_table();
- /* render all user */
- mmi_gx_vsmj_render_user(&user[0]);
- mmi_gx_vsmj_render_user(&user[1]);
- /* render all user */
- mmi_gx_vsmj_render_highlight();
- mmi_gx_vsmj_render_special_bar();
- mmi_gx_vsmj_render_sign();
- // mmi_gx_vsmj_render_pen_cursor(); /* 0913 David: disable cursor (annoying)*/
- break;
- }
- gui_BLT_double_buffer(0,0,UI_device_width-1,UI_device_height-1);
- #ifdef __MMI_TVOUT__
- if(mdi_tvout_is_enable())
- {
- layer_handle = mdi_tvout_get_active_layer();
- gdi_layer_get_base_handle(&base_layer);
- gdi_layer_push_and_set_active(layer_handle);
- gdi_layer_flatten(base_layer, 0,0,0);
- gdi_layer_pop_and_restore_active();
- mdi_tvout_blt();
- }
- #endif
- }
- /**************************************************************
- FUNCTION NAME : mmi_gx_vsmj_render_highlight()
- PURPOSE : Render the table images
- INPUT PARAMETERS : nil
-
- OUTPUT PARAMETERS : nil
- RETURNS : void
- REMARKS : nil
- ***************************************************************/
- void mmi_gx_vsmj_render_highlight(void)
- {
- switch (game_move)
- {
- case MOVE_DISCARD_CHECK_CONTINUE:
- case MOVE_DISCARD_CHECK_START:
- case MOVE_DISCARD_SPECIAL:
- gdi_image_draw_id(HIGHLIGHT_FREE_POS_X[last_user->id],HIGHLIGHT_FREE_POS_Y[last_user->id],
- (U16)(IMG_ID_GX_VSMJ_BRICK_EAST+highlight->id ));
- break;
- case MOVE_PICK_TILE:
- case MOVE_REPLENISH_TILE:
- gdi_image_draw_id(USER_HIGHLIGHT_POS_X[current_user->id],USER_HIGHLIGHT_POS_Y[current_user->id],
- IMG_ID_GX_VSMJ_BRICK_USER_UD_HIDE_BACK);
- break;
- case MOVE_PICK_CHECK:
- case MOVE_PICK_SPECIAL:
- case MOVE_DISCARD_TILE:
- case MOVE_DECLARE_HOU:
- if (highlight->id != WALL_END)
- {
- if (current_user->id == PLAYER_1 || game_move == MOVE_DECLARE_HOU)
- {
- gdi_image_draw_id(USER_HIGHLIGHT_POS_X[current_user->id],USER_HIGHLIGHT_POS_Y[current_user->id],
- (U16)(IMG_ID_GX_VSMJ_BRICK_EAST+highlight->id));
- }
- else
- {
- gdi_image_draw_id(USER_HIGHLIGHT_POS_X[current_user->id],USER_HIGHLIGHT_POS_Y[current_user->id],
- IMG_ID_GX_VSMJ_BRICK_USER_UP_BACK);
- }
- }
- break;
-
- default:
- break;
- }
-
- }
- /**************************************************************
- FUNCTION NAME : mmi_gx_vsmj_render_showtable()
- PURPOSE : Render the table images
- INPUT PARAMETERS : nil
-
- OUTPUT PARAMETERS : nil
- RETURNS : void
- REMARKS : nil
- ***************************************************************/
- void mmi_gx_vsmj_render_table(void)
- {
- /* to be refined later */
- S16 i;
-
- S16 tile_pos_x;
- S16 tile_pos_y;
-
- S16 dx;
- S16 dy;
- S16 pile_dx;
- S16 pile_dy;
- S16 num_of_available_brick;
- S16 position_shift;
- U16 image_id;
-
- /* draw the number of available brick */
- //KP Jerry modify for vsmj type on 2007-3-21 start
- /*Old:
- gdi_draw_rect(MMI_GX_VSMJ_RECT_POS_X1 ,MMI_GX_VSMJ_RECT_POS_Y1 ,MMI_GX_VSMJ_RECT_POS_X2 ,MMI_GX_VSMJ_RECT_POS_Y2 ,GDI_COLOR_WHITE);
- gdi_image_draw_id(MMI_GX_VSMJ_LEFT_BRICK_POS_X ,MMI_GX_VSMJ_LEFT_BRICK_POS_Y ,IMG_ID_GX_VSMJ_BRICK_USER_UD_HIDE_BACK);
- num_of_available_brick = end_index - start_index;
- position_shift = MMI_GX_VSMJ_NUM_POSITION_X + 0 ;
- */
- if( *GFX.game_data.type_index_ptr == 0)//13dices
- {
- gdi_draw_rect(MMI_GX_VSMJ_RECT_POS_X1 -DICES13_OFFSET ,MMI_GX_VSMJ_RECT_POS_Y1 ,MMI_GX_VSMJ_RECT_POS_X2 -DICES13_OFFSET,MMI_GX_VSMJ_RECT_POS_Y2 ,GDI_COLOR_WHITE);
- gdi_image_draw_id(MMI_GX_VSMJ_LEFT_BRICK_POS_X -DICES13_OFFSET ,MMI_GX_VSMJ_LEFT_BRICK_POS_Y ,IMG_ID_GX_VSMJ_BRICK_USER_UD_HIDE_BACK);
- position_shift = MMI_GX_VSMJ_NUM_POSITION_X + 0 -DICES13_OFFSET;
- }
- else
- {
- gdi_draw_rect(MMI_GX_VSMJ_RECT_POS_X1 ,MMI_GX_VSMJ_RECT_POS_Y1 ,MMI_GX_VSMJ_RECT_POS_X2 ,MMI_GX_VSMJ_RECT_POS_Y2 ,GDI_COLOR_WHITE);
- gdi_image_draw_id(MMI_GX_VSMJ_LEFT_BRICK_POS_X ,MMI_GX_VSMJ_LEFT_BRICK_POS_Y ,IMG_ID_GX_VSMJ_BRICK_USER_UD_HIDE_BACK);
- position_shift = MMI_GX_VSMJ_NUM_POSITION_X + 0 ;
- }
- num_of_available_brick = end_index - start_index;
- //KP Jerry modify for vsmj type on 2007-3-21 end
- do
- {
- image_id = IMG_ID_GX_VSMJ_NUMBER_0 + (num_of_available_brick % 10);
- num_of_available_brick = num_of_available_brick / 10;
- gdi_image_draw_id(position_shift,
- MMI_GX_VSMJ_NUM_POSITION_Y,
- (U16)image_id);
- position_shift = position_shift - 9;
- } while (num_of_available_brick != 0);
- #if 0
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- #endif
- /* draw grave */
- tile_pos_x = GRAVE_POS_X;
- tile_pos_y = GRAVE_POS_Y;
- dx = USER_TILE_WIDTH;
- for (i=0 ; i<grave_index; i++)
- {
- gdi_image_draw_id(tile_pos_x,tile_pos_y,(U16)(IMG_ID_GX_VSMJ_BRICK_EAST + grave[i]->id));
- tile_pos_x = tile_pos_x + dx;
- if ( i%17 == 16)
- {
- tile_pos_y = tile_pos_y + USER_TILE_HEIGHT;
- tile_pos_x = GRAVE_POS_X;
- }
- }
- /* draw grave */
-
- }
- /**************************************************************
- FUNCTION NAME : mmi_gx_vsmj_render_user
-
- PURPOSE :Timer trigger function - looping
- INPUT PARAMETERS : nil
-
- OUTPUT PARAMETERS : nil
- RETURNS : void
- REMARKS : nil
- ***************************************************************/
- void mmi_gx_vsmj_render_user(gx_vsmj_user_struct *user_ptr)
- {
- S16 i,j;
- S16 draw_x;
- S16 draw_y;
- BOOL highlight_is_skipped = TRUE;
- S16 shift_x,shift_x_count;
- S16 tile_width;
- /* draw flower */
- draw_x=USER_FLOWER_POS_X[user_ptr->id];
- draw_y=USER_FLOWER_POS_Y[user_ptr->id];
-
- i=0;
- while (user_ptr->flower[i]->id != WALL_END)
- {
- gdi_image_draw_id(draw_x,draw_y,(U16)(IMG_ID_GX_VSMJ_BRICK_EAST+user_ptr->flower[i]->id) );
- draw_x += USER_TILE_WIDTH;
- i++;
- }
- /* draw flower */
-
- /* draw lock*/
- shift_x_count = 0;
- if(user_ptr->id == COM_1)
- {
- shift_x = -1;
- tile_width = -1*USER_TILE_WIDTH;
- }
- else
- {
- shift_x = 1;
- tile_width = USER_TILE_WIDTH;
- }
- draw_x=USER_LOCK_POS_X[user_ptr->id];
- draw_y=USER_LOCK_POS_Y[user_ptr->id];
-
- i=0;
- while (user_ptr->lock[i]->id != WALL_END)
- {
- switch (user_ptr->lock[i]->id)
- {
- case WALL_END:
- case WALL_PON:
- case WALL_EAT:
- case TILE_EMPTY:
- i++;
- draw_x += shift_x;
- shift_x_count++;
- break;
- case WALL_GUNSHOW:
- gdi_image_draw_id(draw_x,draw_y,(U16)(IMG_ID_GX_VSMJ_BRICK_EAST+user_ptr->lock[i]->id));
- draw_x += tile_width;
- gdi_image_draw_id(draw_x,draw_y,(U16)(IMG_ID_GX_VSMJ_BRICK_EAST+user_ptr->lock[i]->id));
- gdi_image_draw_id(draw_x,draw_y-(shift_x*5),(U16)(IMG_ID_GX_VSMJ_BRICK_EAST+user_ptr->lock[i]->id));
- draw_x += tile_width;
- gdi_image_draw_id(draw_x,draw_y,(U16)(IMG_ID_GX_VSMJ_BRICK_EAST+user_ptr->lock[i]->id));
- draw_x += tile_width;
- i+=5;
-
- break;
- case WALL_GUNHIDE: /* 2ppl: user id 0,1 up / down need one image */
- /* 4ppl: user id 0,2 up/down one image, 1,3 need one image */
- /* currently only ver image */
- if (game_move != MOVE_DECLARE_HOU)
- {
- gdi_image_draw_id(draw_x,draw_y,IMG_ID_GX_VSMJ_BRICK_USER_UD_HIDE_BACK);
- draw_x += tile_width;
- gdi_image_draw_id(draw_x,draw_y,IMG_ID_GX_VSMJ_BRICK_USER_UD_HIDE_BACK);
- gdi_image_draw_id(draw_x,draw_y-(shift_x*5),IMG_ID_GX_VSMJ_BRICK_USER_UD_HIDE_BACK);
- draw_x += tile_width;
- gdi_image_draw_id(draw_x,draw_y,IMG_ID_GX_VSMJ_BRICK_USER_UD_HIDE_BACK);
- draw_x += tile_width;
- i = i+5; /*pass the gun tile ,to the next wall */
- }
- else
- {
- i++;
- }
- break;
-
-
- default:
- gdi_image_draw_id(draw_x,draw_y,(U16)(IMG_ID_GX_VSMJ_BRICK_EAST+user_ptr->lock[i]->id));
- draw_x += tile_width;
- i++;
- break;
- }
- }
- /*draw lock*/
- /* draw own */
- if(user_ptr->id==COM_1)
- {
- draw_x=USER_OWN_POS_X[user_ptr->id]-shift_x_count;
- // draw_y=USER_OWN_POS_Y[user_ptr->id];
- }
- user_ptr->start_pos_x = draw_x;
- // user_ptr->start_pos_y = draw_y;
- if (user_ptr->id == current_user->id)
- if (game_move != MOVE_DISCARD_CHECK_START
- && game_move != MOVE_DISCARD_CHECK_CONTINUE)
- if (highlight->id != WALL_END)
- {
- highlight_is_skipped=FALSE;
- }
-
- if (user_ptr->id == PLAYER_1 || game_move== MOVE_DECLARE_HOU)
- {
- j=0;
- while (user_ptr->hand[j]->id != WALL_END)
- {
- if (highlight_is_skipped)
- {
- gdi_image_draw_id(draw_x,draw_y,(U16)(IMG_ID_GX_VSMJ_BRICK_EAST+user_ptr->hand[j]->id));
- draw_x += USER_TILE_WIDTH;
- j++;
- }
- else
- {
- if (user_ptr->hand[j]->id == highlight->id )
- {
- /* skip once to pass highlight offset*/
- highlight_is_skipped=TRUE;
- j++;
- }
- else
- {
- gdi_image_draw_id(draw_x,draw_y,(U16)(IMG_ID_GX_VSMJ_BRICK_EAST+user_ptr->hand[j]->id));
- draw_x += USER_TILE_WIDTH;
- j++;
- }
- }
- }
- }
- else
- {
- j=0;
- while (user_ptr->hand[j]->id != WALL_END)
- {
- if (highlight_is_skipped)
- {
- //gdi_image_draw_id(draw_x,draw_y,IMG_ID_GX_VSMJ_BRICK_USER_UP_BACK);
- gdi_image_draw_id(draw_x,draw_y,IMG_ID_GX_VSMJ_BRICK_USER_UD_HIDE_BACK);
- draw_x += USER_TILE_WIDTH;
- j++;
- }
- else
- {
- if (user_ptr->hand[j]->id == highlight->id )
- {
- /* skip once to pass highlight offset*/
- highlight_is_skipped=TRUE;
- j++;
- }
- else
- {
- //gdi_image_draw_id(draw_x,draw_y,IMG_ID_GX_VSMJ_BRICK_USER_UP_BACK);
- gdi_image_draw_id(draw_x,draw_y,IMG_ID_GX_VSMJ_BRICK_USER_UD_HIDE_BACK);
- draw_x += USER_TILE_WIDTH;
- j++;
- }
- }
- }
- user_ptr->hand_left= j;
- }
-
- /* draw own */
- }
- /**************************************************************
- FUNCTION NAME : mmi_gx_vsmj_render_special_bar
- PURPOSE :Timer trigger function - looping
- INPUT PARAMETERS : nil
-
- OUTPUT PARAMETERS : nil
- RETURNS : void
- REMARKS : nil
- ***************************************************************/
- void mmi_gx_vsmj_render_special_bar(void)
- {
- if (game_move == MOVE_PICK_SPECIAL || game_move == MOVE_DISCARD_SPECIAL )
- if (current_user->id == PLAYER_1)
- {
- //eat base
- gdi_image_draw_id(PLAYER_SPECIAL_POS_X,PLAYER_SPECIAL_POS_Y,IMG_ID_GX_VSMJ_SPECIAL_EAT_BASE);
- //eat 0~2
- if (current_user->can_eat[0])
- {
- gdi_image_draw_id(PLAYER_SPECIAL_POS_X,PLAYER_SPECIAL_POS_Y + PLAYER_SPECIAL_UNIT_HEIGHT
- ,IMG_ID_GX_VSMJ_SPECIAL_EAT_0);
- }
- if (current_user->can_eat[1])
- {
- gdi_image_draw_id(PLAYER_SPECIAL_POS_X,PLAYER_SPECIAL_POS_Y + 2*PLAYER_SPECIAL_UNIT_HEIGHT
- ,IMG_ID_GX_VSMJ_SPECIAL_EAT_1);
- }
- if (current_user->can_eat[2])
- {
- gdi_image_draw_id(PLAYER_SPECIAL_POS_X,PLAYER_SPECIAL_POS_Y + 3*PLAYER_SPECIAL_UNIT_HEIGHT
- ,IMG_ID_GX_VSMJ_SPECIAL_EAT_2 );
- }
- //pon
- gdi_image_draw_id(PLAYER_SPECIAL_POS_X +PLAYER_SPECIAL_UNIT_WIDTH
- ,PLAYER_SPECIAL_POS_Y,(U16)(IMG_ID_GX_VSMJ_SPECIAL_PON_OFF + current_user->can_pon));
-
- //gun base
- gdi_image_draw_id(PLAYER_SPECIAL_POS_X +2*PLAYER_SPECIAL_UNIT_WIDTH
- ,PLAYER_SPECIAL_POS_Y,IMG_ID_GX_VSMJ_SPECIAL_GUN_BASE);
- //bugun
- if (current_user->can_bugun)
- {
- gdi_draw_solid_rect(PLAYER_SPECIAL_POS_X +2*PLAYER_SPECIAL_UNIT_WIDTH
- ,PLAYER_SPECIAL_POS_Y - PLAYER_SPECIAL_UNIT_HEIGHT
- ,PLAYER_SPECIAL_POS_X +3*PLAYER_SPECIAL_UNIT_WIDTH
- ,PLAYER_SPECIAL_POS_Y
- ,GDI_COLOR_BLACK);
- gdi_image_draw_id(PLAYER_SPECIAL_POS_X +2*PLAYER_SPECIAL_UNIT_WIDTH
- ,PLAYER_SPECIAL_POS_Y - PLAYER_SPECIAL_UNIT_HEIGHT
- ,(U16)(IMG_ID_GX_VSMJ_BRICK_EAST + highlight->id));
- }
- //gun 0~3
- if (current_user->can_handgun[0])
- {
- gdi_draw_solid_rect(PLAYER_SPECIAL_POS_X +2*PLAYER_SPECIAL_UNIT_WIDTH
- ,PLAYER_SPECIAL_POS_Y + PLAYER_SPECIAL_UNIT_HEIGHT
- ,PLAYER_SPECIAL_POS_X +3*PLAYER_SPECIAL_UNIT_WIDTH
- ,PLAYER_SPECIAL_POS_Y + 2*PLAYER_SPECIAL_UNIT_HEIGHT
- ,GDI_COLOR_BLACK);
- gdi_image_draw_id(PLAYER_SPECIAL_POS_X +2*PLAYER_SPECIAL_UNIT_WIDTH
- ,PLAYER_SPECIAL_POS_Y + PLAYER_SPECIAL_UNIT_HEIGHT,
- (U16)(IMG_ID_GX_VSMJ_BRICK_EAST + current_user->handgun_id[0]) );
- }
- if (current_user->can_handgun[1])
- {
- gdi_draw_solid_rect(PLAYER_SPECIAL_POS_X +2*PLAYER_SPECIAL_UNIT_WIDTH
- ,PLAYER_SPECIAL_POS_Y + 2*PLAYER_SPECIAL_UNIT_HEIGHT
- ,PLAYER_SPECIAL_POS_X +3*PLAYER_SPECIAL_UNIT_WIDTH
- ,PLAYER_SPECIAL_POS_Y + 3*PLAYER_SPECIAL_UNIT_HEIGHT
- ,GDI_COLOR_BLACK);
-
- gdi_image_draw_id(PLAYER_SPECIAL_POS_X +2*PLAYER_SPECIAL_UNIT_WIDTH
- ,PLAYER_SPECIAL_POS_Y + 2*PLAYER_SPECIAL_UNIT_HEIGHT,
- (U16)(IMG_ID_GX_VSMJ_BRICK_EAST + current_user->handgun_id[1]) );
- }
- if (current_user->can_handgun[2])
- {
- gdi_draw_solid_rect(PLAYER_SPECIAL_POS_X +2*PLAYER_SPECIAL_UNIT_WIDTH
- ,PLAYER_SPECIAL_POS_Y + 3*PLAYER_SPECIAL_UNIT_HEIGHT
- ,PLAYER_SPECIAL_POS_X +3*PLAYER_SPECIAL_UNIT_WIDTH
- ,PLAYER_SPECIAL_POS_Y + 4*PLAYER_SPECIAL_UNIT_HEIGHT
- ,GDI_COLOR_BLACK);
-
- gdi_image_draw_id(PLAYER_SPECIAL_POS_X +2*PLAYER_SPECIAL_UNIT_WIDTH
- ,PLAYER_SPECIAL_POS_Y + 3*PLAYER_SPECIAL_UNIT_HEIGHT,
- (U16)(IMG_ID_GX_VSMJ_BRICK_EAST + current_user->handgun_id[2]) );
- }
- if (current_user->can_handgun[3])
- {
- gdi_draw_solid_rect(PLAYER_SPECIAL_POS_X +2*PLAYER_SPECIAL_UNIT_WIDTH
- ,PLAYER_SPECIAL_POS_Y + 4*PLAYER_SPECIAL_UNIT_HEIGHT
- ,PLAYER_SPECIAL_POS_X +3*PLAYER_SPECIAL_UNIT_WIDTH
- ,PLAYER_SPECIAL_POS_Y +5*PLAYER_SPECIAL_UNIT_HEIGHT
- ,GDI_COLOR_BLACK);
-
- gdi_image_draw_id(PLAYER_SPECIAL_POS_X +2*PLAYER_SPECIAL_UNIT_WIDTH
- ,PLAYER_SPECIAL_POS_Y + 4*PLAYER_SPECIAL_UNIT_HEIGHT,
- (U16)(IMG_ID_GX_VSMJ_BRICK_EAST + current_user->handgun_id[3]) );
- }
- //hou
- gdi_image_draw_id(PLAYER_SPECIAL_POS_X +3*PLAYER_SPECIAL_UNIT_WIDTH
- ,PLAYER_SPECIAL_POS_Y,(U16)(IMG_ID_GX_VSMJ_SPECIAL_HOU_OFF + current_user->can_hou) );
- //cancel
- gdi_image_draw_id(PLAYER_SPECIAL_POS_X +4*PLAYER_SPECIAL_UNIT_WIDTH
- ,PLAYER_SPECIAL_POS_Y,IMG_ID_GX_VSMJ_SPECIAL_CANCEL);
-
- }
-
- }
- /**************************************************************
- FUNCTION NAME : mmi_gx_vsmj_render_sign
- PURPOSE :Timer trigger function - looping
- INPUT PARAMETERS : nil
-
- OUTPUT PARAMETERS : nil
- RETURNS : void
- REMARKS : nil
- ***************************************************************/
- void mmi_gx_vsmj_render_sign(void)
- {
- S16 dx=0;
- if (sign_delay>15)
- {
- dx = 0 - 8*(sign_delay-16);
- }
- else if (sign_delay <9)
- {
- dx = 0 - 5*(9-sign_delay);
- }
-
- if (sign_delay !=0)
- {
- switch (sign)
- {
- case SIGN_OFF:
- break;
- case SIGN_EAT:
- gdi_image_draw_id(SIGN_POS_X+dx,SIGN_POS_Y,IMG_ID_GX_VSMJ_SPECIAL_EAT_BASE);
- break;
- case SIGN_PON:
- gdi_image_draw_id(SIGN_POS_X+dx,SIGN_POS_Y,IMG_ID_GX_VSMJ_SPECIAL_PON_ON);
- break;
- case SIGN_GUN:
- gdi_image_draw_id(SIGN_POS_X+dx,SIGN_POS_Y,IMG_ID_GX_VSMJ_SPECIAL_GUN_BASE);
- break;
- case SIGN_HOU: /*fix one*/
- gdi_image_draw_id(SIGN_POS_X,SIGN_POS_Y,IMG_ID_GX_VSMJ_SPECIAL_HOU_ON);
- break;
- case SIGN_LIOU_GU: /*fix one*/
- gdi_image_draw_id(SIGN_POS_X,SIGN_POS_Y,IMG_ID_GX_VSMJ_SPECIAL_LIOU_GU);
- break;
- }
-
- /* sign_delay will -- in framemove */
- }
- else
- {
- sign=SIGN_OFF;
- }
- }
- /**************************************************************
- FUNCTION NAME : mmi_gx_vsmj_render_pen_cursor
- PURPOSE :Timer trigger function - looping
- INPUT PARAMETERS : nil
-
- OUTPUT PARAMETERS : nil
- RETURNS : void
- REMARKS : nil
- ***************************************************************/
- void mmi_gx_vsmj_render_pen_cursor(void)
- {
- if (current_user->id == PLAYER_1)
- {
- gdi_image_draw_id(pen_last_x,pen_last_y,IMG_ID_GX_VSMJ_PEN_CURSOR_OFF);
- }
- else
- {
- gdi_image_draw_id(pen_last_x,pen_last_y,IMG_ID_GX_VSMJ_PEN_CURSOR_ON);
- }
- }
- /**************************************************************
- FUNCTION NAME : mmi_gx_vsmj_render_scorescreen
- PURPOSE :Timer trigger function - looping
- INPUT PARAMETERS : nil
-
- OUTPUT PARAMETERS : nil
- RETURNS : void
- REMARKS : nil
- ***************************************************************/
- void mmi_gx_vsmj_render_scorescreen(void)
- {
- U8 i;
- S16 draw_y,draw_x;
- mmi_gx_vsmj_count_score(current_user);
- gdi_draw_solid_rect(0,0,240,320,GDI_COLOR_WHITE);
- gdi_draw_frame_rect(SCORE_POS_X-SCORE_FRAME,SCORE_POS_Y-SCORE_FRAME,
- SCORE_WIDTH, SCORE_HEIGHT, GDI_COLOR_GREEN,GDI_COLOR_GRAY,SCORE_FRAME);
-
- draw_y=SCORE_POS_Y;
- draw_x=SCORE_POS_X;
-
- for (i=0 ; i<SCORE_TOTALNUM ; i++)
- {
- if (bonus_hou[i])
- {
- gdi_image_draw_id(draw_x,draw_y,(U16)(IMG_ID_GX_VSMJ_SCORE_8_FLOWER+i));
- /* draw text image and tai number all in one */
- draw_y += SCORE_UNIT_HEIGHT;
- if (i % 8 ==0)
- draw_x = draw_x + 100;
-
- }
- }
- if (draw_y == SCORE_POS_Y && draw_x == SCORE_POS_X) /* none special */
- {
- gdi_image_draw_id(draw_x,draw_y,IMG_ID_GX_VSMJ_SCORE_NOTHING);
- }
- /* add draw tai num image code here */
- /* another way:use the gameover screen to show current score at hand : use title "current score" blahblah
- with game grade box showing total score,gameover scr used as a game set screen */
- /* 0829 : realize upper solution,will need a gameover screen with "current score" title */
-
- }
- /**************************************************************
- FUNCTION NAME : mmi_gx_vsmj_cyclic_timer()
- PURPOSE :Timer trigger function - looping
- INPUT PARAMETERS : nil
-
- OUTPUT PARAMETERS : nil
- RETURNS : void
- REMARKS : nil
- ***************************************************************/
- void mmi_gx_vsmj_cyclic_timer(void)
- {
- if (sign_delay > 0)
- {
- sign_delay--;
- }
- if (game_delay > 0)
- {
- game_delay--;
- }
-
- if(g_gx_vsmj_context.is_gameover == FALSE)
- {
- if (game_delay ==0)
- {
- mmi_gx_vsmj_framemove();
- mmi_gx_vsmj_render();
- }
- }
- else
- {
- mmi_gx_vsmj_gameover();
- return;
- }
- gui_start_timer(g_gx_vsmj_context.timer_elapse, mmi_gx_vsmj_cyclic_timer);
-
- }
- /**************************************************************
- FUNCTION NAME : mmi_gx_vsmj_pen_down_hdlr
- PURPOSE :
- INPUT PARAMETERS : S16
- OUTPUT PARAMETERS : nil
- RETURNS : void
- REMARKS : nil
- ***************************************************************/
- #ifdef __MMI_TOUCH_SCREEN__
- void mmi_gx_vsmj_pen_down_hdlr(mmi_pen_point_struct pos) /*all done */
- {
- S32 tmp;
- tmp = pos.x;
- pos.x= pos.y;
- pos.y = (LCD_WIDTH-1) - tmp;
- pen_last_x=pos.x;
- pen_last_y=pos.y;
- if (pos.x > USER_HIGHLIGHT_POS_X[current_user->id]
- && pos.x < USER_HIGHLIGHT_POS_X[current_user->id] + USER_TILE_WIDTH
- && pos.y > USER_HIGHLIGHT_POS_Y[current_user->id]
- && pos.y < USER_HIGHLIGHT_POS_Y[current_user->id] + USER_TILE_HEIGHT)
- {
- pen_pos = PP_HIGHLIGHT;
- }
- else if (pos.x > PLAYER_SPECIAL_POS_X +PLAYER_SPECIAL_UNIT_WIDTH
- && pos.x < PLAYER_SPECIAL_POS_X + 2*PLAYER_SPECIAL_UNIT_WIDTH
- && pos.y > PLAYER_SPECIAL_POS_Y
- && pos.y < PLAYER_SPECIAL_POS_Y+ PLAYER_SPECIAL_UNIT_HEIGHT)
- {
- pen_pos = PP_SPECIAL_PON;
- }
- else if (pos.x > PLAYER_SPECIAL_POS_X +3*PLAYER_SPECIAL_UNIT_WIDTH
- && pos.x < PLAYER_SPECIAL_POS_X +4*PLAYER_SPECIAL_UNIT_WIDTH
- && pos.y > PLAYER_SPECIAL_POS_Y
- && pos.y < PLAYER_SPECIAL_POS_Y + PLAYER_SPECIAL_UNIT_HEIGHT)
- {
- pen_pos = PP_SPECIAL_HOU;
- }
- else if (pos.x > PLAYER_SPECIAL_POS_X +4*PLAYER_SPECIAL_UNIT_WIDTH
- && pos.x < PLAYER_SPECIAL_POS_X +5*PLAYER_SPECIAL_UNIT_WIDTH
- && pos.y > PLAYER_SPECIAL_POS_Y
- && pos.y < PLAYER_SPECIAL_POS_Y+ PLAYER_SPECIAL_UNIT_HEIGHT)
- {
- pen_pos = PP_SPECIAL_CANCEL;
- }
- else if (pos.x > PLAYER_SPECIAL_POS_X
- && pos.x < PLAYER_SPECIAL_POS_X + PLAYER_SPECIAL_UNIT_WIDTH
- && pos.y > PLAYER_SPECIAL_POS_Y + PLAYER_SPECIAL_UNIT_HEIGHT
- && pos.y < PLAYER_SPECIAL_POS_Y+2*PLAYER_SPECIAL_UNIT_HEIGHT )
- {
- pen_pos = PP_SPECIAL_EAT_0;
- }
- else if (pos.x > PLAYER_SPECIAL_POS_X
- && pos.x < PLAYER_SPECIAL_POS_X + PLAYER_SPECIAL_UNIT_WIDTH
- && pos.y > PLAYER_SPECIAL_POS_Y + 2*PLAYER_SPECIAL_UNIT_HEIGHT
- && pos.y < PLAYER_SPECIAL_POS_Y +3*PLAYER_SPECIAL_UNIT_HEIGHT)
- {
- pen_pos= PP_SPECIAL_EAT_1;
- }
- else if (pos.x > PLAYER_SPECIAL_POS_X
- && pos.x < PLAYER_SPECIAL_POS_X + PLAYER_SPECIAL_UNIT_WIDTH
- && pos.y > PLAYER_SPECIAL_POS_Y + 3*PLAYER_SPECIAL_UNIT_HEIGHT
- && pos.y < PLAYER_SPECIAL_POS_Y + 4*PLAYER_SPECIAL_UNIT_HEIGHT)
- {
- pen_pos= PP_SPECIAL_EAT_2;
- }
- else if (pos.x > PLAYER_SPECIAL_POS_X +2*PLAYER_SPECIAL_UNIT_WIDTH
- && pos.x < PLAYER_SPECIAL_POS_X + 3*PLAYER_SPECIAL_UNIT_WIDTH
- && pos.y > PLAYER_SPECIAL_POS_Y -PLAYER_SPECIAL_UNIT_HEIGHT
- && pos.y < PLAYER_SPECIAL_POS_Y)
- {
- pen_pos = PP_SPECIAL_BUGUN;
- }
- else if (pos.x > PLAYER_SPECIAL_POS_X +2*PLAYER_SPECIAL_UNIT_WIDTH
- && pos.x < PLAYER_SPECIAL_POS_X + 3*PLAYER_SPECIAL_UNIT_WIDTH
- && pos.y > PLAYER_SPECIAL_POS_Y + PLAYER_SPECIAL_UNIT_HEIGHT
- && pos.y < PLAYER_SPECIAL_POS_Y + 5*PLAYER_SPECIAL_UNIT_HEIGHT)
- {
- pen_pos = (gx_vsmj_pen_pos_enum)(PP_SPECIAL_HANDGUN_0 +
- (pos.y - PLAYER_SPECIAL_POS_Y - PLAYER_SPECIAL_UNIT_HEIGHT)/PLAYER_SPECIAL_UNIT_HEIGHT);
- } /* up to down :handgun0~3 */
- else if (pos.x > current_user->start_pos_x && pos.x < current_user->start_pos_x + current_user->hand_left*USER_TILE_WIDTH
- && pos.y > USER_OWN_POS_Y[current_user->id] && pos.y < USER_OWN_POS_Y[current_user->id] + USER_TILE_HEIGHT)
- {
- pen_pos = (gx_vsmj_pen_pos_enum)(PP_OWN_0 + (pos.x - current_user->start_pos_x) / USER_TILE_WIDTH);
- }
- else
- {
- pen_pos = PP_ELSE;
- }
-
- }
- #endif
- /**************************************************************
- FUNCTION NAME : mmi_gx_vsmj_pen_up_hdlr
- PURPOSE :
- INPUT PARAMETERS : S16
- OUTPUT PARAMETERS : nil
- RETURNS : void
- REMARKS : nil
- ***************************************************************/
- #ifdef __MMI_TOUCH_SCREEN__
- void mmi_gx_vsmj_pen_up_hdlr(mmi_pen_point_struct pos)
- {
- }
- #endif
- /**************************************************************
- FUNCTION NAME : mmi_gx_vsmj_debug
- PURPOSE : Debug use
- INPUT PARAMETERS : S16
- OUTPUT PARAMETERS : nil
- RETURNS : void
- REMARKS : nil
- ***************************************************************/
- #ifdef VSMJ_DEBUG_ON
- void mmi_gx_vsmj_debug(void)
- {
- S16 buf[20];
- S16 buf_USC2[40];
- S32 str_width;
- S32 str_height;
- S16 x=0;
- S16 y=0;
- S16 i=0;
- for (i=0 ; i<40 ; i++)
- {
- y+=12;
- if (i%10==0)
- {
- y=0;
- x+=30;
- }
-
- gui_set_font(&MMI_medium_font);
- gui_set_text_color(gui_color(200,63,40));
- gui_set_text_border_color(gui_color(0,0,0));
- sprintf(buf, "%d", gx_vsmj_debug[i]);
- AnsiiToUnicodeString(buf_USC2, buf);
- gui_measure_string((UI_string_type)buf_USC2, &str_width, &str_height);
- gui_move_text_cursor(x,y);
- gui_print_bordered_text((UI_string_type)buf_USC2);
-
- }
- }
- #endif /*VSMJ_DEBUG_ON*/
- /**************************************************************
- FUNCTION NAME : mmi_gx_vsmj_find_no_with_tile_id
- PURPOSE :check eat
- INPUT PARAMETERS : ptr array
-
- OUTPUT PARAMETERS : nil
- RETURNS : void
- REMARKS : nil
- ***************************************************************/
- S16 mmi_gx_vsmj_find_no_with_tile_id(gx_vsmj_tile_id_enum target_id, gx_vsmj_tile_struct* tile_set_ptr[])
- {
- S16 i;
-
- i=0;
- while (1)
- {
- if (tile_set_ptr[i]->id == target_id)
- return i;
- if (tile_set_ptr[i]->id == WALL_END)
- return -1;
- i++;
- }
-
- }
- /**************************************************************
- FUNCTION NAME : mmi_gx_vsmj_insert_tile()
- PURPOSE :
-
- INPUT PARAMETERS : nil
-
- OUTPUT PARAMETERS : nil
- RETURNS : void
- REMARKS : nil
- ***************************************************************/
- void mmi_gx_vsmj_insert_tile(gx_vsmj_tile_struct *tile_target_ptr,gx_vsmj_tile_struct *tile_set_ptr[])
- {
- /* for later usage, must make highlight one be the first in array relative to other same id tile */
- S16 i;
- gx_vsmj_tile_struct *tile_ptr=tile_target_ptr; /* so insert wont change highlight's value*/
-
- i=0;
- while (1)
- {
- if (tile_set_ptr[i]->id == TILE_EMPTY)
- {
- tile_set_ptr[i] = tile_ptr;
- return;
- }
- else if (tile_set_ptr[i]->id == tile_target_ptr->id)
- {
- gx_vsmj_tile_struct *tile_ptr_temp = tile_set_ptr[i];
- tile_set_ptr[i] = tile_ptr;
- tile_ptr = tile_ptr_temp;
- }
- else if (tile_set_ptr[i]->id == WALL_END) /*didnt find a hole, so put it at the end*/
- {
- tile_set_ptr[i] = tile_ptr;
- tile_set_ptr[i+1]= &wall_end;
- return;
- }
- i++;
- }
- }
- /**************************************************************
- FUNCTION NAME : mmi_gx_vsmj_eliminate_tile()
- PURPOSE :
-
- INPUT PARAMETERS : nil
-
- OUTPUT PARAMETERS : nil
- RETURNS : void
- REMARKS : nil
- ***************************************************************/
- /* return true when found one and eliminate it*/
- /* false when didnt find any*/
- BOOL mmi_gx_vsmj_eliminate_tile(gx_vsmj_tile_id_enum target_id ,gx_vsmj_tile_struct *tile_set_ptr[])
- {
- S16 i;
-
-
- i=0;
- while (tile_set_ptr[i]->id != WALL_END)
- {
- if (tile_set_ptr[i]->id == target_id)
- {
- tile_set_ptr[i] = &tile_empty;
- return TRUE;
- }
- i++;
- }
-
- /* didn't find any */
- return FALSE;
- }
-
- /**************************************************************
- FUNCTION NAME : mmi_gx_vsmj_sort_tile
- PURPOSE :check eat
- INPUT PARAMETERS : ptr array
-
- OUTPUT PARAMETERS : nil
- RETURNS : void
- REMARKS : nil
- ***************************************************************/
- void mmi_gx_vsmj_sort_tile(gx_vsmj_tile_struct *tile_set_ptr[])
- {
- S16 i,j;
- gx_vsmj_tile_struct *tile_temp_ptr;
- i=0;
- /* sort order */
- while (tile_set_ptr[i]->id != WALL_END)
- {
- j=0;
- while (tile_set_ptr[j+1]->id != WALL_END)
- {
- if (tile_set_ptr[j]->id > tile_set_ptr[j+1]->id)
- {
- tile_temp_ptr = tile_set_ptr[j];
- tile_set_ptr[j] = tile_set_ptr[j+1];
- tile_set_ptr[j+1] = tile_temp_ptr;
- }
- j++;
- }
- i++;
- }
- /* clear empty and move wall back */
- i=0;
- while (1)
- {
- if (tile_set_ptr[i]->id ==TILE_EMPTY)
- {
- tile_set_ptr[i]=&wall_end;
- break;
- }
- else if (tile_set_ptr[i]->id == WALL_END)
- {
- break;;
- }
- i++;
- }
-
- }
- /**************************************************************
- FUNCTION NAME : mmi_gx_vsmj_pick_tile
- PURPOSE :
- INPUT PARAMETERS : S16
- OUTPUT PARAMETERS : nil
- RETURNS : void
- REMARKS : nil
- ***************************************************************/
- void mmi_gx_vsmj_pick_tile(gx_vsmj_user_struct *user_ptr) /*all done */
- {
- highlight = &tile_table[start_index++];
- highlight->pos = POS_HIGH;
- /*clear special hou parameter , player give up so he can come here */
- score_7_1_flower=FALSE;
- score_8_flower=FALSE;
- score_last_by_own=TRUE;
- score_hou_by_replenish=FALSE;
- /*clear special hou parameter ,player give up so he can come here */
- if (highlight->id < FL_SPRING)
- {
- mmi_gx_vsmj_insert_tile(highlight,user_ptr->hand);
- mmi_gx_vsmj_sort_tile(user_ptr->hand);
- game_move = MOVE_PICK_CHECK;
- }
- else
- {
- mmi_gx_vsmj_insert_tile(highlight,user_ptr->flower);
- highlight= &wall_end;
- /* flower has its stack order, no need to sort,and simple insert wont make any empty block*/
- game_move = MOVE_REPLENISH_TILE;
- }
- }
- /**************************************************************
- FUNCTION NAME : mmi_gx_vsmj_replenish_tile
- PURPOSE : Debug use
- INPUT PARAMETERS : S16
- OUTPUT PARAMETERS : nil
- RETURNS : void
- REMARKS : nil
- ***************************************************************/
- void mmi_gx_vsmj_replenish_tile(gx_vsmj_user_struct *user_ptr)
- {
- highlight = &tile_table[end_index--];
- highlight->pos = POS_HIGH;
- /*clear special hou parameter , player give up so he can come here */
- score_7_1_flower=FALSE;
- score_8_flower=FALSE;
- score_last_by_own=TRUE;
- score_hou_by_replenish=FALSE;
- /*clear special hou parameter ,player give up so he can come here */
- if (highlight->id < FL_SPRING)
- {
- mmi_gx_vsmj_insert_tile(highlight,user_ptr->hand);
- mmi_gx_vsmj_sort_tile(user_ptr->hand);
- game_move = MOVE_PICK_CHECK;
- }
- else
- {
- mmi_gx_vsmj_insert_tile(highlight,user_ptr->flower);
- highlight= &wall_end;
- /* flower has its stack order, no need to sort,and simple insert wont make any empty block*/
- game_move = MOVE_REPLENISH_TILE;
- }
- }
- /**************************************************************
- FUNCTION NAME : mmi_gx_vsmj_discard_tile
- PURPOSE :
- INPUT PARAMETERS : S16
- OUTPUT PARAMETERS : nil
- RETURNS : void
- REMARKS : nil
- ***************************************************************/
- void mmi_gx_vsmj_discard_tile(gx_vsmj_tile_id_enum target_id,gx_vsmj_user_struct *user_ptr)
- {
- /*clear special hou parameter , player give up so he can come here */
- score_7_1_flower=FALSE;
- score_8_flower=FALSE;
- score_hou_by_replenish=FALSE;
- score_last_by_own=FALSE;
- /*clear special hou parameter ,player give up so he can come here */
- highlight = user_ptr->hand[mmi_gx_vsmj_find_no_with_tile_id(target_id,user_ptr->hand)];
- mmi_gx_vsmj_eliminate_tile(target_id,user_ptr->hand);
- mmi_gx_vsmj_sort_tile(user_ptr->hand);
- last_user=user_ptr;
- game_move=MOVE_DISCARD_CHECK_START;
- }
- /**************************************************************
- FUNCTION NAME : mmi_gx_vsmj_gun
- PURPOSE : Debug use
- INPUT PARAMETERS : S16
- OUTPUT PARAMETERS : nil
- RETURNS : void
- REMARKS : nil
- ***************************************************************/
- void mmi_gx_vsmj_handgun(gx_vsmj_tile_id_enum target_id,gx_vsmj_user_struct *user_ptr)
- {
- S16 i,j;
- gun_times++; /*count total gun_times for liou_gu */
- i = mmi_gx_vsmj_find_no_with_tile_id(WALL_END,user_ptr->lock);
- if (game_move == MOVE_DISCARD_SPECIAL)
- user_ptr->lock[i]= &wall_gunshow;
- else if (game_move == MOVE_PICK_SPECIAL || game_move == MOVE_DISCARD_TILE)
- user_ptr->lock[i]=&wall_gunhide;
- i++;
-
- for (j=0; j<4 ; j++)
- {
- user_ptr->lock[i] = user_ptr->hand[mmi_gx_vsmj_find_no_with_tile_id(target_id,user_ptr->hand)];
- mmi_gx_vsmj_eliminate_tile(target_id,user_ptr->hand);
- i++;
- }
- user_ptr->lock[i] = &wall_end;
- mmi_gx_vsmj_sort_tile(user_ptr->hand);
-
- highlight=&wall_end;
- game_move= MOVE_REPLENISH_TILE;
- // current_user = user_ptr; /*not necessary*/
- sign_delay=20;
- sign=SIGN_GUN;
- }
- /**************************************************************
- FUNCTION NAME : mmi_gx_vsmj_bugon
- PURPOSE : Debug use
- INPUT PARAMETERS : S16
- OUTPUT PARAMETERS : nil
- RETURNS : void
- REMARKS : nil
- ***************************************************************/
- void mmi_gx_vsmj_bugun(gx_vsmj_user_struct *user_ptr)
- {
- S16 i;
- gun_times++;
- i=mmi_gx_vsmj_find_no_with_tile_id(highlight->id,user_ptr->lock);
- user_ptr->lock[i-1] = &wall_gunshow;
- user_ptr->lock[i+3] = highlight;
- mmi_gx_vsmj_eliminate_tile(highlight->id,user_ptr->hand);
- mmi_gx_vsmj_sort_tile(user_ptr->hand);
-
- highlight = &wall_end;
- game_move= MOVE_REPLENISH_TILE;
- // current_user = user_ptr; /*not necessary*/
- sign_delay=20;
- sign=SIGN_GUN;
- }
- /**************************************************************
- FUNCTION NAME : mmi_gx_vsmj_pon
- PURPOSE : Debug use
- INPUT PARAMETERS : S16
- OUTPUT PARAMETERS : nil
- RETURNS : void
- REMARKS : nil
- ***************************************************************/
- void mmi_gx_vsmj_pon(gx_vsmj_user_struct *user_ptr)
- {
- S16 i;
- i = mmi_gx_vsmj_find_no_with_tile_id(WALL_END,user_ptr->lock);
- user_ptr->lock[i] = &wall_pon;
- user_ptr->lock[i+1]= user_ptr->hand[mmi_gx_vsmj_find_no_with_tile_id(highlight->id,user_ptr->hand)];
- mmi_gx_vsmj_eliminate_tile(highlight->id,user_ptr->hand);
- user_ptr->lock[i+2]= user_ptr->hand[mmi_gx_vsmj_find_no_with_tile_id(highlight->id,user_ptr->hand)];
- mmi_gx_vsmj_eliminate_tile(highlight->id,user_ptr->hand);
- user_ptr->lock[i+3]= user_ptr->hand[mmi_gx_vsmj_find_no_with_tile_id(highlight->id,user_ptr->hand)];
- mmi_gx_vsmj_eliminate_tile(highlight->id,user_ptr->hand);
- user_ptr->lock[i+4]= &tile_empty;
- user_ptr->lock[i+5] = &wall_end;
-
- mmi_gx_vsmj_sort_tile(user_ptr->hand);
-
- highlight = &wall_end;
- game_move= MOVE_DISCARD_TILE;
- // current_user = user_ptr; /* not necessary */
- sign_delay=20;
- sign=SIGN_PON;
- }
- /**************************************************************
- FUNCTION NAME : mmi_gx_vsmj_eat
- PURPOSE : Debug use
- INPUT PARAMETERS : S16
- OUTPUT PARAMETERS : nil
- RETURNS : void
- REMARKS : nil
- ***************************************************************/
- void mmi_gx_vsmj_eat(gx_vsmj_user_struct *user_ptr,U8 type)
- {
- S16 i;
- S16 d1,d2;
-
- switch (type)
- {
- case 0:
- d1=-2;
- d2=-1;
- break;
- case 1:
- d1=-1;
- d2=1;
- break;
- case 2:
- d1=1;
- d2=2;
- break;
- }
- i=mmi_gx_vsmj_find_no_with_tile_id(WALL_END,user_ptr->lock);
- user_ptr->lock[i] = &wall_eat;
- user_ptr->lock[i+1] = user_ptr->hand[mmi_gx_vsmj_find_no_with_tile_id(highlight->id +d1,user_ptr->hand)];
- mmi_gx_vsmj_eliminate_tile(highlight->id +d1, user_ptr->hand);
- user_ptr->lock[i+2] = user_ptr->hand[mmi_gx_vsmj_find_no_with_tile_id(highlight->id ,user_ptr->hand)];
- mmi_gx_vsmj_eliminate_tile(highlight->id, user_ptr->hand);
- user_ptr->lock[i+3] = user_ptr->hand[mmi_gx_vsmj_find_no_with_tile_id(highlight->id +d2,user_ptr->hand)];
- mmi_gx_vsmj_eliminate_tile(highlight->id +d2, user_ptr->hand);
- user_ptr->lock[i+4]= &tile_empty;
- user_ptr->lock[i+5]= &wall_end;
- mmi_gx_vsmj_sort_tile(user_ptr->hand);
-
- highlight= &wall_end;
- game_move= MOVE_DISCARD_TILE;
- // current_user = user_ptr; /*not necessary */
- sign_delay=20;
- sign=SIGN_EAT;
- }
- /**************************************************************
- FUNCTION NAME : mmi_gx_vsmj_check_hou
- PURPOSE :check eat
- INPUT PARAMETERS : ptr array
-
- OUTPUT PARAMETERS : nil
- RETURNS : void
- REMARKS : nil
- ***************************************************************/
- BOOL mmi_gx_vsmj_check_hou(gx_vsmj_user_struct *user_ptr)
- {
- gx_vsmj_tile_struct tile_set[18];
- gx_vsmj_tile_struct *tile_set_ptr[18];
- S16 i;
- /*initialize*/
- i=0;
- while (user_ptr->hand[i]->id !=WALL_END)
- {
- tile_set_ptr[i] = &tile_set[i];
- tile_set[i].id = user_ptr->hand[i]->id;
- tile_set[i].pos = CHK_NOTUSED;
- i++;
- }
- tile_set[i].id = WALL_END;
- tile_set[i].pos = CHK_END;
- tile_set_ptr[i] = &tile_set[i];
- /*initialize*/
- return mmi_gx_vsmj_hou_trial(tile_set_ptr , FALSE);
-
- }
-
- /**************************************************************
- FUNCTION NAME : mmi_gx_vsmj_check_eat()
- PURPOSE :check eat
- INPUT PARAMETERS : ptr array
-
- OUTPUT PARAMETERS : nil
- RETURNS : void
- REMARKS : nil
- ***************************************************************/
- BOOL mmi_gx_vsmj_check_eat(gx_vsmj_user_struct *user_ptr,U8 type)
- {
- S16 d1,d2;
- /* skip loop for never work case */
- if (highlight->id <= TE_BAI)
- return FALSE;
- /* skip loop for never work case */
-
- switch (type)
- {
- case 0: /* xxo */
- /* skip loop for never work case */
- switch (highlight->id)
- {
- case NU_1S:
- case NU_2S:
- case NU_1T:
- case NU_2T:
- case NU_1W:
- case NU_2W:
- return FALSE;
- break;
- }
- /* skip loop for never work case */
- d1=-2;
- d2=-1;
- break;
-
- case 1: /* xox */
- /* skip loop for never work case */
- switch (highlight->id)
- {
- case NU_1S:
- case NU_9S:
- case NU_1T:
- case NU_9T:
- case NU_1W:
- case NU_9W:
- user_ptr->can_eat[1]=FALSE;
- return FALSE;
- break;
- }
- /* skip loop for never work case */
- d1=-1;
- d2=1;
- break;
-
- case 2: /* oxx*/
- /* skip loop for never work case */
- switch (highlight->id)
- {
- case NU_8S:
- case NU_9S:
- case NU_8T:
- case NU_9T:
- case NU_8W:
- case NU_9W:
- user_ptr->can_eat[2]=FALSE;
- return FALSE;
- break;
- }
- /* skip loop for never work case */
- d1=1;
- d2=2;
- break;
- }
- if (mmi_gx_vsmj_find_no_with_tile_id(highlight->id +d1,user_ptr->hand) != -1)
- if (mmi_gx_vsmj_find_no_with_tile_id(highlight->id +d2,user_ptr->hand) != -1)
- return TRUE;
- /*fail*/
- return FALSE;
-
-
- }
- /**************************************************************
- FUNCTION NAME : mmi_gx_vsmj_check_pon()
- PURPOSE :check pon
- INPUT PARAMETERS : ptr array
-
- OUTPUT PARAMETERS : nil
- RETURNS : void
- REMARKS : nil
- ***************************************************************/
- BOOL mmi_gx_vsmj_check_pon(gx_vsmj_user_struct *user_ptr)
- {
- S16 i;
- U8 num_found=0;
- i=0;
- while (user_ptr->hand[i]->id != WALL_END)
- {
- if (user_ptr->hand[i]->id == highlight->id)
- {
- num_found++;
- }
- i++;
- }
- if (num_found>=3) /* have 2 in hand already and include the one from highlight */
- return TRUE;
- else
- return FALSE;
- }
- /**************************************************************
- FUNCTION NAME : mmi_gx_vsmj_check_handgun()
- PURPOSE :check gun
- INPUT PARAMETERS : ptr array
-
- OUTPUT PARAMETERS : nil
- RETURNS : void
- REMARKS : nil
- ***************************************************************/
- BOOL mmi_gx_vsmj_check_bugun(gx_vsmj_user_struct *user_ptr)
- {
- S16 i;
- if (highlight->id != WALL_END)
- {
- i=mmi_gx_vsmj_find_no_with_tile_id(highlight->id,user_ptr->lock); /*no of first tile with highlight id*/
- if (i!=-1) /*tile exist*/
- if (user_ptr->lock[i+1]->id == highlight->id)
- if (user_ptr->lock[i+2]->id == highlight->id)
- return TRUE;
- }
- /*fail*/
- return FALSE;
-
- }
- /**************************************************************
- FUNCTION NAME : mmi_gx_vsmj_check_handgun
- PURPOSE :check gun
- INPUT PARAMETERS : ptr array
-
- OUTPUT PARAMETERS : nil
- RETURNS : void
- REMARKS : nil
- ***************************************************************/
- BOOL mmi_gx_vsmj_check_handgun(gx_vsmj_user_struct *user_ptr)
- {
- /*all in hand cases*/
- S16 i;
- gx_vsmj_tile_id_enum temp_tile_id;
- U8 num_found_set=0;
- i=0;
- while (user_ptr->hand[i]->id !=WALL_END)
- {
- user_ptr->hand[i]->pos = CHK_NOTUSED;
- i++;
- }
-
-
- for (temp_tile_id=TE_EAST ; temp_tile_id <= NU_9T ; temp_tile_id++)
- {
- if (mmi_gx_vsmj_check_multi(4,temp_tile_id,user_ptr->hand))
- {
- user_ptr->can_handgun[num_found_set]=TRUE;
- user_ptr->handgun_id[num_found_set]= temp_tile_id;
- num_found_set++;
- }
- }
- if (num_found_set >0)
- return TRUE;
- else
- return FALSE;
- }
- /**************************************************************
- FUNCTION NAME : mmi_gx_vsmj_check_multi
- PURPOSE :check eat
- INPUT PARAMETERS : ptr array
-
- OUTPUT PARAMETERS : nil
- RETURNS : void
- REMARKS : nil
- ***************************************************************/
- BOOL mmi_gx_vsmj_check_multi(U8 multi_time,gx_vsmj_tile_id_enum target_id,gx_vsmj_tile_struct *tile_set_ptr[])
- {
- S16 i;
- U8 temp_multi_time=0;
-
- i=0;
- while (tile_set_ptr[i]->id != WALL_END)
- {
- if (tile_set_ptr[i]->id == target_id)
- if (tile_set_ptr[i]->pos == CHK_NOTUSED)
- {
- temp_multi_time++;
-
- if (temp_multi_time == multi_time)
- {
- return TRUE;
- }
- }
- i++;
- }
- /*didnt' get in return true=>fail*/
- return FALSE;
- }
- /**************************************************************
- FUNCTION NAME : mmi_gx_vsmj_check_link
- PURPOSE :check eat
- INPUT PARAMETERS : ptr array
-
- OUTPUT PARAMETERS : nil
- RETURNS : void
- REMARKS : nil
- ***************************************************************/
- BOOL mmi_gx_vsmj_check_link(U8 link_time,gx_vsmj_tile_id_enum target_id,
- gx_vsmj_tile_struct *tile_set_ptr[])
- {
- /* basically for 2 and 3 node link check only*/
- S16 i;
- U8 num_link_found=0;
- /* skip loop for never work case */
- if (target_id >= TE_EAST && target_id <=TE_BAI)
- return FALSE;
- if (target_id == NU_9S || target_id == NU_9W || target_id == NU_9T)
- return FALSE;
-
- if (link_time == 3)
- if (target_id == NU_8S || target_id == NU_8W || target_id == NU_8T)
- return FALSE;
- /* skip loop for never work case */
- i=0;
- while (tile_set_ptr[i]->id != WALL_END)
- {
- if (tile_set_ptr[i]->id == target_id + num_link_found)
- if (tile_set_ptr[i]->pos == CHK_NOTUSED)
- {
- num_link_found++;
- if (num_link_found == link_time)
- return TRUE;
- }
- i++;
- }
-
- /* didnt get in return true =>fail*/
- return FALSE;
-
- }
- /**************************************************************
- FUNCTION NAME : mmi_gx_vsmj_framemove()
- PURPOSE :
-
- INPUT PARAMETERS : nil
-
- OUTPUT PARAMETERS : nil
- RETURNS : void
- REMARKS : nil
- ***************************************************************/
- void mmi_gx_vsmj_framemove(void)
- {
- S16 i;
- gx_vsmj_user_id_enum target_id;
- switch (game_move)
- {
- case MOVE_DISCARD_CHECK_START:
-
- /* check special move possibility */
- for (i=0; i < NUM_PLAYER ; i++)
- {
- /*reset */
- user[i].can_hou=FALSE;
- user[i].can_bugun=FALSE;
- user[i].can_handgun[0]=FALSE;
- user[i].can_handgun[1]=FALSE;
- user[i].can_handgun[2]=FALSE;
- user[i].can_handgun[3]=FALSE;
- user[i].can_pon=FALSE;
- user[i].can_eat[0]=FALSE;
- user[i].can_eat[1]=FALSE;
- user[i].can_eat[2]=FALSE;
- /*reset*/
-
- if (user[i].id != last_user->id) /*not the one just discarded highlight tile */
- {
- /*initialize*/
- mmi_gx_vsmj_insert_tile(highlight,user[i].hand);
- mmi_gx_vsmj_sort_tile(user[i].hand);
- /*initialize*/
-
- /* check if the next player can eat */
- if ( user[i].id == last_user->id +1 || (user[i].id==0 && last_user->id == NUM_PLAYER-1))
- {
- user[i].can_eat[0]=mmi_gx_vsmj_check_eat(&user[i],0);
- user[i].can_eat[1]=mmi_gx_vsmj_check_eat(&user[i],1);
- user[i].can_eat[2]=mmi_gx_vsmj_check_eat(&user[i],2);
- }
-
- user[i].can_hou = mmi_gx_vsmj_check_hou(&user[i]);
- user[i].can_pon = mmi_gx_vsmj_check_pon(&user[i]);
- mmi_gx_vsmj_check_handgun(&user[i]);
- /* move temp highlight out*/
- mmi_gx_vsmj_eliminate_tile(highlight->id,user[i].hand);
- mmi_gx_vsmj_sort_tile(user[i].hand);
- /* move temp highlight out*/
- }
- else
- {
- user[i].can_hou=FALSE;
- user[i].can_bugun=FALSE;
- user[i].can_handgun[0]=FALSE;
- user[i].can_handgun[1]=FALSE;
- user[i].can_handgun[2]=FALSE;
- user[i].can_handgun[3]=FALSE;
- user[i].can_pon=FALSE;
- user[i].can_eat[0]=FALSE;
- user[i].can_eat[1]=FALSE;
- user[i].can_eat[2]=FALSE;
- }
- }
- game_move = MOVE_DISCARD_CHECK_CONTINUE;
- break;
-
- case MOVE_DISCARD_CHECK_CONTINUE:
- target_id = last_user->id;
- for (i=0 ; i< NUM_PLAYER ; i++)
- {
- if (user[i].can_hou)
- target_id = user[i].id;
- }
- for (i=0 ; i<NUM_PLAYER ; i++)
- {
- if (user[i].can_pon || user[i].can_handgun[0])
- target_id = user[i].id;
- }
- for (i=0 ; i < NUM_PLAYER ; i++)
- {
- if (user[i].can_eat[0] ||user[i].can_eat[1] ||user[i].can_eat[2])
- target_id = user[i].id;
- }
- if (target_id != last_user->id) /* someone else have a special move to choice */
- {
- mmi_gx_vsmj_insert_tile(highlight,user[target_id].hand);
- mmi_gx_vsmj_sort_tile(user[target_id].hand);
-
- current_user = &user[target_id];
- game_move = MOVE_DISCARD_SPECIAL;
- }
- else
- {
- /* drop to grave */
- highlight->pos=POS_GRAVE;
- grave[grave_index++]=highlight;
- highlight=&wall_end;
- /* drop to grave */
-
-
- if (last_user->id != NUM_PLAYER-1)
- target_id=last_user->id+1;
- else
- target_id=0;
- current_user = &user[target_id];
- game_move = MOVE_PICK_TILE;
- }
- break;
- case MOVE_DECLARE_HOU:
- game_delay= 50;
- game_move = MOVE_RESULT;
- break;
- case MOVE_RESULT:
- g_gx_vsmj_context.is_gameover=TRUE;
- break;
- case MOVE_LIOU_GU:
- g_gx_vsmj_context.is_gameover=TRUE;
- break;
-
- default:
- if (g_gx_vsmj_context.game_level ==0) /* normal play mode */
- {
- if (current_user->id == PLAYER_1)
- {
- mmi_gx_vsmj_player_move(current_user);
- }
- else /* computer move */
- {
- mmi_gx_vsmj_com_move(current_user);
- }
- break;
- }
- else if (g_gx_vsmj_context.game_level ==1) /*cpu paly mode */
- {
- mmi_gx_vsmj_com_move(current_user);
- }
- }
- pen_pos = PP_PENNOTDOWN;
- }
- /**************************************************************
- FUNCTION NAME : mmi_gx_vsmj_player_move
- PURPOSE : Debug use
- INPUT PARAMETERS : S16
- OUTPUT PARAMETERS : nil
- RETURNS : void
- REMARKS : nil
- ***************************************************************/
- void mmi_gx_vsmj_player_move(gx_vsmj_user_struct *user_ptr)
- {
- S16 choice;
- S16 i;
- switch (game_move)
- {
- case MOVE_PICK_TILE: /*full done */
- if (end_index-start_index+gun_times <16) /* 瑈Ы*/
- {
- /* pop out liou gu sign for some ticks and gameover */
- g_gx_vsmj_context.game_grade=0;
- sign = SIGN_LIOU_GU;
- game_delay=50;
- sign_delay=20;
- game_move=MOVE_LIOU_GU;
- return;
- }
-
- switch (pen_pos)
- {
- case PP_PENNOTDOWN:
- break;
- default:
- mmi_gx_vsmj_pick_tile(user_ptr);
- break;
- }
- break;
- case MOVE_PICK_CHECK: /* full done */
- user_ptr->can_pon = FALSE;
- user_ptr->can_bugun=FALSE;
- user_ptr->can_hou = FALSE;
- user_ptr->can_eat[0]=FALSE;
- user_ptr->can_eat[1]=FALSE;
- user_ptr->can_eat[2]=FALSE;
- user_ptr->can_handgun[0]=FALSE;
- user_ptr->can_handgun[1]=FALSE;
- user_ptr->can_handgun[2]=FALSE;
- user_ptr->can_handgun[3]=FALSE;
- user_ptr->can_hou=mmi_gx_vsmj_check_hou(user_ptr);
- user_ptr->can_bugun=mmi_gx_vsmj_check_bugun(user_ptr);
- mmi_gx_vsmj_check_handgun(user_ptr);
-
- if (user_ptr->can_hou || user_ptr->can_handgun[0] || user_ptr->can_bugun)
- game_move = MOVE_PICK_SPECIAL;
- else
- game_move = MOVE_DISCARD_TILE;
- break;
-
- case MOVE_PICK_SPECIAL: /*full done */
- switch (pen_pos)
- {
- case PP_SPECIAL_HOU:
- if (user_ptr->can_hou)
- {
- mmi_gx_vsmj_declare_hou(user_ptr);
- }
- break;
-
- case PP_SPECIAL_BUGUN:
- if (user_ptr->can_bugun)
- {
- mmi_gx_vsmj_bugun(user_ptr);
- }
- break;
- case PP_SPECIAL_HANDGUN_0:
- if (user_ptr->can_handgun[0])
- {
- mmi_gx_vsmj_handgun(user_ptr->handgun_id[0],user_ptr);
- }
- break;
- case PP_SPECIAL_HANDGUN_1:
- if (user_ptr->can_handgun[1])
- {
- mmi_gx_vsmj_handgun(user_ptr->handgun_id[1],user_ptr);
- }
- break;
- case PP_SPECIAL_HANDGUN_2:
- if (user_ptr->can_handgun[2])
- {
- mmi_gx_vsmj_handgun(user_ptr->handgun_id[2],user_ptr);
- }
- break;
- case PP_SPECIAL_HANDGUN_3:
- if (user_ptr->can_handgun[3])
- {
- mmi_gx_vsmj_handgun(user_ptr->handgun_id[3],user_ptr);
- }
- break;
- case PP_SPECIAL_CANCEL:
- game_move = MOVE_DISCARD_TILE;
- break;
-
- default:
- break;
- }
- if (game_move != MOVE_PICK_SPECIAL) /*have made a choice so move changed*/
- {
- user_ptr->can_pon = FALSE;
- user_ptr->can_bugun=FALSE;
- user_ptr->can_hou = FALSE;
- user_ptr->can_eat[0]=FALSE;
- user_ptr->can_eat[1]=FALSE;
- user_ptr->can_eat[2]=FALSE;
- user_ptr->can_handgun[0]=FALSE;
- user_ptr->can_handgun[1]=FALSE;
- user_ptr->can_handgun[2]=FALSE;
- user_ptr->can_handgun[3]=FALSE;
- }
- break;
-
- case MOVE_REPLENISH_TILE: /*full done*/
- if (end_index-start_index+gun_times <16) /* 瑈Ы*/
- {
- /* pop out liou gu sign for some ticks and gameover */
- g_gx_vsmj_context.game_grade=0;
- sign = SIGN_LIOU_GU;
- game_delay=50;
- sign_delay=20;
- game_move=MOVE_LIOU_GU;
- return;
- }
-
- switch (pen_pos)
- {
- case PP_PENNOTDOWN:
- break;
-
- default:
- mmi_gx_vsmj_replenish_tile(user_ptr);
- break;
- }
- break;
-
- case MOVE_DISCARD_TILE: /*full done */
- switch (pen_pos)
- {
- case PP_OWN_0:
- case PP_OWN_1:
- case PP_OWN_2:
- case PP_OWN_3:
- case PP_OWN_4:
- case PP_OWN_5:
- case PP_OWN_6:
- case PP_OWN_7:
- case PP_OWN_8:
- case PP_OWN_9:
- case PP_OWN_10:
- case PP_OWN_11:
- case PP_OWN_12:
- case PP_OWN_13:
- case PP_OWN_14:
- case PP_OWN_15:
- case PP_OWN_16:
- choice = pen_pos;
- if (user_ptr->hand[choice]->id >= highlight->id)
- choice++; /*skip highlight one */
-
- i=0;
- while (user_ptr->hand[i]->id != WALL_END)
- {
- if (i==choice)
- {
- mmi_gx_vsmj_discard_tile(user_ptr->hand[choice]->id, user_ptr);
- break;
- }
- i++;
- }
- break;
-
- case PP_HIGHLIGHT:
- if (highlight->id != WALL_END)
- mmi_gx_vsmj_discard_tile(highlight->id, user_ptr);
- break;
-
- default:
- break;
- }
- break;
- case MOVE_DISCARD_SPECIAL: /*full done */
- switch(pen_pos)
- {
- case PP_SPECIAL_HOU:
- if (user_ptr->can_hou)
- mmi_gx_vsmj_declare_hou(user_ptr);
- break;
-
- case PP_SPECIAL_BUGUN:
- if (user_ptr->can_bugun)
- {
- mmi_gx_vsmj_bugun(user_ptr);
- }
- break;
-
- case PP_SPECIAL_HANDGUN_0:
- if (user_ptr->can_handgun[0])
- {
- mmi_gx_vsmj_handgun(user_ptr->handgun_id[0],user_ptr);
- }
- break;
- case PP_SPECIAL_HANDGUN_1:
- if (user_ptr->can_handgun[1])
- {
- mmi_gx_vsmj_handgun(user_ptr->handgun_id[1],user_ptr);
- }
- break;
- case PP_SPECIAL_HANDGUN_2:
- if (user_ptr->can_handgun[2])
- {
- mmi_gx_vsmj_handgun(user_ptr->handgun_id[2],user_ptr);
- }
- break;
- case PP_SPECIAL_HANDGUN_3:
- if (user_ptr->can_handgun[3])
- {
- mmi_gx_vsmj_handgun(user_ptr->handgun_id[3],user_ptr);
- }
- break;
- case PP_SPECIAL_PON:
- if (user_ptr->can_pon)
- mmi_gx_vsmj_pon(user_ptr);
- break;
-
- case PP_SPECIAL_EAT_0:
- if (user_ptr->can_eat[0])
- {
- mmi_gx_vsmj_eat(user_ptr,0);
- }
- break;
- case PP_SPECIAL_EAT_1:
- if (user_ptr->can_eat[1])
- {
- mmi_gx_vsmj_eat(user_ptr,1);
- }
- break;
- case PP_SPECIAL_EAT_2:
- if (user_ptr->can_eat[2])
- {
- mmi_gx_vsmj_eat(user_ptr,2);
- }
- break;
- case PP_SPECIAL_CANCEL:
- /*clean all*/
- user_ptr->can_pon = FALSE;
- user_ptr->can_bugun=FALSE;
- user_ptr->can_hou = FALSE;
- user_ptr->can_eat[0]=FALSE;
- user_ptr->can_eat[1]=FALSE;
- user_ptr->can_eat[2]=FALSE;
- user_ptr->can_handgun[0]=FALSE;
- user_ptr->can_handgun[1]=FALSE;
- user_ptr->can_handgun[2]=FALSE;
- user_ptr->can_handgun[3]=FALSE;
- /* remove the highlight added for checkment */
- mmi_gx_vsmj_eliminate_tile(highlight->id,user_ptr->hand);
- mmi_gx_vsmj_sort_tile(user_ptr->hand);
-
- game_move = MOVE_DISCARD_CHECK_CONTINUE;
- break;
-
- }
- break;
-
- case MOVE_DECLARE_HOU: /*shouldn't come here */
- break;
- }
- }
- /**************************************************************
- FUNCTION NAME : mmi_gx_vsmj_com_think
- PURPOSE : Debug use
- INPUT PARAMETERS : S16
- OUTPUT PARAMETERS : nil
- RETURNS : void
- REMARKS : nil
- ***************************************************************/
- void mmi_gx_vsmj_com_move(gx_vsmj_user_struct *user_ptr)
- {
- switch (game_move)
- {
- case MOVE_PICK_TILE: /*full done */
- if (end_index-start_index+gun_times <16) /* 瑈Ы*/
- {
- /* pop out liou gu sign for some ticks and gameover */
- g_gx_vsmj_context.game_grade=0;
- sign = SIGN_LIOU_GU;
- game_delay=50;
- sign_delay=20;
- game_move=MOVE_LIOU_GU;
- return;
- }
-
- mmi_gx_vsmj_pick_tile(user_ptr);
- break;
-
- case MOVE_PICK_CHECK: /* full done */
- user_ptr->can_pon = FALSE;
- user_ptr->can_bugun= FALSE;
- user_ptr->can_hou = FALSE;
- user_ptr->can_eat[0]=FALSE;
- user_ptr->can_eat[1]=FALSE;
- user_ptr->can_eat[2]=FALSE;
- user_ptr->can_handgun[0]=FALSE;
- user_ptr->can_handgun[1]=FALSE;
- user_ptr->can_handgun[2]=FALSE;
- user_ptr->can_handgun[3]=FALSE;
-
- user_ptr->can_bugun=mmi_gx_vsmj_check_bugun(user_ptr);
- mmi_gx_vsmj_check_bugun(user_ptr);
- user_ptr->can_hou=mmi_gx_vsmj_check_hou(user_ptr);
- if (user_ptr->can_hou)
- {
- mmi_gx_vsmj_declare_hou(user_ptr);
- }
- else
- {
- game_move = MOVE_DISCARD_TILE;
- }
- break;
-
- case MOVE_PICK_SPECIAL:
- break;
-
- case MOVE_REPLENISH_TILE: /*full done*/
- if (end_index-start_index+gun_times <16) /* 瑈Ы*/
- {
- /* pop out liou gu sign for some ticks and gameover */
- g_gx_vsmj_context.game_grade=0;
- sign = SIGN_LIOU_GU;
- game_delay=50;
- sign_delay=20;
- game_move=MOVE_LIOU_GU;
- return;
- }
-
- mmi_gx_vsmj_replenish_tile(user_ptr);
- break;
-
- case MOVE_DISCARD_TILE: /*full done */
- if (com_strategy[user_ptr->id]==COM_STRATEGY_1)
- mmi_gx_vsmj_com_think_st_1(user_ptr);
- else if (com_strategy[user_ptr->id]==COM_STRATEGY_2)
- mmi_gx_vsmj_com_think_st_2(user_ptr);
- break;
- case MOVE_DISCARD_SPECIAL: /*full done */
- if (user_ptr->can_hou)
- {
- mmi_gx_vsmj_declare_hou(user_ptr);
- }
- else
- {
- if (com_strategy[user_ptr->id]==COM_STRATEGY_1)
- mmi_gx_vsmj_com_think_st_1(user_ptr);
- else if (com_strategy[user_ptr->id]==COM_STRATEGY_2)
- mmi_gx_vsmj_com_think_st_2(user_ptr);
- }
- break;
-
- case MOVE_DECLARE_HOU:
- /*shouldn't come here */
- break;
- }
- }
- /**************************************************************
- FUNCTION NAME : mmi_gx_vsmj_declare_hou
- PURPOSE :
- INPUT PARAMETERS : S16
- OUTPUT PARAMETERS : nil
- RETURNS : void
- REMARKS : nil
- ***************************************************************/
- void mmi_gx_vsmj_declare_hou(gx_vsmj_user_struct *user_ptr)
- {
- game_move=MOVE_DECLARE_HOU;
-
- game_delay=50;
- sign_delay=20;
- sign=SIGN_HOU;
-
- }
- /**************************************************************
- FUNCTION NAME : mmi_gx_vsmj_count_score
- PURPOSE :
- INPUT PARAMETERS : S16
- OUTPUT PARAMETERS : nil
- RETURNS : void
- REMARKS : nil
- ***************************************************************/
- void mmi_gx_vsmj_count_score(gx_vsmj_user_struct *user_ptr)
- {
- U8 i,j;
- /*for check hou set */
- /* for check hou set */
- U8 temp_flower[2]={0,0};
- U8 temp_3yuang[3]={0,0,0};
- U8 temp_4wind[4]={0,0,0,0};
- U8 temp_W=0;
- U8 temp_T=0;
- U8 temp_S=0;
- U8 temp_TEXT=0;
- U8 temp_num_pon_gun_atlock=0;
- U8 temp_num_pon_gun_athand=0;
- BOOL temp_link_exist = FALSE;
- S16 temp_score=0;
-
- for (i=0 ; i<SCORE_TOTALNUM ; i++)
- {
- bonus_hou[i]= FALSE;
- }
- bonus_hou[SCORE_8_FLOWER]=score_8_flower;
- bonus_hou[SCORE_7_1_FLOWER]=score_7_1_flower;
- bonus_hou[SCORE_PICK_BY_OWN]=score_last_by_own;
- bonus_hou[SCORE_PICK_BY_REPLENISH]=score_hou_by_replenish;
- /* men-chin */
- if (user_ptr->lock[0]->id==WALL_END) /*16 tiles at hand ,1 highlight,and no tile at lock */
- bonus_hou[SCORE_MEN_CHIN]=TRUE;
- /* men_chin ze mo */
- if (bonus_hou[SCORE_MEN_CHIN] && bonus_hou[SCORE_PICK_BY_OWN])
- {
- bonus_hou[SCORE_MEN_CHIN] =FALSE;
- bonus_hou[SCORE_PICK_BY_OWN]=FALSE;
- bonus_hou[SCORE_MEN_CHIN_ZE_MO]=TRUE;
- }
- /* men_chin ze mo */
-
- /*flower gun */
- for (i=0; user_ptr->flower[i]->id !=WALL_END ; i++)
- {
- if (user_ptr->flower[i]->id >=FL_SPRING && user_ptr->flower[i]->id <= FL_WINTER)
- temp_flower[0]++;
- else if (user_ptr->flower[i]->id >=FL_M && user_ptr->flower[i]->id <= FL_J)
- temp_flower[1]++;
- }
- if (temp_flower[0]==4)
- bonus_hou[SCORE_FLOWER_SEASON_SET]=TRUE;
- if (temp_flower[1]==4)
- bonus_hou[SCORE_FLOWER_PLANT_SET]=TRUE;
- /*flower gun */
-
- /*big small 3 yuang, 3-yuang-pai */
- for (i=0 ; user_ptr->hand[i]->id != WALL_END ; i++)
- {
- if (user_ptr->hand[i]->id == TE_CHUNG)
- temp_3yuang[0]++;
- else if (user_ptr->hand[i]->id == TE_FA)
- temp_3yuang[1]++;
- else if (user_ptr->hand[i]->id == TE_BAI)
- temp_3yuang[2]++;
- }
- for (i=0 ; user_ptr->lock[i]->id != WALL_END ; i++)
- {
- if (user_ptr->lock[i]->id == TE_CHUNG)
- temp_3yuang[0]++;
- else if (user_ptr->lock[i]->id == TE_FA)
- temp_3yuang[1]++;
- else if (user_ptr->lock[i]->id == TE_BAI)
- temp_3yuang[2]++;
- }
- if (temp_3yuang[0]>=3 && temp_3yuang[1]>=3 && temp_3yuang[2]>=3)
- bonus_hou[SCORE_BIG_3_YUANG]=TRUE;
- else if ( (temp_3yuang[0]==2 && temp_3yuang[1]>=3 && temp_3yuang[2]>=3)
- || (temp_3yuang[0]>=3 && temp_3yuang[1]==2 && temp_3yuang[2]>=3)
- ||(temp_3yuang[0]>=3 && temp_3yuang[1]>=3 && temp_3yuang[2]==2) )
- bonus_hou[SCORE_SMALL_3_YUANG]=TRUE;
- else
- {
- if (temp_3yuang[0]>=3)
- bonus_hou[SCORE_3_YUANG_CHUNG]=TRUE;
- if (temp_3yuang[1]>=3)
- bonus_hou[SCORE_3_YUANG_FA]=TRUE;
- if (temp_3yuang[2]>=3)
- bonus_hou[SCORE_3_YUANG_BAI]=TRUE;
- }
- /*big small 3 yuang , 3-yuang-pai */
- /*big small 4 shi */
- for (i=0 ; user_ptr->hand[i]->id != WALL_END ; i++)
- {
- if (user_ptr->hand[i]->id == TE_EAST)
- temp_4wind[0]++;
- else if (user_ptr->hand[i]->id == TE_WEST)
- temp_4wind[1]++;
- else if (user_ptr->hand[i]->id == TE_SOUTH)
- temp_4wind[2]++;
- else if (user_ptr->hand[i]->id == TE_NORTH)
- temp_4wind[3]++;
- }
- for (i=0 ; user_ptr->lock[i]->id != WALL_END ; i++)
- {
- if (user_ptr->lock[i]->id == TE_EAST)
- temp_4wind[0]++;
- else if (user_ptr->lock[i]->id == TE_WEST)
- temp_4wind[1]++;
- else if (user_ptr->lock[i]->id == TE_SOUTH)
- temp_4wind[2]++;
- else if (user_ptr->lock[i]->id == TE_NORTH)
- temp_4wind[3]++;
- }
- if (temp_4wind[0]>=3 && temp_4wind[1]>=3 && temp_4wind[2]>=3 && temp_4wind[3]>=3)
- bonus_hou[SCORE_BIG_4_WIND]=TRUE;
- else if ( (temp_4wind[0]==2 && temp_4wind[1]>=3 && temp_4wind[2]>=3 && temp_4wind[3]>=3)
- || (temp_4wind[0]>=3 && temp_4wind[1]==2 && temp_4wind[2]>=3 && temp_4wind[3]>=3)
- ||(temp_4wind[0]>=3 && temp_4wind[1]>=3 && temp_4wind[2]==2 && temp_4wind[3]>=3)
- ||(temp_4wind[0]>=3 && temp_4wind[1]>=3 && temp_4wind[2]>=3 && temp_4wind[3]==2) )
- bonus_hou[SCORE_SMALL_4_WIND]=TRUE;
- /*big small 4 shi */
-
- /* else
- {
- if (temp_4wind[0]>=3)
- bonus_hou[SCORE_4_WIND_EAST]=TRUE;
- if (temp_4wind[1]>=3)
- bonus_hou[SCORE_4_WIND_WEST]=TRUE;
- if (temp_4wind[2]>=3)
- bonus_hou[SCORE_4_WIND_SOUTH]=TRUE;
- if (temp_4wind[3]>=3)
- bonus_hou[SCORE_4_WIND_NORTH]=TRUE;
- }
- */ /* no boarder => nowind score */
- /* sea_moon */
- if (end_index - start_index +gun_times == 16)
- {
- if (score_last_by_own)
- bonus_hou[SCORE_SEA_MOON]=TRUE;
- }
- /* sea_moon , sea_fish */
- /* chuan chio */
- if (user_ptr->hand[1]->id == WALL_END && score_last_by_own == FALSE) /* so only 1 hand tile not in lock */
- bonus_hou[SCORE_CHUAN_CHIO]=TRUE; /* rule: cant count together with ze-mo*/
- /* chuan chio */
- /*the one-color s */
- for (i=0 ; user_ptr->hand[i]->id != WALL_END ; i++)
- {
- if (user_ptr->hand[i]->id >= NU_1W && user_ptr->hand[i]->id <= NU_9W)
- temp_W++;
- else if (user_ptr->hand[i]->id >= NU_1T && user_ptr->hand[i]->id <= NU_9T)
- temp_T++;
- else if (user_ptr->hand[i]->id >= NU_1S && user_ptr->hand[i]->id <= NU_9S)
- temp_S++;
- else if (user_ptr->hand[i]->id >= TE_EAST && user_ptr->hand[i]->id <= TE_BAI)
- temp_TEXT++;
- }
- for (i=0 ; user_ptr->lock[i]->id != WALL_END ; i++)
- {
- if (user_ptr->lock[i]->id >= NU_1W && user_ptr->lock[i]->id <= NU_9W)
- temp_W++;
- else if (user_ptr->lock[i]->id >= NU_1T && user_ptr->lock[i]->id <= NU_9T)
- temp_T++;
- else if (user_ptr->lock[i]->id >= NU_1S && user_ptr->lock[i]->id <= NU_9S)
- temp_S++;
- else if (user_ptr->lock[i]->id >= TE_EAST && user_ptr->lock[i]->id <= TE_BAI)
- temp_TEXT++;
- }
- if (temp_W==0 && temp_T==0 && temp_S ==0 && temp_TEXT>0)
- {
- // cancel text_1_color , rarely used
- // bonus_hou[SCORE_TEXT_1_COLOR]=TRUE;
- }
- else if ( (temp_W>0 && temp_T==0 && temp_S ==0 && temp_TEXT==0)
- || (temp_W==0 && temp_T>0 && temp_S ==0 && temp_TEXT==0)
- || (temp_W==0 && temp_T==0 && temp_S >0 && temp_TEXT==0)
- || (temp_W==0 && temp_T==0 && temp_S ==0 && temp_TEXT>0) )
- bonus_hou[SCORE_NUM_1_COLOR]=TRUE;
- else if ( (temp_W>0 && temp_T==0 && temp_S ==0 && temp_TEXT >0)
- || (temp_W==0 && temp_T>0 && temp_S ==0 && temp_TEXT >0)
- || (temp_W==0 && temp_T==0 && temp_S > 0 && temp_TEXT>0) )
- bonus_hou[SCORE_MIX_1_COLOR]=TRUE;
- /*the one-color s */
- /* get hou set info */
- mmi_gx_vsmj_reset_chk_all(user_ptr->hand);
- mmi_gx_vsmj_hou_trial(user_ptr->hand,FALSE);
- /* get hou set info */
-
- /*3,4,5 en ke */
- i=0;
- while (user_ptr->lock[i]->id != WALL_END)
- {
- if (user_ptr->lock[i]->id == WALL_GUNHIDE)
- temp_num_pon_gun_atlock++;
- i++;
- }
- i=0;
- j=0;
- while (user_ptr->hand[i]->id != WALL_END)
- {
- if (user_ptr->hand[i]->pos==CHK_TRIPLE)
- j++;
- i++;
- }
- temp_num_pon_gun_athand= j / 3;
- switch (temp_num_pon_gun_athand + temp_num_pon_gun_atlock)
- {
- case 3:
- bonus_hou[SCORE_3_ENKE]=TRUE;
- break;
- case 4:
- bonus_hou[SCORE_4_ENKE]=TRUE;
- break;
- case 5:
- bonus_hou[SCORE_5_ENKE]=TRUE;
- break;
- default:
- break;
- }
- /*3,4,5 en ke */
- /*duei duei hou */
- i=0;
- while (user_ptr->lock[i]->id != WALL_END)
- {
- if (user_ptr->lock[i]->id == WALL_EAT)
- {
- temp_link_exist=TRUE;
- break;
- }
- i++;
- }
- i=0;
- while (user_ptr->hand[i]->id != WALL_END)
- {
- if (user_ptr->hand[i]->pos == CHK_LINE_R )
- {
- temp_link_exist=TRUE;
- break;
- }
- i++;
- }
- if (temp_link_exist ==FALSE)
- {
- bonus_hou[SCORE_PAIR_PAIR_HOU]=TRUE;
- }
- /*duei duei hou */
- /***********send score*************/
- if (bonus_hou[SCORE_8_FLOWER])
- temp_score += 8;
- if (bonus_hou[SCORE_7_1_FLOWER])
- temp_score += 8;
- /* hou by 8_flower and 7_1_flower have no chance of the following bonus */
- if (bonus_hou[SCORE_8_FLOWER] ||bonus_hou[SCORE_7_1_FLOWER])
- {
- if (user_ptr->id ==PLAYER_1) /*win*/
- g_gx_vsmj_context.game_grade=temp_score;
- else /*lose */
- g_gx_vsmj_context.game_grade= 0 - temp_score;
- return;
-
- }
-
- if (bonus_hou[SCORE_PICK_BY_OWN])
- temp_score += 1;
- if (bonus_hou[SCORE_PICK_BY_REPLENISH])
- temp_score += 1;
- if (bonus_hou[SCORE_MEN_CHIN])
- temp_score += 1;
- if (bonus_hou[SCORE_MEN_CHIN_ZE_MO])
- temp_score += 3;
- if (bonus_hou[SCORE_FLOWER_SEASON_SET])
- temp_score += 1;
- if (bonus_hou[SCORE_FLOWER_PLANT_SET])
- temp_score += 1;
- if (bonus_hou[SCORE_SEA_MOON])
- temp_score += 1;
- /*
- if (bonus_hou[SCORE_SEA_FISH])
- temp_score += 1;
- */
- if (bonus_hou[SCORE_CHUAN_CHIO])
- temp_score += 2;
- if (bonus_hou[SCORE_BIG_3_YUANG])
- temp_score += 8;
- if (bonus_hou[SCORE_SMALL_3_YUANG])
- temp_score += 4;
- if (bonus_hou[SCORE_3_YUANG_CHUNG])
- temp_score += 1;
- if (bonus_hou[SCORE_3_YUANG_FA])
- temp_score += 1;
- if (bonus_hou[SCORE_3_YUANG_BAI])
- temp_score += 1;
- if (bonus_hou[SCORE_BIG_4_WIND])
- temp_score += 16;
- if (bonus_hou[SCORE_SMALL_4_WIND])
- temp_score += 8;
- if (bonus_hou[SCORE_3_ENKE])
- temp_score += 2;
- if (bonus_hou[SCORE_4_ENKE])
- temp_score += 5;
- if (bonus_hou[SCORE_5_ENKE])
- temp_score += 8;
-
- /*
- if (bonus_hou[SCORE_TEXT_1_COLOR])
- temp_score += 8;
- */
- if (bonus_hou[SCORE_NUM_1_COLOR])
- temp_score += 8;
- if (bonus_hou[SCORE_MIX_1_COLOR])
- temp_score += 4;
-
- if (bonus_hou[SCORE_PAIR_PAIR_HOU])
- temp_score += 4;
- if (user_ptr->id ==PLAYER_1) /*win*/
- g_gx_vsmj_context.game_grade=100+temp_score*30; /*┏+score per tai*