| 1257 | } |
| 1258 | |
| 1259 | void CWorldWeaponsDialog::UpdateWeaponView() { |
| 1260 | int n = D3EditState.current_weapon; |
| 1261 | CWnd *weaponwnd; |
| 1262 | RECT rect; |
| 1263 | int x, y, bm_handle, w, h; |
| 1264 | static int frame = 0; |
| 1265 | static int last_weapon = -1; |
| 1266 | static int last_image_handle = -1; |
| 1267 | int clearit = 0; |
| 1268 | |
| 1269 | if (Num_weapons < 1) |
| 1270 | return; |
| 1271 | |
| 1272 | frame++; |
| 1273 | |
| 1274 | weaponwnd = GetDlgItem(IDC_WEAPONVIEW); |
| 1275 | weaponwnd->GetWindowRect(&rect); |
| 1276 | ScreenToClient(&rect); |
| 1277 | |
| 1278 | Desktop_surf->attach_to_window((unsigned)m_hWnd); |
| 1279 | |
| 1280 | w = rect.right - rect.left; |
| 1281 | h = rect.bottom - rect.top; |
| 1282 | |
| 1283 | if (last_weapon != n || last_image_handle != Weapons[n].hud_image_handle) { |
| 1284 | Desktop_surf->clear(rect.left, rect.top, w, h); |
| 1285 | last_weapon = n; |
| 1286 | last_image_handle = Weapons[n].hud_image_handle; |
| 1287 | clearit = 1; |
| 1288 | } |
| 1289 | |
| 1290 | bm_handle = GetWeaponHudImage(n, frame); |
| 1291 | |
| 1292 | m_WeaponSurf.create(128, 128, bm_bpp(bm_handle)); |
| 1293 | m_WeaponSurf.load(bm_handle); |
| 1294 | |
| 1295 | x = rect.left + ((rect.right - rect.left) / 2) - m_WeaponSurf.width() / 2; |
| 1296 | y = rect.top + ((rect.bottom - rect.top) / 2) - m_WeaponSurf.height() / 2; |
| 1297 | |
| 1298 | Desktop_surf->blt(x, y, &m_WeaponSurf); |
| 1299 | m_WeaponSurf.free(); |
| 1300 | |
| 1301 | weaponwnd = GetDlgItem(IDC_WEAPONFIREVIEW); |
| 1302 | weaponwnd->GetWindowRect(&rect); |
| 1303 | ScreenToClient(&rect); |
| 1304 | |
| 1305 | w = rect.right - rect.left; |
| 1306 | h = rect.bottom - rect.top; |
| 1307 | |
| 1308 | if (clearit) |
| 1309 | Desktop_surf->clear(rect.left, rect.top, w, h); |
| 1310 | |
| 1311 | bm_handle = GetWeaponFireImage(n, frame); |
| 1312 | |
| 1313 | if ((Weapons[n].flags & WF_IMAGE_BITMAP) || (Weapons[n].flags & WF_IMAGE_VCLIP)) { |
| 1314 | m_WeaponSurf.create(bm_w(bm_handle, 0), bm_h(bm_handle, 0), bm_bpp(bm_handle)); |
| 1315 | m_WeaponSurf.load(bm_handle); |
| 1316 |
nothing calls this directly
no test coverage detected