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

Function PlaceGroupTerrain

editor/Group.cpp:438–463  ·  view source on GitHub ↗

Place the given group at the specified terrain cell The function merely causes the group to be drawn in the editor, allowing the user to line it up before attaching it. The function AttachGroup() must be called to do the actual attachment. Parameters: cellnum - where to place the group g - the group to place

Source from the content-addressed store, hash-verified

436// Parameters: cellnum - where to place the group
437// g - the group to place
438void PlaceGroupTerrain(int cellnum, group *g, bool align_to_terrain) {
439 // Clear the placed room, if one exists
440 Placed_room = -1;
441
442 // Set globals
443 Placed_group = g;
444 Placed_room_angle = 0;
445 Placed_baseroomp = NULL;
446
447 if (align_to_terrain)
448 Placed_room_orient.fvec = TerrainNormals[MAX_TERRAIN_LOD - 1][cellnum].normal1;
449 else
450 Placed_room_orient.fvec = Identity_matrix.uvec;
451
452 // Compute attach point on terrain
453 ComputeTerrainSegmentCenter(&Placed_room_attachpoint, cellnum);
454
455 // Compute attach points on face
456 ComputeCenterPointOnFace(&Placed_room_origin, &g->rooms[g->attachroom], g->attachface);
457
458 // Compute initial orientation matrix
459 ComputePlacedRoomMatrix();
460
461 // Set the flag
462 State_changed = 1;
463}
464
465// Attach the already-placed group
466void AttachGroup() {

Callers 1

OnEditPlaceTerrainMethod · 0.85

Calls 3

ComputeCenterPointOnFaceFunction · 0.85
ComputePlacedRoomMatrixFunction · 0.85

Tested by

no test coverage detected