Window_ShopParty::Window_ShopParty(int ix, int iy, int iwidth, int iheight) : Window_Base(ix, iy, iwidth, iheight) { SetContents(Bitmap::Create(width - 16, height - 16)); contents->SetTransparentColor(windowskin->GetTransparentColor()); cycle = 0; item_id = 0; const std::vector<Game_Actor*>& actors = Game_Party::GetActors(); for (size_t i = 0; i < actors.size() && i < 4; i++) { Game_Actor *actor = actors[i]; const std::string& sprite_name = actor->GetCharacterName(); int sprite_id = actor->GetCharacterIndex(); BitmapRef bm = Cache::Charset(sprite_name); int width = bm->GetWidth() / 4 / 3; int height = bm->GetHeight() / 2 / 4; for (int j = 0; j < 3; j++) { int sx = ((sprite_id % 4) * 3 + j) * width; int sy = ((sprite_id / 4) * 4 + 2) * height; Rect src(sx, sy, width, height); for (int k = 0; k < 2; k++) { BitmapRef bm2 = Bitmap::Create(width, height, true); bm2->SetTransparentColor(bm->GetTransparentColor()); bm2->Clear(); bm2->Blit(0, 0, *bm, src, 255); if (k == 0) bm2->ToneBlit(0, 0, *bm2, bm2->GetRect(), Tone(0, 0, 0, 255)); bitmaps[i][j][k] = bm2; } } } Refresh(); }
void Game_Player::Refresh() { Game_Actor* actor; if (Game_Party::GetActors().empty()) { character_name.clear(); return; } actor = Game_Party::GetActors()[0]; character_name = actor->GetCharacterName(); character_index = actor->GetCharacterIndex(); }