Rotghroth Rhapsody Chokboyz Posted March 25, 2009 Share Posted March 25, 2009 Hello, seeing in the Compiled Suggestion List that the Conceal_Ability flag was broken, i browse the code a bit and found that it wasn't hard to fix. So i did. - What was wrong : In the Scenario Editor, giving an item the Conceal_Ability flag, add 32 to its unsigned char item_properties (putting sixth bit to 1 : xx1xxxxx with x=0 or 1). No problem with the editor then. The problem was that nothing was done with this value in the game code (it wasn't even defined). - A fix : First we defines the Conceal_ability flag in ITEM.h : Click to reveal.. #ifndef _ITEM_H #define _ITEM_H #include "location.h" /* item_properties: */ /* 0000 0001 identified 0000 0010 someone's property 0000 0100 magic 0000 1000 contained in sth 0001 0000 cursed 0010 0000 concealed 0100 0000 <not used> 1000 0000 <not used> */ #define ITEM_PROP_IDENTIFIED 1 #define ITEM_PROP_PROPERTY 2 #define ITEM_PROP_MAGIC 4 #define ITEM_PROP_CONTAINED 8 #define ITEM_PROP_CURSED 16 #define ITEM_PROP_CONCEALED 32 //defines the conceal_ability flag struct item_record_type { short variety, item_level; char awkward, bonus, protection, charges, type, magic_use_type; unsigned char graphic_num,ability, ability_strength, type_flag, is_special,a; short value; unsigned char weight, special_class; location item_loc; char full_name[25], name[15]; unsigned char treas_class, item_properties, reserved1, reserved2; /* functions */ bool isIdent() const; /* is identified ? */ bool isMagic() const; /* is magic ? */ bool isContained() const; /* is contained in sth ? */ bool isCursed() const; /* is cursed ? */ bool isProperty() const; /* is someones property? */ bool isConcealed() const; /* is the item ability to be concealed ? */ }; #endif then we defines in ITEM.cpp the isConcealed() function we've just declared : Click to reveal.. [...] bool item_record_type::isConcealed() const { if (item_properties & ITEM_PROP_CONCEALED) return true; else return false; } [...] finally we modifies in INFOGLGS.cpp the function put_item_info() which creates and display items info : Click to reveal.. [...] if (s_i.ability > 0) {//// GetIndString(desc_str,23,s_i.ability + 1); cd_set_item_text(998,12,(char *) desc_str); } if (s_i.isConcealed()){cd_set_item_text(998,12,"???");} //check if the item ability is to be concealed and print "???" in ability if so else{ GetIndString(desc_str,23,s_i.ability + 1); //else it display the item ability as usual cd_set_item_text(998,12,(char *) desc_str); //note : common items weren't displaying the "No ability" string. It is restored here. } [...] and the Conceal_Ability flag will works. Not part of the fix, a little cosmetic change that could be made is to display "???" in ability when the item is not identified (it actually displays nothing). Here is the code to do so (always in INFODLGS.cpp) : Click to reveal.. [...] if (s_i.isIdent() == false) { cd_set_item_text(998,3, s_i.name); cd_set_item_text(998,12, "???"); // cosmetic change, display ??? in ability when the item isn't identified return; } [...] Here it goes, Chokboyz Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.