Angband.oook.cz
Angband.oook.cz
AboutVariantsLadderForumCompetitionComicScreenshotsFunniesLinks

Go Back   Angband Forums > Angband > Development

Reply
 
Thread Tools Display Modes
Old August 30, 2010, 18:08   #1
Hajo
Adept
 
Hajo's Avatar
 
Join Date: Aug 2010
Posts: 142
Hajo is on a distinguished road
Trying to make ego lights for Angband 2.9.3

I've been trying to make ego lights for Angband 2.9.3. It seems I got most of it right. The flags are set right when I inspect the items with the debug commands, and they work as expected.

But there is a strange side effect in inventory display.

Quote:
a Wooden Torch of Brightness (-1) (with 2345 turns of light)
I wonder where the -1 comes from and what it means. The torch has SEE_INVIS and my newly introduced EGO_LIGHT flags. I tried to give it +1 to hit (due to the better light) but nothing else.

Code:
N:103:of Brightness
X:29:0:0
W:1:1:0:0
C:1:0:0:0
T:39:0:99
F:SEE_INVIS | EGO_LIGHT
I guess the -1 comes from the C line, but why is that (-1) then and not [+1, +0]? I might skip the idea of the attack bonus from ego lights if this causes too much troubles. I have even no idea if the bonus would transfer to the attack mods anyways, since this is a ego light and not a weapon.
__________________
I have a project problem? I have no project problem. I start a project, I work on it, it fails. No problem
Hajo is offline   Reply With Quote
Old August 30, 2010, 20:00   #2
Timo Pietilš
Prophet
 
Join Date: Apr 2007
Location: Climbing up from hole I just dug.
Posts: 4,080
Timo Pietilš is on a distinguished road
Quote:
Originally Posted by Hajo View Post
I've been trying to make ego lights for Angband 2.9.3. It seems I got most of it right. The flags are set right when I inspect the items with the debug commands, and they work as expected.

But there is a strange side effect in inventory display.

Code:
a Wooden Torch of Brightness (-1) (with 2345 turns of light)
I wonder where the -1 comes from and what it means. The torch has SEE_INVIS and my newly introduced EGO_LIGHT flags. I tried to give it +1 to hit (due to the better light) but nothing else.

Code:
N:103:of Brightness
X:29:0:0
W:1:1:0:0
C:1:0:0:0
T:39:0:99
F:SEE_INVIS | EGO_LIGHT
I guess the -1 comes from the C line, but why is that (-1) then and not [+1, +0]? I might skip the idea of the attack bonus from ego lights if this causes too much troubles. I have even no idea if the bonus would transfer to the attack mods anyways, since this is a ego light and not a weapon.
That first number is max to-hit. For some reason you get it negative. For to_hit and to_dam values you use parenthesis for AC brackets. 2.9.3 code doesn't show the other value for to_hit and to_dam if it is zero. That is why only one number.

I have no idea why it shows it as negative. Maybe just giving it a value as ego makes it possible to generate negative value too (flip value). That C: -line is max to_hit, not fixed value. Artifacts get fixed values. For egos there is some code for values.
Timo Pietilš is offline   Reply With Quote
Old August 30, 2010, 21:40   #3
Hajo
Adept
 
Hajo's Avatar
 
Join Date: Aug 2010
Posts: 142
Hajo is on a distinguished road
Must have been some kind of mishaps in early versions of my code I guess. Now I get only positive numbers. Thanks for clarifying the (..) vs [..] issue

I saw that I must adapt the "I"nspect command though, it gives wrong radius information. Still kind a cool to have made my first sort of ego item
__________________
I have a project problem? I have no project problem. I start a project, I work on it, it fails. No problem
Hajo is offline   Reply With Quote
Old August 30, 2010, 22:03   #4
Hajo
Adept
 
Hajo's Avatar
 
Join Date: Aug 2010
Posts: 142
Hajo is on a distinguished road
Seems to work fine now. Thanks again for the help, Timo! Was also good to learn about the differences in artifact and ego item configuration.
__________________
I have a project problem? I have no project problem. I start a project, I work on it, it fails. No problem
Hajo is offline   Reply With Quote
Old August 31, 2010, 05:06   #5
Timo Pietilš
Prophet
 
