diff -r directcvs/p/lib/edit/k_info.lua p/lib/edit/k_info.lua 1525c1525 < if (not player.has_intrinsic(FLAG_HOLD_LIFE) and (player.exp > 0)) then --- > if (not player.has_intrinsic(FLAG_HOLD_LIFE) and (player.exp2 > 0)) then 1527c1527 < lose_exp(player.exp / 4) --- > lose_exp(player.exp2 / 4) 2616,2618c2616,2618 < if (player.exp < PY_MAX_EXP) then < local ee = (player.exp / 2) + 10 < if (ee > 100000) then ee = 100000 end --- > if (player.exp2 < PY_MAX_EXP) then > local ee = (player.exp2 / 2) + 10 > if ((ee > 100000) || (player.exp1 > 0)) then ee = 100000 end diff -r directcvs/p/lib/scpt/charsheet.lua p/lib/scpt/charsheet.lua 30,31c30,72 < [{ 3, 30, "d", -20 }] = { title="Exp", data="player.exp" color=TERM_L_GREEN } < [{ 4, 30, "s", -20 }] = { title="Exp to Adv", data=function() if player.lev < 50 then return (player_exp[player.lev] * player.expfact) / 100 else return "****" end end color=TERM_L_GREEN } --- > [{ 3, 30, "d", -20 }] = { title="Exp", data=function() > if (player.exp1 > 0) then > if (player.exp1 > 1000) then > if (player.exp1 > 1000000000) then > val = format("%8dT", > (p_ptr->exp1 / 10000)); > else > val = format("%8dB", > (p_ptr->exp1 / 10)); > end > else > val = format("%8dM", (player.exp1 * 100) > + (player.exp2 / 1000000)) > end > else > val = format("%8d", player.exp2) > end > return val > end > color=TERM_L_GREEN } > [{ 4, 30, "s", -20 }] = { title="Exp to Adv", data=function() > if player.lev >= current_module.max_plev then > val = "****" > else > if (player_exp1[player.lev] > 0) then > if (player_exp1[player.lev] > 1000) then > if (player_exp1[player.lev] > 1000000000) then > format("%8dT", player_exp1[player.lev] > / 10000); > else > format("%8dB", player_exp1[player.lev] / 10); > end > else > format("%8dM", player_exp2[player.lev] / 1000000 > + player_exp1[p_ptr->lev] * 100); > end > else > format("%8d", player_exp2[player.lev] + > player_exp1[player.lev] * 100000000); > end > end > end > color=TERM_L_GREEN } diff -r directcvs/p/lib/scpt/display.lua p/lib/scpt/display.lua 107a108 > 109c110,125 < val = format("%8d", player.exp) --- > if (player.exp1 > 0) then > if (player.exp1 > 1000) then > if (player.exp1 > 1000000000) then > val = format("%8dT", > (p_ptr->exp1 / 10000)); > else > val = format("%8dB", > (p_ptr->exp1 / 10)); > end > else > val = format("%8dM", (player.exp1 * 100) > + (player.exp2 / 1000000)) > end > else > val = format("%8d", player.exp2) > end 114c130,146 < val = format("%8d", (player_exp[player.lev] * player.expfact / 100) - player.exp) --- > if (player_exp1[player.lev] > 0) then > if (player_exp1[player.lev] > 1000) then > if (player_exp1[player.lev] > 1000000000) then > format("%8dT", player_exp1[player.lev] > / 10000 - player.exp2); > else > format("%8dB", player_exp1[player.lev] > / 10 - player.exp2); > end > else > format("%8dM", player_exp2[player.lev] / 1000000 > + player_exp1[p_ptr->lev] * 100 - player.exp2); > end > else > format("%8d", player_exp2[player.lev] + > player_exp1[player.lev] * 100000000 - player.exp2); > end 118c150 < if player.exp >= player.max_exp then --- > if player.exp2 >= player.max_exp2 then diff -r directcvs/p/src/cmd6.c p/src/cmd6.c 365c365 < (p_ptr->exp / 100) * MON_DRAIN_LIFE; --- > (p_ptr->exp2 / 100) * MON_DRAIN_LIFE; 395c395 < (p_ptr->exp / 100) * MON_DRAIN_LIFE; --- > (p_ptr->exp2 / 100) * MON_DRAIN_LIFE; 425c425 < (p_ptr->exp / 100) * MON_DRAIN_LIFE; --- > (p_ptr->exp2 / 100) * MON_DRAIN_LIFE; 455c455 < (p_ptr->exp / 100) * MON_DRAIN_LIFE; --- > (p_ptr->exp2 / 100) * MON_DRAIN_LIFE; 616c616 < lose_exp(200 + (p_ptr->exp / 1000) * MON_DRAIN_LIFE); --- > lose_exp(200 + (p_ptr->exp2 / 1000) * MON_DRAIN_LIFE); 621c621 < lose_exp(200 + (p_ptr->exp / 100) * MON_DRAIN_LIFE); --- > lose_exp(200 + (p_ptr->exp2 / 100) * MON_DRAIN_LIFE); 677c677 < lose_exp(500 + (p_ptr->exp / 1000) * MON_DRAIN_LIFE); --- > lose_exp(500 + (p_ptr->exp2 / 1000) * MON_DRAIN_LIFE); 682c682 < lose_exp(5000 + (p_ptr->exp / 100) * MON_DRAIN_LIFE); --- > lose_exp(5000 + (p_ptr->exp2 / 100) * MON_DRAIN_LIFE); 5296c5296 < lose_exp(p_ptr->exp / 20); --- > lose_exp(p_ptr->exp2 / 20); 5306c5306 < lose_exp(p_ptr->exp / 10); --- > lose_exp(p_ptr->exp2 / 10); diff -r directcvs/p/src/defines.h p/src/defines.h 454c454 < #define PY_MAX_EXP 99999999L /* Maximum exp */ --- > #define PY_MAX_EXP 99999999L /* Maximum exp. It is actually 9999999999999999, but that causes overflow. */ 456c456 < #define PY_MAX_LEVEL 50 /* Maximum level */ --- > #define PY_MAX_LEVEL 100 /* Maximum level */ diff -r directcvs/p/src/dungeon.c p/src/dungeon.c 2875c2875 < if ((rand_int(100) < chance) && (p_ptr->exp > 0)) --- > if ((rand_int(100) < chance) && (p_ptr->exp2 > 0)) 2877,2878c2877,2878 < p_ptr->exp -= 1 + plev / 5; < p_ptr->max_exp -= 1 + plev / 5; --- > p_ptr->exp2 -= 1 + plev / 5; > p_ptr->max_exp2 -= 1 + plev / 5; 2945c2945 < if ((rand_int(100) < 10) && (p_ptr->exp > 0)) --- > if ((rand_int(100) < 10) && (p_ptr->exp2 > 0)) 2947,2948c2947,2948 < p_ptr->exp--; < p_ptr->max_exp--; --- > p_ptr->exp2--; > p_ptr->max_exp2--; 5715a5716,5738 > /* Adjust player_exp based on race/class. If calculated on the fly, > * nasty overflow bugs occur. This is likely to be more efficient, > * anyway. The first 30 levels are calcualated differently > * to prevent underflow bugs. */ > for (i = 0; i <= 30; i++) > { > player_exp2[i] = (player_exp2[i] * p_ptr->expfact / 100L) + > ((player_exp1[i] * p_ptr->expfact) % 100L) * 1000000; > player_exp1[i] = (player_exp1[i] * p_ptr->expfact / 100L) + > (player_exp2[i] / 100000000); > player_exp2[i] %= 100000000L; > } > > while (i <= PY_MAX_LEVEL) > { > player_exp2[i] = ((player_exp2[i] / 100L) * p_ptr->expfact) + > ((player_exp1[i] * p_ptr->expfact) % 100L) * 1000000; > player_exp1[i] = (player_exp1[i] * p_ptr->expfact / 100L) + > (player_exp2[i] / 100000000L); > player_exp2[i] %= 100000000L; > i++; > } > diff -r directcvs/p/src/externs.h p/src/externs.h 54c54,55 < extern s32b player_exp[PY_MAX_LEVEL]; --- > extern s32b player_exp1[PY_MAX_LEVEL]; > extern s32b player_exp2[PY_MAX_LEVEL]; 1698a1700,1701 > extern int lose_experience_funct(int gained); > extern int gain_experience_funct(int gained); diff -r directcvs/p/src/files.c p/src/files.c 1468c1468 < if (p_ptr->exp >= p_ptr->max_exp) --- > if ((p_ptr->exp1 - p_ptr->max_exp1) * 100000000L >= p_ptr->max_exp2 - p_ptr->exp2) 1470c1470,1494 < prt_lnum("Experience ", p_ptr->exp, 10, 28, TERM_L_GREEN); --- > if (p_ptr->exp1 > 0) > { > if (p_ptr->exp1 > 1000) > { > if (p_ptr->exp1 > 1000000000) > { > prt_lnum("Experience ", > (p_ptr->exp1 / 10000L), 10, 28, TERM_L_GREEN); > c_put_str(TERM_L_GREEN, "T", 10, 48); > } else > { > prt_lnum("Experience ", > (p_ptr->exp1 / 10L), 10, 28, TERM_L_GREEN); > c_put_str(TERM_L_GREEN, "B", 10, 48); > } > } > else > { > prt_lnum("Experience ", (p_ptr->exp1 * 100L) > + (p_ptr->exp2 / 1000000L), 10, 28, TERM_L_GREEN); > c_put_str(TERM_L_GREEN, "M", 10, 48); > } > } > else > prt_lnum("Experience ", p_ptr->exp2, 10, 28, TERM_L_GREEN); 1474c1498,1522 < prt_lnum("Experience ", p_ptr->exp, 10, 28, TERM_YELLOW); --- > if (p_ptr->exp1 > 0) > { > if (p_ptr->exp1 > 1000) > { > if (p_ptr->exp1 > 1000000000) > { > prt_lnum("Experience ", > (p_ptr->exp1 / 10000L), 10, 28, TERM_YELLOW); > c_put_str(TERM_L_GREEN, "T", 10, 48); > } else > { > prt_lnum("Experience ", > (p_ptr->exp1 / 10L), 10, 28, TERM_YELLOW); > c_put_str(TERM_L_GREEN, "B", 10, 48); > } > } > else > { > prt_lnum("Experience ", (p_ptr->exp1 * 100L) > + (p_ptr->exp2 / 1000000L), 10, 28, TERM_YELLOW); > c_put_str(TERM_L_GREEN, "M", 10, 48); > } > } > else > prt_lnum("Experience ", p_ptr->exp2, 10, 28, TERM_YELLOW); 1477c1525,1549 < prt_lnum("Max Exp ", p_ptr->max_exp, 11, 28, TERM_L_GREEN); --- > if (p_ptr->max_exp1 > 0) > { > if (p_ptr->max_exp1 > 1000) > { > if (p_ptr->max_exp1 > 1000000000) > { > prt_lnum("Max Exp ", > (p_ptr->max_exp1 / 10000L), 11, 28, TERM_L_GREEN); > c_put_str(TERM_L_GREEN, "T", 11, 48); > } else > { > prt_lnum("Max Exp ", > (p_ptr->max_exp1 / 10L), 11, 28, TERM_L_GREEN); > c_put_str(TERM_L_GREEN, "B", 11, 48); > } > } > else > { > prt_lnum("Max Exp ", (p_ptr->max_exp1 * 100L) > + (p_ptr->max_exp2 / 1000000L), 11, 28, TERM_L_GREEN); > c_put_str(TERM_L_GREEN, "M", 11, 48); > } > } > else > prt_lnum("Max Exp ", p_ptr->max_exp2, 11, 28, TERM_L_GREEN); 1486,1488c1558,1587 < prt_lnum("Exp to Adv.", < (s32b)(player_exp[p_ptr->lev - 1] * p_ptr->expfact / 100L), < 12, 28, TERM_L_GREEN); --- > if (player_exp1[p_ptr->lev - 1] > 0) > { > if (player_exp1[p_ptr->lev - 1] > 1000) > { > if (player_exp1[p_ptr->lev - 1] > 1000000000) > { > prt_lnum("Exp to Adv.", player_exp1[p_ptr->lev - 1] > / 10000L, 12, 28, TERM_L_GREEN); > c_put_str(TERM_L_GREEN, "T", 12, 48); > } else > { > prt_lnum("Exp to Adv.", player_exp1[p_ptr->lev - 1] > / 10L, 12, 28, TERM_L_GREEN); > c_put_str(TERM_L_GREEN, "B", 12, 48); > } > } > else > { > prt_lnum("Exp to Adv.", > player_exp2[p_ptr->lev - 1] / 1000000L + player_exp1[p_ptr->lev - 1] > * 100L, 12, 28, TERM_L_GREEN); > c_put_str(TERM_L_GREEN, "M", 12, 48); > } > } > else > { > prt_lnum("Exp to Adv.", > player_exp2[p_ptr->lev - 1] + player_exp1[p_ptr->lev - 1] > * 100000000L, 12, 28, TERM_L_GREEN); > } 4615c4714 < temp += p_ptr->max_exp / 5; --- > temp += (p_ptr->max_exp1 * 200000000L) + p_ptr->max_exp2 / 5; 4811c4910 < (void)sprintf(tmp, "Exp: %ld", (long)p_ptr->exp); --- > (void)sprintf(tmp, "Exp: %ld", (long)p_ptr->exp1 * 1000000000L + p_ptr->exp2); 5861c5960,5961 < p_ptr->exp = p_ptr->max_exp; --- > p_ptr->exp1 = p_ptr->max_exp1; > p_ptr->exp2 = p_ptr->max_exp2; diff -r directcvs/p/src/loadsave.c p/src/loadsave.c 498,499c498,501 < do_u32b(&p_ptr->max_exp, flag); < do_u32b(&p_ptr->exp, flag); --- > do_u32b(&p_ptr->max_exp1, flag); > do_u32b(&p_ptr->max_exp2, flag); > do_u32b(&p_ptr->exp1, flag); > do_u32b(&p_ptr->exp2, flag); diff -r directcvs/p/src/main-ami.c p/src/main-ami.c 1969c1969 < sprintf( tmp, "Exp: %ld", (long)p_ptr->exp ); --- > sprintf( tmp, "Exp: %ld", (long)(p_ptr->exp1* 100000000L + p_ptr->exp2) ); diff -r directcvs/p/src/makefile.std p/src/makefile.std 95c95 < BINDIR = /usr/local/games --- > BINDIR = /home/trcarlson/games/tome300 diff -r directcvs/p/src/object2.c p/src/object2.c 1607c1607 < o_ptr->exp = player_exp[o_ptr->elevel - 1]; --- > o_ptr->exp = player_exp2[o_ptr->elevel - 1] + player_exp1[o_ptr->elevel - 1] * 100000000; 1681c1681 < o_ptr->exp = player_exp[o_ptr->elevel - 1]; --- > o_ptr->exp = player_exp2[o_ptr->elevel - 1] + player_exp1[o_ptr->elevel - 1] * 100000000; 3346c3346 < o_ptr->exp = player_exp[o_ptr->elevel - 1]; --- > o_ptr->exp = player_exp2[o_ptr->elevel - 1] + player_exp1[o_ptr->elevel - 1] * 100000000; 3500c3500 < o_ptr->exp = player_exp[o_ptr->elevel - 1]; --- > o_ptr->exp = player_exp2[o_ptr->elevel - 1] + player_exp1[o_ptr->elevel - 1] * 100000000; diff -r directcvs/p/src/object3.c p/src/object3.c 129c129 < o_ptr->exp = player_exp[o_ptr->elevel - 1]; --- > o_ptr->exp = player_exp2[o_ptr->elevel - 1] + player_exp1[o_ptr->elevel - 1] * 100000000; diff -r directcvs/p/src/spells1.c p/src/spells1.c 7522c7522 < lose_exp(200 + (p_ptr->exp / 1000) * MON_DRAIN_LIFE); --- > lose_exp(200 + (p_ptr->exp2 / 1000) * MON_DRAIN_LIFE); 7527c7527 < lose_exp(200 + (p_ptr->exp / 100) * MON_DRAIN_LIFE); --- > lose_exp(200 + (p_ptr->exp2 / 100) * MON_DRAIN_LIFE); 7586c7586 < lose_exp(500 + (p_ptr->exp / 1000) * MON_DRAIN_LIFE); --- > lose_exp(500 + (p_ptr->exp2 / 1000) * MON_DRAIN_LIFE); 7591c7591 < lose_exp(5000 + (p_ptr->exp / 100) * MON_DRAIN_LIFE); --- > lose_exp(5000 + (p_ptr->exp2 / 100) * MON_DRAIN_LIFE); 7916c7916 < lose_exp(100 + (p_ptr->exp / 100) * MON_DRAIN_LIFE); --- > lose_exp(100 + (p_ptr->exp2 / 100) * MON_DRAIN_LIFE); diff -r directcvs/p/src/spells2.c p/src/spells2.c 518c518 < if (p_ptr->exp < p_ptr->max_exp) --- > if ((p_ptr->exp1 < p_ptr->max_exp1) || (p_ptr->exp2 < p_ptr->max_exp2)) 524c524,525 < p_ptr->exp = p_ptr->max_exp; --- > p_ptr->exp1 = p_ptr->max_exp1; > p_ptr->exp2 = p_ptr->max_exp2; 6744c6745 < lose_exp(p_ptr->exp / 16); --- > lose_exp(p_ptr->exp2 / 16); 6829c6830 < lose_exp(p_ptr->exp / 12); --- > lose_exp(p_ptr->exp2 / 12); diff -r directcvs/p/src/tables.c p/src/tables.c 1103c1103,1104 < * Base experience levels, may be adjusted up for race and/or class --- > * Base experience levels, may be adjusted up or down for race and/or class. > * To get exp, use player_exp1[level] * 100000000 + player_exp2[level] 1105c1106 < s32b player_exp[PY_MAX_LEVEL] = --- > s32b player_exp2[PY_MAX_LEVEL] = 1107,1156c1108,1156 < 10, < 25, < 45, < 70, < 100, < 140, < 200, < 280, < 380, < 500, < 650, < 850, < 1100, < 1400, < 1800, < 2300, < 2900, < 3600, < 4400, < 5400, < 6800, < 8400, < 10200, < 12500, < 17500, < 25000, < 35000L, < 50000L, < 75000L, < 100000L, < 150000L, < 200000L, < 275000L, < 350000L, < 450000L, < 550000L, < 700000L, < 850000L, < 1000000L, < 1250000L, < 1500000L, < 1800000L, < 2100000L, < 2400000L, < 2700000L, < 3000000L, < 3500000L, < 4000000L, < 4500000L, < 5000000L --- > 10, 25, 45, 70, 100, > 140, 200, 280, 380, 500, > 650, 850, 1100, 1400, 1800, > 2300, 2900, 3600, 4400, 5400, > 6800, 8400, 10200, 12500, 17500, > > 25000L, 35000L, 50000L, 75000L, 100000L, > 150000L, 200000L, 275000L, 350000L, 450000L, > 550000L, 700000L, 850000L, 1000000L, 1250000L, > 1500000L, 1800000L, 2100000L, 2400000L, 2700000L, > 3000000L, 3500000L, 4000000L, 4500000L, 5000000L, > > 6000000L, 7000000L, 8000000L, 9000000L, 10000000L, > 12000000L, 14000000L, 16000000L, 18000000L, 20000000L, > 24000000L, 28000000L, 32000000L, 36000000L, 40000000L, > 48000000L, 56000000L, 64000000L, 72000000L, 80000000L, > 90000000L, 0L, 10000000L, 20000000L, 30000000L, > > 50000000L, 70000000L, 90000000L, 10000000L, 30000000L, > 60000000L, 90000000L, 20000000L, 50000000L, 80000000L, > 20000000L, 60000000L, 0L, 40000000L, 80000000L, > 40000000L, 0L, 60000000L, 20000000L, 80000000L, > 40000000L, 0L, 0L, 0L, 0L > }; > s32b player_exp1[PY_MAX_LEVEL] = > { > 0, 0, 0, 0, 0, > 0, 0, 0, 0, 0, > 0, 0, 0, 0, 0, > 0, 0, 0, 0, 0, > 0, 0, 0, 0, 0, > > 0, 0, 0, 0, 0, > 0, 0, 0, 0, 0, > 0, 0, 0, 0, 0, > 0, 0, 0, 0, 0, > 0, 0, 0, 0, 0, > > 0, 0, 0, 0, 0, > 0, 0, 0, 0, 0, > 0, 0, 0, 0, 0, > 0, 0, 0, 0, 0, > 0, 1, 1, 1, 1, > > 1, 1, 1, 2, 2, > 2, 2, 3, 3, 3, > 4, 4, 5, 5, 5, > 6, 7, 7, 8, 8, > 9, 10, 11, 12, 13 Only in p/src: tolua Only in p/src: tome diff -r directcvs/p/src/types.h p/src/types.h 1370,1371c1370,1376 < s32b max_exp; /* Max experience */ < s32b exp; /* Cur experience */ --- > /* Think of exp1 and exp2 as two halves of a s64b. exp2 > * holds the smaller part, and exp1 the larger. */ > s32b max_exp1; /* Max experience 1*/ > s32b max_exp2; /* Max experience 2*/ > > s32b exp1; /* Cur experience 1*/ > s32b exp2; /* Cur experience 2*/ diff -r directcvs/p/src/w_dun.c p/src/w_dun.c 3c3 < ** Generated automatically by tolua 4.0a - angband on Wed Dec 10 23:08:08 2003. --- > ** Generated automatically by tolua 4.0a - angband on Sat Dec 13 15:19:22 2003. diff -r directcvs/p/src/w_fs.c p/src/w_fs.c 3c3 < ** Generated automatically by tolua 4.0a - angband on Wed Dec 10 23:08:09 2003. --- > ** Generated automatically by tolua 4.0a - angband on Sat Dec 13 15:19:24 2003. diff -r directcvs/p/src/w_player.c p/src/w_player.c 3c3 < ** Generated automatically by tolua 4.0a - angband on Tue Dec 9 22:02:49 2003. --- > ** Generated automatically by tolua 4.0a - angband on Sat Dec 13 14:11:15 2003. 33,34c33,34 < /* get function: player_exp */ < static int toluaI_get_player_player_exp(lua_State* tolua_S) --- > /* get function: player_exp2 */ > static int toluaI_get_player_player_exp2(lua_State* tolua_S) 42c42 < tolua_pushnumber(tolua_S,(long)player_exp[toluaI_index]); --- > tolua_pushnumber(tolua_S,(long)player_exp2[toluaI_index]); 46,47c46,47 < /* set function: player_exp */ < static int toluaI_set_player_player_exp(lua_State* tolua_S) --- > /* set function: player_exp2 */ > static int toluaI_set_player_player_exp2(lua_State* tolua_S) 55c55,81 < player_exp[toluaI_index] = ((s32b) tolua_getnumber(tolua_S,3,0)); --- > player_exp2[toluaI_index] = ((s32b) tolua_getnumber(tolua_S,3,0)); > return 0; > } > > /* get function: player_exp1 */ > static int toluaI_get_player_player_exp1(lua_State* tolua_S) > { > int toluaI_index; > if (!tolua_istype(tolua_S,2,LUA_TNUMBER,0)) > tolua_error(tolua_S,"invalid type in array indexing."); > toluaI_index = (int)tolua_getnumber(tolua_S,2,0)-1; > if (toluaI_index<0 || toluaI_index>=PY_MAX_LEVEL) > tolua_error(tolua_S,"array indexing out of range."); > tolua_pushnumber(tolua_S,(long)player_exp1[toluaI_index]); > return 1; > } > > /* set function: player_exp1 */ > static int toluaI_set_player_player_exp1(lua_State* tolua_S) > { > int toluaI_index; > if (!tolua_istype(tolua_S,2,LUA_TNUMBER,0)) > tolua_error(tolua_S,"invalid type in array indexing."); > toluaI_index = (int)tolua_getnumber(tolua_S,2,0)-1; > if (toluaI_index<0 || toluaI_index>=PY_MAX_LEVEL) > tolua_error(tolua_S,"array indexing out of range."); > player_exp1[toluaI_index] = ((s32b) tolua_getnumber(tolua_S,3,0)); 837,838c863,904 < /* get function: max_exp of class player_type */ < static int toluaI_get_player_player_type_max_exp(lua_State* tolua_S) --- > /* get function: max_exp2 of class player_type */ > static int toluaI_get_player_player_type_max_exp2(lua_State* tolua_S) > { > player_type* self = (player_type*) tolua_getusertype(tolua_S,1,0); > if (!self) TOLUA_ERR_SELF; > tolua_pushnumber(tolua_S,(long)self->max_exp2); > return 1; > } > > /* set function: max_exp2 of class player_type */ > static int toluaI_set_player_player_type_max_exp2(lua_State* tolua_S) > { > player_type* self = (player_type*) tolua_getusertype(tolua_S,1,0); > if (!self) TOLUA_ERR_SELF; > if (!tolua_istype(tolua_S,2,LUA_TNUMBER,0)) > TOLUA_ERR_ASSIGN; > self->max_exp2 = ((s32b) tolua_getnumber(tolua_S,2,0)); > return 0; > } > > /* get function: max_exp1 of class player_type */ > static int toluaI_get_player_player_type_max_exp1(lua_State* tolua_S) > { > player_type* self = (player_type*) tolua_getusertype(tolua_S,1,0); > if (!self) TOLUA_ERR_SELF; > tolua_pushnumber(tolua_S,(long)self->max_exp1); > return 1; > } > > /* set function: max_exp1 of class player_type */ > static int toluaI_set_player_player_type_max_exp1(lua_State* tolua_S) > { > player_type* self = (player_type*) tolua_getusertype(tolua_S,1,0); > if (!self) TOLUA_ERR_SELF; > if (!tolua_istype(tolua_S,2,LUA_TNUMBER,0)) > TOLUA_ERR_ASSIGN; > self->max_exp1 = ((s32b) tolua_getnumber(tolua_S,2,0)); > return 0; > } > > /* get function: exp2 of class player_type */ > static int toluaI_get_player_player_type_exp2(lua_State* tolua_S) 842c908 < tolua_pushnumber(tolua_S,(long)self->max_exp); --- > tolua_pushnumber(tolua_S,(long)self->exp2); 846,847c912,913 < /* set function: max_exp of class player_type */ < static int toluaI_set_player_player_type_max_exp(lua_State* tolua_S) --- > /* set function: exp2 of class player_type */ > static int toluaI_set_player_player_type_exp2(lua_State* tolua_S) 853c919 < self->max_exp = ((s32b) tolua_getnumber(tolua_S,2,0)); --- > self->exp2 = ((s32b) tolua_getnumber(tolua_S,2,0)); 857,858c923,924 < /* get function: exp of class player_type */ < static int toluaI_get_player_player_type_exp(lua_State* tolua_S) --- > /* get function: exp1 of class player_type */ > static int toluaI_get_player_player_type_exp1(lua_State* tolua_S) 862c928 < tolua_pushnumber(tolua_S,(long)self->exp); --- > tolua_pushnumber(tolua_S,(long)self->exp1); 866,867c932,933 < /* set function: exp of class player_type */ < static int toluaI_set_player_player_type_exp(lua_State* tolua_S) --- > /* set function: exp1 of class player_type */ > static int toluaI_set_player_player_type_exp1(lua_State* tolua_S) 873c939 < self->exp = ((s32b) tolua_getnumber(tolua_S,2,0)); --- > self->exp1 = ((s32b) tolua_getnumber(tolua_S,2,0)); 8238c8304,8305 < tolua_globalarray(tolua_S,"player_exp",toluaI_get_player_player_exp,toluaI_set_player_player_exp); --- > tolua_globalarray(tolua_S,"player_exp1",toluaI_get_player_player_exp1,toluaI_set_player_player_exp1); > tolua_globalarray(tolua_S,"player_exp2",toluaI_get_player_player_exp2,toluaI_set_player_player_exp2); 8333,8334c8400,8403 < tolua_tablevar(tolua_S,"player_type","max_exp",toluaI_get_player_player_type_max_exp,toluaI_set_player_player_type_max_exp); < tolua_tablevar(tolua_S,"player_type","exp",toluaI_get_player_player_type_exp,toluaI_set_player_player_type_exp); --- > tolua_tablevar(tolua_S,"player_type","max_exp2",toluaI_get_player_player_type_max_exp2,toluaI_set_player_player_type_max_exp2); > tolua_tablevar(tolua_S,"player_type","max_exp1",toluaI_get_player_player_type_max_exp1,toluaI_set_player_player_type_max_exp1); > tolua_tablevar(tolua_S,"player_type","exp2",toluaI_get_player_player_type_exp2,toluaI_set_player_player_type_exp2); > tolua_tablevar(tolua_S,"player_type","exp1",toluaI_get_player_player_type_exp1,toluaI_set_player_player_type_exp1); diff -r directcvs/p/src/wizard2.c p/src/wizard2.c 306a307 > char tmp_val2[16]; 351c352 < sprintf(tmp_val, "%ld", (long)(p_ptr->max_exp)); --- > sprintf(tmp_val, "%ld", (long)(p_ptr->max_exp1 * 100000000L + p_ptr->max_exp2)); 354c355,370 < if (!get_string("Experience: ", tmp_val, 9)) return; --- > if (!get_string("Experience: ", tmp_val, 18)) return; > > /* get exp2. This grabs (up to) the last 8 digits of tmp_val, > erasing so that exp1 is grabbed properly */ > tmp_int = 0; > while (tmp_val[tmp_int]) tmp_int++; > if (tmp_int < 8) tmp_int = 8; > > i = tmp_int - 8; > tmp_val2[i - tmp_int + 8] = tmp_val[i]; > while(tmp_val[i] > '\0') > { > i++; > tmp_val[i - 1] = '\0'; > tmp_val2[i - tmp_int + 8] = tmp_val[i]; > } 357c373,394 < tmp_long = atol(tmp_val); --- > tmp_long = atol(tmp_val2); > > /* Verify */ > if (tmp_long < 0) tmp_long = 0L; > > /* Save */ > p_ptr->max_exp2 = tmp_long; > p_ptr->exp2 = p_ptr->max_exp2; > > > > /* get exp1 */ > i = 0; > tmp_val2[i] = tmp_val[i]; > while(tmp_val[i] > '\0') > { > i++; > tmp_val2[i] = tmp_val[i]; > } > > /* Extract */ > tmp_long = atol(tmp_val2); 363,364c400,401 < p_ptr->max_exp = tmp_long; < p_ptr->exp = tmp_long; --- > p_ptr->max_exp1 = tmp_long; > p_ptr->exp1 = p_ptr->max_exp1; 1915c1952 < gain_exp(p_ptr->exp + 1); --- > gain_exp(p_ptr->exp2 + 1); diff -r directcvs/p/src/xtra2.c p/src/xtra2.c 3514c3514 < bool level_corruption = FALSE; --- > 3521c3521,3522 < if (p_ptr->exp < 0) p_ptr->exp = 0; --- > if (p_ptr->exp1 < 0) p_ptr->exp1 = 0; > if (p_ptr->exp2 < 0) p_ptr->exp2 = 0; 3524c3525,3526 < if (p_ptr->max_exp < 0) p_ptr->max_exp = 0; --- > if (p_ptr->max_exp1 < 0) p_ptr->max_exp1 = 0; > if (p_ptr->max_exp2 < 0) p_ptr->max_exp2 = 0; 3527c3529,3533 < if (p_ptr->exp > PY_MAX_EXP) p_ptr->exp = PY_MAX_EXP; --- > if (p_ptr->exp1 > (PY_MAX_EXP - p_ptr->exp2) / 100000000L ) > { > p_ptr->exp1 = (PY_MAX_EXP - p_ptr->exp2) / 100000000L; > p_ptr->exp2 = PY_MAX_EXP - p_ptr->exp1 * 100000000L; > } 3530c3536,3540 < if (p_ptr->max_exp > PY_MAX_EXP) p_ptr->max_exp = PY_MAX_EXP; --- > if (p_ptr->max_exp1 > (PY_MAX_EXP - p_ptr->max_exp2) / 100000000L ) > { > p_ptr->max_exp1 = (PY_MAX_EXP - p_ptr->max_exp2) / 100000000L; > p_ptr->max_exp2 = PY_MAX_EXP - p_ptr->max_exp1 * 100000000L; > } 3533c3543,3547 < if (p_ptr->exp > p_ptr->max_exp) p_ptr->max_exp = p_ptr->exp; --- > if ((p_ptr->exp1 - p_ptr->max_exp1) * 100000000L > p_ptr->max_exp2 - p_ptr->exp2) > { > p_ptr->max_exp1 = p_ptr->exp1; > p_ptr->max_exp2 = p_ptr->exp2; > } 3542,3544c3556,3557 < /* Lose levels while possible */ < while ((p_ptr->lev > 1) && < (p_ptr->exp < (player_exp[p_ptr->lev - 2] * p_ptr->expfact / 100L))) --- > /* move high experience from exp2 to exp1 */ > while (p_ptr->exp2 > 99999999L) 3546,3557c3559,3561 < /* Lose a level */ < p_ptr->lev--; < gained--; < lite_spot(p_ptr->py, p_ptr->px); < < /* Update some stuff */ < p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS | PU_SANITY); < < /* Redraw some stuff */ < flag_bool(&p_ptr->redraw, FLAG_PR_LEV); < flag_bool(&p_ptr->redraw, FLAG_PR_TITLE); < flag_bool(&p_ptr->redraw, FLAG_PR_EXP); --- > p_ptr->exp1++; > p_ptr->exp2 -= 100000000L; > } 3559,3560c3563,3586 < /* Window stuff */ < p_ptr->window |= (PW_PLAYER); --- > while (p_ptr->max_exp2 > 99999999L) > { > p_ptr->max_exp1++; > p_ptr->max_exp2 -= 100000000L; > } > /* move low experience from exp1 to exp2 */ > while (p_ptr->exp2 < 0L) > { > if (p_ptr->max_exp1 > 0L) > { > p_ptr->exp1--; > p_ptr->exp2 += 100000000L; > } > else p_ptr->exp2 = 0; > } > while (p_ptr->max_exp2 < 0L) > { > if (p_ptr->max_exp1 > 0L) > { > p_ptr->max_exp1--; > p_ptr->max_exp2 += 100000000L; > } > else p_ptr->max_exp2 = 0; > } 3562,3563c3588,3597 < /* Handle stuff */ < handle_stuff(); --- > /* Lose levels while possible */ > while (p_ptr->lev > 1) > { > if (p_ptr->exp1 > player_exp1[p_ptr->lev - 2]) break; > else if (p_ptr->exp1 == player_exp1[p_ptr->lev - 2]) > { > if (p_ptr->exp2 > player_exp2[p_ptr->lev - 2]) break; > else gained = lose_experience_funct(gained); > } > else gained = lose_experience_funct(gained); 3568,3569c3602 < while ((p_ptr->lev < PY_MAX_LEVEL) && (p_ptr->lev < max_plev) && < (p_ptr->exp >= (player_exp[p_ptr->lev - 1] * p_ptr->expfact / 100L))) --- > while ((p_ptr->lev < PY_MAX_LEVEL) && (p_ptr->lev < max_plev)) 3571,3577c3604,3605 < /* Gain a level */ < p_ptr->lev++; < gained++; < lite_spot(p_ptr->py, p_ptr->px); < < /* Save the highest level */ < if (p_ptr->lev > p_ptr->max_plv) --- > if (p_ptr->exp1 < player_exp1[p_ptr->lev - 1]) break; > else if (p_ptr->exp1 == player_exp1[p_ptr->lev - 1]) 3579,3584c3607,3608 < p_ptr->max_plv = p_ptr->lev; < if ((has_flag(p_ptr, FLAG_CORRUPT)) && < (randint(3) == 1)) < { < level_corruption = TRUE; < } --- > if (p_ptr->exp2 < player_exp2[p_ptr->lev - 1]) break; > else gained = gain_experience_funct(gained); 3585a3610,3611 > else gained = gain_experience_funct(gained); > } 3587,3591c3613,3615 < /* Sound */ < sound(SOUND_LEVEL); < < /* Message */ < cmsg_format(TERM_L_GREEN, "Welcome to level %d.", p_ptr->lev); --- > /* Hook it! */ > process_hooks(HOOK_PLAYER_LEVEL, "(d)", gained); > } 3593,3596c3617,3622 < if (p_ptr->skill_last_level < p_ptr->lev) < { < s32b pts; < call_lua("exec_module_info", "(s)", "d", "skill_per_level", &pts); --- > /* Lose a level, called from check_experience() */ > int lose_experience_funct(int gained) > { > p_ptr->lev--; > gained--; > lite_spot(p_ptr->py, p_ptr->px); 3598,3602c3624,3625 < p_ptr->skill_last_level = p_ptr->lev; < p_ptr->skill_points += pts; < cmsg_format(TERM_L_GREEN, "You can increase %d more skills.", p_ptr->skill_points); < flag_bool(&p_ptr->redraw, FLAG_PR_STUDY); < } --- > /* Update some stuff */ > p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS | PU_SANITY); 3604,3605c3627,3630 < /* Gain this level's abilities */ < apply_level_abilities(p_ptr->lev); --- > /* Redraw some stuff */ > flag_bool(&p_ptr->redraw, FLAG_PR_LEV); > flag_bool(&p_ptr->redraw, FLAG_PR_TITLE); > flag_bool(&p_ptr->redraw, FLAG_PR_EXP); 3607,3613c3632,3633 < /* If auto-note taking enabled, write a note to the file. < * Only write this note when the level is gained for the first < * time. < */ < if (take_notes && auto_notes) < { < char note[80]; --- > /* Window stuff */ > p_ptr->window |= (PW_PLAYER); 3615,3618c3635,3638 < /* Write note */ < sprintf(note, "Reached level %d", p_ptr->lev); < add_note(note, 'L'); < } --- > /* Handle stuff */ > handle_stuff(); > return gained; > } 3620,3621d3639 < /* Update some stuff */ < p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS | PU_SANITY); 3623,3626c3641,3645 < /* Redraw some stuff */ < flag_bool(&p_ptr->redraw, FLAG_PR_LEV); < flag_bool(&p_ptr->redraw, FLAG_PR_TITLE); < flag_bool(&p_ptr->redraw, FLAG_PR_EXP); --- > /* gain a level, called from check_experience() */ > int gain_experience_funct(int gained) > { > bool level_reward = FALSE; > bool level_corruption = FALSE; 3628,3629d3646 < /* Window stuff */ < p_ptr->window |= (PW_PLAYER); 3631,3632c3648,3651 < /* Handle stuff */ < handle_stuff(); --- > /* Gain a level */ > p_ptr->lev++; > gained++; > lite_spot(p_ptr->py, p_ptr->px); 3634c3653,3658 < if (level_corruption) --- > /* Save the highest level */ > if (p_ptr->lev > p_ptr->max_plv) > { > p_ptr->max_plv = p_ptr->lev; > if ((has_flag(p_ptr, FLAG_CORRUPT)) && > (randint(3) == 1)) 3636,3638c3660 < msg_print("You feel different..."); < corrupt_corrupted(); < level_corruption = FALSE; --- > level_corruption = TRUE; 3642,3643c3664,3718 < /* Hook it! */ < process_hooks(HOOK_PLAYER_LEVEL, "(d)", gained); --- > /* Sound */ > sound(SOUND_LEVEL); > > /* Message */ > cmsg_format(TERM_L_GREEN, "Welcome to level %d.", p_ptr->lev); > > if (p_ptr->skill_last_level < p_ptr->lev) > { > s32b pts; > call_lua("exec_module_info", "(s)", "d", "skill_per_level", &pts); > > p_ptr->skill_last_level = p_ptr->lev; > p_ptr->skill_points += pts; > cmsg_format(TERM_L_GREEN, "You can increase %d more skills.", p_ptr->skill_points); > flag_bool(&p_ptr->redraw, FLAG_PR_STUDY); > } > > /* Gain this level's abilities */ > apply_level_abilities(p_ptr->lev); > > /* If auto-note taking enabled, write a note to the file. > * Only write this note when the level is gained for the first > * time. > */ > if (take_notes && auto_notes) > { > char note[80]; > > /* Write note */ > sprintf(note, "Reached level %d", p_ptr->lev); > add_note(note, 'L'); > } > > /* Update some stuff */ > p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS | PU_SANITY); > > /* Redraw some stuff */ > flag_bool(&p_ptr->redraw, FLAG_PR_LEV); > flag_bool(&p_ptr->redraw, FLAG_PR_TITLE); > flag_bool(&p_ptr->redraw, FLAG_PR_EXP); > > /* Window stuff */ > p_ptr->window |= (PW_PLAYER); > > /* Handle stuff */ > handle_stuff(); > > > if (level_corruption) > { > msg_print("You feel different..."); > corrupt_corrupted(); > level_corruption = FALSE; > } > return gained; 3644a3720,3723 > > > > 3663c3742,3743 < (o_ptr->exp >= (player_exp[o_ptr->elevel - 1] * 5 / 2))) --- > (o_ptr->exp >= ((player_exp1[o_ptr->elevel - 1] *100000000L + > player_exp2[o_ptr->elevel - 1]) * 5 / 2))) 3707c3787 < if ((p_ptr->max_exp > 0) && (has_flag(p_ptr, FLAG_CORRUPT))) --- > if ((p_ptr->max_exp2 > 0) && (has_flag(p_ptr, FLAG_CORRUPT))) 3709c3789 < if ((randint(p_ptr->max_exp) < amount) || (randint(12000000) < amount)) --- > if ((randint(p_ptr->exp1 * 100000000L + p_ptr->exp2) < amount) || (randint(12000000) < amount)) 3718c3798 < p_ptr->exp += amount / num; --- > p_ptr->exp2 += amount / num; 3724c3804 < if (p_ptr->exp < p_ptr->max_exp) --- > if ((p_ptr->exp1 - p_ptr->max_exp1) * 100000000L < p_ptr->max_exp2 - p_ptr->exp2) 3727c3807 < p_ptr->max_exp += amount / 5; --- > p_ptr->max_exp2 += amount / 5; 3741c3821 < if (amount > p_ptr->exp) amount = p_ptr->exp; --- > if (amount > p_ptr->exp2) amount = p_ptr->exp2; 3744c3824 < p_ptr->exp -= amount; --- > p_ptr->exp2 -= amount;