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

Method OnRButtonDown

editor/TextureGrWnd.cpp:1163–1335  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1161void CTextureGrWnd::OnMouseMove(UINT nFlags, CPoint point) { CWnd::OnMouseMove(nFlags, point); }
1162
1163void CTextureGrWnd::OnRButtonDown(UINT nFlags, CPoint point) {
1164 int n = D3EditState.current_megacell;
1165 int newobjnum = -1;
1166 bool do_popup = false;
1167
1168 TexGrStartOpenGL();
1169
1170 if (Editor_view_mode == VM_TERRAIN) {
1171 TSearch_seg = -1;
1172 TSearch_on = 1;
1173 TSearch_x = point.x;
1174 TSearch_y = point.y;
1175 TSearch_found_type = -1;
1176
1177 StartEditorFrame(m_grViewport, &Viewer_object->pos, &Viewer_object->orient, D3_DEFAULT_ZOOM);
1178 RenderTerrain(0);
1179 PostRender(Viewer_object->roomnum);
1180 EndEditorFrame();
1181 TSearch_on = 0;
1182 if (TSearch_found_type == TSEARCH_FOUND_TERRAIN) {
1183 if (nFlags & MK_SHIFT) {
1184 int w = Megacells[n].width;
1185 int h = Megacells[n].height;
1186
1187 for (int i = 0; i < h; i++) {
1188 for (int t = 0; t < w; t++) {
1189 int terrain_x = (TSearch_seg % TERRAIN_WIDTH) + t;
1190 int terrain_z = (TSearch_seg / TERRAIN_WIDTH) - i;
1191 int mx, my;
1192
1193 if (terrain_x < 0 || terrain_x >= TERRAIN_WIDTH)
1194 continue;
1195 if (terrain_z < 0 || terrain_z >= TERRAIN_DEPTH)
1196 continue;
1197
1198 if (D3EditState.randomize_megacell) {
1199 mx = rand() % w;
1200 my = rand() % h;
1201 } else {
1202 mx = t;
1203 my = i;
1204 }
1205
1206 TV_changed = 1;
1207 }
1208 }
1209 }
1210 if (nFlags & MK_CONTROL) {
1211 int x, z, i, t;
1212
1213 for (i = 0; i < TERRAIN_DEPTH * TERRAIN_WIDTH; i++) {
1214 if (TerrainSelected[i]) {
1215 x = i % TERRAIN_WIDTH;
1216 z = i / TERRAIN_WIDTH;
1217
1218 break;
1219 }
1220 }

Callers

nothing calls this directly

Calls 5

StartEditorFrameFunction · 0.85
RenderTerrainFunction · 0.85
PostRenderFunction · 0.85
EndEditorFrameFunction · 0.85
SelectObjectFunction · 0.85

Tested by

no test coverage detected