VOID PAL_GameEquipItem( VOID ) /*++ Purpose: Allow player equip an item in the game. Parameters: None. Return value: None. --*/ { WORD wObject; while (TRUE) { wObject = PAL_ItemSelectMenu(NULL, kItemFlagEquipable); if (wObject == 0) { return; } PAL_EquipItemMenu(wObject); } }
VOID PAL_SellMenu( VOID ) /*++ Purpose: Show the sell item menu. Parameters: None. Return value: None. --*/ { WORD w; while (TRUE) { w = PAL_ItemSelectMenu(PAL_SellMenu_OnItemChange, kItemFlagSellable); if (w == 0) { break; } if (PAL_ConfirmMenu()) { if (PAL_AddItemToInventory(w, -1)) { gpGlobals->dwCash += gpGlobals->g.rgObject[w].item.wPrice / 2; } } } }
VOID PAL_GameUseItem( VOID ) /*++ Purpose: Allow player use an item in the game. Parameters: None. Return value: None. --*/ { WORD wObject; while (TRUE) { wObject = PAL_ItemSelectMenu(NULL, kItemFlagUsable); if (wObject == 0) { return; } if (!(gpGlobals->g.rgObject[wObject].item.wFlags & kItemFlagApplyToAll)) { // // Select the player to use the item on // WORD wPlayer = 0; while (TRUE) { wPlayer = PAL_ItemUseMenu(wObject); if (wPlayer == MENUITEM_VALUE_CANCELLED) { break; } // // Run the script // gpGlobals->g.rgObject[wObject].item.wScriptOnUse = PAL_RunTriggerScript(gpGlobals->g.rgObject[wObject].item.wScriptOnUse, wPlayer); // // Remove the item if the item is consuming and the script succeeded // if ((gpGlobals->g.rgObject[wObject].item.wFlags & kItemFlagConsuming) && g_fScriptSuccess) { PAL_AddItemToInventory(wObject, -1); } } } else { // // Run the script // gpGlobals->g.rgObject[wObject].item.wScriptOnUse = PAL_RunTriggerScript(gpGlobals->g.rgObject[wObject].item.wScriptOnUse, 0xFFFF); // // Remove the item if the item is consuming and the script succeeded // if ((gpGlobals->g.rgObject[wObject].item.wFlags & kItemFlagConsuming) && g_fScriptSuccess) { PAL_AddItemToInventory(wObject, -1); } return; } } }