OSDN Git Service

[Refactor] #38993 temp_n/x/y を pos_list 構造体に置換。 / Replace temp/x/y to pos_list structure.
authordeskull <deskull@users.sourceforge.jp>
Wed, 6 Mar 2019 13:16:38 +0000 (22:16 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Wed, 6 Mar 2019 13:16:38 +0000 (22:16 +0900)
src/externs.h
src/grid.c
src/rooms.c
src/spells2.c
src/variable.c
src/view-mainwindow.c
src/xtra2.c

index 0827a3d..3a16a03 100644 (file)
@@ -12,7 +12,7 @@
  * Note that some files have their own header files
  * (z-virt.h, z-util.h, z-form.h, term.h, random.h)
  */
-
+#include "geometry.h"
 
 /*
  * Automatically generated "variable" declarations
@@ -214,9 +214,7 @@ extern int player_egid;
 extern char player_base[32];
 extern char savefile[1024];
 extern char savefile_base[40];
-extern POSITION_IDX temp_n;
-extern POSITION temp_y[TEMP_MAX];
-extern POSITION temp_x[TEMP_MAX];
+extern pos_list tmp_pos;
 extern s16b macro__num;
 extern concptr *macro__pat;
 extern concptr *macro__act;
index f17cd87..779e3f8 100644 (file)
@@ -3331,9 +3331,9 @@ void update_lite(void)
                current_floor_ptr->grid_array[y][x].info |= (CAVE_TEMP);
 
                /* Add it to the "seen" set */
-               temp_y[temp_n] = y;
-               temp_x[temp_n] = x;
-               temp_n++;
+               tmp_pos.y[tmp_pos.n] = y;
+               tmp_pos.x[tmp_pos.n] = x;
+               tmp_pos.n++;
        }
 
        /* None left */
@@ -3491,10 +3491,10 @@ void update_lite(void)
        }
 
        /* Clear them all */
-       for (i = 0; i < temp_n; i++)
+       for (i = 0; i < tmp_pos.n; i++)
        {
-               y = temp_y[i];
-               x = temp_x[i];
+               y = tmp_pos.y[i];
+               x = tmp_pos.x[i];
 
                g_ptr = &current_floor_ptr->grid_array[y][x];
 
@@ -3509,7 +3509,7 @@ void update_lite(void)
        }
 
        /* None left */
-       temp_n = 0;
+       tmp_pos.n = 0;
 
        /* Mega-Hack -- Visual update later */
        p_ptr->update |= (PU_DELAY_VIS);
@@ -3583,15 +3583,15 @@ static void mon_lite_hack(POSITION y, POSITION x)
                }
        }
 
-       /* We trust temp_n does not exceed TEMP_MAX */
+       /* We trust tmp_pos.n does not exceed TEMP_MAX */
 
        /* New grid */
        if (!(g_ptr->info & CAVE_MNDK))
        {
                /* Save this square */
-               temp_x[temp_n] = x;
-               temp_y[temp_n] = y;
-               temp_n++;
+               tmp_pos.x[tmp_pos.n] = x;
+               tmp_pos.y[tmp_pos.n] = y;
+               tmp_pos.n++;
        }
 
        /* Darkened grid */
@@ -3669,12 +3669,12 @@ static void mon_dark_hack(POSITION y, POSITION x)
                }
        }
 
-       /* We trust temp_n does not exceed TEMP_MAX */
+       /* We trust tmp_pos.n does not exceed TEMP_MAX */
 
        /* Save this square */
-       temp_x[temp_n] = x;
-       temp_y[temp_n] = y;
-       temp_n++;
+       tmp_pos.x[tmp_pos.n] = x;
+       tmp_pos.y[tmp_pos.n] = y;
+       tmp_pos.n++;
 
        /* Darken it */
        g_ptr->info |= CAVE_MNDK;
@@ -3720,7 +3720,7 @@ void update_mon_lite(void)
        }
 
        /* Empty temp list of new squares to lite up */
-       temp_n = 0;
+       tmp_pos.n = 0;
 
        /* If a monster stops time, don't process */
        if (!current_world_ptr->timewalk_m_idx)
@@ -3893,7 +3893,7 @@ void update_mon_lite(void)
        }
 
        /* Save end of list of new squares */
