Rename shape_*_x/y variables

Variables for pointer positions while drawing a shape were
center-centric ("shape_ctr_x/y" and "shape_outer_x/y").
Renamed them to be more general.
This commit is contained in:
Bill Kendrick 2020-08-15 00:58:44 -07:00
parent 2159f8616b
commit 1bf15f2d27

View file

@ -22,7 +22,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
(See COPYING.txt)
June 14, 2002 - August 14, 2020
June 14, 2002 - August 15, 2020
*/
@ -2218,7 +2218,7 @@ int cur_thing;
static void mainloop(void)
{
int done, val_x, val_y, valhat_x, valhat_y, new_x, new_y,
shape_tool_mode, shape_ctr_x, shape_ctr_y, shape_outer_x, shape_outer_y, old_stamp_group, which;
shape_tool_mode, shape_start_x, shape_start_y, shape_current_x, shape_current_y, old_stamp_group, which;
int num_things;
int *thing_scroll;
int do_draw, max;
@ -2256,10 +2256,10 @@ static void mainloop(void)
old_x = 0;
old_y = 0;
which = 0;
shape_ctr_x = 0;
shape_ctr_y = 0;
shape_outer_x = 0;
shape_outer_y = 0;
shape_start_x = 0;
shape_start_y = 0;
shape_current_x = 0;
shape_current_y = 0;
shape_tool_mode = SHAPE_TOOL_MODE_DONE;
button_down = 0;
last_cursor_blink = cur_toggle_count = 0;
@ -4344,8 +4344,8 @@ static void mainloop(void)
rec_undo_buffer();
shape_ctr_x = old_x;
shape_ctr_y = old_y;
shape_start_x = old_x;
shape_start_y = old_y;
shape_tool_mode = SHAPE_TOOL_MODE_STRETCH;
@ -4366,8 +4366,8 @@ static void mainloop(void)
reset_brush_counter();
playsound(screen, 1, SND_LINE_END, 1, event.button.x, SNDDIST_NEAR);
do_shape(shape_ctr_x, shape_ctr_y, shape_outer_x, shape_outer_y,
shape_rotation(shape_ctr_x, shape_ctr_y,
do_shape(shape_start_x, shape_start_y, shape_current_x, shape_current_y,
shape_rotation(shape_start_x, shape_start_y,
event.button.x - r_canvas.x, event.button.y - r_canvas.y), 1);
shape_tool_mode = SHAPE_TOOL_MODE_DONE;
@ -4977,31 +4977,31 @@ static void mainloop(void)
{
/* Now we can rotate the shape... */
shape_outer_x = event.button.x - r_canvas.x;
shape_outer_y = event.button.y - r_canvas.y;
shape_current_x = event.button.x - r_canvas.x;
shape_current_y = event.button.y - r_canvas.y;
if (!simple_shapes && !shape_no_rotate[cur_shape])
{
shape_tool_mode = SHAPE_TOOL_MODE_ROTATE;
shape_radius =
sqrt((shape_ctr_x - shape_outer_x) * (shape_ctr_x - shape_outer_x) +
(shape_ctr_y - shape_outer_y) * (shape_ctr_y - shape_outer_y));
sqrt((shape_start_x - shape_current_x) * (shape_start_x - shape_current_x) +
(shape_start_y - shape_current_y) * (shape_start_y - shape_current_y));
SDL_WarpMouse(shape_outer_x + 96, shape_ctr_y);
SDL_WarpMouse(shape_current_x + 96, shape_start_y);
do_setcursor(cursor_rotate);
/* Erase stretchy XOR: */
if (abs(shape_ctr_x - shape_outer_x) > 15 || abs(shape_ctr_y - shape_outer_y) > 15)
do_shape(shape_ctr_x, shape_ctr_y, old_x, old_y, 0, 0);
if (abs(shape_start_x - shape_current_x) > 15 || abs(shape_start_y - shape_current_y) > 15)
do_shape(shape_start_x, shape_start_y, old_x, old_y, 0, 0);
/* Make an initial rotation XOR to be erased: */
do_shape(shape_ctr_x, shape_ctr_y,
shape_outer_x, shape_outer_y,
shape_rotation(shape_ctr_x, shape_ctr_y, shape_outer_x, shape_outer_y), 0);
do_shape(shape_start_x, shape_start_y,
shape_current_x, shape_current_y,
shape_rotation(shape_start_x, shape_start_y, shape_current_x, shape_current_y), 0);
playsound(screen, 1, SND_LINE_START, 1, event.button.x, SNDDIST_NEAR);
draw_tux_text(TUX_BORED, TIP_SHAPE_NEXT, 1);
@ -5017,7 +5017,7 @@ static void mainloop(void)
playsound(screen, 1, SND_LINE_END, 1, event.button.x, SNDDIST_NEAR);
do_shape(shape_ctr_x, shape_ctr_y, shape_outer_x, shape_outer_y, 0, 1);
do_shape(shape_start_x, shape_start_y, shape_current_x, shape_current_y, 0, 1);
SDL_Flip(screen);
@ -5030,8 +5030,8 @@ static void mainloop(void)
reset_brush_counter();
playsound(screen, 1, SND_LINE_END, 1, event.button.x, SNDDIST_NEAR);
do_shape(shape_ctr_x, shape_ctr_y, shape_outer_x, shape_outer_y,
shape_rotation(shape_ctr_x, shape_ctr_y,
do_shape(shape_start_x, shape_start_y, shape_current_x, shape_current_y,
shape_rotation(shape_start_x, shape_start_y,
event.button.x - r_canvas.x, event.button.y - r_canvas.y), 1);
shape_tool_mode = SHAPE_TOOL_MODE_DONE;
@ -5332,15 +5332,15 @@ static void mainloop(void)
if (shape_tool_mode == SHAPE_TOOL_MODE_STRETCH)
{
do_shape(shape_ctr_x, shape_ctr_y, old_x, old_y, 0, 0);
do_shape(shape_start_x, shape_start_y, old_x, old_y, 0, 0);
do_shape(shape_ctr_x, shape_ctr_y, new_x, new_y, 0, 0);
do_shape(shape_start_x, shape_start_y, new_x, new_y, 0, 0);
/* FIXME: Fix update shape function! */
/* update_shape(shape_ctr_x, old_x, new_x,
shape_ctr_y, old_y, new_y,
/* update_shape(shape_start_x, old_x, new_x,
shape_start_y, old_y, new_y,
shape_locked[cur_shape]); */
SDL_Flip(screen);
@ -5522,12 +5522,12 @@ static void mainloop(void)
}
else if (cur_tool == TOOL_SHAPES && shape_tool_mode == SHAPE_TOOL_MODE_ROTATE)
{
do_shape(shape_ctr_x, shape_ctr_y,
shape_outer_x, shape_outer_y, shape_rotation(shape_ctr_x, shape_ctr_y, old_x, old_y), 0);
do_shape(shape_start_x, shape_start_y,
shape_current_x, shape_current_y, shape_rotation(shape_start_x, shape_start_y, old_x, old_y), 0);
do_shape(shape_ctr_x, shape_ctr_y,
shape_outer_x, shape_outer_y, shape_rotation(shape_ctr_x, shape_ctr_y, new_x, new_y), 0);
do_shape(shape_start_x, shape_start_y,
shape_current_x, shape_current_y, shape_rotation(shape_start_x, shape_start_y, new_x, new_y), 0);
/* FIXME: Do something less intensive! */