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

Function msafe_GetValue

Descent3/multisafe.cpp:724–1259  ·  view source on GitHub ↗

Gets a value for the calling party

Source from the content-addressed store, hash-verified

722
723// Gets a value for the calling party
724void msafe_GetValue(int type, msafe_struct *mstruct) {
725 object *objp;
726 switch (type) {
727 case MSAFE_SHOW_ENABLED_CONTROLS:
728 objp = ObjGet(mstruct->objhandle);
729 if (objp && (objp->type == OBJ_PLAYER))
730 mstruct->state = Hud_show_controls;
731 else
732 mstruct->state = false;
733 break;
734 break;
735 case MSAFE_OBJECT_PLAYER_CMASK:
736 objp = ObjGet(mstruct->objhandle);
737 if (objp && (objp->type == OBJ_PLAYER))
738 mstruct->control_mask = Players[objp->id].controller_bitflags;
739 else
740 mstruct->control_mask = 0;
741 break;
742 case MSAFE_OBJECT_POS:
743 objp = ObjGet(mstruct->objhandle);
744 if (!objp)
745 mstruct->pos = Zero_vector;
746 else
747 mstruct->pos = objp->pos;
748 break;
749 case MSAFE_OBJECT_ORIENT:
750 objp = ObjGet(mstruct->objhandle);
751 if (!objp)
752 mstruct->orient = Identity_matrix;
753 else
754 mstruct->orient = objp->orient;
755 break;
756 case MSAFE_OBJECT_ROOMNUM:
757 objp = ObjGet(mstruct->objhandle);
758 if (!objp)
759 mstruct->roomnum = -1;
760 else
761 mstruct->roomnum = objp->roomnum;
762 break;
763 case MSAFE_OBJECT_WORLD_POSITION:
764 objp = ObjGet(mstruct->objhandle);
765 if (!objp) {
766 mstruct->pos = Zero_vector;
767 mstruct->orient = Identity_matrix;
768 mstruct->roomnum = -1;
769 } else {
770 mstruct->orient = objp->orient;
771 mstruct->roomnum = objp->roomnum;
772 mstruct->pos = objp->pos;
773 }
774 break;
775 case MSAFE_OBJECT_VELOCITY:
776 objp = ObjGet(mstruct->objhandle);
777 if (!objp || (objp->movement_type != MT_WALKING && objp->movement_type != MT_PHYSICS))
778 mstruct->velocity = Zero_vector;
779 else
780 mstruct->velocity = objp->mtype.phys_info.velocity;
781 break;

Callers 2

osipf_PlayerValueFunction · 0.85
osipf_IsShipEnabledFunction · 0.85

Calls 15

ObjGetFunction · 0.85
VALIDATE_OBJECTFunction · 0.85
ObjGetUltimateParentFunction · 0.85
ObjGetLightInfoFunction · 0.85
DoorwayLockedFunction · 0.85
DoorwayOpenableFunction · 0.85
TriggerGetStateFunction · 0.85
VALIDATE_ROOMFunction · 0.85
VALIDATE_ROOM_PORTALFunction · 0.85
PlayerIsShipAllowedFunction · 0.85
FindWeaponNameFunction · 0.85
get_guidebot_nameMethod · 0.80

Tested by

no test coverage detected