Pages:<< prev 1 next >>



Apprentice

GroupMembers
Posts86
JoinedAug 25, 2003
Hello, I need extend my sd_damtype mask but I found the same problem described here: http://www.gammon.com.au/forum/?id=13905
Looking in smaug 1.8 I found that they addes SD_HOLY and SD_UNHOLY in this way:
But SDAM_MASK with only bv00, bv01 and bv02 I think isn't enough. I'm wrong?
My opinion is that the right way is:
bv00,bv1,bv2 allow sd from none to drain (7) but are not enought for holy and unholy.
I thing we need to add bv03... ...but I'm not very familiar with bitmask operation.
Any opinion? And about a way to add new sd_types without messup all skill.dat skill->info settings?
thank you
bye
mat
Looking in smaug 1.8 I found that they addes SD_HOLY and SD_UNHOLY in this way:
typedef enum { SD_NONE, SD_FIRE, SD_COLD, SD_ELECTRICITY, SD_ENERGY, SD_ACID, SD_POISON, SD_DRAIN, SD_HOLY, SD_UNHOLY } spell_dam_types; #define ALL_BITS INT_MAX #define SDAM_MASK ALL_BITS & ~(BV00 | BV01 | BV02) #define SACT_MASK ALL_BITS & ~(BV03 | BV04 | BV05) #define SCLA_MASK ALL_BITS & ~(BV06 | BV07 | BV08) #define SPOW_MASK ALL_BITS & ~(BV09 | BV10) #define SSAV_MASK ALL_BITS & ~(BV11 | BV12 | BV13) #define SPELL_DAMAGE(skill) ( ((skill)->info ) & 15 ) #define SPELL_ACTION(skill) ( ((skill)->info >> 4) & 7 ) #define SPELL_CLASS(skill) ( ((skill)->info >> 7) & 7 ) #define SPELL_POWER(skill) ( ((skill)->info >> 10) & 3 ) #define SPELL_SAVE(skill) ( ((skill)->info >> 12) & 7 ) #define SET_SDAM(skill, val) ( (skill)->info = ((skill)->info & SDAM_MASK) + ((val) & 15) ) #define SET_SACT(skill, val) ( (skill)->info = ((skill)->info & SACT_MASK) + (((val) & 7) << 4) ) #define SET_SCLA(skill, val) ( (skill)->info = ((skill)->info & SCLA_MASK) + (((val) & 7) << 7) ) #define SET_SPOW(skill, val) ( (skill)->info = ((skill)->info & SPOW_MASK) + (((val) & 3) << 10) ) #define SET_SSAV(skill, val) ( (skill)->info = ((skill)->info & SSAV_MASK) + (((val) & 7) << 12) )
But SDAM_MASK with only bv00, bv01 and bv02 I think isn't enough. I'm wrong?
My opinion is that the right way is:
#define ALL_BITS INT_MAX #define SDAM_MASK ALL_BITS & ~(BV00 | BV01 | BV02 | BV03) #define SACT_MASK ALL_BITS & ~(BV04 | BV05 | BV06) #define SCLA_MASK ALL_BITS & ~(BV07 | BV08 | BV09) #define SPOW_MASK ALL_BITS & ~(BV10 | BV11) #define SSAV_MASK ALL_BITS & ~(BV12 | BV13 | BV14)
bv00,bv1,bv2 allow sd from none to drain (7) but are not enought for holy and unholy.
I thing we need to add bv03... ...but I'm not very familiar with bitmask operation.
Any opinion? And about a way to add new sd_types without messup all skill.dat skill->info settings?
thank you
bye
mat


Black Hand

GroupAdministrators
Posts3,707
JoinedJan 1, 2002
It's been a very long time since I've looked at any of this but I think because of how those 2 new ones were added you can't just add it to the SDAM_MASK that way. The whole system would be thrown off by doing so.
And since this information is written into files in a bunch of places you'll just end up disrupting a good portion of the skills and spells trying to account for the new ones this way.
And since this information is written into files in a bunch of places you'll just end up disrupting a good portion of the skills and spells trying to account for the new ones this way.


Apprentice

GroupMembers
Posts86
JoinedAug 25, 2003
I tried to implement sd_blunt, sd_pierce, sd_slash, sd_magic etc and everything seems to work.
of course I had to modify all the skills in skill.dat by hand since the bits in -> info are all irretrievably shifted.
but apart from that and obviously implementing the specific code portions for the new sd_blunt, sd_pierce, etc (... it is enough to trivially do a grep on an exisrent sd_dam, eg sd_cold to see where to act) I don't think there is anything else do or problematic.
what is really wrong for me is how the bits mask is implemented as done in smaug 1.8 for holy and unholy.
I don't see how it can work without adding bv03 to sdam_mask.
without bv03 then the ssav_mask bv13 will be "out of bounds"
0 SD_NONE
1 SD_FIRE bv00
2 SD_COLD bv01
3 SD_ELECTRICITY bv02
4 SD_ENERGY bv00+bv01
5 SD_ACID bv00+bv02
6 SD_POISON bv01+bv02
7 SD_DRAIN bv00+bv01+bv02
...now bv00, bv01 and bv02 are full: 2^3=8
we need bv03 on sdam_mask to allow SD_HOLY, SD_UNHOLY
but maybe something escapes me
of course I had to modify all the skills in skill.dat by hand since the bits in -> info are all irretrievably shifted.
but apart from that and obviously implementing the specific code portions for the new sd_blunt, sd_pierce, etc (... it is enough to trivially do a grep on an exisrent sd_dam, eg sd_cold to see where to act) I don't think there is anything else do or problematic.
what is really wrong for me is how the bits mask is implemented as done in smaug 1.8 for holy and unholy.
I don't see how it can work without adding bv03 to sdam_mask.
without bv03 then the ssav_mask bv13 will be "out of bounds"
0 SD_NONE
1 SD_FIRE bv00
2 SD_COLD bv01
3 SD_ELECTRICITY bv02
4 SD_ENERGY bv00+bv01
5 SD_ACID bv00+bv02
6 SD_POISON bv01+bv02
7 SD_DRAIN bv00+bv01+bv02
...now bv00, bv01 and bv02 are full: 2^3=8
we need bv03 on sdam_mask to allow SD_HOLY, SD_UNHOLY
but maybe something escapes me



Geomancer

GroupAdministrators
Posts1,992
JoinedJul 26, 2005
Like Samson it has been ages since I messed with this system and I chose to actually do away with the info setup and redo it all differently to make future changes easier on others.


Black Hand

GroupAdministrators
Posts3,707
JoinedJan 1, 2002
You're screwing around with a very strangely configured bitvector system. No matter what changes you're seeking to implement they're going to invalidate your whole skill file at the very least unless you intend to completely rewrite the whole thing in a different manner to allow for whatever those bit masks are trying to allow for.
Honestly I have no idea what it's even trying to do, so it's not something I ever wanted to mess with because of that.
Honestly I have no idea what it's even trying to do, so it's not something I ever wanted to mess with because of that.



Geomancer

GroupAdministrators
Posts1,992
JoinedJul 26, 2005
lol yea it was a mess in the stock way. I split it up into verious points in LoP and it really does make it easier to deal with in the long run, but as you said it requires redoing it all lol.
Pages:<< prev 1 next >>