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

Function ObjSetRenderPolyobj

Descent3/ObjInit.cpp:635–662  ·  view source on GitHub ↗

Initialize the polygon object information for an object

Source from the content-addressed store, hash-verified

633#define NUM_PLAYER_ATTACH_POINTS 3
634// Initialize the polygon object information for an object
635void ObjSetRenderPolyobj(object *objp, int model_num, int dying_model_num) {
636 objp->render_type = RT_POLYOBJ;
637 objp->flags |= OF_POLYGON_OBJECT;
638 polyobj_info *p_info = &objp->rtype.pobj_info;
639 p_info->model_num = model_num;
640 p_info->dying_model_num = dying_model_num;
641 p_info->anim_frame = 0.0f;
642 p_info->tmap_override = -1;
643 p_info->subobj_flags = 0xFFFFFFFF;
644 p_info->multi_turret_info.num_turrets = 0;
645 p_info->multi_turret_info.keyframes = NULL;
646 p_info->multi_turret_info.last_keyframes = NULL;
647 // Initialize attach slots
648 if (model_num != -1) {
649 poly_model *pm = GetPolymodelPointer(model_num); // get also pages in
650 if (objp->attach_children != NULL) {
651 mem_free(objp->attach_children);
652 objp->attach_children = NULL;
653 }
654 if ((objp->attach_children == NULL) && pm->n_attach) {
655 objp->attach_children = (int *)mem_malloc(sizeof(int) * pm->n_attach);
656 if (objp->type == OBJ_PLAYER)
657 ASSERT(pm->n_attach >= NUM_PLAYER_ATTACH_POINTS);
658 for (int i = 0; i < pm->n_attach; i++)
659 objp->attach_children[i] = OBJECT_HANDLE_NONE;
660 }
661 }
662}
663// Initialize a player object
664// Returns 1 if ok, 0 if error
665int ObjInitPlayer(object *objp) {

Callers 6

ObjInitPlayerFunction · 0.85
ObjInitGenericFunction · 0.85
ObjInitDebrisFunction · 0.85
ObjInitMarkerFunction · 0.85
ObjInitDoorFunction · 0.85
PlayerChangeShipFunction · 0.85

Calls 1

GetPolymodelPointerFunction · 0.85

Tested by

no test coverage detected