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

Method OnLevelGoalGotoItemButton

editor/levelkeypad.cpp:751–798  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

749}
750
751void levelkeypad::OnLevelGoalGotoItemButton() {
752 char type;
753 int handle;
754
755 if (Level_goals.GoalItemInfo(m_current_goal, m_current_item, LO_GET_SPECIFIED, &type, &handle, NULL)) {
756 bool valid = false;
757 vector pnt;
758 int roomnum;
759
760 MakeBOA();
761
762 switch (type) {
763 case LIT_OBJECT: {
764 object *obj = ObjGet(handle);
765 if (obj) {
766 pnt = obj->pos;
767 roomnum = obj->roomnum;
768 valid = true;
769 }
770 } break;
771 case LIT_INTERNAL_ROOM: {
772 if (handle >= 0 && handle <= Highest_room_index && Rooms[handle].used) {
773 pnt = Rooms[handle].path_pnt;
774 roomnum = handle;
775 valid = true;
776 }
777 } break;
778 case LIT_TERRAIN_CELL: {
779 if (handle >= 0 && handle < TERRAIN_WIDTH * TERRAIN_DEPTH) {
780 ComputeTerrainSegmentCenter(&pnt, handle);
781 roomnum = MAKE_ROOMNUM(handle);
782 valid = true;
783 }
784 } break;
785 }
786
787 if (valid) {
788 ObjSetPos(Viewer_object, &pnt, roomnum, NULL, false);
789 Viewer_moved = 1;
790 } else {
791 OutrageMessageBox(MBOX_OK, "Cannot move viewer: This item is not valid.");
792 }
793 } else {
794 OutrageMessageBox(MBOX_OK, "Cannot move viewer: This item is not defined.");
795 }
796
797 UpdateDialog();
798}
799
800void levelkeypad::OnKillfocusLevelGoalItemEdit() {
801 int handle;

Callers

nothing calls this directly

Calls 6

MakeBOAFunction · 0.85
ObjGetFunction · 0.85
ObjSetPosFunction · 0.85
OutrageMessageBoxFunction · 0.85
GoalItemInfoMethod · 0.80

Tested by

no test coverage detected