| 340 | } |
| 341 | |
| 342 | void CUIWeaponCellItem::InitAddon(CUIStatic* s, CIconParams& params, Fvector2 addon_offset, bool b_rotate) |
| 343 | { |
| 344 | Fvector2 base_scale; |
| 345 | Fvector2 inventory_size; |
| 346 | Fvector2 expected_size; |
| 347 | static int method = 1; |
| 348 | |
| 349 | inventory_size.x = INV_GRID_WIDTHF * m_grid_size.x; |
| 350 | inventory_size.y = INV_GRID_HEIGHTF * m_grid_size.y; |
| 351 | |
| 352 | expected_size.x = m_cell_size.x * m_grid_size.x; // vert: cell_size = 40x50, grid_size = 5x2 |
| 353 | expected_size.y = m_cell_size.y * m_grid_size.y; |
| 354 | if (Heading()) |
| 355 | { // h = 250, w = 80, i.x = 300, i.y = 100 |
| 356 | if (1 == method) |
| 357 | { |
| 358 | expected_size.x = m_cell_size.y * m_grid_size.x; |
| 359 | expected_size.y = m_cell_size.x * m_grid_size.y; |
| 360 | } |
| 361 | if (2 == method) |
| 362 | { |
| 363 | expected_size.x = m_cell_size.y * m_grid_size.y; |
| 364 | expected_size.y = m_cell_size.x * m_grid_size.x; |
| 365 | } |
| 366 | |
| 367 | base_scale.x = GetHeight() / inventory_size.x; |
| 368 | base_scale.y = GetWidth() / inventory_size.y; |
| 369 | } |
| 370 | else |
| 371 | { |
| 372 | base_scale.x = GetWidth() / inventory_size.x; |
| 373 | base_scale.y = GetHeight() / inventory_size.y; |
| 374 | } |
| 375 | |
| 376 | if (method > 0) |
| 377 | { |
| 378 | base_scale.x = expected_size.x / inventory_size.x; |
| 379 | base_scale.y = expected_size.y / inventory_size.y; |
| 380 | } |
| 381 | |
| 382 | Fvector2 cell_size; |
| 383 | cell_size.x = params.grid_width * INV_GRID_WIDTHF; |
| 384 | cell_size.y = params.grid_height * INV_GRID_HEIGHTF; |
| 385 | cell_size.mul(base_scale); |
| 386 | |
| 387 | if (b_rotate) |
| 388 | { |
| 389 | s->SetWndSize(Fvector2().set(cell_size.y, cell_size.x)); |
| 390 | Fvector2 new_offset; |
| 391 | new_offset.x = addon_offset.y * base_scale.x; |
| 392 | new_offset.y = GetHeight() - addon_offset.x * base_scale.x - cell_size.x; |
| 393 | addon_offset = new_offset; |
| 394 | addon_offset.x *= UI()->get_current_kx(); |
| 395 | } |
| 396 | else |
| 397 | { |
| 398 | s->SetWndSize(cell_size); |
| 399 | addon_offset.mul(base_scale); |
nothing calls this directly
no test coverage detected