Join Date: Apr 2007
Location: Climbing up from hole I just dug.
Posts: 4,080
Timo Pietilš is on a distinguished road
Quote:
Originally Posted by Hajo View Post
Seems to work fine now. Thanks again for the help, Timo! Was also good to learn about the differences in artifact and ego item configuration.
Actually now that I read my reply to you again I think vanilla has some "hackish" code somewhere for displaying to_hit and to_dam. Armors and rings in 2.9.3 show only one value if another is zero and none if both are zero, but weapons show both even if they are both zero. It shows that differently based on item type, and that must have some kind of definition somewhere when to use which way to show those values. Might be a bit more complicated than I thought.
Timo Pietilš is offline   Reply With Quote
Old August 31, 2010, 12:20   #6
Hajo
Adept
 
Hajo's Avatar
 
Join Date: Aug 2010
Posts: 142
Hajo is on a distinguished road
I think I found the function. Looks a bit convoluted. Before hacking my way in the code I thought Angband would have much less special cases, but there are enough, still. On the other hand once one understood the logic it looks more reasonable. I'd assume that the code was state of the art when written, and it's just me who is not used to such code.

At the moment I think I do not need to adapt this place though.

I have a slightly off topic question: The number of 127 ego items seems to be limited through the use of a byte variable in the object_type structure for the link into the ego-item-date table. If I change that I assume I must also adapt game saving and loading routines. And somewhere the allocation of the e_info ego-item-data table (should have a define, IIRC). Is there more to it? It's not urgent, I think I have 20 ego-data slots left but if I continue modding Angband I sure run out of these slots, and maybe I'd better make the move early, if it alters the savegame structure.

On the other hand "unsigned char" seems to work reasonably well with gcc on all platforms that I know and it would already give a whopping 128 extra ego data slots, while keeping the save game format. A comment in types.h mentions that "unsigned char" is not properly supported on some platforms, but maybe this has improved in the past ten years?
__________________
I have a project problem? I have no project problem. I start a project, I work on it, it fails. No problem
Hajo is offline   Reply With Quote
Old September 1, 2010, 06:40   #7
zaimoni
Knight
 
zaimoni's Avatar
 
Join Date: Apr 2007
Posts: 590
zaimoni is on a distinguished road
Quote:
Originally Posted by Hajo View Post
On the other hand "unsigned char" seems to work reasonably well with gcc on all platforms that I know and it would already give a whopping 128 extra ego data slots, while keeping the save game format. A comment in types.h mentions that "unsigned char" is not properly supported on some platforms, but maybe this has improved in the past ten years?
More like past twenty (that comment sounds more appropriate for the K&R compilers available in Moria's time).

Any C90 compliant compiler targeting a normal platform should be fine with unsigned char for that field.
__________________
Zaiband: end the "I shouldn't have survived that" experience. V3.0.6 fork on Hg.
Zaiband 3.0.10 ETA Mar. 7 2011 (Yes, schedule slipped. Latest testing indicates not enough assert() calls to allow release.)
Z.C++: pre-alpha C/C++ compiler system (usable preprocessor). Also on Hg. Z.C++ 0.0.10 ETA December 31 2011
zaimoni is offline   Reply With Quote
Old September 1, 2010, 10:27   #8
Hajo
Adept
 
Hajo's Avatar
 
Join Date: Aug 2010
Posts: 142
Hajo is on a distinguished road
Good to know. I don't have much experience with compilers other than gcc, thus I was a bit uncertain.

Keeping the variable to a 8 bit quantity should make things easier.
__________________
I have a project problem? I have no project problem. I start a project, I work on it, it fails. No problem
Hajo is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
*** no rule to make target JDTAY Development 9 March 3, 2010 20:58
Ego weapons you always wanted to find... Pete Mack AAR 5 July 5, 2009 05:37
pricing on slay ego weapons Malak Darkhunter Vanilla 2 July 1, 2009 22:02
Ego-Item indexes in defines.h PaulBlay Development 0 April 17, 2009 10:21
Trying to make my own variant bpleshek Variants 8 September 15, 2008 21:42


All times are GMT +1. The time now is 03:43.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2017, vBulletin Solutions, Inc.