aboutsummaryrefslogtreecommitdiff
path: root/undead.c
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>2014-01-07 18:21:24 +0000
committerSimon Tatham <anakin@pobox.com>2014-01-07 18:21:24 +0000
commitf41f4c0cc8dfdcbdf2f9145e39a38257ac4526c6 (patch)
tree61f00f4d896e2edc8d27d544e47b504ab130443b /undead.c
parent3a35ed219583c456b84615cfdd3b62a1499c8fcf (diff)
downloadpuzzles-f41f4c0cc8dfdcbdf2f9145e39a38257ac4526c6.zip
puzzles-f41f4c0cc8dfdcbdf2f9145e39a38257ac4526c6.tar.gz
puzzles-f41f4c0cc8dfdcbdf2f9145e39a38257ac4526c6.tar.bz2
puzzles-f41f4c0cc8dfdcbdf2f9145e39a38257ac4526c6.tar.xz
Position the monster counts more sensibly.
Now they're centred within the spare grid cell at the top of the playing area, rather than being too far down so that the bottoms of the monster drawings collide with the background of the path clues at large magnification. Also, while I'm here, I've simplified the code that draws the monster counts, by moving duplicated parts out of the branches of the 'if'. (In fact, almost all of this patch is cleanup; the only substantive change is the one that changes dy from TILESIZE/2 to TILESIZE/4.) [originally from svn r10108]
Diffstat (limited to 'undead.c')
-rw-r--r--undead.c28
1 files changed, 13 insertions, 15 deletions
diff --git a/undead.c b/undead.c
index 629de81..7d68b81 100644
--- a/undead.c
+++ b/undead.c
@@ -2273,12 +2273,11 @@ static void draw_monster(drawing *dr, game_drawstate *ds, int x, int y,
static void draw_monster_count(drawing *dr, game_drawstate *ds,
const game_state *state, int c, int hflash) {
- int dx,dy,dh;
+ int dx,dy;
char buf[8];
char bufm[8];
- dy = TILESIZE/2;
- dh = TILESIZE;
+ dy = TILESIZE/4;
dx = BORDER+(ds->w+2)*TILESIZE/2+TILESIZE/4;
switch (c) {
case 0:
@@ -2297,22 +2296,21 @@ static void draw_monster_count(drawing *dr, game_drawstate *ds,
break;
}
+ draw_rect(dr, dx-2*TILESIZE/3, dy, 3*TILESIZE/2, TILESIZE,
+ COL_BACKGROUND);
if (!ds->ascii) {
- draw_rect(dr,dx-2*TILESIZE/3,dy,3*TILESIZE/2,dh,COL_BACKGROUND);
- draw_monster(dr,ds,dx-TILESIZE/3,dh,2*TILESIZE/3,hflash,1<<c);
- draw_text(dr,dx,dh,FONT_VARIABLE,dy-1,ALIGN_HLEFT|ALIGN_VCENTRE,
- (state->count_errors[c] ? COL_ERROR : hflash ? COL_FLASH : COL_TEXT), buf);
- draw_update(dr,dx-2*TILESIZE/3,dy,3*TILESIZE/2,dh);
- }
- else {
- draw_rect(dr,dx-2*TILESIZE/3,dy,3*TILESIZE/2,dh,COL_BACKGROUND);
- draw_text(dr,dx-TILESIZE/3,dh,FONT_VARIABLE,dy-1,
+ draw_monster(dr, ds, dx-TILESIZE/3, dy+TILESIZE/2,
+ 2*TILESIZE/3, hflash, 1<<c);
+ } else {
+ draw_text(dr, dx-TILESIZE/3,dy+TILESIZE/2,FONT_VARIABLE,TILESIZE/2,
ALIGN_HCENTRE|ALIGN_VCENTRE,
hflash ? COL_FLASH : COL_TEXT, bufm);
- draw_text(dr,dx,dh,FONT_VARIABLE,dy-1,ALIGN_HLEFT|ALIGN_VCENTRE,
- (state->count_errors[c] ? COL_ERROR : hflash ? COL_FLASH : COL_TEXT), buf);
- draw_update(dr,dx-2*TILESIZE/3,dy,3*TILESIZE/2,dh);
}
+ draw_text(dr, dx, dy+TILESIZE/2, FONT_VARIABLE, TILESIZE/2,
+ ALIGN_HLEFT|ALIGN_VCENTRE,
+ (state->count_errors[c] ? COL_ERROR :
+ hflash ? COL_FLASH : COL_TEXT), buf);
+ draw_update(dr, dx-2*TILESIZE/3, dy, 3*TILESIZE/2, TILESIZE);
return;
}