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

Function ObjGet

Descent3/object.cpp:3251–3272  ·  view source on GitHub ↗

Retruns a pointer to an object given its handle. Returns NULL if object no longer exists.

Source from the content-addressed store, hash-verified

3249
3250// Retruns a pointer to an object given its handle. Returns NULL if object no longer exists.
3251object *ObjGet(int handle) {
3252 if (handle == OBJECT_HANDLE_NONE)
3253 return NULL;
3254
3255 if (handle == OBJECT_HANDLE_BAD) {
3256 Int3();
3257 return NULL;
3258 }
3259
3260 int objnum = handle & HANDLE_OBJNUM_MASK;
3261 object *objp;
3262
3263 ASSERT((handle & HANDLE_COUNT_MASK) != 0); // count == 0 means never-used object
3264 ASSERT(objnum < MAX_OBJECTS);
3265
3266 objp = &Objects[objnum];
3267
3268 if ((objp->type != OBJ_NONE) && (objp->handle == handle))
3269 return objp;
3270 else
3271 return NULL;
3272}
3273
3274void GetObjectPointInWorld(vector *dest, object *obj, int subnum, int vertnum) {
3275 poly_model *pm = &Poly_models[obj->rtype.pobj_info.model_num];

Callers 15

BeginSoundFrameMethod · 0.85
ComputePlayInfoMethod · 0.85
DoPhysLinkedFrameFunction · 0.85
CheckLevelNamesFunction · 0.85
OnCommandMethod · 0.85
OnGotoMethod · 0.85
OnDeleteMethod · 0.85
OnAddScriptMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected