void player_right_clicked(int x, int y) { if (world_state != WORLDSTATE_NOLOAD) {return;} if ((*global).active_screen != SCREEN_WORLD){return;} if ((*global).game_pause) {return;} if ( util.is_same_tile(x,y, (*global).player.player_at_x_int, (*global).player.player_at_y_int)) { return; } t_o_interact.player_to_teleport_to(x,y); }
void player_left_clicked(int x, int y) { if (world_state != WORLDSTATE_NOLOAD) {return;} if ((*global).active_screen != SCREEN_WORLD){return;} if ((*global).game_pause) {return;} int player_x = (*global).player.player_at_x_int; int player_y = (*global).player.player_at_y_int; bool close_tile = util.tiles_are_one_appart(x, y, player_x, player_y); bool same_tile = util.is_same_tile(x,y, player_x, player_y); bool going_for_monster_interaction = false; int16_t interaction_monster_type = MON_VOID; bool going_for_mech_activation = false; int16_t interaction_mech_type = TILE_MECH_VOID; bool going_for_a_walk = false; if (close_tile) { (*global).lock_tile(x, y); if ( (*global).tile_exists(x, y)) { (*global).tile[x][y].monsters.reset_itt(); if((*global).tile[x][y].monsters.can_request_next()) { tile_monster* tmon = (*global).tile[x][y].monsters.request_next(); if ((*global).monsters.selectable((*tmon).type)) { going_for_monster_interaction = true; interaction_monster_type = (*tmon).type; } } if ( (*global).tile[x][y].has_mechanic && !going_for_monster_interaction) { tile_mechanic* tm = (*global).tile[x][y].mech; if ( (*global).mechanics.selectable((*tm).type) ) { going_for_mech_activation = true; interaction_mech_type = (*tm).type; } } } (*global).unlock_tile(x, y); } if (!going_for_monster_interaction && !going_for_mech_activation && !same_tile) { going_for_a_walk = true; } if ( going_for_monster_interaction) { t_o_interact.player_to_monster_interaction(interaction_monster_type, x, y); } else if ( going_for_mech_activation) { t_o_interact.player_to_mechanic_interaction(interaction_mech_type, x, y); } else if (going_for_a_walk) { t_o_interact.player_going_for_a_walk(x,y); } }