UPDATED FEB13: Inventory+Random Item Gen
Posted: Thu Jan 24, 2013 11:34 pm
Updated GED February 13, 2013
HOW TO USE:
Notes:
The green background canvas is not a part of the inventory. This area is used for generating items to display the random creation function.
The white box is the display information for hovered items. It does not clear on mouse exit. Its just a debug box.
Left Mouse Button Down on GREEN Canvas Generates a random Item.
Left Mouse Button Down on ITEM will add it to an available slot in the inventory.
Right Mouse Button HELD Down on an ITEM will allow you to drag the ITEM around.
KEYBOARD Key 'i' for INVENTORY will display the inventory.
Hover over ANY option and LEFT Mouse Button Down and it will display ALL contents of the inventory. THIS IS NOT A BUG. (Apparel and Quest Features yet to be implemented)
Hover over inventory item to display the stats of the item in the display window.
Keyboard 'i' Down again will "close" the inventory.
______________________________
Template Code, Just Add Actor Variables:
HOW TO USE:
Notes:
The green background canvas is not a part of the inventory. This area is used for generating items to display the random creation function.
The white box is the display information for hovered items. It does not clear on mouse exit. Its just a debug box.
Left Mouse Button Down on GREEN Canvas Generates a random Item.
Left Mouse Button Down on ITEM will add it to an available slot in the inventory.
Right Mouse Button HELD Down on an ITEM will allow you to drag the ITEM around.
KEYBOARD Key 'i' for INVENTORY will display the inventory.
Hover over ANY option and LEFT Mouse Button Down and it will display ALL contents of the inventory. THIS IS NOT A BUG. (Apparel and Quest Features yet to be implemented)
Hover over inventory item to display the stats of the item in the display window.
Keyboard 'i' Down again will "close" the inventory.
______________________________
Template Code, Just Add Actor Variables:
- Code: Select all
//Script for items
//*************************************************************************
//
// THIS AREA IS FOR NOTES FOR FUTURE IMPLEMENTATION:
//
// Formula for Measured Attack Speed:
// Attack speed = (Attack Speed * Weapon Attack Speed) +
// ((Attack Speed * Weapon Attack Speed)* EQUIPMODS)
//
//
//
//*************************
// Actor Variables: |
// ItemName |
// ItemMagicType |
// ItemBaseType |
// ItemMod1 |
// ItemMod2 |
// ItemMod3 |
// ItemMod4 |
//*************************
//*************************
// BaseItem Struct |
// is used to create |
// basic items for use. |
//*************************
struct BaseItem;
typedef struct BaseItem{
char itemName[30];
int itemType; //0-None, 1-Weapon, 2-Off-hand, 3-Chest, 4-Pants, 5-Boots,
// 6-Gloves, 7-Helm, 8-Rings, 9-Amulet, 10-Potion, 11-Quest
int itemPoints; //Damage, Defense, Healing
float itemRate; //Attack Speed, Healing Speed, Blocking Rate
int itemValue; //Sell price
int itemStack; //0: Not stackable;; 1 or more: Stackable
}BaseItem;
//*******************************************************************************************
// This is used to template new Item Modifiers for items |
// |
// prefix array: is used to give a Prefix to an item in naming |
// |
// suffix array: is used to give a Suffix to an item in naming |
// |
// modDescription: Gives a description of what the modifier does, use %d |
// for point mods such as Damage increases. |
// |
// modType: This is used to identify the type of modification. |
// |
// |
// modPointsPrefix: Add points based on if its a Prefix. |
// |
// modPointsSuffix: Add points based on if its a Suffix. |
// |
// modPercPrefix: Add percentage mod for Prefix. |
// |
// modPercSuffix: Add percentage mod for Suffix. |
// |
// special: Idenifier for adding special effects. |
// |
//*******************************************************************************************
struct ItemModifier;
typedef struct ItemModifier{
char prefix[30];
char suffix[30];
char modDescription[150];
int modType; //Types of mods availible based on integer value
int modPointsPrefix;
int modPointsSuffix;
float modPercPrefix; //0.0 - 1.0
float modPercSuffix;
float modValue; //Percentage of value increase
int special; //Special Modifiers for increased funness and awesome.
}ItemModifer;
struct SimpleRect;
typedef struct SimpleRect{
int x;
int y;
int width;
int height;
}SimpleRect;
SimpleRect WF_Selector = {0,0,0,0};
const int INVENTORY_MAX = 20;
const int INVEN_MAX_NAME_VALUE = 30;
int Inventory[INVENTORY_MAX][8];
char Inventory_ItemName[INVENTORY_MAX][150];
const int MENU_MAX_INDEX = 5;
int MenuButtons[MENU_MAX_INDEX];
char MenuButtonTexts[MENU_MAX_INDEX][10] = {"Weapons", "Apparel", "Potions", "Quest", "Misc"};
int MenuOpened = 0;
//**************************************************
// When adding more items to the mod list,
// or to the base items list, the array size
// will have to be increased to the exact number
// of Modifers, or Base Items, respectively.
//
//**************************************************
const int MODNUM = 6;
const int BASENUM = 6;
ItemModifer ItemModList[MODNUM+1];
BaseItem BaseItemList[BASENUM];
char MagicTypes[10][50] = {"Normal", "Magic", "Magic", "Magic" , "Rare", "Rare", "Epic"};
char RareNamePrefix[10][50] = {"Wolf ", "Brutal ", "Raven ", "Toad ", "Dark ",
"Regal ", "Heavy ", "Torch ", "Cold ", "Bloody "};
char RareNameSuffix[10][50] = {"Tower", "Finger", "Wood", "Steel", "Grip",
"Stare", "Killer", "Shank", "Spike", "Water"};
char EpicNamePrefix[10][50] = {"Cow ", "Forgotten ", "Tasty ", "Horrid ", "Spectral ",
"Eclipsing ", "Red ", "For The ", "Historical ", "Buried "};
char EpicNameSuffix[10][50] = {"Pie", "Forever", "Hand", "Me", "Razor",
"Dawn", "Horde", "Ransom", "Rum", "...yeah"};
//******************************
// Function Prototyping |
//******************************
Actor* ITEM_CreateRandom(int x, int y);
void ITEM_SetRandomMods(Actor* myActor);
void ITEM_InitMods();
void ITEM_InitBaseItems();
void ITEM_GetDescription(Actor* myActor, char description[]);
int ITEM_GetWeaponDamage(Actor* myActor, float equipMod);
void ITEM_GetModDesc(Actor* myActor, int modifier, char description[],int prefix);
Actor* ITEM_CreateSpecificItem(int x, int y, int baseType, int magicType,
int mod1, int mod2, int mod3, int mod4 );
void INVEN_Init();
void INVEN_ClearSlot(int slot);
void INVEN_AddItem(Actor* myActor);
void INVEN_Replace(int removedItem);
void INVEN_Organize();
void MENU_InitButtons();
void MENU_ActivateDrawSelected(char fromActor[], char toCanvas[]);
void MENU_WriteTextToButton(int index);
int MENU_AddToIndex(int clonenum);
void MENU_CreateMenuButton(int i_x, int i_y, int index);
void MENU_CreateMenu(int i_x, int i_y);
void MENU_CreateItemListButton(int i_x, int i_y, int index, int i_type);
void MENU_CreateItemList(int i_x, int i_y, int i_type);
void MENU_MoveCanvasToScreen(char Canvas[]);
void MENU_MoveCanvasOffScreen(char Canvas[]);
Actor* ITEM_CreateSpecificItem(int x, int y, int baseType, int magicType,
int mod1, int mod2, int mod3, int mod4 )
{
Actor* myActor;
char temp[100];
//************************************************
// IMPORTANT NOTE: |
// Change "Draggable". "simplegear" |
// to the names of your Actor and |
// Animation. |
// |
// Or simply make Actor named |
// "Draggable" with Animation |
// named "simplegear". |
//************************************************
myActor = CreateActor("Draggable", "simplegear", "(none)", "(none)", x, y, false);
ChangeAnimationDirection(myActor->name, STOPPED);
myActor->animpos = baseType;
myActor->ItemBaseType = baseType;
myActor->ItemMagicType = magicType;
myActor->ItemMod1 = mod1;
myActor->ItemMod2 = mod2;
myActor->ItemMod3 = mod3;
myActor->ItemMod4 = mod4;
if(myActor->ItemMagicType > 3)
{
strcat(temp, RareNamePrefix[rand(10)]);
strcat(temp, RareNameSuffix[rand(10)]);
if(myActor->ItemMagicType > 5)
{
strcpy(temp, "");
strcat(temp, EpicNamePrefix[rand(10)]);
strcat(temp, EpicNameSuffix[rand(10)]);
}
}
else
{
if(myActor->ItemMagicType > 0 && myActor->ItemMagicType != 2 )
{
strcat(temp, ItemModList[myActor->ItemMod1].prefix);
strcat(temp, ItemModList[myActor->ItemMod2].prefix);
}
//********************************
// Put the base type in its name |
//********************************
strcat(temp, BaseItemList[myActor->ItemBaseType].itemName);
//********************************************************
// If the item has a suffix, add the suffix to the name. |
//********************************************************
if(myActor->ItemMagicType > 1 )
{
strcat(temp, " of");
strcat(temp, ItemModList[myActor->ItemMod3].suffix);
strcat(temp, ItemModList[myActor->ItemMod4].suffix);
}
}
strcpy(myActor->ItemName, temp);
return myActor;
}
//*************************************************
// This Function creates a random item at |
// x,y coordinates. |
// |
// The item created has no modifiers. |
// |
//*************************************************
Actor* ITEM_CreateRandom(int x, int y)
{
Actor* myActor;
int i;
//************************************************
// IMPORTANT NOTE: |
// Change "Draggable". "simplegear" |
// to the names of your Actor and |
// Animation. |
// |
// Or simply make Actor named |
// "Draggable" with Animation |
// named "simplegear". |
//************************************************
myActor = CreateActor("Draggable", "simplegear", "(none)", "(none)", x, y, false);
ChangeAnimationDirection(myActor->name, STOPPED);
i = rand(BASENUM);
myActor->animpos = i;
myActor->ItemBaseType = i;
myActor->ItemMagicType = 0;
myActor->ItemMod1 = 0;
myActor->ItemMod2 = 0;
myActor->ItemMod3 = 0;
myActor->ItemMod4 = 0;
return myActor;
}
//********************************************************
// ITEM_setRandomMods function |
// adds modifiers to a pre-existiing item. |
// |
// You pass the actor to the function and it randomly |
// adds modifiers to it from the ItemModList and |
// changes it's rarity type. |
//********************************************************
void ITEM_SetRandomMods(Actor* myActor)
{
char temp[100];
//Set Rarity
myActor->ItemMagicType = rand(7);
//*************************************************************
// Add Random Mods |
// |
// This checks to see if the item should have a prefix. |
// If the item is of the Normal type or No Prefix Magic type |
// this first Mod Slot (prefix slot) will be passed over. |
//*************************************************************
if(myActor->ItemMagicType > 0 && myActor->ItemMagicType != 2 )
{
myActor->ItemMod1 = rand(MODNUM)+1;
}
//*************************************************************
// This checks to see if the item should have a suffix. |
// If the item is of the Normal type or No Suffix Magic type |
// this third Mod Slot (suffix slot) will be passed over. |
//*************************************************************
if(myActor->ItemMagicType > 1)
{
myActor->ItemMod3 = rand(MODNUM)+1;
}
//***************************************************************
// This checks to see if the item should have a second prefix. |
// If the item is lower than Rare or single Prefix Rare type |
// this second Mod slot (prefix slot) will be passed over. |
//***************************************************************
if(myActor->ItemMagicType > 3 && myActor->ItemMagicType != 5 )
{
myActor->ItemMod2 = rand(MODNUM)+1;
}
//****************************************************************
// This checks to see if the item should have a second suffix. |
// if the item is not of the second suffix Rare or higher type |
// this forth Mod slot (suffix slot) will be passed over. |
//****************************************************************
if(myActor->ItemMagicType > 4)
{
myActor->ItemMod4 = rand(MODNUM)+1;
}
//**********************************************************************
// This Names the items based on the Prefixs, Suffixs, and Base type. |
// |
// If the item has a prefix then name the item with a prefix |
// |
// The first set of if statements checks to see if it is RARE or |
// EPIC. Then names it based on such. |
//**********************************************************************
if(myActor->ItemMagicType > 3)
{
strcat(temp, RareNamePrefix[rand(10)]);
strcat(temp, RareNameSuffix[rand(10)]);
if(myActor->ItemMagicType > 5)
{
strcpy(temp, "");
strcat(temp, EpicNamePrefix[rand(10)]);
strcat(temp, EpicNameSuffix[rand(10)]);
}
}
else
{
if(myActor->ItemMagicType > 0 && myActor->ItemMagicType != 2 )
{
strcat(temp, ItemModList[myActor->ItemMod1].prefix);
strcat(temp, ItemModList[myActor->ItemMod2].prefix);
}
//********************************
// Put the base type in its name |
//********************************
strcat(temp, BaseItemList[myActor->ItemBaseType].itemName);
//********************************************************
// If the item has a suffix, add the suffix to the name. |
//********************************************************
if(myActor->ItemMagicType > 1 )
{
strcat(temp, " of");
strcat(temp, ItemModList[myActor->ItemMod3].suffix);
strcat(temp, ItemModList[myActor->ItemMod4].suffix);
}
}
strcpy(myActor->ItemName, temp);
}
//*************************************
// ITEM_getWeaponDamage returns the |
// damage integer of the weapon |
// including MODS on weapon and |
// MODS on equipment. |
// ************************************
int ITEM_GetWeaponDamage(Actor* myActor, float equipMod)
{
int i = BaseItemList[myActor->ItemBaseType].itemPoints;
if(ItemModList[myActor->ItemMod1].modType == 1)
{
i = i + (BaseItemList[myActor->ItemBaseType].itemPoints *
ItemModList[myActor->ItemMod1].modPercPrefix);
}
if(ItemModList[myActor->ItemMod2].modType == 1)
{
i = i + (BaseItemList[myActor->ItemBaseType].itemPoints *
ItemModList[myActor->ItemMod2].modPercPrefix);
}
if(ItemModList[myActor->ItemMod3].modType == 1)
{
i = i + (BaseItemList[myActor->ItemBaseType].itemPoints *
ItemModList[myActor->ItemMod3].modPercSuffix);
}
if(ItemModList[myActor->ItemMod4].modType == 1)
{
i = i + (BaseItemList[myActor->ItemBaseType].itemPoints *
ItemModList[myActor->ItemMod4].modPercSuffix);
}
i = i + (BaseItemList[myActor->ItemBaseType].itemPoints * equipMod);
return i;
}
//*********************************************
// ITEM_getDescription function writes a |
// description of the item passed to it. |
// |
// It requires an array large enough to hold |
// the description. |
// |
// A char array of [250] should be more than |
// enough. |
//*********************************************
void ITEM_GetDescription(Actor* myActor, char description[])
{
char temp[50];
char newline[2] = "\n";
int namelen = strlen(myActor->ItemName);
int i;
int runOnce = 0;
float equipMOD = .5; //add 50% more damage to base weapon
strcpy(description, "");
//FOR LOOP FOR SPLITTING LONG ITEM NAMES INTO TWO LINES
if(namelen > 25)
{
for(i = 0; i < namelen; i++)
{
if(i >= (namelen)/2
&& myActor->ItemName[i] == ' ' && runOnce == 0)
{
description[i] = newline[0];
i++;
runOnce = 1;
}
description[i] = myActor->ItemName[i];
}
}
else
{
strcpy(description, myActor->ItemName);
}
strcat (description, "\n\n");
// Type
strcat (description, MagicTypes[myActor->ItemMagicType]);
strcat (description, " ");
strcat (description, BaseItemList[myActor->ItemBaseType].itemName);
strcat (description, "\n");
sprintf(temp, "Damage: %d", ITEM_GetWeaponDamage(myActor, equipMOD));
strcat (description, temp);
strcat (description, "\n----------------------\n");
ITEM_GetModDesc(myActor, myActor->ItemMod1 , description, 1);
ITEM_GetModDesc(myActor, myActor->ItemMod2 , description, 1);
ITEM_GetModDesc(myActor, myActor->ItemMod3 , description, 0);
ITEM_GetModDesc(myActor, myActor->ItemMod4 , description, 0);
}
void ITEM_GetModDesc(Actor* myActor, int modifier, char description[], int prefix)
{
char temp[150];
int i;
if(modifier)
{
//****************************************************************
// Uses the description in the mod list + the point modifier to |
// write a description of the Modifier. |
//****************************************************************
if(prefix)
{
if(ItemModList[modifier].modPointsPrefix)
{
sprintf (temp, ItemModList[modifier].modDescription,
ItemModList[modifier].modPointsPrefix );
}
if(ItemModList[modifier].modPercPrefix)
{
i = (ItemModList[modifier].modPercPrefix)*100;
sprintf (temp, ItemModList[modifier].modDescription, i);
}
if(ItemModList[modifier].modPointsPrefix == 0
&& ItemModList[modifier].modPercPrefix == 0)
{
strcpy (temp, ItemModList[modifier].modDescription);
}
}
else
{
if(ItemModList[modifier].modPointsSuffix)
{
sprintf (temp, ItemModList[modifier].modDescription,
ItemModList[modifier].modPointsSuffix );
}
if(ItemModList[modifier].modPercSuffix)
{
i = (ItemModList[modifier].modPercSuffix)*100;
sprintf (temp, ItemModList[modifier].modDescription, i);
}
if(ItemModList[modifier].modPointsSuffix == 0
&& ItemModList[modifier].modPercSuffix == 0)
{
strcpy (temp, ItemModList[modifier].modDescription);
}
}
strcat (description, temp);
strcat (description, "\n\n");
}
}
void INVEN_ClearSlot(int slot)
{
Inventory[slot][0] = 0;
Inventory[slot][1] = 0;
Inventory[slot][2] = 0;
Inventory[slot][3] = 0;
Inventory[slot][4] = 0;
Inventory[slot][5] = 0;
Inventory[slot][6] = 0;
Inventory[slot][7] = 0;
strcpy(Inventory_ItemName[slot], "");
}
void INVEN_AddItem(Actor* myActor)
{
int i;
if(!Inventory[INVENTORY_MAX-1][0])
{
Inventory[INVENTORY_MAX-1][0] = 1; //slot filled
Inventory[INVENTORY_MAX-1][1] = myActor->ItemEquipped;
Inventory[INVENTORY_MAX-1][2] = myActor->ItemBaseType;
Inventory[INVENTORY_MAX-1][3] = myActor->ItemMagicType;
Inventory[INVENTORY_MAX-1][4] = myActor->ItemMod1;
Inventory[INVENTORY_MAX-1][5] = myActor->ItemMod2;
Inventory[INVENTORY_MAX-1][6] = myActor->ItemMod3;
Inventory[INVENTORY_MAX-1][7] = myActor->ItemMod4;
strcpy(Inventory_ItemName[INVENTORY_MAX-1], myActor->ItemName);
}
INVEN_Organize();
}
void INVEN_Replace(int removedItem)
{
int i;
for(i = INVENTORY_MAX-1; i > removedItem; i--)
{
if(Inventory[i][0])
{
Inventory[removedItem][0] = 1; //slot filled
Inventory[removedItem][1] = Inventory[i][1];
Inventory[removedItem][2] = Inventory[i][2];
Inventory[removedItem][3] = Inventory[i][3];
Inventory[removedItem][4] = Inventory[i][4];
Inventory[removedItem][5] = Inventory[i][5];
Inventory[removedItem][6] = Inventory[i][6];
Inventory[removedItem][7] = Inventory[i][7];
strcpy(Inventory_ItemName[removedItem], Inventory_ItemName[i] );
INVEN_ClearSlot(i);
break;
}
}
}
void INVEN_Organize()
{
int i;
for(i=0; i < INVENTORY_MAX; i++)
{
if(!Inventory[i][0])
{
INVEN_Replace(i);
}
}
}
//**********************************************************
// MENU FUNCTIONS
//
//
//**********************************************************
void MENU_ActivateDrawSelected(char fromActor[], char toCanvas[])
{
Actor* myActor = getclone(fromActor);
Actor* myCanvas = getclone(toCanvas);
WF_Selector.x = myActor->xscreen - myCanvas->xscreen;
WF_Selector.y = myActor->yscreen - myCanvas->yscreen;
WF_Selector.width = myActor->width;
WF_Selector.height = myActor->height;
SendActivationEvent(toCanvas);
}
void MENU_WriteTextToButton(int index)
{
Actor* myActor;
char temp[30];
sprintf(temp, "MenuText.%d", MenuButtons[index]);
myActor = getclone(temp);
strcpy(myActor->text, MenuButtonTexts[index]);
}
int MENU_AddToIndex(int clonenum)
{
int i;
for(i = 0; i < MENU_MAX_INDEX; i++)
{
if(MenuButtons[i] == -1)
{
MenuButtons[i] = clonenum;
return i;
}
}
return -1;
}
void MENU_CreateMenuButton(int i_x, int i_y, int index)
{
Actor* myActor;
//int index = -1;
myActor = CreateActor("MenuText", "icon", "InventoryPane", "(none)", i_x +15, i_y + 5, false);
MenuButtons[index] = myActor->cloneindex;
if(index != -1 && index < MENU_MAX_INDEX)
{
MENU_WriteTextToButton(index);
}
else
{
strcpy(myActor->text,"ERROR!!");
}
myActor = CreateActor("MenuHitBox", "icon", "InventoryPane", "(none)", i_x, i_y, false);
if(index != -1 && index < MENU_MAX_INDEX)
{
MenuButtons[index] = myActor->cloneindex;
}
myActor->Menu_Index = index;
}
void MENU_CreateMenu(int i_x, int i_y)
{
int i;
for(i = 0; i < MENU_MAX_INDEX; i++)
{
MENU_CreateMenuButton(i_x, i_y + (50*i), i);
}
}
void MENU_CreateItemListButton(int i_x, int i_y, int index, int i_type)
{
Actor* myActor;
char blank[2] = " ";
char temp[250];
char temp2[250];
int i;
for( i = 0; i < 250; i++)
{
temp[i] = blank[0];
temp2[i] = blank[0];
}
strcpy(temp,Inventory_ItemName[index]);
for( i = 0; i < INVEN_MAX_NAME_VALUE; i++)
{
temp2[i] = temp[i];
}
temp2[INVEN_MAX_NAME_VALUE-1] = blank[1];
if(i_type != BaseItemList[Inventory[index][2]].itemType)
{
//doNothing
}
else
{
if(index != -1 && index < INVENTORY_MAX)
{
myActor = CreateActor("ItemSlotText", "icon", "InventoryPane2", "(none)", i_x + 3, i_y, false);
strcpy(myActor->text, temp2);
myActor = CreateActor("ItemHitBox", "icon", "InventoryPane2", "(none)", i_x, i_y, false);
strcpy(myActor->ItemName, Inventory_ItemName[index]);
myActor->ItemBaseType = Inventory[index][2];
myActor->ItemMagicType = Inventory[index][3];
myActor->ItemMod1 = Inventory[index][4];
myActor->ItemMod2 = Inventory[index][5];
myActor->ItemMod3 = Inventory[index][6];
myActor->ItemMod4 = Inventory[index][7];
}
else
{
myActor = CreateActor("ItemSlotText", "icon", "InventoryPane", "(none)", i_x + 3, i_y, false);
strcpy(myActor->text, "FAILURE");
myActor = CreateActor("ItemHitBox", "icon", "InventoryPane", "(none)", i_x, i_y, false);
}
}
}
void MENU_CreateItemList(int i_x, int i_y, int i_type)
{
int i;
int pos = 0;
for(i = 0; i < INVENTORY_MAX; i++)
{
if(Inventory[i][0])
{
switch(i_type)
{
case 0: //Weapons Menu
if(BaseItemList[Inventory[i][2]].itemType == 1) //If Weapon
{
MENU_CreateItemListButton(i_x, i_y + (20*pos), i, 1);
pos++;
}
break;
case 1: //Apparel Menu
if(BaseItemList[Inventory[i][2]].itemType >= 2 && BaseItemList[Inventory[i][2]].itemType <= 9) //If Apparel
{
MENU_CreateItemListButton(i_x, i_y + (20*pos), i, BaseItemList[Inventory[i][2]].itemType );
pos++;
}
break;
case 2: //Potions Menu
if(BaseItemList[Inventory[i][2]].itemType == 10)
{
MENU_CreateItemListButton(i_x, i_y + (20*pos), i, 10);
pos++;
}
break;
case 3: //Quest Menu
if(BaseItemList[Inventory[i][2]].itemType == 11)
{
MENU_CreateItemListButton(i_x, i_y + (20*pos), i, 11);
pos++;
}
break;
case 4:
if(BaseItemList[Inventory[i][2]].itemType == 1) //If Weapon
{
MENU_CreateItemListButton(i_x, i_y + (20*pos), i, 0);
pos++;
}
break;
}
}
}
}
void MENU_MoveCanvasToScreen(char Canvas[])
{
Actor* myCanvas = getclone(Canvas);
myCanvas->x = view.x;
myCanvas->y = view.y;
}
void MENU_MoveCanvasOffScreen(char Canvas[])
{
Actor* myCanvas = getclone(Canvas);
myCanvas->x = -(myCanvas->width + 10);
myCanvas->y = -(myCanvas->height + 10);
}
//******************************************
// Current Item Mods Section |
// |
// This section will be removed and |
// Mods will be added from a text file |
// for easier addition and modification |
//******************************************
ItemModifer IM_None = { "", "", "", 0, 0, 0, 0, 0, 0, 0 };
ItemModifer IM_FireDamage = { "Fiery ", " Flame", "Adds %d points\n of fire damage",
4, 42, 90, 0, 0, 0, 0 };
ItemModifer IM_ColdDamage = { "Icy ", " Ice", "Adds %d points of\n cold damage",
5, 45, 60, 0, 0, 0, 0 };
ItemModifer IM_ElecDamage = { "Shocking ", " Static", "Adds %d points\n of electric damage",
6, 69, 80, 0, 0, 0, 0 };
ItemModifer IM_PosnDamage = { "Toxic ", " Poison", "Adds %d points\n of poison damage",
7, 66, 78, 0, 0, 0, 0 };
ItemModifer IM_PhysDamage = { "Butcher's ", " Wounding", "Increases damage\n by %d%%",
1, 0, 0, 1.2, 2.5, 0, 0 };
ItemModifer IM_Test = { "Longnamed ", " Longnames", "This is only a test name,\n non useable, just sayin'.....",
1, 0, 0, 0, 0, 0, 0 };
//******************************
// Basic types of items |
// itemName(char), itemType(i), itemPoints(i), itemRate(f) itemValue(i), itemStack(i), itemEquip
//******************************
BaseItem BaseItem_Sword = { "Sword", 1, 50, 0, 0, 0};
BaseItem BaseItem_Dagger = { "Dagger", 1, 20, 0, 0, 0};
BaseItem BaseItem_Bow = { "Bow", 1, 35, 0, 0, 0};
BaseItem BaseItem_Potion = { "Potion", 10, 35, 0, 0, 0};
BaseItem BaseItem_QuestItem = { "Deckard's Trinket", 11, 35, 0, 0, 0};
BaseItem BaseItem_Armor = { "Armor", 3, 35, 0, 0, 0};
//**************************************************
// Initialize the current mods into the mod list, |
// put this function into the CREATE ACTOR EVENT |
// of the view. |
//**************************************************
void ITEM_initMods()
{
ItemModList[0] = IM_None;
ItemModList[1] = IM_FireDamage;
ItemModList[2] = IM_ColdDamage;
ItemModList[3] = IM_ElecDamage;
ItemModList[4] = IM_PosnDamage;
ItemModList[5] = IM_PhysDamage;
ItemModList[6] = IM_Test;
}
void ITEM_initBaseItems()
{
BaseItemList[0] = BaseItem_Sword;
BaseItemList[1] = BaseItem_Dagger;
BaseItemList[2] = BaseItem_Bow;
BaseItemList[3] = BaseItem_Potion;
BaseItemList[4] = BaseItem_QuestItem;
BaseItemList[5] = BaseItem_Armor;
}
void MENU_initButtons()
{
int i;
for(i = 0; i < MENU_MAX_INDEX; i++)
{
MenuButtons[i] = -1;
}
}
void INVEN_init()
{
int i;
for(i=0; i < INVENTORY_MAX; i++)
{
INVEN_ClearSlot(i);
}
}