-       end_temp = temp_n;
+       end_temp = tmp_pos.n;
 
        /*
         * Look at old set flags to see if there are any changes.
@@ -3930,9 +3930,9 @@ void update_mon_lite(void)
                }
 
                /* Add to end of temp array */
-               temp_x[temp_n] = fx;
-               temp_y[temp_n] = fy;
-               temp_n++;
+               tmp_pos.x[tmp_pos.n] = fx;
+               tmp_pos.y[tmp_pos.n] = fy;
+               tmp_pos.n++;
        }
 
        /* Clear the lite array */
@@ -3941,8 +3941,8 @@ void update_mon_lite(void)
        /* Copy the temp array into the lit array lighting the new squares. */
        for (i = 0; i < end_temp; i++)
        {
-               fx = temp_x[i];
-               fy = temp_y[i];
+               fx = tmp_pos.x[i];
+               fy = tmp_pos.y[i];
 
                /* We trust this grid is in bounds */
 
@@ -3977,15 +3977,15 @@ void update_mon_lite(void)
        }
 
        /* Clear the temp flag for the old lit or darken grids */
-       for (i = end_temp; i < temp_n; i++)
+       for (i = end_temp; i < tmp_pos.n; i++)
        {
                /* We trust this grid is in bounds */
 
-               current_floor_ptr->grid_array[temp_y[i]][temp_x[i]].info &= ~(CAVE_TEMP | CAVE_XTRA);
+               current_floor_ptr->grid_array[tmp_pos.y[i]][tmp_pos.x[i]].info &= ~(CAVE_TEMP | CAVE_XTRA);
        }
 
-       /* Finished with temp_n */
-       temp_n = 0;
+       /* Finished with tmp_pos.n */
+       tmp_pos.n = 0;
 
        /* Mega-Hack -- Visual update later */
        p_ptr->update |= (PU_DELAY_VIS);
@@ -4335,9 +4335,9 @@ void update_view(void)
                g_ptr->info |= (CAVE_TEMP);
 
                /* Add it to the "seen" set */
-               temp_y[temp_n] = y;
-               temp_x[temp_n] = x;
-               temp_n++;
+               tmp_pos.y[tmp_pos.n] = y;
+               tmp_pos.x[tmp_pos.n] = x;
+               tmp_pos.n++;
        }
 
        /* Start over with the "view" array */
@@ -4706,10 +4706,10 @@ void update_view(void)
        }
 
        /* Wipe the old grids, update as needed */
-       for (n = 0; n < temp_n; n++)
+       for (n = 0; n < tmp_pos.n; n++)
        {
-               y = temp_y[n];
-               x = temp_x[n];
+               y = tmp_pos.y[n];
+               x = tmp_pos.x[n];
                g_ptr = &current_floor_ptr->grid_array[y][x];
 
                /* No longer in the array */
@@ -4723,7 +4723,7 @@ void update_view(void)
        }
 
        /* None left */
-       temp_n = 0;
+       tmp_pos.n = 0;
 
        /* Mega-Hack -- Visual update later */
        p_ptr->update |= (PU_DELAY_VIS);
@@ -4819,7 +4819,7 @@ void update_flow(void)
        int flow_tail = 0;
 
        /* Paranoia -- make sure the array is empty */
-       if (temp_n) return;
+       if (tmp_pos.n) return;
 
        /* The last way-point is on the map */
        if (running && in_bounds(flow_y, flow_x))
@@ -4843,8 +4843,8 @@ void update_flow(void)
        flow_x = p_ptr->x;
 
        /* Add the player's grid to the queue */
-       temp_y[0] = p_ptr->y;
-       temp_x[0] = p_ptr->x;
+       tmp_pos.y[0] = p_ptr->y;
+       tmp_pos.x[0] = p_ptr->x;
 
        /* Now process the queue */
        while (flow_head != flow_tail)
@@ -4852,8 +4852,8 @@ void update_flow(void)
                int ty, tx;
 
                /* Extract the next entry */
-               ty = temp_y[flow_tail];
-               tx = temp_x[flow_tail];
+               ty = tmp_pos.y[flow_tail];
+               tx = tmp_pos.x[flow_tail];
 
                /* Forget that entry */
                if (++flow_tail == TEMP_MAX) flow_tail = 0;
@@ -4891,8 +4891,8 @@ void update_flow(void)
                        if (n == MONSTER_FLOW_DEPTH) continue;
 
                        /* Enqueue that entry */
