MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / UpdateWeaponView

Method UpdateWeaponView

editor/WorldWeaponsDialog.cpp:1259–1346  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1257}
1258
1259void 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

Callers

nothing calls this directly

Calls 15

GetWeaponHudImageFunction · 0.85
bm_bppFunction · 0.85
GetWeaponFireImageFunction · 0.85
bm_wFunction · 0.85
bm_hFunction · 0.85
vm_MakeZeroFunction · 0.85
StartEditorFrameFunction · 0.85
DrawPolygonModelFunction · 0.85
EndEditorFrameFunction · 0.85
attach_to_windowMethod · 0.80
vm_MakeIdentityFunction · 0.50
vm_AnglesToMatrixFunction · 0.50

Tested by

no test coverage detected