From 2231cd8c39b553e1ddf4bf1388083c618b708470 Mon Sep 17 00:00:00 2001 From: Magnus Auvinen Date: Sun, 22 Jul 2007 12:01:20 +0000 Subject: various small changes --- src/game/client/game_client.cpp | 15 +++++++++++---- src/game/client/mapres_tilemap.cpp | 36 ++++++++++++++++++++++++++---------- src/game/client/menu.h | 2 +- src/game/server/game_server.cpp | 10 +++++++--- 4 files changed, 45 insertions(+), 18 deletions(-) (limited to 'src/game') diff --git a/src/game/client/game_client.cpp b/src/game/client/game_client.cpp index 511df061..7b5b69c4 100644 --- a/src/game/client/game_client.cpp +++ b/src/game/client/game_client.cpp @@ -629,7 +629,7 @@ static void render_powerup(obj_powerup *prev, obj_powerup *current) float size = 64.0f; if (current->type == POWERUP_TYPE_WEAPON) { - angle = -0.25f * pi * 2.0f; + angle = 0; //-pi/6;//-0.25f * pi * 2.0f; select_sprite(data->weapons[current->subtype%data->num_weapons].sprite_body); size = data->weapons[current->subtype%data->num_weapons].visual_size; } @@ -1213,9 +1213,16 @@ void modc_render() gfx_clear(0.65f,0.78f,0.9f); // draw the sun - { - render_sun(local_player_pos.x*0.5f, local_player_pos.y*0.5f); - } + render_sun(local_player_pos.x*0.5f, local_player_pos.y*0.5f); + + // draw backdrop + gfx_texture_set(data->images[IMAGE_BACKDROP].id); + gfx_quads_begin(); + float parallax_amount = 0.25f; + for(int x = -1; x < 3; x++) + gfx_quads_drawTL(1024*x+screen_x*parallax_amount, (screen_y)*parallax_amount+150, 1024, 1024); + gfx_quads_end(); + // render map tilemap_render(32.0f, 0); diff --git a/src/game/client/mapres_tilemap.cpp b/src/game/client/mapres_tilemap.cpp index dfc7a7f8..6038e67c 100644 --- a/src/game/client/mapres_tilemap.cpp +++ b/src/game/client/mapres_tilemap.cpp @@ -15,6 +15,10 @@ void tilemap_render(float scale, int fg) if(!map_is_loaded()) return; + + float screen_x0, screen_y0, screen_x1, screen_y1; + gfx_getscreen(&screen_x0, &screen_y0, &screen_x1, &screen_y1); + // fetch indecies int start, num; map_get_type(MAPRES_TILEMAP, &start, &num); @@ -40,23 +44,35 @@ void tilemap_render(float scale, int fg) gfx_texture_set(img_get(tmap->image)); gfx_quads_begin(); - int c = 0; float frac = (1.0f/1024.0f);//2.0f; //2.0f; float texsize = 1024.0f; float nudge = 0.5f/texsize; - for(int y = 0; y < tmap->height; y++) - for(int x = 0; x < tmap->width; x++, c++) + + int startx = (int)(screen_x0/scale) - 1; + int endx = (int)(screen_x1/scale) + 1; + int starty = (int)(screen_y0/scale) - 1; + int endy = (int)(screen_y1/scale) + 1; + 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) { - /* - 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); - */ + //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); diff --git a/src/game/client/menu.h b/src/game/client/menu.h index 0a8c1fe3..66c69953 100644 --- a/src/game/client/menu.h +++ b/src/game/client/menu.h @@ -14,4 +14,4 @@ int ui_do_check_box(void *id, float x, float y, float w, float h, int value); int do_scroll_bar_horiz(void *id, float x, float y, float width, int steps, int last_index); int do_scroll_bar_vert(void *id, float x, float y, float height, int steps, int last_index); -#endif \ No newline at end of file +#endif diff --git a/src/game/server/game_server.cpp b/src/game/server/game_server.cpp index 6d026fb4..a1f1b72e 100644 --- a/src/game/server/game_server.cpp +++ b/src/game/server/game_server.cpp @@ -10,7 +10,7 @@ data_container *data = 0x0; using namespace baselib; // --------- DEBUG STUFF --------- -const bool debug_bots = true; +const bool debug_bots = false; // --------- PHYSICS TWEAK! -------- const float ground_control_speed = 7.0f; @@ -1691,14 +1691,18 @@ void mods_init() case ITEM_ARMOR: type = POWERUP_TYPE_ARMOR; break; + case ITEM_NINJA: type = POWERUP_TYPE_NINJA; subtype = WEAPON_NINJA; break; }; - powerup *ppower = new powerup(type, subtype); - ppower->pos = vec2(it->x, it->y); + if(type != -1) + { + powerup *ppower = new powerup(type, subtype); + ppower->pos = vec2(it->x, it->y); + } } world.insert_entity(&gameobj); -- cgit 1.4.1