MCPcopy Create free account
hub / github.com/Meridian59/Meridian59 / SelectObjectsInBox

Function SelectObjectsInBox

roomedit/source/objects.cpp:303–417  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

301*/
302
303SelPtr SelectObjectsInBox (int objtype, SHORT x0, SHORT y0, SHORT x1, SHORT y1)
304{
305 SHORT n, m;
306 SelPtr list;
307
308 list = NULL;
309 if (x1 < x0)
310 {
311 n = x0; x0 = x1; x1 = n;
312 }
313 if (y1 < y0)
314 {
315 n = y0; y0 = y1; y1 = n;
316 }
317
318 switch (objtype)
319 {
320 case OBJ_THINGS:
321 for (n = 0; n < NumThings; n++)
322 {
323 SHORT xpos = Things[ n].xpos;
324 SHORT ypos = Things[ n].ypos;
325 if (xpos >= x0 && xpos <= x1 && ypos >= y0 && ypos <= y1)
326 {
327 SelectObject (&list, n);
328 }
329 }
330 break;
331
332 case OBJ_VERTEXES:
333 for (n = 0; n < NumVertexes; n++)
334 {
335 SHORT x = Vertexes[ n].x;
336 SHORT y = Vertexes[ n].y;
337 if (x >= x0 && x <= x1 && y >= y0 && y <= y1)
338 {
339 SelectObject( &list, n);
340 }
341 }
342 break;
343
344 case OBJ_LINEDEFS:
345 for (n = 0; n < NumLineDefs; n++)
346 {
347 SHORT x, y;
348 /* the two ends of the line must be in the box */
349 m = LineDefs[n].start;
350 assert (m >= 0 && m < NumVertexes);
351 x = Vertexes[ m].x;
352 y = Vertexes[ m].y;
353 if (x < x0 || x > x1 || y < y0 || y > y1)
354 {
355 continue;
356 }
357 m = LineDefs[n].end;
358 assert (m >= 0 && m < NumVertexes);
359 x = Vertexes[ m].x;
360 y = Vertexes[ m].y;

Callers 1

EvLButtonUpMethod · 0.85

Calls 2

SelectObjectFunction · 0.85
UnSelectObjectFunction · 0.85

Tested by

no test coverage detected