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

Method CheckinTexture

editor/MegacellDialog.cpp:1047–1101  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1045}
1046
1047void CMegacellDialog::CheckinTexture(int n, int tracklock_num) {
1048 mngs_Pagelock temp_pl;
1049 int r;
1050
1051 if (!GameTextures[n].used) {
1052 mprintf(0, "Whoa, trying to save non-used texture %s!\n", GameTextures[n].name);
1053 return;
1054 }
1055
1056 strcpy(temp_pl.name, GameTextures[n].name);
1057 temp_pl.pagetype = PAGETYPE_TEXTURE;
1058
1059 r = mng_CheckIfPageOwned(&temp_pl, TableUser);
1060 if (r < 0)
1061 OutrageMessageBox(ErrorString);
1062 else if (r == 0)
1063 OutrageMessageBox(InfoString);
1064 else {
1065 strcpy(temp_pl.holder, "UNLOCKED");
1066 if (!mng_ReplacePagelock(temp_pl.name, &temp_pl)) {
1067 OutrageMessageBox(ErrorString, "Error!");
1068 mng_EraseLocker();
1069 return;
1070 } else {
1071 if (!mng_ReplacePage(GameTextures[n].name, GameTextures[n].name, n, PAGETYPE_TEXTURE, 0))
1072 OutrageMessageBox(ErrorString);
1073 else {
1074 // Save this textures bitmap to the network for all
1075
1076 std::filesystem::path fname;
1077
1078 if (GameTextures[n].flags & TF_ANIMATED) {
1079 fname = ManageGraphicsDir / GameVClips[GameTextures[n].bm_handle].name;
1080 SaveVClip(fname, GameTextures[n].bm_handle);
1081
1082 fname = LocalManageGraphicsDir / GameVClips[GameTextures[n].bm_handle].name;
1083 SaveVClip(fname, GameTextures[n].bm_handle);
1084 } else {
1085 fname = ManageGraphicsDir / GameBitmaps[GameTextures[n].bm_handle].name;
1086 bm_SaveFileBitmap(fname, GameTextures[n].bm_handle);
1087
1088 fname = LocalManageGraphicsDir / GameBitmaps[GameTextures[n].bm_handle].name;
1089 bm_SaveFileBitmap(fname, GameTextures[n].bm_handle);
1090 }
1091
1092 mprintf(0, "%s texture checked in.\n", GameTextures[n].name);
1093 int dret = mng_DeletePage(GameTextures[n].name, PAGETYPE_TEXTURE, 1);
1094
1095 ASSERT(dret == 1);
1096
1097 mng_FreeTrackLock(tracklock_num);
1098 }
1099 }
1100 }
1101}
1102
1103void CMegacellDialog::OnImportTiny() {
1104 char filename[255];

Callers

nothing calls this directly

Calls 9

mng_CheckIfPageOwnedFunction · 0.85
OutrageMessageBoxFunction · 0.85
mng_ReplacePagelockFunction · 0.85
mng_EraseLockerFunction · 0.85
mng_ReplacePageFunction · 0.85
SaveVClipFunction · 0.85
bm_SaveFileBitmapFunction · 0.85
mng_DeletePageFunction · 0.85
mng_FreeTrackLockFunction · 0.85

Tested by

no test coverage detected