-                       temp_y[flow_head] = y;
-                       temp_x[flow_head] = x;
+                       tmp_pos.y[flow_head] = y;
+                       tmp_pos.x[flow_head] = x;
 
                        /* Advance the queue */
                        if (++flow_head == TEMP_MAX) flow_head = 0;
index 5868722..49be8f6 100644 (file)
@@ -877,15 +877,15 @@ static void cave_fill(POSITION y, POSITION x)
        /*** Start Grid ***/
 
        /* Enqueue that entry */
-       temp_y[0] = y;
-       temp_x[0] = x;
+       tmp_pos.y[0] = y;
+       tmp_pos.x[0] = x;
 
        /* Now process the queue */
        while (flow_head != flow_tail)
        {
                /* Extract the next entry */
-               ty = temp_y[flow_head];
-               tx = temp_x[flow_head];
+               ty = tmp_pos.y[flow_head];
+               tx = tmp_pos.x[flow_head];
 
                /* Forget that entry */
                if (++flow_head == TEMP_MAX) flow_head = 0;
@@ -918,8 +918,8 @@ static void cave_fill(POSITION y, POSITION x)
                                        fill_data.info1, fill_data.info2, fill_data.info3))
                                {
                                        /* Enqueue that entry */
-                                       temp_y[flow_tail] = (byte_hack)j;
-                                       temp_x[flow_tail] = (byte_hack)i;
+                                       tmp_pos.y[flow_tail] = (byte_hack)j;
+                                       tmp_pos.x[flow_tail] = (byte_hack)i;
 
                                        /* Advance the queue */
                                        if (++flow_tail == TEMP_MAX) flow_tail = 0;
index 77abb1a..c24357f 100644 (file)
@@ -2191,10 +2191,10 @@ static void cave_temp_room_lite(void)
        int i;
 
        /* Clear them all */
-       for (i = 0; i < temp_n; i++)
+       for (i = 0; i < tmp_pos.n; i++)
        {
-               POSITION y = temp_y[i];
-               POSITION x = temp_x[i];
+               POSITION y = tmp_pos.y[i];
+               POSITION x = tmp_pos.x[i];
 
                grid_type *g_ptr = &current_floor_ptr->grid_array[y][x];
 
@@ -2243,7 +2243,7 @@ static void cave_temp_room_lite(void)
        }
 
        /* None left */
-       temp_n = 0;
+       tmp_pos.n = 0;
 }
 
 
@@ -2265,10 +2265,10 @@ static void cave_temp_room_unlite(void)
        int i;
 
        /* Clear them all */
-       for (i = 0; i < temp_n; i++)
+       for (i = 0; i < tmp_pos.n; i++)
        {
-               POSITION y = temp_y[i];
-               POSITION x = temp_x[i];
+               POSITION y = tmp_pos.y[i];
+               POSITION x = tmp_pos.x[i];
                int j;
 
                grid_type *g_ptr = &current_floor_ptr->grid_array[y][x];
@@ -2324,7 +2324,7 @@ static void cave_temp_room_unlite(void)
        }
 
        /* None left */
-       temp_n = 0;
+       tmp_pos.n = 0;
 }
 
 
