Retruns a pointer to an object given its handle. Returns NULL if object no longer exists.
| 3249 | |
| 3250 | // Retruns a pointer to an object given its handle. Returns NULL if object no longer exists. |
| 3251 | object *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 | |
| 3274 | void GetObjectPointInWorld(vector *dest, object *obj, int subnum, int vertnum) { |
| 3275 | poly_model *pm = &Poly_models[obj->rtype.pobj_info.model_num]; |
no outgoing calls
no test coverage detected