*** store_org.c Fri Nov 16 00:07:37 2007 --- store.c Fri Nov 16 10:29:37 2007 *************** *** 300,305 **** --- 300,311 ---- }; + static int get_items_per_page() + { + int w, h; + Term_get_size(&w, &h); + return h-6-2-5;/*6:top, 1:more, 1:money, 5:commands*/ + } /* * Successful haggle. *************** *** 2218,2231 **** int maxwid = 75; /* Get the item */ o_ptr = &st_ptr->stock[pos]; /* Get the "offset" */ ! i = (pos % 12); /* Label it, clear the line --(-- */ ! (void)sprintf(out_val, "%c) ", I2A(i)); prt(out_val, i+6, 0); cur_col = 3; --- 2224,2248 ---- int maxwid = 75; + int w, h; + int ipp; + /* Get Screen size*/ + Term_get_size(&w, &h); + ipp = get_items_per_page(); + /* Get the item */ o_ptr = &st_ptr->stock[pos]; + /* Get the "offset" */ ! i = (pos-store_top) % ipp; /* Label it, clear the line --(-- */ ! if(i<12){ ! (void)sprintf(out_val, "%c) ", I2A(i)); ! }else{ ! strcpy(out_val, " ) "); ! } prt(out_val, i+6, 0); cur_col = 3; *************** *** 2248,2254 **** /* Describe an item in the home */ if ((cur_store_num == STORE_HOME) || (cur_store_num == STORE_MUSEUM)) { ! maxwid = 75; /* Leave room for weights, if necessary -DRS- */ if (show_weights) maxwid -= 10; --- 2265,2271 ---- /* Describe an item in the home */ if ((cur_store_num == STORE_HOME) || (cur_store_num == STORE_MUSEUM)) { ! maxwid = w;/*extend width*/ /* Leave room for weights, if necessary -DRS- */ if (show_weights) maxwid -= 10; *************** *** 2265,2274 **** int wgt = o_ptr->weight; #ifdef JP sprintf(out_val, "%3d.%1d kg", lbtokg1(wgt) , lbtokg2(wgt) ); ! put_str(out_val, i+6, 67); #else (void)sprintf(out_val, "%3d.%d lb", wgt / 10, wgt % 10); ! put_str(out_val, i+6, 68); #endif } --- 2282,2291 ---- int wgt = o_ptr->weight; #ifdef JP sprintf(out_val, "%3d.%1d kg", lbtokg1(wgt) , lbtokg2(wgt) ); ! put_str(out_val, i+6, w-9); #else (void)sprintf(out_val, "%3d.%d lb", wgt / 10, wgt % 10); ! put_str(out_val, i+6, w-9); #endif } *************** *** 2354,2362 **** static void display_inventory(void) { int i, k; ! /* Display the next 12 items */ ! for (k = 0; k < 12; k++) { /* Do not display "dead" items */ if (store_top + k >= st_ptr->stock_num) break; --- 2371,2382 ---- static void display_inventory(void) { int i, k; + int ipp; + + ipp = get_items_per_page(); ! /* Display the next items */ ! for (k = 0; k < ipp; k++) { /* Do not display "dead" items */ if (store_top + k >= st_ptr->stock_num) break; *************** *** 2366,2372 **** } /* Erase the extra lines and the "more" prompt */ ! for (i = k; i < 13; i++) prt("", i + 6, 0); /* Assume "no current page" */ #ifdef JP --- 2386,2392 ---- } /* Erase the extra lines and the "more" prompt */ ! for (i = k; i < ipp+1; i++) prt("", i + 6, 0); /* Assume "no current page" */ #ifdef JP *************** *** 2405,2420 **** static void store_prt_gold(void) { char out_val[64]; #ifdef JP ! prt("手持ちのお金: ", 19, 53); #else ! prt("Gold Remaining: ", 19, 53); #endif sprintf(out_val, "%9ld", (long)p_ptr->au); ! prt(out_val, 19, 68); } --- 2425,2442 ---- static void store_prt_gold(void) { char out_val[64]; + int w, h; + Term_get_size(&w, &h); #ifdef JP ! prt("手持ちのお金: ", h-6, w-25); #else ! prt("Gold Remaining: ", h-6, w-25); #endif sprintf(out_val, "%9ld", (long)p_ptr->au); ! prt(out_val, h-6, w-10); } *************** *** 2424,2429 **** --- 2446,2452 ---- static void display_store(void) { char buf[80]; + int w, h; /* Clear screen */ *************** *** 2451,2460 **** /* If showing weights, show label */ if (show_weights) { #ifdef JP ! put_str("重さ", 5, 72); #else ! put_str("Weight", 5, 70); #endif } --- 2474,2484 ---- /* If showing weights, show label */ if (show_weights) { + Term_get_size(&w, &h); #ifdef JP ! put_str("重さ", 5, w-5); #else ! put_str("Weight", 5, w-7); #endif } *************** *** 4380,4385 **** --- 4404,4410 ---- */ static void store_process_command(void) { + int ipp = get_items_per_page(); #ifdef ALLOW_REPEAT /* TNB */ /* Handle repeating the last command */ *************** *** 4772,4777 **** --- 4797,4803 ---- int i; cave_type *c_ptr; bool need_redraw_store_inv; /* To redraw missiles damage and prices in store */ + int w,h,row; /* Access the player grid */ *************** *** 4871,4888 **** /* Interact with player */ while (!leave_store) { /* Hack -- Clear line 1 */ prt("", 1, 0); /* Clear */ ! clear_from(20); /* Basic commands */ #ifdef JP ! prt(" ESC) 建物から出る", 21, 0); #else ! prt(" ESC) Exit from Building.", 21, 0); #endif --- 4897,4916 ---- /* Interact with player */ while (!leave_store) { + Term_get_size(&w, &h); /* Hack -- Clear line 1 */ prt("", 1, 0); /* Clear */ ! row = h-5;/* use 5lines for commands */ ! clear_from(row); /* Basic commands */ #ifdef JP ! prt(" ESC) 建物から出る", row+1, 0); #else ! prt(" ESC) Exit from Building.", row+1, 0); #endif *************** *** 4890,4900 **** if (st_ptr->stock_num > 12) { #ifdef JP ! prt(" -)前ページ", 22, 0); ! prt(" スペース) 次ページ", 23, 0); #else ! prt(" -) Previous page", 22, 0); ! prt(" SPACE) Next page", 23, 0); #endif } --- 4918,4928 ---- if (st_ptr->stock_num > 12) { #ifdef JP ! prt(" -)前ページ", row+2, 0); ! prt(" スペース) 次ページ", row+3, 0); #else ! prt(" -) Previous page", row+2, 0); ! prt(" SPACE) Next page", row+3, 0); #endif } *************** *** 4903,4915 **** if (cur_store_num == STORE_HOME) { #ifdef JP ! prt("g) アイテムを取る", 21, 27); ! prt("d) アイテムを置く", 22, 27); ! prt("x) 家のアイテムを調べる", 23,27); ! #else ! prt("g) Get an item.", 21, 27); ! prt("d) Drop an item.", 22, 27); ! prt("x) eXamine an item in the home.", 23,27); #endif } --- 4931,4943 ---- if (cur_store_num == STORE_HOME) { #ifdef JP ! prt("g) アイテムを取る", row+1, 27); ! prt("d) アイテムを置く", row+2, 27); ! prt("x) 家のアイテムを調べる", row+3,27); ! #else ! prt("g) Get an item.", row+1, 27); ! prt("d) Drop an item.", row+2, 27); ! prt("x) eXamine an item in the home.", row+3,27); #endif } *************** *** 4917,4929 **** else if (cur_store_num == STORE_MUSEUM) { #ifdef JP ! prt("d) アイテムを置く", 21, 27); ! prt("r) アイテムの展示をやめる", 22, 27); ! prt("x) 博物館のアイテムを調べる", 23, 27); ! #else ! prt("d) Drop an item.", 21, 27); ! prt("r) order to Remove an item.", 22, 27); ! prt("x) eXamine an item in the museum.", 23, 27); #endif } --- 4945,4957 ---- else if (cur_store_num == STORE_MUSEUM) { #ifdef JP ! prt("d) アイテムを置く", row+1, 27); ! prt("r) アイテムの展示をやめる", row+2, 27); ! prt("x) 博物館のアイテムを調べる", row+3, 27); ! #else ! prt("d) Drop an item.", row+1, 27); ! prt("r) order to Remove an item.", row+2, 27); ! prt("x) eXamine an item in the museum.", row+3, 27); #endif } *************** *** 4931,4976 **** else { #ifdef JP ! prt("p) 商品を買う", 21, 30); ! prt("s) アイテムを売る", 22, 30); ! prt("x) 商品を調べる", 23,30); ! #else ! prt("p) Purchase an item.", 21, 30); ! prt("s) Sell an item.", 22, 30); ! prt("x) eXamine an item in the shop", 23,30); #endif } #ifdef JP /* 基本的なコマンドの追加表示 */ ! prt("i/e) 持ち物/装備の一覧", 21, 56); if (rogue_like_commands) { ! prt("w/T) 装備する/はずす", 22, 56); } else { ! prt("w/t) 装備する/はずす", 22, 56); } #else ! prt("i/e) Inventry/Equipment list", 21, 56); if (rogue_like_commands) { ! prt("w/T) Wear/Take off equipment", 22, 56); } else { ! prt("w/t) Wear/Take off equipment", 22, 56); } #endif /* Prompt */ #ifdef JP ! prt("コマンド:", 20, 0); #else ! prt("You may: ", 20, 0); #endif --- 4959,5004 ---- else { #ifdef JP ! prt("p) 商品を買う", row+1, 30); ! prt("s) アイテムを売る", row+2, 30); ! prt("x) 商品を調べる", row+3,30); ! #else ! prt("p) Purchase an item.", row+1, 30); ! prt("s) Sell an item.", row+2, 30); ! prt("x) eXamine an item in the shop", row+3,30); #endif } #ifdef JP /* 基本的なコマンドの追加表示 */ ! prt("i/e) 持ち物/装備の一覧", row+1, 56); if (rogue_like_commands) { ! prt("w/T) 装備する/はずす", row+2, 56); } else { ! prt("w/t) 装備する/はずす", row+2, 56); } #else ! prt("i/e) Inventry/Equipment list", row+1, 56); if (rogue_like_commands) { ! prt("w/T) Wear/Take off equipment", row+2, 56); } else { ! prt("w/t) Wear/Take off equipment", row+2, 56); } #endif /* Prompt */ #ifdef JP ! prt("コマンド:", row+0, 0); #else ! prt("You may: ", row+0, 0); #endif