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

Function LoadWeaponHudImage

Descent3/weapon.cpp:582–605  ·  view source on GitHub ↗

Given a filename, loads either the bitmap or vclip found in that file. If type is not NULL, sets it to 1 if file is animation, otherwise sets it to zero

Source from the content-addressed store, hash-verified

580// Given a filename, loads either the bitmap or vclip found in that file. If type
581// is not NULL, sets it to 1 if file is animation, otherwise sets it to zero
582int LoadWeaponHudImage(char *filename, int *type) {
583 int anim = 0, bm_handle;
584 char extension[10];
585
586 int len = strlen(filename);
587
588 if (len < 4)
589 return -1;
590
591 strncpy(extension, &filename[len - 3], 5);
592
593 if ((!strnicmp("oaf", extension, 3)) || (!strnicmp("ifl", extension, 3)) || (!strnicmp("abm", extension, 3)))
594 anim = 1;
595
596 if (type != NULL)
597 *type = anim;
598
599 if (anim)
600 bm_handle = AllocLoadVClip(IGNORE_TABLE(filename), NOT_TEXTURE, 0);
601 else
602 bm_handle = bm_AllocLoadFileBitmap(IGNORE_TABLE(filename), 0);
603
604 return bm_handle;
605}
606
607// Given a weapon handle, returns that weapons discharge bitmap
608int GetWeaponFireImage(int handle, int frame) {

Callers 2

OnAddWeaponMethod · 0.85
OnLoadWeaponAnimMethod · 0.85

Calls 2

AllocLoadVClipFunction · 0.85
bm_AllocLoadFileBitmapFunction · 0.85

Tested by

no test coverage detected