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

Function DrawIntoTopoMap

editor/WireframeGrWnd.cpp:845–872  ·  view source on GitHub ↗

Lets the user draw free hand into the topographical map

Source from the content-addressed store, hash-verified

843
844// Lets the user draw free hand into the topographical map
845void DrawIntoTopoMap(int x, int y) {
846 int i, t, segx, segz;
847
848 if (KEY_STATE(KEY_LSHIFT)) {
849 int seg = theApp.wireframe_view->GetCellFromPoint(x, y);
850 if (seg < 0 || seg >= TERRAIN_WIDTH * TERRAIN_DEPTH)
851 Int3(); // get Jason
852
853 for (i = -1; i <= 1; i++) {
854 for (t = -1; t <= 1; t++) {
855 segx = seg % TERRAIN_WIDTH;
856 segz = seg / TERRAIN_WIDTH;
857
858 if ((segz + i) < 0 || segz + i >= TERRAIN_DEPTH)
859 continue;
860 if ((segx + t) < 0 || segx + t >= TERRAIN_WIDTH)
861 continue;
862
863 segz += i;
864 segx += t;
865
866 Terrain_tex_seg[Terrain_seg[(segz * TERRAIN_WIDTH) + segx].texseg_index].tex_index = D3EditState.texdlg_texture;
867 theApp.wireframe_view->DrawTerrainCell((segz * TERRAIN_WIDTH) + segx);
868 }
869 }
870 theApp.wireframe_view->Invalidate();
871 }
872}

Callers 1

OnMouseMoveMethod · 0.85

Calls 3

GetCellFromPointMethod · 0.80
DrawTerrainCellMethod · 0.80
InvalidateMethod · 0.80

Tested by

no test coverage detected