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

Method OnLoadWeaponAnim

editor/WorldWeaponsDialog.cpp:783–823  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

781}
782
783void CWorldWeaponsDialog::OnLoadWeaponAnim() {
784 char filename[255];
785 int bm_handle;
786 int anim = 0;
787
788 CString filter =
789 "Descent III files (*.tga,*.bbm,*.lbm,*.ogf,*.oaf,*.ilf,*.pcx)|*.pcx;*.tga;*.bbm;*.lbm;*.ogf;*.oaf;*.ifl||";
790
791 if (!OpenFileDialog(this, (LPCSTR)filter, filename, Current_weapon_dir, sizeof(Current_weapon_dir)))
792 return;
793
794 // Okay, we selected a file. Lets do what needs to be done here.
795 bm_handle = LoadWeaponHudImage(filename, &anim);
796
797 if (bm_handle < 0) {
798 OutrageMessageBox("Could not load that bitmap...restoring previous bitmap.");
799 return;
800 }
801 int n = D3EditState.current_weapon;
802
803 Weapons[n].hud_image_handle = bm_handle;
804
805 if (anim)
806 Weapons[n].flags |= WF_HUD_ANIMATED;
807 else
808 Weapons[n].flags &= ~WF_HUD_ANIMATED;
809
810 mprintf(0, "Making a copy of this bitmap/anim locally...\n");
811
812 std::filesystem::path curname;
813 if (anim) {
814 curname = LocalManageGraphicsDir / GameVClips[Weapons[n].hud_image_handle].name;
815 SaveVClip(curname, Weapons[n].hud_image_handle);
816
817 } else {
818 curname = LocalManageGraphicsDir / GameBitmaps[Weapons[n].hud_image_handle].name;
819 bm_SaveFileBitmap(curname, Weapons[n].hud_image_handle);
820 }
821
822 UpdateDialog();
823}
824
825void CWorldWeaponsDialog::OnSelendokWeaponPulldown() {
826 int i, cur;

Callers

nothing calls this directly

Calls 5

OpenFileDialogFunction · 0.85
LoadWeaponHudImageFunction · 0.85
OutrageMessageBoxFunction · 0.85
SaveVClipFunction · 0.85
bm_SaveFileBitmapFunction · 0.85

Tested by

no test coverage detected