@@ -2393,7 +2393,7 @@ static int next_to_walls_adj(POSITION cy, POSITION cx, bool (*pass_bold)(POSITIO
 
 
 /*!
- * @brief 部屋内にある一点の周囲に該当する地形数かいくつあるかをグローバル変数temp_nに返す / Aux function -- see below
+ * @brief 部屋内にある一点の周囲に該当する地形数かいくつあるかをグローバル変数tmp_pos.nに返す / Aux function -- see below
  * @param y 部屋内のy座標1点
  * @param x 部屋内のx座標1点
  * @param only_room 部屋内地形のみをチェック対象にするならば TRUE
@@ -2433,15 +2433,15 @@ static void cave_temp_room_aux(POSITION y, POSITION x, bool only_room, bool (*pa
        }
 
        /* Paranoia -- verify space */
-       if (temp_n == TEMP_MAX) return;
+       if (tmp_pos.n == TEMP_MAX) return;
 
        /* Mark the grid as "seen" */
        g_ptr->info |= (CAVE_TEMP);
 
        /* Add it to the "seen" set */
-       temp_y[temp_n] = y;
-       temp_x[temp_n] = x;
-       temp_n++;
+       tmp_pos.y[tmp_pos.n] = y;
+       tmp_pos.x[tmp_pos.n] = x;
+       tmp_pos.n++;
 }
 
 /*!
@@ -2456,7 +2456,7 @@ static bool cave_pass_lite_bold(POSITION y, POSITION x)
 }
 
 /*!
- * @brief 部屋内にある一点の周囲がいくつ光を通すかをグローバル変数temp_nに返す / Aux function -- see below
+ * @brief 部屋内にある一点の周囲がいくつ光を通すかをグローバル変数tmp_pos.nに返す / Aux function -- see below
  * @param y 指定Y座標
  * @param x 指定X座標
  * @return なし
@@ -2479,7 +2479,7 @@ static bool cave_pass_dark_bold(POSITION y, POSITION x)
 
 
 /*!
- * @brief 部屋内にある一点の周囲がいくつ射線を通すかをグローバル変数temp_nに返す / Aux function -- see below
+ * @brief 部屋内にある一点の周囲がいくつ射線を通すかをグローバル変数tmp_pos.nに返す / Aux function -- see below
  * @param y 指定Y座標
  * @param x 指定X座標
  * @return なし
@@ -2505,9 +2505,9 @@ void lite_room(POSITION y1, POSITION x1)
        cave_temp_lite_room_aux(y1, x1);
 
        /* While grids are in the queue, add their neighbors */
-       for (i = 0; i < temp_n; i++)
+       for (i = 0; i < tmp_pos.n; i++)
        {
-               x = temp_x[i], y = temp_y[i];
+               x = tmp_pos.x[i], y = tmp_pos.y[i];
 
                /* Walls get lit, but stop light */
                if (!cave_pass_lite_bold(y, x)) continue;
@@ -2550,9 +2550,9 @@ void unlite_room(POSITION y1, POSITION x1)
        cave_temp_unlite_room_aux(y1, x1);
 
        /* Spread, breadth first */
-       for (i = 0; i < temp_n; i++)
+       for (i = 0; i < tmp_pos.n; i++)
        {
-               x = temp_x[i], y = temp_y[i];
+               x = tmp_pos.x[i], y = tmp_pos.y[i];
 
                /* Walls get dark, but stop darkness */
                if (!cave_pass_dark_bold(y, x)) continue;
index 2590343..c780391 100644 (file)
@@ -11,6 +11,7 @@
  */
 
 #include "angband.h"
+#include "geometry.h"
 
 /*!
  * コピーライト情報 /
@@ -207,9 +208,8 @@ char player_base[32];
 char savefile[1024];
 char savefile_base[40];
 
-POSITION_IDX temp_n; //!< Array of grids for use by various functions (see "current_floor_ptr->grid_array.c")
-POSITION temp_y[TEMP_MAX];
-POSITION temp_x[TEMP_MAX];
+
+pos_list tmp_pos;
 
 
 /*
index ef089b8..1d74198 100644 (file)
@@ -1615,8 +1615,8 @@ void print_monster_list(TERM_LEN x, TERM_LEN y, TERM_LEN max_lines){
        int n_same = 0;
        int i;
 
-       for(i=0;i<temp_n;i++){
-               grid_type* g_ptr = &current_floor_ptr->grid_array[temp_y[i]][temp_x[i]];
+       for(i=0;i<tmp_pos.n;i++){
+               grid_type* g_ptr = &current_floor_ptr->grid_array[tmp_pos.y[i]][tmp_pos.x[i]];
                if(!g_ptr->m_idx || !current_floor_ptr->m_list[g_ptr->m_idx].ml)continue;//no mons or cannot look
                m_ptr = &current_floor_ptr->m_list[g_ptr->m_idx];
                if(is_pet(m_ptr))continue;//pet
@@ -1658,7 +1658,7 @@ void print_monster_list(TERM_LEN x, TERM_LEN y, TERM_LEN max_lines){
                        break;
                }
        }
-       if(line-y-1==max_lines && i!=temp_n){
+       if(line-y-1==max_lines && i!=tmp_pos.n){
                Term_gotoxy(x, line);
                Term_addstr(-1, TERM_WHITE, "-- and more --");
        }else{
index 153effd..728ae5f 100644 (file)
@@ -687,11 +687,11 @@ static POSITION_IDX target_pick(POSITION y1, POSITION x1, POSITION dy, POSITION
 
 
        /* Scan the locations */
-       for (i = 0; i < temp_n; i++)
+       for (i = 0; i < tmp_pos.n; i++)
        {
                /* Point 2 */
-               x2 = temp_x[i];
-               y2 = temp_y[i];
+               x2 = tmp_pos.x[i];
+               y2 = tmp_pos.y[i];
 
                /* Directed distance */
                x3 = (x2 - x1);
@@ -806,7 +806,7 @@ static void target_set_prepare(BIT_FLAGS mode)
        }
 
        /* Reset "temp" array */
-       temp_n = 0;
+       tmp_pos.n = 0;
 
        /* Scan the current panel */
        for (y = min_hgt; y <= max_hgt; y++)
@@ -826,9 +826,9 @@ static void target_set_prepare(BIT_FLAGS mode)
                        if ((mode & (TARGET_KILL)) && !target_pet && is_pet(&current_floor_ptr->m_list[g_ptr->m_idx])) continue;
 
                        /* Save the location */
-                       temp_x[temp_n] = x;
-                       temp_y[temp_n] = y;
-                       temp_n++;
+                       tmp_pos.x[tmp_pos.n] = x;
+                       tmp_pos.y[tmp_pos.n] = y;
+                       tmp_pos.n++;
                }
        }
 
@@ -847,18 +847,18 @@ static void target_set_prepare(BIT_FLAGS mode)
        }
 
        /* Sort the positions */
