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

Function CreateCustomFireballObject

Descent3/fireball.cpp:866–892  ·  view source on GitHub ↗

TODO: MTS: used only in this file. Creates a fireball object with a custom texture/vclip

Source from the content-addressed store, hash-verified

864// TODO: MTS: used only in this file.
865// Creates a fireball object with a custom texture/vclip
866int CreateCustomFireballObject(vector *pos, int fireball_num, int tex_handle, int roomnum) {
867 int objnum;
868 ASSERT(GameTextures[tex_handle].used >= 1);
869
870 if (roomnum == -1)
871 return -1;
872 objnum = ObjCreate(OBJ_FIREBALL, fireball_num, roomnum, pos, NULL);
873 if (objnum < 0) {
874 mprintf(0, "Couldn't create fireball object!\n");
875 return -1;
876 }
877 Objects[objnum].size = Fireballs[fireball_num].size;
878 Objects[objnum].flags |= OF_USES_LIFELEFT;
879 float lifetime;
880 // If this is an animated texture then use the life of the vclip
881 if (GameTextures[tex_handle].flags & TF_ANIMATED) {
882 PageInVClip(GameTextures[tex_handle].bm_handle);
883 vclip *vc = &GameVClips[GameTextures[tex_handle].bm_handle];
884 lifetime = vc->frame_time * vc->num_frames;
885 } else // Just set it to half a second
886 lifetime = .5;
887 Objects[objnum].lifeleft = lifetime;
888 Objects[objnum].lifetime = lifetime;
889 Objects[objnum].ctype.blast_info.bm_handle = tex_handle;
890
891 return objnum;
892}
893//----------------------------------
894// Putting in some explosion stuff
895//----------------------------------

Callers

nothing calls this directly

Calls 2

ObjCreateFunction · 0.85
PageInVClipFunction · 0.85

Tested by

no test coverage detected