Saves a bitmap to a file. Saves the bitmap as an OUTRAGE_COMPRESSED_OGF. Returns -1 if something is wrong.
| 1080 | // Saves a bitmap to a file. Saves the bitmap as an OUTRAGE_COMPRESSED_OGF. |
| 1081 | // Returns -1 if something is wrong. |
| 1082 | int bm_SaveFileBitmap(const std::filesystem::path &filename, int handle) { |
| 1083 | int ret; |
| 1084 | CFILE *fp; |
| 1085 | if (!GameBitmaps[handle].used) { |
| 1086 | mprintf(0, "bm_SaveBitmap: Trying to save a bitmap that isn't used!\n"); |
| 1087 | Int3(); |
| 1088 | return -1; |
| 1089 | } |
| 1090 | if (handle == BAD_BITMAP_HANDLE) { |
| 1091 | Int3(); // Hey, you shouldn't be saving this bitmap! |
| 1092 | return -1; |
| 1093 | } |
| 1094 | if (!bm_MakeBitmapResident(handle)) { |
| 1095 | mprintf(0, "There was a problem paging this bitmap in!\n"); |
| 1096 | return -1; |
| 1097 | } |
| 1098 | fp = (CFILE *)cfopen(filename, "wb"); |
| 1099 | |
| 1100 | if (!fp) { |
| 1101 | mprintf(0, "bm_SaveBitmap: Trying to save a bitmap to a closed file!\n"); |
| 1102 | Int3(); |
| 1103 | return -1; |
| 1104 | } |
| 1105 | ret = bm_SaveBitmap(fp, handle); |
| 1106 | |
| 1107 | cfclose(fp); |
| 1108 | return ret; |
| 1109 | } |
| 1110 | // returns a bitmaps width (based on miplevel), else -1 if something is wrong |
| 1111 | int bm_w(int handle, int miplevel) { |
| 1112 | int w; |
no test coverage detected