Icons.InsertCustomEntries.cs 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. using Microsoft.Xna.Framework;
  2. namespace OpenVIII
  3. {
  4. public sealed partial class Icons
  5. {
  6. #region Methods
  7. /// <summary>
  8. /// Add Manual hardcoded entries / settings here.
  9. /// </summary>
  10. /// <remarks>Maybe one day we can export these to an xml file and read it in on launch.</remarks>
  11. protected override void InsertCustomEntries()
  12. {
  13. Entry BG = new Entry
  14. {
  15. X = 0,
  16. Y = 48,
  17. Width = 256,
  18. Height = 16,
  19. CustomPalette = 1,
  20. Fill = Vector2.UnitX,
  21. Tile = Vector2.UnitY,
  22. };
  23. Entry Border_TopLeft = new Entry
  24. {
  25. X = 16,
  26. Y = 0,
  27. Width = 8,
  28. Height = 8,
  29. CustomPalette = 0,
  30. };
  31. Entry Border_Top = new Entry
  32. {
  33. X = 24,
  34. Y = 0,
  35. Width = 8,
  36. Height = 8,
  37. Tile = Vector2.UnitX,
  38. Offset = new Vector2(8, 0),
  39. End = new Vector2(-8, 0),
  40. CustomPalette = 0
  41. };
  42. Entry Border_Bottom = new Entry
  43. {
  44. X = 24,
  45. Y = 16,
  46. Width = 8,
  47. Height = 8,
  48. Tile = Vector2.UnitX,
  49. Snap_Bottom = true,
  50. Offset = new Vector2(8, -8),
  51. End = new Vector2(-8, 0),
  52. CustomPalette = 0
  53. };
  54. Entry Border_TopRight = new Entry
  55. {
  56. X = 32,
  57. Y = 0,
  58. Width = 8,
  59. Height = 8,
  60. Snap_Right = true,
  61. Offset = new Vector2(-8, 0),
  62. CustomPalette = 0
  63. };
  64. Entry Border_Left = new Entry
  65. {
  66. X = 16,
  67. Y = 8,
  68. Width = 8,
  69. Height = 8,
  70. Tile = Vector2.UnitY,
  71. Offset = new Vector2(0, 8),
  72. End = new Vector2(0, -8),
  73. CustomPalette = 0
  74. };
  75. Entry Border_Right = new Entry
  76. {
  77. X = 32,
  78. Y = 8,
  79. Width = 8,
  80. Height = 8,
  81. Tile = Vector2.UnitY,
  82. Snap_Right = true,
  83. Offset = new Vector2(-8, 8),
  84. End = new Vector2(0, -8),
  85. CustomPalette = 0
  86. };
  87. Entry Border_BottomLeft = new Entry
  88. {
  89. X = 16,
  90. Y = 16,
  91. Width = 8,
  92. Height = 8,
  93. Snap_Bottom = true,
  94. Offset = new Vector2(0, -8),
  95. CustomPalette = 0
  96. };
  97. Entry Border_BottomRight = new Entry
  98. {
  99. X = 32,
  100. Y = 16,
  101. Width = 8,
  102. Height = 8,
  103. Snap_Bottom = true,
  104. Snap_Right = true,
  105. Offset = new Vector2(-8, -8),
  106. CustomPalette = 0
  107. };
  108. Entries[ID.Bar_BG] = new EntryGroup(new Entry
  109. {
  110. X = 16,
  111. Y = 24,
  112. Width = 8,
  113. Height = 8,
  114. Tile = Vector2.UnitX,
  115. Fill = Vector2.UnitY,
  116. CustomPalette = 2, // 2 in 2019, was set to 0 for 2013
  117. });
  118. Entries[ID.Bar_Fill] = new EntryGroup(new Entry
  119. {
  120. X = 0,
  121. Y = 16,
  122. Width = 8,
  123. Height = 8,
  124. Tile = Vector2.UnitX,
  125. Fill = Vector2.UnitY,
  126. //Offset = new Vector2(2, 2),
  127. //End = new Vector2(-2, 0),
  128. CustomPalette = 5
  129. });
  130. Entries[ID.MenuBorder] = new EntryGroup(Border_Top, Border_Left, Border_Right, Border_Bottom, Border_TopLeft, Border_TopRight, Border_BottomLeft, Border_BottomRight);
  131. Entries[ID.Menu_BG_256] = new EntryGroup(BG, Border_Top, Border_Left, Border_Right, Border_Bottom, Border_TopLeft, Border_TopRight, Border_BottomLeft, Border_BottomRight);
  132. Entries[ID.Menu_BG_368] = new EntryGroup(BG, new Entry
  133. {
  134. X = 0,
  135. Y = 64,
  136. Offset = new Vector2(256, 0), //offset should be 256 but i had issue with 1 pixel gap should be able to get away with losing one pixel.
  137. Width = 112,
  138. Height = 16,
  139. CustomPalette = 1,
  140. Fill = Vector2.UnitX,
  141. Tile = Vector2.UnitY
  142. }, Border_Top, Border_Left, Border_Right, Border_Bottom, Border_TopLeft, Border_TopRight, Border_BottomLeft, Border_BottomRight);
  143. Entries[ID.DEBUG] = new EntryGroup(
  144. new Entry { X = 128, Y = 24, Width = 7, Height = 8, Offset = new Vector2(4, 0) },
  145. new Entry { X = 65, Y = 8, Width = 6, Height = 8, Offset = new Vector2(7 + 4, 0) },
  146. new Entry { X = 147, Y = 24, Width = 6, Height = 8, Offset = new Vector2(13 + 4, 0) },
  147. new Entry { X = 141, Y = 24, Width = 6, Height = 8, Offset = new Vector2(19 + 4, 0) },
  148. new Entry { X = 104, Y = 16, Width = 6, Height = 8, Offset = new Vector2(25 + 4, 0) }
  149. );
  150. //2 pages
  151. GeneratePages(ID.COMMAND, ID.COMMAND_PG1, 4, 4);
  152. //4 pages
  153. GeneratePages(ID.ABILITY, ID.ABILITY_PG1, 4, 8);
  154. //4 pages for 16 gfs
  155. GeneratePages(ID.GF, ID.GF_PG1, 4, 8);
  156. //13 pages for 50 spells
  157. GeneratePages(ID.MAGIC, ID.MAGIC_PG1, 13, 8);
  158. //18 pages for 198 Items
  159. //50 pages if squashed to 4 items per page.
  160. GeneratePages(ID.ITEM, ID.ITEM_PG1, 50, -4);
  161. //16 spells 4 pages for blue magic
  162. GeneratePages(ID.SPECIAL, ID.SPECIAL_PG1, 4, 8);
  163. //revese order of rewind so arrows draw correctly
  164. Entry _RR_0 = Entries[ID.Rewind_Fast][0].Clone();
  165. Entry _RR_1 = Entries[ID.Rewind_Fast][1].Clone();
  166. Entries[ID.Rewind_Fast] = new EntryGroup(_RR_1, _RR_0);
  167. //override this entry to make it tile instead of have set number of elements.
  168. EntryGroup b = Entries[ID.Size_08x64_Bar];
  169. Entry Left = b[0].Clone();
  170. Entry Center = b[1].Clone();
  171. Entry Right = b[7].Clone();
  172. Left.Offset = Vector2.Zero;
  173. Center.Offset = Vector2.Zero;
  174. Right.Offset = new Vector2(-8f, 0);
  175. Center.Tile = Vector2.UnitX;
  176. Right.Snap_Right = true;
  177. Entries[ID.Size_08x64_Bar] = new EntryGroup(Center, Left, Right);
  178. ID tmp = ID.D_Pad_Up;
  179. Entries[tmp] = new EntryGroup(Entries[tmp][0], Entries[tmp][2], Entries[tmp][1], Entries[tmp][3]);
  180. tmp = ID.D_Pad_Down;
  181. Entries[tmp] = new EntryGroup(Entries[tmp][0], Entries[tmp][2], Entries[tmp][1], Entries[tmp][3]);
  182. tmp = ID.D_Pad_Left;
  183. Entries[tmp] = new EntryGroup(Entries[tmp][0], Entries[tmp][2], Entries[tmp][1], Entries[tmp][3]);
  184. tmp = ID.D_Pad_Right;
  185. Entries[tmp] = new EntryGroup(Entries[tmp][0], Entries[tmp][2], Entries[tmp][1], Entries[tmp][3]);
  186. }
  187. private void GeneratePages(ID label, ID label_pg1, byte count, sbyte offset)
  188. {
  189. count = (byte)MathHelper.Clamp(count, 1, 99);
  190. Entry P_ = Entries[ID.Size_08x08_P_][0].Clone();
  191. P_.Offset.X += Entries[label][0].Width + offset;
  192. P_.CustomPalette = 2;
  193. Entry[] _ = new Entry[10];
  194. _[1] = Entries[ID.Num_8x8_1_1][0].Clone();
  195. _[1].Offset.X += P_.Offset.X + P_.Width + 2;
  196. _[1].CustomPalette = 7;
  197. for (byte i = 2; i <= 9 && i <= count; i++)
  198. {
  199. _[i] = Entries[ID.Num_8x8_1_1 + i - 1][0].Clone();
  200. _[i].Offset.X = _[1].Offset.X;
  201. _[i].CustomPalette = _[1].CustomPalette;
  202. }
  203. Entry[] __ = null;
  204. if (count > 9)
  205. {
  206. __ = new Entry[10];
  207. __[0] = Entries[ID.Num_8x8_1_0][0].Clone();
  208. __[0].Offset.X += P_.Offset.X + P_.Width + 2 + _[1].Width;
  209. __[0].CustomPalette = 7;
  210. for (byte i = 1; i <= 9; i++)
  211. {
  212. __[i] = _[i].Clone();
  213. __[i].Offset.X = __[0].Offset.X;
  214. }
  215. }
  216. for (byte i = 1; i <= count; i++)
  217. {
  218. if (i < 10)
  219. Entries[label_pg1 + i - 1] = new EntryGroup(Entries[label][0], P_, _[i]);
  220. else if (i >= 10 && __ != null)
  221. Entries[label_pg1 + i - 1] = new EntryGroup(Entries[label][0], P_, _[i / 10], __[i % 10]);
  222. }
  223. }
  224. #endregion Methods
  225. }
  226. }