diff options
Diffstat (limited to 'src/game/client')
| -rw-r--r-- | src/game/client/mapres_tilemap.cpp | 110 | ||||
| -rw-r--r-- | src/game/client/menu.cpp | 50 |
2 files changed, 77 insertions, 83 deletions
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 <baselib/opengl.h> -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); - } diff --git a/src/game/client/menu.cpp b/src/game/client/menu.cpp index 06b65e62..1f9857a8 100644 --- a/src/game/client/menu.cpp +++ b/src/game/client/menu.cpp @@ -424,7 +424,7 @@ int ui_do_edit_box(void *id, float x, float y, float w, float h, char *str, int if (inside && ui_mouse_button(0)) { - int mx_rel = ui_mouse_x() - x; + int mx_rel = (int)(ui_mouse_x() - x); for (int i = 1; i <= len; i++) { @@ -727,6 +727,9 @@ const float row1_y = 180; const float row2_y = row1_y + 40; const float row3_y = row2_y + 40; const float row4_y = row3_y + 40; +const float row5_y = row4_y + 40; +const float row6_y = row5_y + 40; +const float row7_y = row6_y + 40; static int main_render() { @@ -873,9 +876,9 @@ static int settings_video_render_select_mode() char buf[128]; int s = 0; - if(modes[index].width == config_copy.screen_width && - modes[index].height == config_copy.screen_height && - depth == config_copy.color_depth) + if(modes[index].width == config_copy.gfx_screen_width && + modes[index].height == config_copy.gfx_screen_height && + depth == config_copy.gfx_color_depth) { s = 1; } @@ -886,9 +889,9 @@ static int settings_video_render_select_mode() column1_x, row1_y + 40 * i, 320, 32.0f, draw_teewars_button)) { // select - config_set_color_depth(&config_copy, depth); - config_set_screen_width(&config_copy, modes[index].width); - config_set_screen_height(&config_copy, modes[index].height); + config_set_gfx_color_depth(&config_copy, depth); + config_set_gfx_screen_width(&config_copy, modes[index].width); + config_set_gfx_screen_height(&config_copy, modes[index].height); screen = SCREEN_SETTINGS_VIDEO; } } @@ -898,23 +901,34 @@ static int settings_video_render_select_mode() static int settings_video_render() { - // we need to draw these bottom up, to make overlapping work correctly - ui_do_label(column1_x, row4_y + 50, "(A restart of the game is required for these settings to take effect.)", 20); - - ui_do_label(column1_x, row4_y, "V-sync:", 36); - config_set_vsync(&config_copy, ui_do_check_box(&config_copy.vsync, column2_x, row4_y + 5, 32, 32, config_copy.vsync)); - - ui_do_label(column1_x, row3_y, "Fullscreen:", 36); - config_set_fullscreen(&config_copy, ui_do_check_box(&config_copy.fullscreen, column2_x, row3_y + 5, 32, 32, config_copy.fullscreen)); - ui_do_label(column1_x, row2_y, "Mode:", 36); + ui_do_label(column1_x, row1_y, "Mode:", 36); char buf[128]; - sprintf(buf, "%dx%d %d bit", config_copy.screen_width, config_copy.screen_height, config_copy.color_depth); + sprintf(buf, "%dx%d %d bit", config_copy.gfx_screen_width, config_copy.gfx_screen_height, config_copy.gfx_color_depth); static int select_button = 0; - if(ui_do_button(&select_button, buf, 0, column2_x, row2_y, 300, 32, draw_teewars_button)) + if(ui_do_button(&select_button, buf, 0, column2_x, row1_y, 300, 32, draw_teewars_button)) screen = SCREEN_SETTINGS_VIDEO_SELECT_MODE; + // we need to draw these bottom up, to make overlapping work correctly + + ui_do_label(column1_x, row2_y, "Fullscreen:", 36); + config_set_gfx_fullscreen(&config_copy, ui_do_check_box(&config_copy.gfx_fullscreen, column3_x, row2_y + 5, 32, 32, config_copy.gfx_fullscreen)); + + ui_do_label(column1_x, row3_y, "V-sync:", 36); + config_set_gfx_vsync(&config_copy, ui_do_check_box(&config_copy.gfx_vsync, column3_x, row3_y + 5, 32, 32, config_copy.gfx_vsync)); + + ui_do_label(column1_x, row4_y, "Quality Textures:", 36); + config_set_gfx_texture_quality(&config_copy, ui_do_check_box(&config_copy.gfx_texture_quality, column3_x, row4_y + 5, 32, 32, config_copy.gfx_texture_quality)); + + ui_do_label(column1_x, row5_y, "Textures Compression:", 36); + config_set_gfx_texture_compression(&config_copy, ui_do_check_box(&config_copy.gfx_texture_compression, column3_x, row5_y + 5, 32, 32, config_copy.gfx_texture_compression)); + + ui_do_label(column1_x, row6_y, "High Detail:", 36); + config_set_gfx_high_detail(&config_copy, ui_do_check_box(&config_copy.gfx_high_detail, column3_x, row6_y + 5, 32, 32, config_copy.gfx_high_detail)); + + ui_do_label(column1_x, row6_y + 50, "(A restart of the game is required for these settings to take effect.)", 20); + return 0; } |