//---------------------------------- //dùng để chuyển từ stage này sang stage khác; reset một số thuộc tính về giá trị mặc định; //đọc file map và lấy các thông tin cần thiết như ma trận map, số lượng tank địch, ..; //tạo danh sách tank địch sẽ xuất hiện trên map, tạo danh sách các đối tượng tĩnh như gạch, thép, //rừng, ..; đưa ma trận map vào cho _player để hỗ trợ xét va chạm //---------------------------------- void Map::changeStage() { // _listStaticObject = new vector<vector<StaticObject*>>; _posGameOverText = POS_START_GAMEOVER; _delaytimeReSpawn = DEFINE_ZERO_VALUE; _delayEndStage = DELAY_TIME_END_PLAYING_STATE; _isPrepareRespawn = false; _maxEnemy = MAX_ENEMY; _numEnemy = DEFINE_ZERO_VALUE; _delayFreeze = DELAY_FREEZE_TIME; _isFreeze = false; // int numOfTypeEnemy[NUM_TYPE_ENEMY]; string orderAppear; string stringLine; int tempMaxEnemy; if (!GetFileMap()) return; getline(_mapFile, stringLine); tempMaxEnemy = std::stoi(stringLine); _maxEnemy = tempMaxEnemy; for (int i = 0; i < NUM_TYPE_ENEMY;i++) { getline(_mapFile, stringLine); numOfTypeEnemy[i] = std::stoi(stringLine); } getline(_mapFile, stringLine); orderAppear = stringLine; //read matrix map int i, j; i = 0; while (!_mapFile.eof()) { j = 0; getline(_mapFile, stringLine); stringstream ss(stringLine); string token; while (getline(ss, token, ',')) { _mapMatrix[i][j] = std::stoi(token); j++; } i++; } InitStaticObject(); _mapFile.close(); _player->InitMapData(_mapMatrix, _listStaticObject); InitListEnemy(numOfTypeEnemy,orderAppear); _powerUpItem->setmap(_mapMatrix); }
status_t FileMapDisk::RegisterFileMapBootItem() { return B_ERROR; struct file_map_boot_item *item; item = (struct file_map_boot_item *)malloc(sizeof(struct file_map_boot_item)); item->num_runs = FMAP_MAX_RUNS; status_t err; err = GetFileMap(item->runs, &item->num_runs); if (err < B_OK) return err; // err = add_boot_item("file_map_disk", item, sizeof(struct file_map_boot_item)); err = B_ERROR; return err; }