Magic: Show a size selector
...still doesn't interact yet, but it renders!
This commit is contained in:
parent
bd199cf567
commit
3996edaeec
1 changed files with 70 additions and 54 deletions
|
|
@ -10531,43 +10531,59 @@ static void draw_magic(void)
|
|||
|
||||
if (!disable_magic_sizes)
|
||||
{
|
||||
SDL_Surface *button_color;
|
||||
int grp, cur;
|
||||
int down;
|
||||
|
||||
down = 4;
|
||||
if (disable_magic_controls)
|
||||
down = 2;
|
||||
|
||||
|
||||
grp = magic_group;
|
||||
cur = cur_magic[magic_group];
|
||||
|
||||
if (magics[grp][cur].sizes > 1) {
|
||||
int i, xx, yy;
|
||||
float x_per, y_per;
|
||||
SDL_Surface * blnk, * btn;
|
||||
|
||||
/* FIXME */
|
||||
x_per = (float) r_ttoolopt.w / (float) magics[grp][cur].sizes;
|
||||
y_per = (float) button_h / (float) (magics[grp][cur].sizes + 1);
|
||||
|
||||
button_color = img_btn_off; /* Unavailable */
|
||||
for (i = 1; i < magics[grp][cur].sizes + 1; i++)
|
||||
{
|
||||
xx = ceil(x_per);
|
||||
yy = ceil(y_per * (float) i);
|
||||
|
||||
dest.x = WINDOW_WIDTH - r_ttoolopt.w;
|
||||
dest.y =
|
||||
r_ttoolopt.h +
|
||||
((most / gd_toolopt.cols +
|
||||
(TOOLOFFSET + down) / gd_toolopt.cols) * button_h);
|
||||
if (i <= magics[grp][cur].size + 1)
|
||||
btn = thumbnail(img_btn_down, xx, yy, 0);
|
||||
else
|
||||
btn = thumbnail(img_btn_up, xx, yy, 0);
|
||||
|
||||
SDL_BlitSurface(button_color, NULL, screen, &dest);
|
||||
blnk = thumbnail(img_btn_off, xx, button_h - yy, 0);
|
||||
|
||||
/* FIXME: Check for NULL! */
|
||||
|
||||
/* FIXME */
|
||||
dest.x = (WINDOW_WIDTH - r_ttoolopt.w) + ((i - 1) * x_per);
|
||||
dest.y = (button_h * buttons_tall + r_ttools.h) - button_h;
|
||||
SDL_BlitSurface(blnk, NULL, screen, &dest);
|
||||
|
||||
button_color = img_btn_off; /* Unavailable */
|
||||
dest.x = (WINDOW_WIDTH - r_ttoolopt.w) + ((i - 1) * x_per);
|
||||
dest.y = (button_h * buttons_tall + r_ttools.h) - (y_per * i);
|
||||
SDL_BlitSurface(btn, NULL, screen, &dest);
|
||||
|
||||
dest.x = WINDOW_WIDTH - button_w;
|
||||
dest.y =
|
||||
r_ttoolopt.h +
|
||||
((most / gd_toolopt.cols +
|
||||
(TOOLOFFSET + down) / gd_toolopt.cols) * button_h);
|
||||
SDL_FreeSurface(btn);
|
||||
SDL_FreeSurface(blnk);
|
||||
}
|
||||
} else {
|
||||
SDL_Surface * wide_button_off;
|
||||
|
||||
SDL_BlitSurface(button_color, NULL, screen, &dest);
|
||||
/* Sizing not supported, just draw a big blank */
|
||||
|
||||
wide_button_off = thumbnail(img_btn_off, r_ttoolopt.w, button_h, 0);
|
||||
|
||||
/* FIXME: Check for NULL! */
|
||||
|
||||
dest.x = WINDOW_WIDTH - r_ttoolopt.w;
|
||||
dest.y = (button_h * buttons_tall + r_ttools.h) - button_h;
|
||||
SDL_BlitSurface(wide_button_off, NULL, screen, &dest);
|
||||
|
||||
SDL_FreeSurface(wide_button_off);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue