/*! \brief Use item on selected target * * Do target selection for using an item and then use it. * * \param pp Item index */ static void camp_item_targetting(int pp) { int t1, tg, z; t1 = g_inv[pp][0]; if (items[t1].use == USE_NOT || items[t1].use > USE_CAMP_INF) { return; } if (items[t1].tgt == TGT_NONE || items[t1].tgt > TGT_ALLY_ALL) { return; } while (1) { update_equipstats(); tg = select_any_player(items[t1].tgt - 1, items[t1].icon, items[t1].name); if (tg > -1) { z = item_effects(0, tg, t1); if (z == 0) { play_effect(SND_BAD, 128); } else { revert_equipstats(); if (z == 1) { play_effect(SND_ITEM, 128); select_any_player(3, 0, ""); } if (items[t1].use != USE_ANY_INF && items[t1].use != USE_CAMP_INF) { remove_item(pp, 1); } return; } } else { return; } kq_yield(); } }
/*! \brief Draw a player's status screen * * Draw the verbose stats of a single player. * \param fighter_index - Character to draw (index in pidx array) */ static void status_screen(size_t fighter_index) { int stop = 0; int bc = 0; unsigned int rect_fill_amount = 0, curr_fill, res_index, stats_y, equipment_index; size_t pidx_index, stats_index; play_effect(SND_MENU, 128); pidx_index = pidx[fighter_index]; update_equipstats(); while (!stop) { check_animation(); // Redraw the map, clearing any menus under this new window drawmap(); // Box around top-left square menubox(double_buffer, xofs, 16 + yofs, 18, 5, BLUE); draw_playerstat(double_buffer, pidx_index, 8 + xofs, 24 + yofs); // Box around bottom-left square menubox(double_buffer, xofs, 72 + yofs, 18, 17, BLUE); print_font(double_buffer, 8 + xofs, 80 + yofs, _("Exp:"), FGOLD); sprintf(strbuf, "%d", party[pidx_index].xp); print_font(double_buffer, 152 - (strlen(strbuf) * 8) + xofs, 80 + yofs, strbuf, FNORMAL); print_font(double_buffer, 8 + xofs, 88 + yofs, _("Next:"), FGOLD); // TT: Does this mean we can only level up to 50? if (party[pidx_index].lvl < 50) { sprintf(strbuf, "%d", party[pidx_index].next - party[pidx_index].xp); } else { sprintf(strbuf, "%d", 0); } print_font(double_buffer, 152 - (strlen(strbuf) * 8) + xofs, 88 + yofs, strbuf, FNORMAL); print_font(double_buffer, 8 + xofs, 104 + yofs, _("Strength"), FGOLD); print_font(double_buffer, 8 + xofs, 112 + yofs, _("Agility"), FGOLD); print_font(double_buffer, 8 + xofs, 120 + yofs, _("Vitality"), FGOLD); print_font(double_buffer, 8 + xofs, 128 + yofs, _("Intellect"), FGOLD); print_font(double_buffer, 8 + xofs, 136 + yofs, _("Sagacity"), FGOLD); print_font(double_buffer, 8 + xofs, 144 + yofs, _("Speed"), FGOLD); print_font(double_buffer, 8 + xofs, 152 + yofs, _("Aura"), FGOLD); print_font(double_buffer, 8 + xofs, 160 + yofs, _("Spirit"), FGOLD); // Blank space on display of 16 pixels print_font(double_buffer, 8 + xofs, 176 + yofs, _("Attack"), FGOLD); print_font(double_buffer, 8 + xofs, 184 + yofs, _("Hit"), FGOLD); print_font(double_buffer, 8 + xofs, 192 + yofs, _("Defense"), FGOLD); print_font(double_buffer, 8 + xofs, 200 + yofs, _("Evade"), FGOLD); print_font(double_buffer, 8 + xofs, 208 + yofs, _("Mag.Def"), FGOLD); for (stats_index = 0; stats_index < NUM_STATS; stats_index++) { // Coordinates of stats on display stats_y = stats_index * 8 + 104; // Add an extra 8-pixel space to separate these from the others if (stats_index > A_SPI) { stats_y += 8; } print_font(double_buffer, 96 + xofs, stats_y + yofs, "$", FGOLD); sprintf(strbuf, "%d", fighter[fighter_index].stats[stats_index]); print_font(double_buffer, 152 - (strlen(strbuf) * 8) + xofs, stats_y + yofs, strbuf, FNORMAL); } menubox(double_buffer, 160 + xofs, 16 + yofs, 18, 16, BLUE); print_font(double_buffer, 168 + xofs, 24 + yofs, _("Earth"), FNORMAL); print_font(double_buffer, 168 + xofs, 32 + yofs, _("Black"), FNORMAL); print_font(double_buffer, 168 + xofs, 40 + yofs, _("Fire"), FNORMAL); print_font(double_buffer, 168 + xofs, 48 + yofs, _("Thunder"), FNORMAL); print_font(double_buffer, 168 + xofs, 56 + yofs, _("Air"), FNORMAL); print_font(double_buffer, 168 + xofs, 64 + yofs, _("White"), FNORMAL); print_font(double_buffer, 168 + xofs, 72 + yofs, _("Water"), FNORMAL); print_font(double_buffer, 168 + xofs, 80 + yofs, _("Ice"), FNORMAL); print_font(double_buffer, 168 + xofs, 88 + yofs, _("Poison"), FNORMAL); print_font(double_buffer, 168 + xofs, 96 + yofs, _("Blind"), FNORMAL); print_font(double_buffer, 168 + xofs, 104 + yofs, _("Charm"), FNORMAL); print_font(double_buffer, 168 + xofs, 112 + yofs, _("Paralyze"), FNORMAL); print_font(double_buffer, 168 + xofs, 120 + yofs, _("Petrify"), FNORMAL); print_font(double_buffer, 168 + xofs, 128 + yofs, _("Silence"), FNORMAL); print_font(double_buffer, 168 + xofs, 136 + yofs, _("Sleep"), FNORMAL); print_font(double_buffer, 168 + xofs, 144 + yofs, _("Time"), FNORMAL); for (res_index = 0; res_index < R_TOTAL_RES; res_index++) { rectfill(double_buffer, 240 + xofs, res_index * 8 + 25 + yofs, 310 + xofs, res_index * 8 + 31 + yofs, 3); if (fighter[fighter_index].res[res_index] < 0) { bc = 18; // bright red, meaning WEAK defense rect_fill_amount = abs(fighter[fighter_index].res[res_index]); } else if (fighter[fighter_index].res[res_index] >= 0 && fighter[fighter_index].res[res_index] <= 10) { bc = 34; // bright green, meaning so-so defense rect_fill_amount = fighter[fighter_index].res[res_index]; } else if (fighter[fighter_index].res[res_index] > 10) { bc = 50; // bright blue, meaning STRONG defense rect_fill_amount = fighter[fighter_index].res[res_index] - 10; } if (rect_fill_amount > 0) { for (curr_fill = 0; curr_fill < rect_fill_amount; curr_fill++) { rectfill(double_buffer, curr_fill * 7 + 241 + xofs, res_index * 8 + 26 + yofs, curr_fill * 7 + 246 + xofs, res_index * 8 + 30 + yofs, bc + curr_fill); } } } menubox(double_buffer, 160 + xofs, 160 + yofs, 18, 6, BLUE); for (equipment_index = 0; equipment_index < NUM_EQUIPMENT; equipment_index++) { draw_icon(double_buffer, items[party[pidx_index].eqp[equipment_index]].icon, 168 + xofs, equipment_index * 8 + 168 + yofs); print_font(double_buffer, 176 + xofs, equipment_index * 8 + 168 + yofs, items[party[pidx_index].eqp[equipment_index]].name, FNORMAL); } blit2screen(xofs, yofs); readcontrols(); if (PlayerInput.left && fighter_index > 0) { unpress(); fighter_index--; pidx_index = pidx[fighter_index]; play_effect(SND_MENU, 128); } if (PlayerInput.right && fighter_index < numchrs - 1) { unpress(); fighter_index++; pidx_index = pidx[fighter_index]; play_effect(SND_MENU, 128); } if (PlayerInput.bctrl) { unpress(); play_effect(SND_MENU, 128); stop = 1; } } }