Advertisement
ZoriaRPG

Reference on Editing Items and Weapons

Jan 25th, 2017
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 10.23 KB | None | 0 0
  1. // Link Items and Weapons Reference
  2.  
  3.  
  4. /* Item Class Variables
  5.     The following are the present values that can be passed to items in weapons.cpp or link.cpp,
  6.     from the item editor in ZQUest.
  7.     All examples use 'curitem' as their pointer, for example. curitem.family.
  8.     They vurther use a legal assign, as an example.
  9. */
  10.  
  11. int var;
  12.  
  13. //Item Class, ->Family in ZScript
  14. var = itemsbuf[curitem].family;
  15.  
  16. //Level, ->Level in ZScript
  17. var = itemsbuf[curitem].fam_type;
  18.  
  19. //Keep old, ->Keep in ZScript
  20. var = itemsbuf[curitem].flags & ITEM_GAMEDATA;
  21.  
  22. //The 'Increase Amount' value in the item editor, ->Increase in ZScript
  23. var = itemsbuf[curitem].amount;
  24.  
  25.  
  26. //The 'Full Max' value in the item editor, ->Max in ZScript.
  27. var = itemsbuf[curitem].max;
  28.  
  29. /*
  30.     In conjunction with MaxIncrement (see below) this value controls how the maximum
  31.     value of the counter of this item (see Counter below) is modified when the item
  32.     is picked up.
  33.    
  34.     If MaxIncrement is nonzero at that time, the counter's new maximum value is at
  35.     that time set to the minimum of its current value plus MaxIncrement, Max.
  36.    
  37.     If Max is less than the current maximum of the counter, Max is ignored and that
  38.     maximum is used instead.
  39.    
  40.     Notice that as a special case, if Max = MaxIncrement, the counter's maximum value
  41.     will be forced equal to Max.
  42. */
  43.  
  44. //The '+Max' value in the item editor, ->MaxIncrement in ZScript.
  45. var = itemsbuf[curitem].setmax;
  46.  
  47. /*
  48.     In conjunction with Max (see above) this value controls how the maximum value of the
  49.     counter of this item (see Counter below) is modified when the item is picked up.
  50.    
  51.     If MaxIncrement is nonzero at that time, the counter's new maximum value is at that
  52.     time set to the minimum of its current value plus MaxIncrement, and Max.
  53.    
  54.     If Max is less than the current maximum of the counter, Max is ignored and that
  55.     maximum is used instead.
  56.    
  57. */
  58.  
  59. //Counter Reference, ->Counter in ZScript
  60. var = itemsbuf[curitem].count;
  61.  
  62. //UseSound, ->UseSound in ZScript
  63. var = itemsbuf[curitem].usesound;
  64.     //Called as SFX(itemsbuf[curitem].usesound)
  65.    
  66. //Damage of the weapon, ->Power in ZScript
  67. var = itemsbuf[curitem].power;
  68.  
  69. //ID : From the ZScript Parser, ->ID in ZScript; otherwise 'parentitem' or 'itemid'
  70. int id = ri->idata; //this is the stack reference to the item being used.
  71.  
  72. //->Attributes[] : These are variable purpose indices, used by some items, and unused (at present) by others.
  73. //For example Arrows use 'misc1' (Attributes[0]) for their lifespan.
  74. var = itemsbuf[curitem].misc1; //Attribute[0]
  75. var = itemsbuf[curitem].misc2; //Attribute[1]
  76. var = itemsbuf[curitem].misc3; //Attribute[2]
  77. var = itemsbuf[curitem].misc4; //Attribute[3]
  78. var = itemsbuf[curitem].misc5; //Attribute[4]
  79. var = itemsbuf[curitem].misc6; //Attribute[5]
  80. var = itemsbuf[curitem].misc7; //Attribute[6]
  81. var = itemsbuf[curitem].misc8; //Attribute[7]
  82. var = itemsbuf[curitem].misc9; //Attribute[8]
  83. var = itemsbuf[curitem].misc10; //Attribute[9]
  84.  
  85. //->Sprites[] used by the item. THere are ten of these available, used for specific internal purposes.
  86. //Some items use one, other use more. Spells such as 'Din's Fire' use all ten.
  87. var = itemsbuf[curitem].wpn; //Sprites[0]
  88. var = itemsbuf[curitem].wpn2; //Sprites[1]
  89. var = itemsbuf[curitem].wpn3; //Sprites[2]
  90. var = itemsbuf[curitem].wpn4; //Sprites[3]
  91. var = itemsbuf[curitem].wpn5; //Sprites[4]
  92. var = itemsbuf[curitem].wpn6; //Sprites[5]
  93. var = itemsbuf[curitem].wpn7; //Sprites[6]
  94. var = itemsbuf[curitem].wpn8; //Sprites[7]
  95. var = itemsbuf[curitem].wpn9; //Sprites[8]
  96. var = itemsbuf[curitem].wpn10; //Sprites[9]
  97.  
  98. //Link Tile Modifier, ->Modifier in ZScript
  99. var = itemsbuf[curitem].ltm;
  100.  
  101. //Action Script, ->Script in ZScript
  102. var = itemsbuf[curitem].script; //it would be possible to set a default script to items.
  103.  
  104. //Pickup Script, ->PScript in ZScript
  105. var = itemsbuf[curitem].collect_script;
  106.  
  107. //Magic Cost, ->MagicCost in ZScript
  108. var = itemsbuf[curitem].magic;
  109.  
  110. //Minimum Hearts to Pick Up Item (e.g. Z1 swords), ->MinHearts in ZScript.
  111. var = itemsbuf[curitem].pickup_hearts;
  112.  
  113. //Tile of the item, ->Tile in ZScript.
  114. var = itemsbuf[curitem].tile;
  115.  
  116. //Flash Value; seems to be used as a flagset holding the 'Behind' and 'Flip' values, too. ?
  117. //->Flash in ZScript.
  118. //! Needs verification.
  119. var = itemsbuf[curitem].misc; //Poorly named.
  120.  
  121. //CSet, ->CSet in ZScript.
  122. var = itemsbuf[curitem].csets;
  123.  
  124. //Number of frames in the item's animation, ->AFrames in ZScript.
  125. var = itemsbuf[curitem].frames;
  126.  
  127. //Animation Speed of the anim frames, ->ASpeed in ZScript.
  128. var = itemsbuf[curitem].speed;
  129.  
  130. //Animation delay, ->Delay in ZScript.
  131. var = itemsbuf[curitem].delay;
  132.  
  133. //Upgrade when collected twice, ->Combine in ZScript.
  134. var = itemsbuf[curitem].flags & ITEM_COMBINE;
  135.  
  136. //Downgrade to an item one level lower, when used, ->Downgrade in ZScript.
  137. var = itemsbuf[curitem].flags & ITEM_DOWNGRADE;
  138.  
  139. //->Flags[] : Five flags are defined for multipurpose use.
  140. var = itemsbuf[curitem].flags & ITEM_FLAG1; //Flags[0]
  141. var = itemsbuf[curitem].flags & ITEM_FLAG2; //Flags[1]
  142. var = itemsbuf[curitem].flags & ITEM_FLAG3; //Flags[2]
  143. var = itemsbuf[curitem].flags & ITEM_FLAG4; //Flags[3]
  144. var = itemsbuf[curitem].flags & ITEM_FLAG5; //Flags[4]
  145.  
  146. //When collecting an upgrade, keep the old item too, ->KeepOld in ZScript.
  147. var = itemsbuf[curitem].flags & ITEM_KEEPOLD;
  148.  
  149. //Use Rupees instead of Magic, ->RupeeCost in ZScript.
  150. var = itemsbuf[curitem].flags & ITEM_RUPEE_MAGIC;
  151.  
  152. //Can be eaten by enemies, ->Edible in ZScript.
  153. var = itemsbuf[curitem].flags & ITEM_EDIBLE;
  154.  
  155. //Unused. I plan to steal this for 'Magic Use is in Seconds, Not Frames'.
  156. //! DO NOT USE for ANYTHING!
  157. var = itemsbuf[curitem].flags & ITEM_UNUSED;
  158.  
  159. //When collecting an item, gain all lower-level items in its class, ->GainLower in ZScript.
  160. var = itemsbuf[curitem].flags & ITEM_GAINOLD;
  161.  
  162. //Ten D# arguments, eight of them, ->InitD[n] in ZScript.
  163. var = itemsbuf[curitem].initiald[0]; //D0
  164. var = itemsbuf[curitem].initiald[1]; //D1
  165. var = itemsbuf[curitem].initiald[2]; //D2
  166. var = itemsbuf[curitem].initiald[3]; //D3
  167. var = itemsbuf[curitem].initiald[4]; //D4
  168. var = itemsbuf[curitem].initiald[5]; //D5
  169. var = itemsbuf[curitem].initiald[6]; //D6
  170. var = itemsbuf[curitem].initiald[7]; //D7
  171.  
  172. /* The following are INTERNAL to the items and weapons classes. */
  173. int wpn.power; //The damage value
  174. int wpn.type; //Wepaon type ID, such as wArrow (LW_ARROW).
  175. int wpn.dead; //The deadstate.
  176. int wpn.misc2; //A general purpose variable for internal use.
  177. int wpn.ignorecombo; //Weapon will not trigger combos. Used for dummy status wepaons.
  178. bool wpn isLit. //A single bit that can be set if the weapon lights the screen.
  179. int wpn.clk2; wpn->clk2; //A general purpose timer.
  180. int wpn.parentid; //The ID of an NPC that generates an EWeapon. -1 if created by script.
  181. int wpn.parentitem; //The ID of an item that creates an LWeapon. -1 if created by script.
  182. int wpn.dragging; //
  183. fix wpn.step; //The speed at which the weapon moves.
  184.     //Don;t forget to typecast int to fix!
  185. bool wpn.bounce; //Determines if boomerang class weapons are bouncing back to Link.
  186.          //Note: It is assigned as follows:  bounce=ignoreLink=false; in weapon::weapon(...)
  187. int wpn.cs; //The CSet of the weapon. Assigned by LOADGFX() by cs = wpn.csets&15;
  188. bool wpn.ignoreLink; // Weapon will not have collision with Link. Used for dummy status.
  189. word wpn.wid; //A 16-bit value that is meant to hold the current tile of the item's animation.
  190.     //Holds the default weapon tile, too. When calling LOADGFX(int gfx), 'wid' is assigned to 'gfx'.
  191. word wpn.flash; //A 16-bit value that is meant to hold the flash value from itemdata.
  192.         //When calling LOADGFX(wpn), this is set as follows: flash = wpnsbuf[wid].misc&3;
  193. word wpn.aframe; //A 16-bit value that holds the present frame NUMBER of the item's animation.
  194. word wpn.csclk; //A 16-bit value that holds the timer for cset flashing.
  195. int wpn.o_tile; //THe original tile of the item, corresponding to idata.tile.
  196. int wpn.o_cset; //The original cset of the item, corresponding to idata.cset.
  197. int wpn.o_speed; //The original animation speed, corresponding to idata.speed.
  198. int wpn.o_type; //The original ID (weapon type) of the item, corrsponding to idata.type;
  199.     //idata.type has no ZScript instruction, it seems?
  200. int wpn.o_frames; //The number of the frames inof animation, corresponding ti idata.frames.
  201. int wpn.flip; //The present flip state of the item's sprite. Corresponds to *Weapon->Flip in ZScript.
  202. int wpn.temp1; //Used by fire weapons and reads the tile of wFIRE when calling LOADGFX().
  203. bool wpn.behind; //A bit to set to determine if the weapon is drawn underneath Link and other sprites.
  204.     //Seems to be assigned oddly: wpnsbuf[wid].misc&WF_BEHIND
  205.  
  206. /////////////////
  207. /// Functions ///
  208. /////////////////
  209.  
  210. //Create a weapon pointer.
  211. weapon(weapon const & other);
  212.  
  213. //Create a weapon with specific attributes.
  214. weapon(fix X,fix Y,fix Z,int Id,int Type,int pow,int Dir, int Parentid, int prntid, bool isDummy=false);
  215.     //isDummy is used to set a default item ID to a weapon.
  216.  
  217. //Set the sprite of a weapon.
  218. void LOADGFX(int wpn);
  219.  
  220. //Kill a weapon.
  221. bool Dead();
  222.    
  223. //Determine of a weapon 'clips' the hitbox of a sprite.
  224. bool clip();
  225.    
  226. //Determine of a weapon is blocked.
  227. bool blocked();
  228.    
  229. //As blocked90, but with offsets.
  230. virtual bool blocked(int xOffset, int yOffset);
  231.    
  232. //Runs the item's movement.
  233. virtual bool animate(int index);
  234.    
  235. //If the weapon hits a valid target...
  236.     //Allows setting if the weapon may 'clip' a sprite.
  237. virtual void onhit(bool clipped);
  238.     //additionally, 'special' determines " " , and 'linkdir' determines " " .
  239. virtual void onhit(bool clipped, int special, int linkdir);
  240.    
  241. //Perform a hit based on a sprite, or a collision rect
  242. virtual bool hit(sprite *s);
  243.     //Need to verify, but these params should be:
  244.     //tx = x1, ty = y1, tz = z1, txsz = x2, tysz = y2, tzsz = z2
  245. virtual bool hit(int tx,int ty,int tz,int txsz,int tysz,int tzsz);
  246.  
  247. //Render the weapon to the screen, or any arbitrary bitmap.
  248. virtual void draw(BITMAP *dest);
  249.  
  250.  //Handle weapon animations.
  251. virtual void update_weapon_frame(int change, int orig);
  252.  
  253. //Add a weapon to the screen
  254. void Lwpns.add(*ptr);
  255. void Lwpns.add(*ptr, fix x, fix y, fix z, int weapon_type, int weapon_family, int weapon_damage, int direction, int itemid, int uid)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement