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
| 436 | // Parameters: cellnum - where to place the group |
| 437 | // g - the group to place |
| 438 | void 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 |
| 466 | void AttachGroup() { |
no test coverage detected