Takes a TGA and extracts the hotspot map and ogf from it
| 3157 | */ |
| 3158 | |
| 3159 | // Takes a TGA and extracts the hotspot map and ogf from it |
| 3160 | void CMainFrame::OnHotspotTga() { |
| 3161 | // TODO: Add your command handler code here |
| 3162 | CString tga_filter = "TGA (*.tga)|*.tga|All Files (*.*)|*.*||"; |
| 3163 | CString tga_path; |
| 3164 | char *buffer; |
| 3165 | int anim = 0, bm_handle; |
| 3166 | char filename[200]; |
| 3167 | |
| 3168 | CFileDialog dlg(true, 0, 0, OFN_FILEMUSTEXIST, (LPCTSTR)tga_filter, this); |
| 3169 | |
| 3170 | if (dlg.DoModal() == IDOK) { |
| 3171 | tga_path = dlg.GetPathName(); |
| 3172 | } else { |
| 3173 | return; |
| 3174 | } |
| 3175 | |
| 3176 | buffer = (char *)mem_malloc(strlen(tga_path.GetBuffer(1)) + 1); |
| 3177 | if (!buffer) { |
| 3178 | Int3(); // find Jeff |
| 3179 | return; |
| 3180 | } |
| 3181 | strcpy(buffer, tga_path.GetBuffer(1)); |
| 3182 | if (menutga_ConvertTGAtoHSM(buffer)) |
| 3183 | OutrageMessageBox("HotSpot Map Extracted"); |
| 3184 | |
| 3185 | bm_handle = LoadTextureImage(buffer, &anim, NOT_TEXTURE, 0); |
| 3186 | |
| 3187 | if (bm_handle < 0) { |
| 3188 | OutrageMessageBox("Couldn't open that bitmap/anim file."); |
| 3189 | return; |
| 3190 | } |
| 3191 | |
| 3192 | if (!anim) { |
| 3193 | sprintf(filename, "%s\\%s", LocalManageGraphicsDir.u8string().c_str(), GameBitmaps[bm_handle].name); |
| 3194 | bm_SaveFileBitmap(filename, bm_handle); |
| 3195 | bm_FreeBitmap(bm_handle); |
| 3196 | } |
| 3197 | |
| 3198 | if (buffer) |
| 3199 | mem_free(buffer); |
| 3200 | } |
| 3201 | |
| 3202 | void CMainFrame::OnEditorsFiles() { |
nothing calls this directly
no test coverage detected