Skip to content

Commit ba39c37

Browse files
committed
Replace define with procedure for saner syntax
1 parent 2ab4eb5 commit ba39c37

1 file changed

Lines changed: 22 additions & 15 deletions

File tree

scripts_src/newreno/nif2hint.ssl

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -35,21 +35,28 @@ procedure Node001;
3535
#define read_book_bit bit_10
3636

3737
#define max_skill(x) critter_mod_skill(dude_obj, x, (300 - (has_skill(dude_obj, x))))
38-
//#define max_stat(x) set_critter_stat(dude_obj, x, (10 - (get_critter_stat(dude_obj, x))))
39-
#define max_stat(x) counter := 0; \
40-
current_stat := get_critter_stat(dude_obj, x); \
41-
while (counter < (10 - (current_stat - (get_pc_extra_stat(x))))) do begin \
42-
set_critter_stat(dude_obj, x, 1); \
43-
counter := (counter + 1); \
44-
end;
45-
#define read_book lvar_bit(LVAR_Flags, read_book_bit)
38+
39+
#define read_book lvar_bit(LVAR_Flags, read_book_bit )
40+
4641
/*#define set_read_book if (read_book == false) then begin \
4742
end \
4843
set_lvar_bit_on(LVAR_Flags, read_book_bit); comment out by killap*/
4944

5045
variable counter := 0;
5146
variable current_stat := 0;
5247

48+
/**
49+
* Maximize PC stat
50+
*/
51+
procedure max_stat(variable x) begin
52+
counter := 0;
53+
current_stat := get_critter_stat(dude_obj,x);
54+
while (counter < (10 - (current_stat - (get_pc_extra_stat(x))))) do begin
55+
set_critter_stat(dude_obj, x, 1);
56+
counter := (counter + 1);
57+
end
58+
end
59+
5360
procedure start begin
5461
end
5562

@@ -65,10 +72,10 @@ script_overrides;
6572
//set_critter_stat(dude_obj, STAT_max_hp, (999 - (get_critter_stat(dude_obj,STAT_max_hp))));
6673
set_pc_base_stat(STAT_max_hp, 999); //added by killap - requires Timeslip's compiler and dlls
6774
set_pc_extra_stat(STAT_max_hp, 999); //added by killap - requires Timeslip's compiler and dlls
68-
max_stat(STAT_st);
69-
max_stat(STAT_pe);
70-
max_stat(STAT_en);
71-
max_stat(STAT_ch);
75+
call max_stat(STAT_st);
76+
call max_stat(STAT_pe);
77+
call max_stat(STAT_en);
78+
call max_stat(STAT_ch);
7279
//When PC obtains any of the enhanced combat implants, internally the game assigns a permanent
7380
//-1 to the bonus charisma stat. The script for the Hintbook only tries to increase the base
7481
//charisma stat. Since base charisma stat remains unchanged (i.e. at 10), ultimately nothing happens.
@@ -77,9 +84,9 @@ script_overrides;
7784
set_pc_extra_stat(STAT_ch, get_pc_extra_stat(STAT_ch) + 1);
7885
if (dude_perk(PERK_phoenix_enhancement_perk)) then
7986
set_pc_extra_stat(STAT_ch, get_pc_extra_stat(STAT_ch) + 1);
80-
max_stat(STAT_iq);
81-
max_stat(STAT_ag);
82-
max_stat(STAT_lu);
87+
call max_stat(STAT_iq);
88+
call max_stat(STAT_ag);
89+
call max_stat(STAT_lu);
8390
max_skill(SKILL_SMALL_GUNS);
8491
max_skill(SKILL_BIG_GUNS);
8592
max_skill(SKILL_ENERGY_WEAPONS);

0 commit comments

Comments
 (0)