Skip to content

Commit

Permalink
Made the function that follows the DF window actually follow using th…
Browse files Browse the repository at this point in the history
…e center of the view, instead of the center of the worldsegment, which is more useful.

Signed-off-by: Japa Illo <japa.mala.illo@gmail.com>
  • Loading branch information
RosaryMala committed Feb 22, 2012
1 parent ce5ec6c commit 6a22417
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 10 deletions.
15 changes: 8 additions & 7 deletions GUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,18 +173,19 @@ ALLEGRO_COLOR getDayShade(int hour, int tick)

void ScreenToPoint(int x,int y,int &x1, int &y1, int &z1)
{ //assume z of 0
x-=al_get_bitmap_width(al_get_target_bitmap()) / 2;
y-=al_get_bitmap_height(al_get_target_bitmap()) / 2;
x-=config.screenWidth / 2;
y-=config.screenHeight / 2;
x/=config.scale;
y/=config.scale;
x+=al_get_bitmap_width(al_get_target_bitmap()) / 2;
y+=al_get_bitmap_height(al_get_target_bitmap()) / 2; x-=TILEWIDTH/2;
x+=config.screenWidth / 2;
y+=config.screenHeight / 2;
x-=TILEWIDTH/2;
y+=TILEWIDTH/2;
z1 = -3;
y+= z1*BLOCKHEIGHT/2;
//y-=BLOCKHEIGHT;
x+=TILEWIDTH>>1;
int offx = al_get_bitmap_width(al_get_target_bitmap()) /2;
int offx = config.screenWidth /2;
int offy = (-20)-(BLOCKHEIGHT * config.lift_segment_offscreen);
y-=offy;
x-=offx;
Expand Down Expand Up @@ -1331,8 +1332,8 @@ void draw_particle_cloud(int count, float centerX, float centerY, float rangeX,
{
for(int i = 0;i < count;i++)
{
float drawx = centerX + ((((float)rand() / RAND_MAX) - 0.5) * rangeX);
float drawy = centerY + ((((float)rand() / RAND_MAX) - 0.5) * rangeY);
float drawx = centerX + ((((float)rand() / RAND_MAX) - 0.5) * rangeX * config.scale);
float drawy = centerY + ((((float)rand() / RAND_MAX) - 0.5) * rangeY * config.scale);
al_draw_tinted_bitmap(sprite, tint, drawx, drawy, 0);
}
}
7 changes: 4 additions & 3 deletions MapLoading.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1239,9 +1239,10 @@ void FollowCurrentDFCenter()
{
Pos->getWindowSize(viewsizex,viewsizey);
Pos->getViewCoords(newviewx,newviewy,newviewz);

parms.x = newviewx + (viewsizex/2) - (config.segmentSize.x / 2) + config.viewXoffset;
parms.y = newviewy + (viewsizey/2) - (config.segmentSize.y / 2) + config.viewYoffset;
int screenx, screeny, screenz;
ScreenToPoint(config.screenWidth/2, config.screenHeight/2, screenx, screeny, screenz);
parms.x = newviewx + (viewsizex/2) - screenx + config.viewXoffset;
parms.y = newviewy + (viewsizey/2) - screeny + config.viewYoffset;
parms.z = newviewz + config.viewZoffset + 1;
}
else
Expand Down
2 changes: 2 additions & 0 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,8 @@ static void main_loop(ALLEGRO_DISPLAY * display, ALLEGRO_EVENT_QUEUE *queue, ALL
ALLEGRO_BITMAP *bb = al_get_backbuffer(al_get_current_display());
int w = al_get_bitmap_width(bb);
int h = al_get_bitmap_height(bb);
config.screenHeight = h;
config.screenWidth = w;
WriteErr("backbuffer w, h: %d, %d\n", w, h);
}
#endif
Expand Down
Binary file modified resources/Effect_web.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 6a22417

Please sign in to comment.