Originally Posted by
SUCCESSOR
Sorry for the late reply. I have updated the OP with a new link on my onedrive. I don't really know what is happening with dropbox. I'll try getting that one fixed as well.
Sorry, I have not really updated this. Lost touch with ZC and ZScript. If there is anything lacking, faulty, or other such let me know! I realize this reply is coming a year late, but it goes to anyone else who might have a similar question.
@SUCCESSOR
: You may want to consider adding it to the databases on zeldaclassic.ocm and pureze.com.
One nice thing that I added to 2.54 and above, thatwill benefit this, and to which you may want to update it (once released), is:
int SetItemSlot(int itm_id, int slot, int force);
/**
* This allows you to set Link's button items without binary operations, and to decide whether to
* obey quest rules, or inventory.
*
* When using this, 'itm_id' is the ID number of the item.
* Set 'slot' to one of the following: 0 == Slot B, 1 == Slot A
* Other buttons may be added in the future, and other values for 'slot' are thus, reserved.
* Set the flags on 'force' as follows:
* const int ITM_REQUIRE_NONE = 0
* const int ITM_REQUIRE_INVENTORY = 1
* const int ITM_REQUIRE_A_SLOT_RULE = 2
* Thus, require both inventory, and following quest slot rules, force == 3.
Thus, needing to set up a subscreen, or using idiotic functions to page through items, is a duck.
I want to add either, or both, RunitemScript(int script) and Useitem(int item_id) at some point--I may have mentioned this in the thread earlier, but I've forgotten--and I want to add bitem slots for the extra buttons, plus L and R; hence the configuration for SetItemSlot(), which can be expanded to cover additional slots, if we add more.
The real issue, is the suibscreen: I could add item slots for more buttons, but making the subscreen show them would be hellish.
Originally Posted by
Lunaria
Well I was both wanting to look into how it handled things in code as well as maybe implementing it depending on how it worked, I'm not yet certain exactly what kind of solution I want so I really can't see exactly what I need from it. If you do find it that would be appreciated.
One of the things that I did, to suppress the graphical inconsistency, was this:
Set the tile positions for A and B item slots (the subscreen icons) as constants:
const int SUBSC_PSV_ITEM_A_X = n;
const int SUBSC_PSV_ITEM_A_Y = n;
const int SUBSC_PSV_ITEM_B_X = n;
const int SUBSC_PSV_ITEM_B_Y = n;
Draw a solid black tile over the item that I am substituting.
Draw the item tile for the item the item that is truly held in that slot (the one that I am temporarily shifting out) over the black tile.
This overrides the graphics of the item that I am using for a frame, so that the graphical glitch is less obvious.
I was more clever with 2.54, and in that version, I do:
Code:
//global
const int TEMP_ITM_B_ID = 0;
const int TEMP_ITM_B_TILE = 1;
const int TEMP_ITM_A_ID = 2;
const int TEMP_ITM_A_TILE = 3;
const int TEMP_ITM_L_ID = 4;
const int TEMP_ITM_L_TILE = 5;
int tempitem[8]; //holds the item that should be in the slot, and its tile.
// Item that should be there: item id (B), tile (B), item id (A), tile (A)
//item that we are using this frame tempidtem_id, tempitem_tile
void UseItemOnL(int itm_id)
{
itemdata temp = Game->LoadItemData(GetItemSlot(SLOT_B));
itemdata itmL = Game->LoadItemData(itm_id);
//store the original item information for the slot
tempitem[TEMP_ITM_B_ID] = temp->ID; //what was in the slot.
tempitem[TEMP_ITM_B_TILE] = temp->Tile; //..
tempitem[TEMP_ITM_L_ID] = itm_id;
tempitem[TEMP_ITM_L_TILE] = temp->Tile; //the original tile for the temporary item
itmL->Tile = tempitem[1];
Link->SetItemSlot(itm_id, SLOT_B, 0);
Link->PressB = true;
Waitframe();
}
void RestoreItemB()
{
itemdata temp = Game->LoadItemData(tempitem[TEMP_ITM_L_ID]);
itemdata real = Game->LoadItemData(tempitem[TEMP_ITM_B_ID]);
Link->SetItemSlot(tempitem[TEMP_ITM_B_ID], SLOT_B, 0); //restore the true item
temp->Tile = tempitem[TEMP_ITM_L_TILE]; //restore the original tile.
}