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

Function bm_SaveFileBitmap

bitmap/bitmain.cpp:1082–1109  ·  view source on GitHub ↗

Saves a bitmap to a file. Saves the bitmap as an OUTRAGE_COMPRESSED_OGF. Returns -1 if something is wrong.

Source from the content-addressed store, hash-verified

1080// Saves a bitmap to a file. Saves the bitmap as an OUTRAGE_COMPRESSED_OGF.
1081// Returns -1 if something is wrong.
1082int 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
1111int bm_w(int handle, int miplevel) {
1112 int w;

Callers 15

OnWtexdlgAddnewMethod · 0.85
OnCheckinMethod · 0.85
SaveTexturesOnCloseMethod · 0.85
OnLoadBitmapMethod · 0.85
LoadITLFileMethod · 0.85
OnAddNewSmallMethod · 0.85
OnAddNewTinyMethod · 0.85
OnAddNewHugeMethod · 0.85
CheckinTextureMethod · 0.85
OnImportTinyMethod · 0.85
OnImportSkyMethod · 0.85
OnImportSkyBandMethod · 0.85

Calls 4

bm_MakeBitmapResidentFunction · 0.85
cfopenFunction · 0.85
bm_SaveBitmapFunction · 0.85
cfcloseFunction · 0.85

Tested by

no test coverage detected