Login
User Name:

Password:



Register

Forgot your password?
Dusting off the old code...
Nov 2, 2019 6:52 pm
By Remcon
ADD NEW SD_DAMTYPES
Nov 1, 2019 8:02 pm
By Remcon
Bug in will_fall( )
Oct 12, 2019 4:46 pm
By Matteo2303
Forum Search/User Post History
May 13, 2019 12:43 pm
By Keirath
AFKMud 2.2.2
Mar 3, 2019 5:35 pm
By Samson
SmaugFUSS 1.9.3
Author: Various
Submitted by: Samson
AFKMud 2.2.2
Author: AFKMud Team
Submitted by: Samson
tintin++ ogg sound player script for linux
Author: Robert Smith
Submitted by: Vladaar
6Dragons ogg Soundpack
Author: Vladaar
Submitted by: Vladaar
6Dragons 4.4
Author: Vladaar
Submitted by: Vladaar
Users Online
CommonCrawl

Members: 0
Guests: 0
Stats
Files
Topics
Posts
Members
Newest Member
482
3,749
19,418
592
NelsonAdv2

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
Posts62
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,655
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
Posts62
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,877
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,655
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,877
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 >>