-       ang_sort(temp_x, temp_y, temp_n);
+       ang_sort(tmp_pos.x, tmp_pos.y, tmp_pos.n);
 
-       if (p_ptr->riding && target_pet && (temp_n > 1) && (mode & (TARGET_KILL)))
+       if (p_ptr->riding && target_pet && (tmp_pos.n > 1) && (mode & (TARGET_KILL)))
        {
                POSITION tmp;
 
-               tmp = temp_y[0];
-               temp_y[0] = temp_y[1];
-               temp_y[1] = tmp;
-               tmp = temp_x[0];
-               temp_x[0] = temp_x[1];
-               temp_x[1] = tmp;
+               tmp = tmp_pos.y[0];
+               tmp_pos.y[0] = tmp_pos.y[1];
+               tmp_pos.y[1] = tmp;
+               tmp = tmp_pos.x[0];
+               tmp_pos.x[0] = tmp_pos.x[1];
+               tmp_pos.x[1] = tmp;
        }
 }
 
@@ -1515,10 +1515,10 @@ bool target_set(BIT_FLAGS mode)
        while (!done)
        {
                /* Interesting grids */
-               if (flag && temp_n)
+               if (flag && tmp_pos.n)
                {
-                       y = temp_y[m];
-                       x = temp_x[m];
+                       y = tmp_pos.y[m];
+                       x = tmp_pos.x[m];
 
                        /* Set forcus */
                        change_panel_xy(y, x);
@@ -1596,7 +1596,7 @@ bool target_set(BIT_FLAGS mode)
                                case '*':
                                case '+':
                                {
-                                       if (++m == temp_n)
+                                       if (++m == tmp_pos.n)
                                        {
                                                m = 0;
                                                if (!expand_list) done = TRUE;
@@ -1608,7 +1608,7 @@ bool target_set(BIT_FLAGS mode)
                                {
                                        if (m-- == 0)
                                        {
-                                               m = temp_n - 1;
+                                               m = tmp_pos.n - 1;
                                                if (!expand_list) done = TRUE;
                                        }
                                        break;
@@ -1645,7 +1645,7 @@ bool target_set(BIT_FLAGS mode)
                                {
                                        if(query == same_key)
                                        {
-                                               if (++m == temp_n)
+                                               if (++m == tmp_pos.n)
                                                {
                                                        m = 0;
                                                        if (!expand_list) done = TRUE;
@@ -1669,7 +1669,7 @@ bool target_set(BIT_FLAGS mode)
                                POSITION x2 = panel_col_min;
 
                                /* Find a new monster */
-                               i = target_pick(temp_y[m], temp_x[m], ddy[d], ddx[d]);
+                               i = target_pick(tmp_pos.y[m], tmp_pos.x[m], ddy[d], ddx[d]);
 
                                /* Request to target past last interesting grid */
                                while (flag && (i < 0))
@@ -1677,8 +1677,8 @@ bool target_set(BIT_FLAGS mode)
                                        /* Note the change */
                                        if (change_panel(ddy[d], ddx[d]))
                                        {
-                                               int v = temp_y[m];
-                                               int u = temp_x[m];
+                                               int v = tmp_pos.y[m];
+                                               int u = tmp_pos.x[m];
 
                                                /* Recalculate interesting grids */
                                                target_set_prepare(mode);
@@ -1843,9 +1843,9 @@ bool target_set(BIT_FLAGS mode)
                                        bd = 999;
 
                                        /* Pick a nearby monster */
-                                       for (i = 0; i < temp_n; i++)
+                                       for (i = 0; i < tmp_pos.n; i++)
                                        {
-                                               t = distance(y, x, temp_y[i], temp_x[i]);
+                                               t = distance(y, x, tmp_pos.y[i], tmp_pos.x[i]);
 
                                                /* Pick closest */
                                                if (t < bd)
@@ -1926,7 +1926,7 @@ bool target_set(BIT_FLAGS mode)
        }
 
        /* Forget */
-       temp_n = 0;
+       tmp_pos.n = 0;
 
        /* Clear the top line */
        prt("", 0, 0);
@@ -2400,7 +2400,7 @@ static void tgt_pt_prepare(void)
        POSITION y, x;
 
        /* Reset "temp" array */
-       temp_n = 0;
+       tmp_pos.n = 0;
 
        if (!expand_list) return;
 
@@ -2413,9 +2413,9 @@ static void tgt_pt_prepare(void)
                        if (!tgt_pt_accept(y, x)) continue;
 
                        /* Save the location */
-                       temp_x[temp_n] = x;
-                       temp_y[temp_n] = y;
-                       temp_n++;
+                       tmp_pos.x[tmp_pos.n] = x;
+                       tmp_pos.y[tmp_pos.n] = y;
+                       tmp_pos.n++;
                }
        }
 
@@ -2424,7 +2424,7 @@ static void tgt_pt_prepare(void)
        ang_sort_swap = ang_sort_swap_distance;
 
        /* Sort the positions */
-       ang_sort(temp_x, temp_y, temp_n);
+       ang_sort(tmp_pos.x, tmp_pos.y, tmp_pos.n);
 }
 
 /*
@@ -2478,7 +2478,7 @@ bool tgt_pt(POSITION *x_ptr, POSITION *y_ptr)
                /* XAngband: Move cursor to stairs */
                case '>':
                case '<':
-                       if (expand_list && temp_n)
+                       if (expand_list && tmp_pos.n)
                        {
                                int dx, dy;
                                int cx = (panel_col_min + panel_col_max) / 2;
@@ -2487,9 +2487,9 @@ bool tgt_pt(POSITION *x_ptr, POSITION *y_ptr)
                                n++;
 
                                /* Skip stairs which have defferent distance */
-                               for (; n < temp_n; ++ n)
+                               for (; n < tmp_pos.n; ++ n)
                                {
-                                       grid_type *g_ptr = &current_floor_ptr->grid_array[temp_y[n]][temp_x[n]];
+                                       grid_type *g_ptr = &current_floor_ptr->grid_array[tmp_pos.y[n]][tmp_pos.x[n]];
 
                                        if (cave_have_flag_grid(g_ptr, FF_STAIRS) &&
                                            cave_have_flag_grid(g_ptr, ch == '>' ? FF_MORE : FF_LESS))
@@ -2499,7 +2499,7 @@ bool tgt_pt(POSITION *x_ptr, POSITION *y_ptr)
                                        }
                                }
 
-                               if (n == temp_n)        /* Loop out taget list */
+                               if (n == tmp_pos.n)     /* Loop out taget list */
                                {
                                        n = 0;
                                        y = p_ptr->y;
@@ -2515,8 +2515,8 @@ bool tgt_pt(POSITION *x_ptr, POSITION *y_ptr)
                                }
                                else    /* move cursor to next stair and change panel */
                                {
-                                       y = temp_y[n];
-                                       x = temp_x[n];
+                                       y = tmp_pos.y[n];
+                                       x = tmp_pos.x[n];
 
                                        dy = 2 * (y - cy) / hgt;
                                        dx = 2 * (x - cx) / wid;