mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-05 15:48:19 +00:00
various small changes
This commit is contained in:
parent
bcb97cfdf6
commit
2231cd8c39
BIN
data/demo.map
BIN
data/demo.map
Binary file not shown.
|
@ -139,6 +139,10 @@ images {
|
|||
char_default {
|
||||
filename "data/char_teefault.png"
|
||||
}
|
||||
|
||||
backdrop {
|
||||
filename "data/mountain_paralax.png"
|
||||
}
|
||||
}
|
||||
|
||||
particles {
|
||||
|
|
|
@ -45,4 +45,4 @@ public:
|
|||
void pump_network();
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -35,7 +35,10 @@ static opengl::vertex_buffer vertex_buffer;
|
|||
//static int screen_height = 600;
|
||||
static float rotation = 0;
|
||||
static int quads_drawing = 0;
|
||||
|
||||
static float screen_x0 = 0;
|
||||
static float screen_y0 = 0;
|
||||
static float screen_x1 = 0;
|
||||
static float screen_y1 = 0;
|
||||
|
||||
struct texture_holder
|
||||
{
|
||||
|
@ -415,11 +418,23 @@ void gfx_clear(float r, float g, float b)
|
|||
|
||||
void gfx_mapscreen(float tl_x, float tl_y, float br_x, float br_y)
|
||||
{
|
||||
screen_x0 = tl_x;
|
||||
screen_y0 = tl_y;
|
||||
screen_x1 = br_x;
|
||||
screen_y1 = br_y;
|
||||
mat4 mat;
|
||||
mat.ortho(tl_x, br_x, br_y, tl_y, 1.0f, 10.f);
|
||||
opengl::matrix_projection(&mat);
|
||||
}
|
||||
|
||||
void gfx_getscreen(float *tl_x, float *tl_y, float *br_x, float *br_y)
|
||||
{
|
||||
*tl_x = screen_x0;
|
||||
*tl_y = screen_y0;
|
||||
*br_x = screen_x1;
|
||||
*br_y = screen_y1;
|
||||
}
|
||||
|
||||
void gfx_setoffset(float x, float y)
|
||||
{
|
||||
//const float scale = 0.75f;
|
||||
|
|
|
@ -750,6 +750,8 @@ int client_tickspeed();
|
|||
void gfx_pretty_text(float x, float y, float size, const char *text);
|
||||
float gfx_pretty_text_width(float size, const char *text);
|
||||
|
||||
void gfx_getscreen(float *tl_x, float *tl_y, float *br_x, float *br_y);
|
||||
|
||||
void mods_message(int msg, int client_id);
|
||||
void modc_message(int msg);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
#endif
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue