Ticket #28: quickstart.v1.diff
| File quickstart.v1.diff, 8.9 kB (added by takkaria, 1 year ago) |
|---|
-
src/birth.c
old new 111 111 112 112 /* Load the data */ 113 113 p_ptr->age = prev.age; 114 p_ptr->wt = p rev.wt;115 p_ptr->ht = p rev.ht;114 p_ptr->wt = p_ptr->wt_birth = prev.wt; 115 p_ptr->ht = p_ptr->ht_birth = prev.ht; 116 116 p_ptr->sc = prev.sc; 117 p_ptr->au = p rev.au;117 p_ptr->au = p_ptr->au_birth = prev.au; 118 118 119 119 /* Load the stats */ 120 120 for (i = 0; i < A_MAX; i++) 121 121 { 122 p_ptr->stat_max[i] = prev.stat[i]; 123 p_ptr->stat_cur[i] = prev.stat[i]; 122 p_ptr->stat_max[i] = p_ptr->stat_cur[i] = p_ptr->stat_birth[i] = prev.stat[i]; 124 123 } 125 124 126 125 /* Load the history */ … … 265 264 /* Save the resulting stat maximum */ 266 265 p_ptr->stat_cur[i] = p_ptr->stat_max[i] = stat_use[i]; 267 266 } 267 268 p_ptr->stat_birth[i] = p_ptr->stat_max[i]; 268 269 } 269 270 } 270 271 … … 385 386 /* Calculate the height/weight for males */ 386 387 if (p_ptr->psex == SEX_MALE) 387 388 { 388 p_ptr->ht = Rand_normal(rp_ptr->m_b_ht, rp_ptr->m_m_ht);389 p_ptr->wt = Rand_normal(rp_ptr->m_b_wt, rp_ptr->m_m_wt);389 p_ptr->ht = p_ptr->ht_birth = Rand_normal(rp_ptr->m_b_ht, rp_ptr->m_m_ht); 390 p_ptr->wt = p_ptr->wt_birth = Rand_normal(rp_ptr->m_b_wt, rp_ptr->m_m_wt); 390 391 } 391 392 392 393 /* Calculate the height/weight for females */ 393 394 else if (p_ptr->psex == SEX_FEMALE) 394 395 { 395 p_ptr->ht = Rand_normal(rp_ptr->f_b_ht, rp_ptr->f_m_ht);396 p_ptr->wt = Rand_normal(rp_ptr->f_b_wt, rp_ptr->f_m_wt);396 p_ptr->ht = p_ptr->ht_birth = Rand_normal(rp_ptr->f_b_ht, rp_ptr->f_m_ht); 397 p_ptr->wt = p_ptr->wt_birth = Rand_normal(rp_ptr->f_b_wt, rp_ptr->f_m_wt); 397 398 } 398 399 } 399 400 … … 426 427 if (gold < 100) gold = 100; 427 428 428 429 /* Save the gold */ 429 p_ptr->au = gold;430 p_ptr->au = p_ptr->au_birth = gold; 430 431 } 431 432 432 433 … … 1030 1031 static bool player_birth_aux_1(void) 1031 1032 { 1032 1033 int i, res, cur; 1034 1035 /* Wipe the player */ 1036 player_wipe(); 1037 1033 1038 1034 1039 /*** Instructions ***/ 1035 1040 … … 1177 1182 if (adult_maximize) 1178 1183 { 1179 1184 /* Reset stats */ 1180 p_ptr->stat_cur[i] = p_ptr->stat_max[i] = stats[i]; 1181 1185 p_ptr->stat_cur[i] = p_ptr->stat_max[i] = p_ptr->stat_birth[i] = stats[i]; 1182 1186 } 1183 1187 1184 1188 /* Fixed stat maxes */ … … 1210 1214 } 1211 1215 1212 1216 /* Gold is inversely proportional to cost */ 1213 p_ptr->au = (100 * (48 - cost)) + 100;1217 p_ptr->au = p_ptr->au_birth = (100 * (48 - cost)) + 100; 1214 1218 1215 1219 /* Calculate the bonuses and hitpoints */ 1216 1220 p_ptr->update |= (PU_BONUS | PU_HP); … … 1700 1704 1701 1705 1702 1706 /* 1707 * Helper function for 'player_birth_quick()'. 1708 * 1709 * See "display_player" for screen layout code. 1710 */ 1711 static bool player_birth_quick(void) 1712 { 1713 char ch; 1714 int i; 1715 birther old_char; 1716 byte old_class; 1717 byte old_race; 1718 byte old_sex; 1719 byte old_hitdie; 1720 u16b old_expfact; 1721 s16b old_hp[PY_MAX_LEVEL]; 1722 1723 old_sex = p_ptr->psex; 1724 old_class = p_ptr->pclass; 1725 old_race = p_ptr->prace; 1726 1727 old_hitdie = p_ptr->hitdie; 1728 old_expfact = p_ptr->expfact; 1729 1730 old_char.age = p_ptr->age; 1731 old_char.au = p_ptr->au_birth; 1732 old_char.ht = p_ptr->ht_birth; 1733 old_char.wt = p_ptr->wt_birth; 1734 old_char.sc = p_ptr->sc; 1735 1736 /* Save the stats */ 1737 for (i = 0; i < A_MAX; i++) 1738 { 1739 old_char.stat[i] = p_ptr->stat_birth[i]; 1740 } 1741 1742 /* Save the history */ 1743 my_strcpy(old_char.history, p_ptr->history, sizeof(old_char.history)); 1744 1745 /* Save the hp */ 1746 for (i = 0; i < PY_MAX_LEVEL; i++) 1747 { 1748 old_hp[i] = p_ptr->player_hp[i]; 1749 } 1750 1751 /* Wipe the player */ 1752 player_wipe(); 1753 1754 /* Level one */ 1755 p_ptr->max_lev = p_ptr->lev = 1; 1756 1757 p_ptr->psex = old_sex; 1758 p_ptr->pclass = old_class; 1759 p_ptr->prace = old_race; 1760 1761 p_ptr->hitdie = old_hitdie; 1762 p_ptr->expfact = old_expfact; 1763 1764 p_ptr->age = old_char.age; 1765 p_ptr->au_birth = p_ptr->au = old_char.au; 1766 p_ptr->ht = old_char.ht; 1767 p_ptr->wt = old_char.wt; 1768 p_ptr->sc = old_char.sc; 1769 1770 /* Load the stats */ 1771 for (i = 0; i < A_MAX; i++) 1772 { 1773 p_ptr->stat_birth[i] = p_ptr->stat_cur[i] = p_ptr->stat_max[i] = old_char.stat[i]; 1774 } 1775 1776 /* Load the history */ 1777 my_strcpy(p_ptr->history, old_char.history, sizeof(p_ptr->history)); 1778 1779 /* Load the hp */ 1780 for (i = 0; i < PY_MAX_LEVEL; i++) 1781 { 1782 p_ptr->player_hp[i] = old_hp[i]; 1783 } 1784 1785 /* Set adult options from birth options */ 1786 for (i = OPT_BIRTH; i < OPT_CHEAT; i++) 1787 { 1788 op_ptr->opt[OPT_ADULT + (i - OPT_BIRTH)] = op_ptr->opt[i]; 1789 } 1790 1791 /* Reset score options from cheat options */ 1792 for (i = OPT_CHEAT; i < OPT_ADULT; i++) 1793 { 1794 op_ptr->opt[OPT_SCORE + (i - OPT_CHEAT)] = op_ptr->opt[i]; 1795 } 1796 1797 /* Calculate the bonuses and hitpoints */ 1798 p_ptr->update |= (PU_BONUS | PU_HP); 1799 1800 /* Update stuff */ 1801 update_stuff(); 1802 1803 /* Fully healed */ 1804 p_ptr->chp = p_ptr->mhp; 1805 1806 /* Fully rested */ 1807 p_ptr->csp = p_ptr->msp; 1808 1809 /* Display the player */ 1810 display_player(0); 1811 1812 /* Get a name, prepare savefile */ 1813 get_name(); 1814 1815 /* Prompt for it */ 1816 prt("['CTRL-X' to quit, 'ESC' to start over, or any other key to continue]", 23, 5); 1817 1818 /* Get a key */ 1819 ch = inkey(); 1820 1821 /* Quit */ 1822 if (ch == KTRL('X')) quit(NULL); 1823 1824 /* Start over */ 1825 if (ch == ESCAPE) return (FALSE); 1826 1827 /* Accept */ 1828 return (TRUE); 1829 } 1830 1831 1832 1833 /* 1703 1834 * Create a new character. 1704 1835 * 1705 1836 * Note that we may be called with "junk" leftover in the various … … 1708 1839 void player_birth(void) 1709 1840 { 1710 1841 int i, n; 1842 bool done = FALSE; 1843 char ch; 1844 1845 1846 /* 1847 * If this a pre-existing savefile, offer to do a quick creation, based 1848 * on the previous character. 1849 */ 1850 if (character_existed) 1851 { 1852 /* Prompt */ 1853 while (TRUE) 1854 { 1855 Term_clear(); 1856 1857 put_str("Quick-start character based on previous one (y/n)? ", 2, 2); 1858 ch = inkey(); 1859 if (ch == KTRL('X')) quit(NULL); 1860 if ((ch == ESCAPE) || (ch == '\r') || (ch == '\n')) break; 1861 if (strchr("YyNn", ch)) break; 1862 if (ch == '?') (void)show_file("birth.hlp", NULL, 0, 0); 1863 else bell("Illegal answer!"); 1864 } 1865 1866 /* Quick generation */ 1867 if ((ch == 'y') || (ch == 'Y')) 1868 { 1869 if (player_birth_quick()) done = TRUE; 1870 } 1871 } 1711 1872 1712 1873 1713 1874 /* Create a new character */ 1714 while (1) 1715 { 1716 /* Wipe the player */ 1717 player_wipe(); 1718 1875 while (!done) 1876 { 1719 1877 /* Roll up a new character */ 1720 if (player_birth_aux()) break;1878 done = player_birth_aux(); 1721 1879 } 1722 1880 1723 1881 -
src/externs.h
old new 91 91 extern bool arg_force_original; 92 92 extern bool arg_force_roguelike; 93 93 extern bool character_generated; 94 extern bool character_existed; 94 95 extern bool character_dungeon; 95 96 extern bool character_loaded; 96 97 extern bool character_saved; -
src/load.c
old new 989 989 /* Age/Height/Weight */ 990 990 rd_s16b(&p_ptr->age); 991 991 rd_s16b(&p_ptr->ht); 992 rd_s16b(&p_ptr->ht_birth); 992 993 rd_s16b(&p_ptr->wt); 994 rd_s16b(&p_ptr->wt_birth); 993 995 994 996 /* Read the stat info */ 995 997 for (i = 0; i < A_MAX; i++) rd_s16b(&p_ptr->stat_max[i]); 996 998 for (i = 0; i < A_MAX; i++) rd_s16b(&p_ptr->stat_cur[i]); 999 for (i = 0; i < A_MAX; i++) rd_s16b(&p_ptr->stat_birth[i]); 997 1000 998 1001 strip_bytes(24); /* oops */ 999 1002 1000 1003 rd_s32b(&p_ptr->au); 1004 rd_s32b(&p_ptr->au_birth); 1001 1005 1002 1006 rd_s32b(&p_ptr->max_exp); 1003 1007 rd_s32b(&p_ptr->exp); … … 2231 2235 /* Forget death */ 2232 2236 p_ptr->is_dead = FALSE; 2233 2237 2238 /* A character existed in this savefile. */ 2239 character_existed = TRUE; 2240 2234 2241 /* Count lives */ 2235 2242 sf_lives++; 2236 2243 -
src/save.c
old new 1026 1026 wr_s16b(p_ptr->age); 1027 1027 wr_s16b(p_ptr->ht); 1028 1028 wr_s16b(p_ptr->wt); 1029 1030 /* Dump the stats (maximum and current) */ 1029 wr_s16b(p_ptr->ht_birth); 1030 wr_s16b(p_ptr->wt_birth); 1031 1032 /* Dump the stats (maximum and current and birth) */ 1031 1033 for (i = 0; i < A_MAX; ++i) wr_s16b(p_ptr->stat_max[i]); 1032 1034 for (i = 0; i < A_MAX; ++i) wr_s16b(p_ptr->stat_cur[i]); 1035 for (i = 0; i < A_MAX; ++i) wr_s16b(p_ptr->stat_birth[i]); 1033 1036 1034 1037 /* Ignore the transient stats */ 1035 1038 for (i = 0; i < 12; ++i) wr_s16b(0); 1036 1039 1037 1040 wr_u32b(p_ptr->au); 1041 wr_u32b(p_ptr->au_birth); 1042 1038 1043 1039 1044 wr_u32b(p_ptr->max_exp); 1040 1045 wr_u32b(p_ptr->exp); -
src/types.h
old new 1047 1047 byte ammo_tval; /* Ammo variety */ 1048 1048 1049 1049 s16b pspeed; /* Current speed */ 1050 1051 /* Generation fields (for quick start) */ 1052 s32b au_birth; /* Birth gold */ 1053 byte stat_birth[A_MAX]; /* Birth "natural" stat values */ 1054 s16b ht_birth; /* Birth Height */ 1055 s16b wt_birth; /* Birth Weight */ 1050 1056 }; 1051 1057 1052 1058 -
src/variable.c
old new 61 61 */ 62 62 63 63 bool character_generated; /* The character exists */ 64 bool character_existed; /* A character existed on the same savefile */ 64 65 bool character_dungeon; /* The character has a dungeon */ 65 66 bool character_loaded; /* The character was loaded from a savefile */ 66 67 bool character_saved; /* The character was just saved to a savefile */
