/* * Helper function for 'player_birth()'. * * See "display_player" for screen layout code. */ static bool player_birth_aux(void) { /* Ask questions */ if (!player_birth_aux_1()) return (FALSE); /* Point-based stats */ if (!player_birth_aux_2()) return (FALSE); /* Point-based skills */ if (!gain_skills()) return (FALSE); /* Choose sex */ if (!get_sex()) return (FALSE); /* Roll for history */ if (!get_history()) return (FALSE); /* Roll for age/height/weight */ if (!get_ahw()) return (FALSE); /* Get a name, prepare savefile */ if (!get_name()) return (FALSE); // Reset the number of artefacts p_ptr->artefacts = 0; /* Accept */ return (TRUE); }
/* * Get the Age, Height and Weight. */ static bool get_ahw(void) { char prompt[50]; char line[70]; char query2; int loopagain = TRUE; // hack to see whether we are opening an old player file bool roll_ahw = !p_ptr->age; //put_str("(a)ccept age/height/weight, (r)eroll, (m)anually enter ", 0, 0); while (loopagain == TRUE) { if (roll_ahw) { /*get the random age/height/weight, display for approval. */ get_ahw_aux(); } else { roll_ahw = TRUE; } /* Display the player */ display_player(0); // Highlight relevant info display_player_xtra_info(1); /* Prompt */ Term_putstr(QUESTION_COL, INSTRUCT_ROW + 1, -1, TERM_SLATE, "Enter accept age/height/weight"); Term_putstr(QUESTION_COL, INSTRUCT_ROW + 2, -1, TERM_SLATE, "Space reroll"); Term_putstr(QUESTION_COL, INSTRUCT_ROW + 3, -1, TERM_SLATE, " m manually enter"); /* Hack - highlight the key names */ Term_putstr(QUESTION_COL, INSTRUCT_ROW + 1, - 1, TERM_L_WHITE, "Enter"); Term_putstr(QUESTION_COL, INSTRUCT_ROW + 2, - 1, TERM_L_WHITE, "Space"); Term_putstr(QUESTION_COL + 4, INSTRUCT_ROW + 3, - 1, TERM_L_WHITE, "m"); /* Move the cursor */ Term_gotoxy(0, INSTRUCT_ROW + 1); /* Query */ query2 = inkey(); if ((query2 == '\r') || (query2 == '\n')) { /* got ahw*/ loopagain = FALSE; p_ptr->redraw |= (PR_MISC); } else if ((query2 == 'm') || (query2 == 'M')) { /* don't want random stats */ int age = 0; int height = 0; int weight = 0; int age_l, age_h, height_l, height_h, weight_l, weight_h; age_l = 10; age_h = 4865; if (p_ptr->psex == SEX_MALE) { height_l = rp_ptr->m_b_ht - 5 * (rp_ptr->m_m_ht); height_h = rp_ptr->m_b_ht + 5 * (rp_ptr->m_m_ht); weight_l = rp_ptr->m_b_wt / 3; weight_h = rp_ptr->m_b_wt * 2; } else { height_l = rp_ptr->f_b_ht - 5 * (rp_ptr->f_m_ht); height_h = rp_ptr->f_b_ht + 5 * (rp_ptr->f_m_ht); weight_l = rp_ptr->f_b_wt / 3; weight_h = rp_ptr->f_b_wt * 2; } // clear line line[0] = '\0'; while ((age < age_l) || (age > age_h)) { sprintf(prompt, "Enter age (%d-%d): ", age_l, age_h); if (!term_get_string(prompt, line, sizeof(line))) return (FALSE); age = atoi(line); p_ptr->age = age; } /* Display the player */ p_ptr->redraw |= (PR_MISC); display_player(0); // clear line line[0] = '\0'; while ((height < height_l) || (height > height_h)) { sprintf(prompt, "Enter height in inches (%d-%d): ", height_l, height_h); if (!term_get_string(prompt, line, sizeof(line))) return (FALSE); height = atoi(line); p_ptr->ht = height; } /* Display the player */ p_ptr->redraw |= (PR_MISC); display_player(0); // clear line line[0] = '\0'; while ((weight < weight_l) || (weight > weight_h)) { sprintf(prompt, "Enter weight in pounds (%d-%d): ", weight_l, weight_h); if (!term_get_string(prompt, line, sizeof(line))) return (FALSE); weight = atoi(line); p_ptr->wt = weight; } /* Display the player */ p_ptr->redraw |= (PR_MISC); display_player(0); // confirm the choices if (!get_ahw()) return (FALSE); loopagain = FALSE; } else if (query2 == ESCAPE) return (FALSE); else if (((query2 == 'Q') || (query2 == 'q')) && (turn == 0)) quit (NULL); } return (TRUE); }
/* * Wield or wear a single item from the pack or floor */ void do_cmd_wield(void) { int i, item, slot; object_type forge; object_type *q_ptr; object_type *o_ptr; cptr act; char o_name[MAX_NLEN]; cptr q, s; bool newrace = FALSE; /* Restrict the choices */ item_tester_hook = item_tester_hook_wear; /* Get an item */ #ifdef JP q = "どれを装備しますか? "; s = "装備可能なアイテムがない。"; #else q = "Wear/Wield which item? "; s = "You have nothing you can wear or wield."; #endif if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return; /* Get the item (in the pack) */ if (item >= 0) { o_ptr = &inventory[item]; } /* Get the item (on the floor) */ else { o_ptr = &o_list[0 - item]; } /* Check the slot */ slot = wield_slot(o_ptr); /* Where is the item now */ if (slot == INVEN_WIELD) { #ifdef JP act = "を打撃用に装備した"; #else act = "You are wielding"; #endif } else if (slot == INVEN_BOW) { #ifdef JP act = "を射撃用に装備した"; #else act = "You are shooting with"; #endif } else if (slot == INVEN_LITE) { #ifdef JP act = "を光源にした"; #else act = "Your light source is"; #endif } else { #ifdef JP act = "を装備した"; #else act = "You are wearing"; #endif } if ((o_ptr->tval == TV_RING) && inventory[INVEN_LEFT].k_idx && inventory[INVEN_RIGHT].k_idx) { /* Restrict the choices */ item_tester_tval = TV_RING; /* Choose a ring from the equipment only */ #ifdef JP q = "どちらの指輪と取り替えますか?"; s = "おっと。"; #else q = "Replace which ring? "; s = "Oops."; #endif if (!get_item(&slot, q, s, (USE_EQUIP))) return; } if (slot == INVEN_WIELD) { if (is_two_handed()) { /* Restrict the choices */ item_tester_hook = item_tester_hook_melee_weapon; /* Choose a ring from the equipment only */ #ifdef JP q = "どちらの武器と取り替えますか?"; s = "おっと。"; #else q = "Replace which weapon? "; s = "Oops."; #endif if (!get_item(&slot, q, s, (USE_EQUIP))) return; } else if (inventory[slot].k_idx) { /* Confirm doing two handed combat */ #ifdef JP if (get_check("二刀流を行いますか?")) #else if (get_check("Do you want to do two handed combat?")) #endif { slot = INVEN_ARM; } } } /* Prevent wielding into a cursed slot */ if (cursed_p(&inventory[slot])) { /* Describe it */ object_desc(o_name, &inventory[slot], OD_OMIT_PREFIX | OD_NAME_ONLY); /* Message */ #ifdef JP msg_format("%s%sは呪われているようだ。", describe_use(slot) , o_name ); #else msg_format("The %s you are %s appears to be cursed.", o_name, describe_use(slot)); #endif /* Cancel the command */ return; } if (cursed_p(o_ptr) && (object_known_p(o_ptr) || (o_ptr->ident & IDENT_SENSE))) { char dummy[512]; /* Describe it */ object_desc(o_name, o_ptr, OD_OMIT_PREFIX | OD_NAME_ONLY); #ifdef JP sprintf(dummy, "本当に%s{呪われている}を使いますか?", o_name); #else sprintf(dummy, "Really use the %s {cursed}? ", o_name); #endif if (!get_check(dummy)) return; } #if 0 if ((o_ptr->name1 == ART_STONEMASK) && object_known_p(o_ptr) && (p_ptr->prace != RACE_VAMPIRE)) { char dummy[MAX_NLEN+80]; /* Describe it */ object_desc(o_name, o_ptr, OD_OMIT_PREFIX | OD_NAME_ONLY); #ifdef JP sprintf(dummy, "%sを装備すると吸血鬼になります。よろしいですか?", o_name); #else msg_format("%s will transforms you into a vampire permanently when equiped.", o_name); sprintf(dummy, "Do you become a vampire?"); #endif if (!get_check(dummy)) return; } #endif /* Check if completed a quest */ for (i = 0; i < max_quests; i++) { if ((quest[i].type == QUEST_TYPE_FIND_ARTIFACT) && (quest[i].status == QUEST_STATUS_TAKEN) && (quest[i].k_idx == o_ptr->name1)) { quest[i].status = QUEST_STATUS_COMPLETED; quest[i].complev = (byte)p_ptr->lev; #ifdef JP msg_print("クエストを達成した!"); #else msg_print("You completed your quest!"); #endif sound(SOUND_LEVEL); /* (Sound substitute) No quest sound */ msg_print(NULL); } } /* Take a turn */ energy_use = 100; /* Get local object */ q_ptr = &forge; /* Obtain local object */ object_copy(q_ptr, o_ptr); /* Modify quantity */ q_ptr->number = 1; /* Decrease the item (from the pack) */ if (item >= 0) { inven_item_increase(item, -1); inven_item_optimize(item); } /* Decrease the item (from the floor) */ else { floor_item_increase(0 - item, -1); floor_item_optimize(0 - item); } /* Access the wield slot */ o_ptr = &inventory[slot]; /* Take off existing item */ if (o_ptr->k_idx) { /* Take off existing item */ (void)inven_takeoff(slot, 255); } /* Wear the new stuff */ object_copy(o_ptr, q_ptr); /* Player touches it */ o_ptr->marked |= OM_TOUCHED; /* Forget stack */ o_ptr->next_o_idx = 0; /* Forget location */ o_ptr->iy = o_ptr->ix = 0; /* Increase the weight */ p_ptr->total_weight += q_ptr->weight; /* Increment the equip counter by hand */ equip_cnt++; /* Describe the result */ object_desc(o_name, o_ptr, 0); /* Message */ #ifdef JP msg_format("%s(%c)%s。", o_name, index_to_label(slot), act ); #else msg_format("%s %s (%c).", act, o_name, index_to_label(slot)); #endif sound(SOUND_WIELD); /* Cursed! */ if (cursed_p(o_ptr)) { /* Warn the player */ #ifdef JP msg_print("うわ! すさまじく冷たい!"); #else msg_print("Oops! It feels deathly cold!"); #endif sound(SOUND_CURSED); /* Note the curse */ o_ptr->ident |= (IDENT_SENSE); } #if 0 /* if you weild stonemask, you morph into vampire */ if ((o_ptr->name1 == ART_STONEMASK) && (!is_undead())) { p_ptr->prace = RACE_VAMPIRE; newrace = TRUE; #ifdef JP msg_format("あなたは吸血鬼に変化した!"); #else msg_format("You polymorphed into a vampire!"); #endif } #endif if (newrace) { rp_ptr = &race_info[p_ptr->prace]; /* Experience factor */ calc_expfact(); /* Get new height and weight */ get_ahw(FALSE); check_experience(); /* Hitdice */ p_ptr->hitdie = rp_ptr->r_mhp + cp_ptr->c_mhp; do_cmd_rerate(TRUE); p_ptr->redraw |= (PR_BASIC); p_ptr->update |= (PU_BONUS); handle_stuff(); /* Load an autopick preference file */ autopick_load_pref(FALSE); lite_spot(py, px); } /* Recalculate bonuses */ p_ptr->update |= (PU_BONUS); /* Recalculate torch */ p_ptr->update |= (PU_TORCH); /* Recalculate mana */ p_ptr->update |= (PU_MANA); p_ptr->redraw |= (PR_EQUIPPY); /* Window stuff */ p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER | PW_STATS); }