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

Function bm_ChangeEndName

bitmap/bitmain.cpp:653–678  ·  view source on GitHub ↗

gets the filename from a path, plus appends our .ogf extension

Source from the content-addressed store, hash-verified

651}
652// gets the filename from a path, plus appends our .ogf extension
653void bm_ChangeEndName(const char *src, char *dest) {
654 uint32_t i, limit;
655 int last = -1;
656 int curnum = -1;
657 char namedest[256 + 16];
658 char path[256], ext[256], filename[256];
659
660 ddio_SplitPath(src, path, filename, ext);
661 limit = BITMAP_NAME_LEN - 7;
662 // Make sure we don't go over our name length limit
663 filename[limit] = 0;
664Start:
665 if (curnum != -1)
666 snprintf(namedest, sizeof(namedest), "%s%d", filename, curnum);
667 else
668 strcpy(namedest, filename);
669 // Now, make sure there are no other bitmaps with this name
670 strcat(namedest, ".ogf");
671 if ((i = bm_FindBitmapName(namedest)) != -1) {
672 curnum++;
673 // This name is already taken. Try same name with different number
674 // appended
675 goto Start;
676 }
677 strcpy(dest, namedest);
678}
679// Checks to see if this file is a kind we can read
680int bm_GetFileType(CFILE *infile, const char *dest) {
681 char iffcheck[4];

Callers 5

OnImportTinyMethod · 0.85
OnImportSkyMethod · 0.85
OnImportSkyBandMethod · 0.85
bm_AllocLoadFileBitmapFunction · 0.85

Calls 2

bm_FindBitmapNameFunction · 0.85
ddio_SplitPathFunction · 0.50

Tested by

no test coverage detected