From 7699e4b400fef04e9353302b8fd253bf7b2c8cc2 Mon Sep 17 00:00:00 2001 From: Magnus Auvinen Date: Sun, 29 Jul 2007 15:55:04 +0000 Subject: removed the batch functions as it did next to nothing. changed some of the default values. cleaned up some of the config variables. added options in the menu to control gfx quality of the game. --- src/game/client/mapres_tilemap.cpp | 110 +++++++++++++++---------------------- 1 file changed, 45 insertions(+), 65 deletions(-) (limited to 'src/game/client/mapres_tilemap.cpp') diff --git a/src/game/client/mapres_tilemap.cpp b/src/game/client/mapres_tilemap.cpp index 6f61e656..032238bf 100644 --- a/src/game/client/mapres_tilemap.cpp +++ b/src/game/client/mapres_tilemap.cpp @@ -6,16 +6,8 @@ #include -void *batches[32] = {0}; - int tilemap_init() { - for(int i = 0; i < 32; i++) - if(batches[i]) - { - gfx_destoy_batch(batches[i]); - batches[i] = 0; - } return 0; } @@ -47,69 +39,57 @@ void tilemap_render(float scale, int fg) continue; gfx_texture_set(img_get(tmap->image)); - if(!batches[t]) - { - gfx_quads_begin(); - - int starty = (int)(screen_y0/scale)-1; - int startx = (int)(screen_x0/scale)-1; - int endy = (int)(screen_y1/scale)+1; - int endx = (int)(screen_x1/scale)+1; - - float frac = (1.0f/1024.0f);//2.0f; //2.0f; - float texsize = 1024.0f; - float nudge = 0.5f/texsize; - int border = 24; - for(int y = starty; y < endy; y++) - for(int x = startx; x < endx; x++) + gfx_quads_begin(); + + int starty = (int)(screen_y0/scale)-1; + int startx = (int)(screen_x0/scale)-1; + int endy = (int)(screen_y1/scale)+1; + int endx = (int)(screen_x1/scale)+1; + + float frac = (1.0f/1024.0f);//2.0f; //2.0f; + float texsize = 1024.0f; + float nudge = 0.5f/texsize; + for(int y = starty; y < endy; y++) + for(int x = startx; x < endx; x++) + { + int mx = x; + int my = y; + if(mx<0) mx = 0; + if(mx>=tmap->width) mx = tmap->width-1; + if(my<0) my = 0; + if(my>=tmap->height) my = tmap->height-1; + + int c = mx + my*tmap->width; + + unsigned char d = data[c*2]; + if(d) { - int mx = x; - int my = y; - if(mx<0) mx = 0; - if(mx>=tmap->width) mx = tmap->width-1; - if(my<0) my = 0; - if(my>=tmap->height) my = tmap->height-1; + /* + gfx_quads_setsubset( + (d%16)/16.0f*s+frac, + (d/16)/16.0f*s+frac, + ((d%16)/16.0f+1.0f/16.0f)*s-frac, + ((d/16)/16.0f+1.0f/16.0f)*s-frac); + */ - int c = mx + my*tmap->width; - - unsigned char d = data[c*2]; - if(d) - { - /* - gfx_quads_setsubset( - (d%16)/16.0f*s+frac, - (d/16)/16.0f*s+frac, - ((d%16)/16.0f+1.0f/16.0f)*s-frac, - ((d/16)/16.0f+1.0f/16.0f)*s-frac); - */ - - int tx = d%16; - int ty = d/16; - int px0 = tx*(1024/16); - int py0 = ty*(1024/16); - int px1 = (tx+1)*(1024/16)-1; - int py1 = (ty+1)*(1024/16)-1; + int tx = d%16; + int ty = d/16; + int px0 = tx*(1024/16); + int py0 = ty*(1024/16); + int px1 = (tx+1)*(1024/16)-1; + int py1 = (ty+1)*(1024/16)-1; - gfx_quads_setsubset( - nudge + px0/texsize+frac, - nudge + py0/texsize+frac, - nudge + px1/texsize-frac, - nudge + py1/texsize-frac); + gfx_quads_setsubset( + nudge + px0/texsize+frac, + nudge + py0/texsize+frac, + nudge + px1/texsize-frac, + nudge + py1/texsize-frac); - gfx_quads_drawTL(x*scale, y*scale, scale, scale); - } + gfx_quads_drawTL(x*scale, y*scale, scale, scale); } - - gfx_quads_end(); - //batches[t] = gfx_quads_create_batch(); - } + } - //gfx_quads_draw_batch(batches[t]); - //glCallList(lists_start+t); + gfx_quads_end(); } } - - //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); - } -- cgit 1.4.1