void EmptyFingerModule(void) { //1 memset(FingerRecord,0,sizeof(FingerRecord)); FingerOn(); BellOn(); DelayNmS(200); BellOff(); //2 if(OK == WriteFingerFlash(FingerRecord,sizeof(FingerRecord),0,0)) { } else { DisplayErr(); FingerOff(); return; } //3 if(OK == EmptyFinger()) { DisplayOK(); } else { DisplayErr(); } FingerOff(); }
ALLEGRO_BITMAP* load_bitmap_withWarning(const char* path){ ALLEGRO_BITMAP* img = 0; img = al_load_bitmap(path); if(!img){ DisplayErr("Cannot load image: %s", path); exit(0); } al_convert_mask_to_alpha(img, al_map_rgb(255, 0, 255)); return img; }
void SearchFingerModule(void) { unsigned char SearchResult = 0; unsigned char SearchReturn = 0; FingerOn(); BellOn(); DelayNmS(200); BellOff(); // SearchReturn = SearchFinger(&SearchResult,250); if(ANSWER_SEARCH_OK == SearchReturn)// { DisplayOK(); } else { if((ANSWER_SEARCH_FAIL == SearchReturn)||(ANSWER_FAIL == SearchReturn))// { DisplayFail(); } else { if(ANSWER_OUT_TIME == SearchReturn) { DisplayOutTime();// } else { DisplayErr();// } } } FingerOff(); }
void c_tile::load_ini(ALLEGRO_PATH * path) { ALLEGRO_CONFIG * config = 0; const char * thepath = al_path_cstr(path, ALLEGRO_NATIVE_PATH_SEP); log_printf("Loading tile at: %s\n", thepath); config = al_load_config_file(thepath); if(!config) { DisplayErr("Cannot load tile: %s\n", thepath); exit(1); } char buffer[256]; height_max = get_config_int(config, "SPRITE", "height_max", 280); height_min = get_config_int(config, "SPRITE", "height_min", 0); priority = get_config_int(config, "SPRITE", "priority", 0); const char * terra = al_get_config_value(config, "SPRITE", "special_terrain"); if(terra) special_terrain = get_terrain_type(terra); const char * cons = al_get_config_value(config, "SPRITE", "special_object"); if(cons) structure = get_structure_type(cons); s_sprite temp; size_t cap_layers = get_config_int(config, "SPRITE", "cap_layers"); for(size_t i = 0; i < cap_layers; i++) { sprintf(buffer, "CAP_IMAGE_%d", i); temp = get_from_ini(config, buffer, path); if(temp.index >= 0) top_sprites.push_back(temp); } size_t column_layers = get_config_int(config, "SPRITE", "column_layers"); for(size_t i = 0; i < column_layers; i++) { sprintf(buffer, "COLUMN_IMAGE_%d", i); temp = get_from_ini(config, buffer, path); if(temp.index >= 0) bottom_sprites.push_back(temp); } size_t surface_layers = get_config_int(config, "SPRITE", "surface_layers"); for(size_t i = 0; i < surface_layers; i++) { sprintf(buffer, "SURFACE_IMAGE_%d", i); temp = get_from_ini(config, buffer, path); if(temp.index >= 0) surface_sprites.push_back(temp); } size_t intermediate_layers = get_config_int(config, "SPRITE", "intermediate_layers"); for(size_t i = 0; i < intermediate_layers; i++) { sprintf(buffer, "INTERMEDIATE_IMAGE_%d", i); temp = get_from_ini(config, buffer, path); if(temp.index >= 0) intermediate_sprites.push_back(temp); } size_t object_layers = get_config_int(config, "SPRITE", "object_layers"); for(size_t i = 0; i < object_layers; i++) { sprintf(buffer, "OBJECT_IMAGE_%d", i); temp = get_from_ini(config, buffer, path); if(temp.index >= 0) object_sprites.push_back(temp); } }
void AddFingerModule(void) { unsigned char i = 0; unsigned char AH = 0;// unsigned char AL = 0;// unsigned char t = 0; FingerOn(); BellOn(); DelayNmS(200); BellOff(); // if(ReadFingerFlash(FingerRecord,sizeof(FingerRecord),0,0) != OK) { DisplayErr(); FingerOff(); return; } //2 for(i = 0;i<MAX_FINGER;i++) { AH = i/8; AL = i%8; t = FingerRecord[AH]<<(7-AL); t = t>>7; if(0 == t) { // break; } } if(i == MAX_FINGER) { // DisplayFail(); FingerOff(); return; } //3 t = AddFinger(0,i,250); if(ANSWER_OK == t) { DisplayOK();// } else { if(ANSWER_OUT_TIME == t)// { DisplayOutTime(); FingerOff(); return; } else { if(FALSE == t)// { DisplayErr(); FingerOff(); return; } else { DisplayFail();// FingerOff(); return; } } } //4 FingerRecord[AH] |= 1<<AL; if(OK == WriteFingerFlash(FingerRecord,sizeof(FingerRecord),0,0)) { } else { DisplayErr(); FingerOff(); return; } FingerOff();// }