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

Function SelectNextCameraView

Descent3/GameLoop.cpp:1022–1100  ·  view source on GitHub ↗

Selects the next mode for this view

Source from the content-addressed store, hash-verified

1020
1021// Selects the next mode for this view
1022void SelectNextCameraView(int window) {
1023 int current = Camera_view_mode[window];
1024
1025 // If the window has gone away because there's no object, then the current state is none
1026 if (GetSmallViewer(window) == OBJECT_HANDLE_NONE)
1027 current = CV_NONE;
1028
1029 switch (current) {
1030 case CV_NONE:
1031 Camera_view_mode[window] = CV_REARVIEW;
1032 CreateSmallView(window, Player_object->handle, SVF_REARVIEW, 0.0, D3_DEFAULT_ZOOM, -1, TXT_VIEW_REAR);
1033 if (window == 0)
1034 Current_pilot.lrearview_enabled = true; // set to true.
1035 else if (window == 2)
1036 Current_pilot.rrearview_enabled = true;
1037 break;
1038
1039 case CV_REARVIEW: {
1040 object *objp = ObjGet(Buddy_handle[Player_num]);
1041 if (window == 0)
1042 Current_pilot.lrearview_enabled = false; // leaving rearview
1043 else if (window == 2)
1044 Current_pilot.rrearview_enabled = false;
1045
1046 if (objp && objp->type == OBJ_ROBOT) { // Not hidden
1047 Camera_view_mode[window] = CV_GUIDEBOT;
1048 CreateSmallView(window, objp->handle, 0, 0.0, D3_DEFAULT_ZOOM, -1, TXT_VIEW_GUIDEBOT);
1049 break;
1050 }
1051 // If no GB, then fall into next case
1052 }
1053 case CV_GUIDEBOT:
1054 case CV_MARKER1:
1055 case CV_MARKER2:
1056 case CV_MARKER3:
1057 case CV_MARKER4:
1058 case CV_MARKER5:
1059 case CV_MARKER6:
1060 case CV_MARKER7:
1061 case CV_MARKER8: {
1062 if (window == 0)
1063 Current_pilot.lrearview_enabled = false; // leaving rearview
1064 else if (window == 2)
1065 Current_pilot.rrearview_enabled = false;
1066
1067 if (Players[Player_num].num_markers > 0) {
1068 int num = (current == CV_GUIDEBOT) ? 0 : (current - CV_MARKER1) + 1;
1069 int max = (Game_mode & GM_MULTI) ? 2 : 8; // Why no symbolic constants? Ask Jason.
1070 int id = Player_num * 2 + num;
1071
1072 if (num < max) {
1073 int i;
1074
1075 // Search for the marker
1076 for (i = 0; i <= Highest_object_index; i++) {
1077 if ((Objects[i].type == OBJ_MARKER) && (Objects[i].id == id))
1078 break;
1079 }

Callers 1

ProcessNormalKeyFunction · 0.85

Calls 4

GetSmallViewerFunction · 0.85
CreateSmallViewFunction · 0.85
ObjGetFunction · 0.85
CloseSmallViewFunction · 0.85

Tested by

no test coverage detected