Magic: Show a size selector

...still doesn't interact yet, but it renders!
This commit is contained in:
Bill Kendrick 2023-04-12 22:49:09 -07:00
parent bd199cf567
commit 3996edaeec

View file

@ -10531,43 +10531,59 @@ static void draw_magic(void)
if (!disable_magic_sizes) if (!disable_magic_sizes)
{ {
SDL_Surface *button_color;
int grp, cur; int grp, cur;
int down;
down = 4;
if (disable_magic_controls)
down = 2;
grp = magic_group; grp = magic_group;
cur = cur_magic[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; if (i <= magics[grp][cur].size + 1)
dest.y = btn = thumbnail(img_btn_down, xx, yy, 0);
r_ttoolopt.h + else
((most / gd_toolopt.cols + btn = thumbnail(img_btn_up, xx, yy, 0);
(TOOLOFFSET + down) / gd_toolopt.cols) * button_h);
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; SDL_FreeSurface(btn);
dest.y = SDL_FreeSurface(blnk);
r_ttoolopt.h + }
((most / gd_toolopt.cols + } else {
(TOOLOFFSET + down) / gd_toolopt.cols) * button_h); 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);
}
} }
} }