Login
User Name:

Password:



Register

Forgot your password?
Changes list / Addchange
Author: Khonsu
Submitted by: Khonsu
6Dragons mp3 sound pack
Author: Vladaar
Submitted by: Vladaar
AFKMud 2.2.3
Author: AFKMud Team
Submitted by: Samson
SWFOTEFUSS 1.5
Author: Various
Submitted by: Samson
SWRFUSS 1.4
Author: Various
Submitted by: Samson
Users Online
Naver

Members: 0
Guests: 34
Stats
Files
Topics
Posts
Members
Newest Member
488
3,788
19,631
595
Khonsu

Today's Birthdays
There are no member birthdays today.
» SmaugMuds » Codebases » SmaugFUSS » ADD NEW SD_DAMTYPES
Forum Rules | Mark all | Recent Posts

ADD NEW SD_DAMTYPES
< Newer Topic :: Older Topic > how to add new damtypes...

Pages:<< prev 1 next >>
Post is unread #1 Oct 28, 2019 3:23 pm   
Go to the top of the page
Go to the bottom of the page

Matteo2303
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:


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

Post is unread #2 Oct 31, 2019 4:37 pm   
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,685
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.

Post is unread #3 Oct 31, 2019 8:55 pm   Last edited Oct 31, 2019 9:20 pm by Matteo2303
Go to the top of the page
Go to the bottom of the page

Matteo2303
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

Post is unread #4 Nov 1, 2019 10:36 am   
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,914
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.

Post is unread #5 Nov 1, 2019 7:45 pm   
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,685
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.

Post is unread #6 Nov 1, 2019 8:02 pm   
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,914
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 >>