From 61d39c64310875c94f0841952626d8a9e62cbe2e Mon Sep 17 00:00:00 2001 From: Juan Pablo Kaniefsky Date: Thu, 30 Apr 2015 17:31:54 -0300 Subject: [PATCH 1/3] fixed makefile.cyg for recent versions of gcc and added some stuff to gitignore that get created on compile and execution --- .gitignore | 2 ++ src/Makefile.cyg | 11 +++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 83bf48a..e346af5 100755 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,5 @@ lib/user/*.prf .new *~ *.DS_Store +sil.INI +src/sil.res diff --git a/src/Makefile.cyg b/src/Makefile.cyg index 3f92b89..3fff7f6 100755 --- a/src/Makefile.cyg +++ b/src/Makefile.cyg @@ -8,8 +8,8 @@ CC = gcc WRES = windres -LIBS = -s -mno-cygwin -mwindows -e _mainCRTStartup -lwinmm -CFLAGS = -Wall -mno-cygwin -O2 -fno-strength-reduce -DWINDOWS +LIBS = -s -mwindows -e _mainCRTStartup -lwinmm +CFLAGS = -Wall -O2 -fno-strength-reduce -DWINDOWS EXOBJS = \ sil.res \ @@ -158,7 +158,7 @@ generate.o: generate.c $(INCS) init1.o: init1.c $(INCS) init.h $(CC) $(CFLAGS) $(INCDIRS) -c -o $@ $< -init2.o: init2.c $(INCS) init.h +init2.o: init2.c $(INCS) init.h $(CC) $(CFLAGS) $(INCDIRS) -c -o $@ $< load.o: load.c $(INCS) init.h @@ -226,13 +226,13 @@ variable.o: variable.c $(INCS) wizard1.o: wizard1.c $(INCS) $(CC) $(CFLAGS) $(INCDIRS) -c -o $@ $< -wizard2.o: wizard2.c $(INCS) +wizard2.o: wizard2.c $(INCS) $(CC) $(CFLAGS) $(INCDIRS) -c -o $@ $< squelch.o: squelch.c $(INCS) $(CC) $(CFLAGS) $(INCDIRS) -c -o $@ $< -xtra1.o: xtra1.c $(INCS) +xtra1.o: xtra1.c $(INCS) $(CC) $(CFLAGS) $(INCDIRS) -c -o $@ $< xtra2.o: xtra2.c $(INCS) @@ -258,4 +258,3 @@ z-virt.o: z-virt.c $(HDRS) z-virt.h z-util.h .c.o: $(CC) $(CFLAGS) $(INCDIRS) -c -o $@ $< - From f88b3a93bbbcd5b3a490ea9be571d8825eba95bc Mon Sep 17 00:00:00 2001 From: Juan Pablo Kaniefsky Date: Thu, 30 Apr 2015 19:05:01 -0300 Subject: [PATCH 2/3] allowed smithing difficulty reduction for all negative effects, up to half of the actual difficulty --- src/cmd4.c | 79 +++++++++++++++++++++++++++++++++--------------------- 1 file changed, 48 insertions(+), 31 deletions(-) diff --git a/src/cmd4.c b/src/cmd4.c index c9dd385..d553981 100755 --- a/src/cmd4.c +++ b/src/cmd4.c @@ -2561,6 +2561,23 @@ void dif_mod(int value, int positive_base, int *dif_inc) } } +/* +* Determines the difficulty modifier for pvals, with the possibility of a negative one. +* +* It uses dif_mod (see above) and applies to the increment or the decrement as appropiate. +*/ +void neg_dif_mod(int value, int base, int *dif_inc, int *dif_dec) +{ + int mod = 0; + + dif_mod(ABS(value), base, &mod); + + if (value > 0) { + *dif_inc += mod; + } else { + *dif_dec += mod / 2; + } +} /* * Determines the difficulty of a given object. @@ -2692,32 +2709,30 @@ int object_difficulty(object_type *o_ptr) if (f1 & TR1_TUNNEL) { x = o_ptr->pval - k_ptr->pval; - dif_mod(x, 10, &dif_inc); + neg_dif_mod(x, 10, &dif_inc, &dif_dec); smithing_cost.str += (x > 0) ? x : 0; } if (o_ptr->pval != 0) { - x = (o_ptr->pval > 0) ? o_ptr->pval : 0; + x = o_ptr->pval; - if (f1 & TR1_DAMAGE_SIDES) { dif_mod(x, 15, &dif_inc); smithing_cost.str += x; } - if (f1 & TR1_STR) { dif_mod(x, 12, &dif_inc); smithing_cost.str += x; } - if (f1 & TR1_DEX) { dif_mod(x, 12, &dif_inc); smithing_cost.dex += x; } - if (f1 & TR1_CON) { dif_mod(x, 12, &dif_inc); smithing_cost.con += x; } - if (f1 & TR1_GRA) { dif_mod(x, 12, &dif_inc); smithing_cost.gra += x; } - if (f1 & TR1_MEL) { dif_mod(x, 4, &dif_inc); smithing_cost.exp += x*100; } - if (f1 & TR1_ARC) { dif_mod(x, 4, &dif_inc); smithing_cost.exp += x*100; } - if (f1 & TR1_STL) { dif_mod(x, 4, &dif_inc); smithing_cost.exp += x*100; } - if (f1 & TR1_PER) { dif_mod(x, 4, &dif_inc); smithing_cost.exp += x*100; } - if (f1 & TR1_WIL) { dif_mod(x, 4, &dif_inc); smithing_cost.exp += x*100; } - if (f1 & TR1_SMT) { dif_mod(x, 4, &dif_inc); smithing_cost.exp += x*100; } - if (f1 & TR1_SNG) { dif_mod(x, 4, &dif_inc); smithing_cost.exp += x*100; } - - x = (o_ptr->pval < 0) ? o_ptr->pval : 0; + if (f1 & TR1_DAMAGE_SIDES) { neg_dif_mod(x, 15, &dif_inc, &dif_dec); smithing_cost.str += x; } + if (f1 & TR1_STR) { neg_dif_mod(x, 12, &dif_inc, &dif_dec); smithing_cost.str += x; } + if (f1 & TR1_DEX) { neg_dif_mod(x, 12, &dif_inc, &dif_dec); smithing_cost.dex += x; } + if (f1 & TR1_CON) { neg_dif_mod(x, 12, &dif_inc, &dif_dec); smithing_cost.con += x; } + if (f1 & TR1_GRA) { neg_dif_mod(x, 12, &dif_inc, &dif_dec); smithing_cost.gra += x; } + if (f1 & TR1_MEL) { neg_dif_mod(x, 4, &dif_inc, &dif_dec); smithing_cost.exp += x*100; } + if (f1 & TR1_ARC) { neg_dif_mod(x, 4, &dif_inc, &dif_dec); smithing_cost.exp += x*100; } + if (f1 & TR1_STL) { neg_dif_mod(x, 4, &dif_inc, &dif_dec); smithing_cost.exp += x*100; } + if (f1 & TR1_PER) { neg_dif_mod(x, 4, &dif_inc, &dif_dec); smithing_cost.exp += x*100; } + if (f1 & TR1_WIL) { neg_dif_mod(x, 4, &dif_inc, &dif_dec); smithing_cost.exp += x*100; } + if (f1 & TR1_SMT) { neg_dif_mod(x, 4, &dif_inc, &dif_dec); smithing_cost.exp += x*100; } + if (f1 & TR1_SNG) { neg_dif_mod(x, 4, &dif_inc, &dif_dec); smithing_cost.exp += x*100; } - if (f1 & TR1_NEG_STR) { dif_mod(-x, 12, &dif_inc); smithing_cost.str -= x; } - if (f1 & TR1_NEG_DEX) { dif_mod(-x, 12, &dif_inc); smithing_cost.dex -= x; } - if (f1 & TR1_NEG_CON) { dif_mod(-x, 12, &dif_inc); smithing_cost.con -= x; } - if (f1 & TR1_NEG_GRA) { dif_mod(-x, 12, &dif_inc); smithing_cost.gra -= x; } + if (f1 & TR1_NEG_STR) { neg_dif_mod(-x, 12, &dif_inc, &dif_dec); smithing_cost.str -= x; } + if (f1 & TR1_NEG_DEX) { neg_dif_mod(-x, 12, &dif_inc, &dif_dec); smithing_cost.dex -= x; } + if (f1 & TR1_NEG_CON) { neg_dif_mod(-x, 12, &dif_inc, &dif_dec); smithing_cost.con -= x; } + if (f1 & TR1_NEG_GRA) { neg_dif_mod(-x, 12, &dif_inc, &dif_dec); smithing_cost.gra -= x; } } // Sustains @@ -2749,15 +2764,17 @@ int object_difficulty(object_type *o_ptr) if (f2 & TR2_RES_HALLU) { dif_inc += 3; } // Penalty Flags - if (f2 & TR2_FEAR) { dif_dec += 0; } - if (f2 & TR2_HUNGER) { dif_dec += 0; } - if (f2 & TR2_DARKNESS) { dif_dec += 0; } - if (f2 & TR2_DANGER) { dif_dec += 5; } // only Danger counts - if (f2 & TR2_AGGRAVATE) { dif_dec += 0; } - if (f2 & TR2_HAUNTED) { dif_dec += 0; } - if (f2 & TR2_VUL_COLD) { dif_dec += 0; } - if (f2 & TR2_VUL_FIRE) { dif_dec += 0; } - if (f2 & TR2_VUL_POIS) { dif_dec += 0; } + if (f2 & TR2_FEAR) { dif_dec += 1; } + if (f2 & TR2_HUNGER) { dif_dec += 2; } + if (f2 & TR2_DARKNESS) { dif_dec += 4; } + if (f2 & TR2_DANGER) { dif_dec += 8; } + if (f2 & TR2_AGGRAVATE) { dif_dec += 1; } + if (f2 & TR2_HAUNTED) { dif_dec += 6; } + if (f2 & TR2_VUL_COLD) { dif_dec += 4; } + if (f2 & TR2_VUL_FIRE) { dif_dec += 4; } + if (f2 & TR2_VUL_POIS) { dif_dec += 4; } + if (f2 & TR2_VUL_POIS) { dif_dec += 4; } + if (f3 & TR3_LIGHT_CURSE) { dif_dec += 7; } // Abilities @@ -2773,8 +2790,8 @@ int object_difficulty(object_type *o_ptr) // Penalty for being an artefact if (o_ptr->name1) { smithing_cost.uses += 2; } - // Cap the difficulty reduction at 8 - if (dif_dec > 8) dif_dec = 8; + // Cap the difficulty reduction at half of the current difficulty + dif_dec = MIN(dif_inc / 2, dif_dec); // Set the overall difficulty dif = dif_inc - dif_dec; From 25f104c93ec7efae9407822d925fb427ebc70c94 Mon Sep 17 00:00:00 2001 From: Juan Pablo Kaniefsky Date: Mon, 4 May 2015 01:01:43 -0300 Subject: [PATCH 3/3] take into account what is or isn't 'smithing gear' for smithing difficulty reduction purposes --- src/cmd4.c | 56 +++++++++++++++++++++++++++++++++--------------------- 1 file changed, 34 insertions(+), 22 deletions(-) diff --git a/src/cmd4.c b/src/cmd4.c index d553981..b8d426d 100755 --- a/src/cmd4.c +++ b/src/cmd4.c @@ -2572,11 +2572,10 @@ void neg_dif_mod(int value, int base, int *dif_inc, int *dif_dec) dif_mod(ABS(value), base, &mod); - if (value > 0) { + if (value > 0) *dif_inc += mod; - } else { + else *dif_dec += mod / 2; - } } /* @@ -2595,6 +2594,7 @@ int object_difficulty(object_type *o_ptr) int brands = 0; int dif_mult = 100; int cat = 0; // default to soothe compilation warnings + bool smithing_gear = FALSE; // reset smithing costs smithing_cost.str = 0; @@ -2709,13 +2709,34 @@ int object_difficulty(object_type *o_ptr) if (f1 & TR1_TUNNEL) { x = o_ptr->pval - k_ptr->pval; - neg_dif_mod(x, 10, &dif_inc, &dif_dec); + dif_mod(x, 10, &dif_inc); smithing_cost.str += (x > 0) ? x : 0; } + + // Abilities + for (i = 0; i < o_ptr->abilities; i++) + { + dif_inc += 5 + (&b_info[ability_index(o_ptr->skilltype[i],o_ptr->abilitynum[i])])->level / 2; + smithing_cost.exp += 500; + // if it has a smithing ability, flag it as smithing gear + if (o_ptr->skilltype[i] == S_SMT) smithing_gear = TRUE; + } + if (o_ptr->pval != 0) { x = o_ptr->pval; + // if it has a smithing skill modifier + if (f1 & TR1_SMT) + { + // flag it as smithing gear + smithing_gear = TRUE; + dif_mod(x, 4, &dif_inc); + if (x > 0) smithing_cost.exp += x*100; + } + + if (smithing_gear) x = (x > 0) ? x : 0; // do not allow negative difficulty modifiers if it is smithing gear + if (f1 & TR1_DAMAGE_SIDES) { neg_dif_mod(x, 15, &dif_inc, &dif_dec); smithing_cost.str += x; } if (f1 & TR1_STR) { neg_dif_mod(x, 12, &dif_inc, &dif_dec); smithing_cost.str += x; } if (f1 & TR1_DEX) { neg_dif_mod(x, 12, &dif_inc, &dif_dec); smithing_cost.dex += x; } @@ -2726,7 +2747,6 @@ int object_difficulty(object_type *o_ptr) if (f1 & TR1_STL) { neg_dif_mod(x, 4, &dif_inc, &dif_dec); smithing_cost.exp += x*100; } if (f1 & TR1_PER) { neg_dif_mod(x, 4, &dif_inc, &dif_dec); smithing_cost.exp += x*100; } if (f1 & TR1_WIL) { neg_dif_mod(x, 4, &dif_inc, &dif_dec); smithing_cost.exp += x*100; } - if (f1 & TR1_SMT) { neg_dif_mod(x, 4, &dif_inc, &dif_dec); smithing_cost.exp += x*100; } if (f1 & TR1_SNG) { neg_dif_mod(x, 4, &dif_inc, &dif_dec); smithing_cost.exp += x*100; } if (f1 & TR1_NEG_STR) { neg_dif_mod(-x, 12, &dif_inc, &dif_dec); smithing_cost.str -= x; } @@ -2764,27 +2784,19 @@ int object_difficulty(object_type *o_ptr) if (f2 & TR2_RES_HALLU) { dif_inc += 3; } // Penalty Flags - if (f2 & TR2_FEAR) { dif_dec += 1; } + if (f2 & TR2_FEAR) { if (!smithing_gear) dif_dec += 1; } if (f2 & TR2_HUNGER) { dif_dec += 2; } - if (f2 & TR2_DARKNESS) { dif_dec += 4; } + if (f2 & TR2_DARKNESS) { if (!smithing_gear) dif_dec += 4; } if (f2 & TR2_DANGER) { dif_dec += 8; } - if (f2 & TR2_AGGRAVATE) { dif_dec += 1; } + if (f2 & TR2_AGGRAVATE) { if (!smithing_gear) dif_dec += 1; } if (f2 & TR2_HAUNTED) { dif_dec += 6; } - if (f2 & TR2_VUL_COLD) { dif_dec += 4; } - if (f2 & TR2_VUL_FIRE) { dif_dec += 4; } - if (f2 & TR2_VUL_POIS) { dif_dec += 4; } - if (f2 & TR2_VUL_POIS) { dif_dec += 4; } - if (f3 & TR3_LIGHT_CURSE) { dif_dec += 7; } - - - // Abilities - for (i = 0; i < o_ptr->abilities; i++) - { - dif_inc += 5 + (&b_info[ability_index(o_ptr->skilltype[i],o_ptr->abilitynum[i])])->level / 2; - smithing_cost.exp += 500; - } + if (f2 & TR2_VUL_COLD) { if (!smithing_gear) dif_dec += 4; } + if (f2 & TR2_VUL_FIRE) { if (!smithing_gear) dif_dec += 4; } + if (f2 & TR2_VUL_POIS) { if (!smithing_gear) dif_dec += 4; } + if (f2 & TR2_VUL_POIS) { if (!smithing_gear) dif_dec += 4; } + if (f3 & TR3_LIGHT_CURSE) { dif_dec += 4; /* representative of the 4 points in will necessary to break it */ } - // Mithirl + // Mithril if (k_ptr->flags3 & TR3_MITHRIL) { smithing_cost.mithril += o_ptr->weight; } // Penalty for being an artefact