X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;ds=sidebyside;f=tools%2Fdunger%2Fsrc%2Flview.c;h=8e0ee270b891e35426931e3ea0d713e219de664d;hb=8d36df2b04dfa5d747dd21ae2ddf7d349524674a;hp=16af53093b5faa9e34467dd1754d1e20d2b459c1;hpb=576f9aa6409354c392d2ff661d61dbf6d967a8f8;p=vrlugburz diff --git a/tools/dunger/src/lview.c b/tools/dunger/src/lview.c index 16af530..8e0ee27 100644 --- a/tools/dunger/src/lview.c +++ b/tools/dunger/src/lview.c @@ -46,10 +46,36 @@ void zoom_lview(float dz) cellsz = xsz > ysz ? ysz : xsz; } -void lview_mouse(int x, int y) +static int bnstate[8]; + +void lview_mbutton(int bn, int press, int x, int y) { float hsz = cellsz / 2.0f; sel = pos_to_cell(x + hsz - vpx, vph - y + hsz - vpy, 0, 0); + bnstate[bn] = press; + + if(press) { + if(!sel) return; + if(bn == 0) { + sel->type = CELL_WALK; + } else if(bn == 2) { + sel->type = CELL_SOLID; + } + } +} + +void lview_mouse(int x, int y) +{ + float hsz = cellsz / 2.0f; + if(!(sel = pos_to_cell(x + hsz - vpx, vph - y + hsz - vpy, 0, 0))) { + return; + } + + if(bnstate[0]) { + sel->type = CELL_WALK; + } else if(bnstate[2]) { + sel->type = CELL_SOLID; + } } #define LTHICK 0.5f