Module_main_menu_debug.IGM_Junction.cs 88 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888
  1. using Microsoft.Xna.Framework;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace FF8
  6. {
  7. public partial class Module_main_menu_debug
  8. {
  9. private class IGM_Junction : Menu
  10. {
  11. public enum Items
  12. {
  13. Junction,
  14. Off,
  15. Auto,
  16. Ability,
  17. HP,
  18. Str,
  19. Vit,
  20. Mag,
  21. Spr,
  22. Spd,
  23. Luck,
  24. Hit,
  25. ST_A,
  26. ST_D,
  27. EL_A,
  28. EL_D,
  29. ST_A_D,
  30. EL_A_D,
  31. Stats,
  32. ST_A2,
  33. GF,
  34. Magic,
  35. AutoAtk,
  36. AutoMag,
  37. AutoDef,
  38. RemAll,
  39. RemMag,
  40. ChooseGFtojunction,
  41. Chooseslottojunction,
  42. Choosemagictojunction,
  43. RemovealljunctionedGFandmagic,
  44. Removealljunctionedmagic,
  45. CurrentEXP,
  46. NextLEVEL,
  47. _,
  48. LV,
  49. ForwardSlash,
  50. Percent
  51. }
  52. public enum SectionName
  53. {
  54. /// <summary>
  55. /// Junction OFF Auto Ability
  56. /// </summary>
  57. TopMenu,
  58. /// <summary>
  59. /// Top Right
  60. /// </summary>
  61. Title,
  62. /// <summary>
  63. /// Description Help
  64. /// </summary>
  65. Help,
  66. /// <summary>
  67. /// Character Stats
  68. /// </summary>
  69. Stats,
  70. /// <summary>
  71. /// 4 Commands you can use in battle
  72. /// </summary>
  73. Commands,
  74. /// <summary>
  75. /// Portrait Name HP EXP Rank?
  76. /// </summary>
  77. CharacterInfo,
  78. TopMenu_Junction,
  79. TopMenu_Off,
  80. TopMenu_Auto,
  81. TopMenu_Abilities,
  82. RemMag,
  83. RemAll,
  84. TopMenu_GF_Group,
  85. }
  86. public static Dictionary<Items, FF8String> Titles { get; private set; }
  87. public static Dictionary<Items, FF8String> Misc { get; private set; }
  88. public static Dictionary<Items, FF8String> Descriptions { get; private set; }
  89. /// <summary>
  90. /// Character who has the junctions and inventory. Same as VisableCharacter unless TeamLaguna.
  91. /// </summary>
  92. public static Characters Character { get; private set; }
  93. /// <summary>
  94. /// Required to support Laguna's Party. They have unique stats but share junctions and inventory.
  95. /// </summary>
  96. public static Characters VisableCharacter { get; private set; }
  97. public override bool Update()
  98. {
  99. base.Update();
  100. return Inputs();
  101. }
  102. protected override void Init()
  103. {
  104. Size = new Vector2 { X = 840, Y = 630 };
  105. TextScale = new Vector2(2.545455f, 3.0375f);
  106. Titles = new Dictionary<Items, FF8String> {
  107. {Items.Junction, Memory.Strings.Read(Strings.FileID.MNGRP,2,217) },
  108. {Items.Off, Memory.Strings.Read(Strings.FileID.MNGRP,2,219) },
  109. {Items.Auto, Memory.Strings.Read(Strings.FileID.MNGRP,2,221) },
  110. {Items.Ability, Memory.Strings.Read(Strings.FileID.MNGRP,2,223) },
  111. {Items.HP, Memory.Strings.Read(Strings.FileID.MNGRP,2,225) },
  112. {Items.Str, Memory.Strings.Read(Strings.FileID.MNGRP,2,227) },
  113. {Items.Vit, Memory.Strings.Read(Strings.FileID.MNGRP,2,229) },
  114. {Items.Mag, Memory.Strings.Read(Strings.FileID.MNGRP,2,231) },
  115. {Items.Spr, Memory.Strings.Read(Strings.FileID.MNGRP,2,233) },
  116. {Items.Spd, Memory.Strings.Read(Strings.FileID.MNGRP,2,235) },
  117. {Items.Luck, Memory.Strings.Read(Strings.FileID.MNGRP,2,237) },
  118. {Items.Hit, Memory.Strings.Read(Strings.FileID.MNGRP,2,239) },
  119. {Items.ST_A,Memory.Strings.Read(Strings.FileID.MNGRP,2,243)},
  120. {Items.ST_D,Memory.Strings.Read(Strings.FileID.MNGRP,2,245)},
  121. {Items.EL_A,Memory.Strings.Read(Strings.FileID.MNGRP,2,247)},
  122. {Items.EL_D,Memory.Strings.Read(Strings.FileID.MNGRP,2,249)},
  123. {Items.ST_A_D,Memory.Strings.Read(Strings.FileID.MNGRP,2,251)},
  124. {Items.EL_A_D,Memory.Strings.Read(Strings.FileID.MNGRP,2,253)},
  125. {Items.Stats,Memory.Strings.Read(Strings.FileID.MNGRP,2,255)},
  126. { Items.ST_A2,Memory.Strings.Read(Strings.FileID.MNGRP, 2, 257)},
  127. {Items.GF,Memory.Strings.Read(Strings.FileID.MNGRP,2,262)},
  128. { Items.Magic,Memory.Strings.Read(Strings.FileID.MNGRP, 2, 264)},
  129. {Items.AutoAtk,Memory.Strings.Read(Strings.FileID.MNGRP,2,269)},
  130. {Items.AutoMag,Memory.Strings.Read(Strings.FileID.MNGRP,2,271)},
  131. {Items.AutoDef,Memory.Strings.Read(Strings.FileID.MNGRP,2,273)},
  132. {Items.RemAll,Memory.Strings.Read(Strings.FileID.MNGRP,2,275)},
  133. {Items.RemMag,Memory.Strings.Read(Strings.FileID.MNGRP,2,277)},
  134. };
  135. Misc = new Dictionary<Items, FF8String> {
  136. { Items.CurrentEXP, Memory.Strings.Read(Strings.FileID.MNGRP, 0, 23) },
  137. { Items.NextLEVEL, Memory.Strings.Read(Strings.FileID.MNGRP, 0, 24) },
  138. { Items._,Memory.Strings.Read(Strings.FileID.MNGRP,2,266)},
  139. { Items.HP,Memory.Strings.Read(Strings.FileID.MNGRP,0,26)},
  140. { Items.LV,Memory.Strings.Read(Strings.FileID.MNGRP,0,27)},
  141. { Items.ForwardSlash,Memory.Strings.Read(Strings.FileID.MNGRP,0,25)},
  142. { Items.Percent,Memory.Strings.Read(Strings.FileID.MNGRP,0,29)},
  143. };
  144. //{Items.ST_D,Memory.Strings.Read(Strings.FileID.MNGRP,2,259)},
  145. //{Items.EL_A,Memory.Strings.Read(Strings.FileID.MNGRP,2,260)},
  146. //{Items.EL_D,Memory.Strings.Read(Strings.FileID.MNGRP,2,261)},
  147. //{Items.Areyousure?,Memory.Strings.Read(Strings.FileID.MNGRP,2,267)},
  148. //{Items.Keepprevioussetting,Memory.Strings.Read(Strings.FileID.MNGRP,2,268)},
  149. //{Items.Junctionedto<Special:0xA27>,Memory.Strings.Read(Strings.FileID.MNGRP,2,284)},
  150. //{Items.Empty,Memory.Strings.Read(Strings.FileID.MNGRP,2,285)},
  151. //{Items.BasicOperation,Memory.Strings.Read(Strings.FileID.MNGRP,2,286)},
  152. //{Items.BasicControlExplanationinFFVIII,Memory.Strings.Read(Strings.FileID.MNGRP,2,287)},
  153. //{Items.BattleOperation,Memory.Strings.Read(Strings.FileID.MNGRP,2,288)},
  154. //{Items.BattleExplanation,Memory.Strings.Read(Strings.FileID.MNGRP,2,289)},
  155. //{Items.CardGameRules,Memory.Strings.Read(Strings.FileID.MNGRP,2,290)},
  156. //{Items.CardGameExplanation,Memory.Strings.Read(Strings.FileID.MNGRP,2,291)},
  157. //{Items.OnlineHelp,Memory.Strings.Read(Strings.FileID.MNGRP,2,292)},
  158. //{Items.ExplanationofVariousFeatures,Memory.Strings.Read(Strings.FileID.MNGRP,2,293)},
  159. //{Items.GFJunction,Memory.Strings.Read(Strings.FileID.MNGRP,2,294)},
  160. //{Items.JunctioningaGFandsettingcommands,Memory.Strings.Read(Strings.FileID.MNGRP,2,295)},
  161. //{Items.MagicJunction,Memory.Strings.Read(Strings.FileID.MNGRP,2,296)},
  162. //{Items.Explanationonjunctioningmagic,Memory.Strings.Read(Strings.FileID.MNGRP,2,297)},
  163. //{Items.JunctiontoElements,Memory.Strings.Read(Strings.FileID.MNGRP,2,298)},
  164. //{Items.Explanationofelementaljunction,Memory.Strings.Read(Strings.FileID.MNGRP,2,299)},
  165. //{Items.JunctionofStatus,Memory.Strings.Read(Strings.FileID.MNGRP,2,300)},
  166. //{Items.Explanationofstatusjunction,Memory.Strings.Read(Strings.FileID.MNGRP,2,301)},
  167. Descriptions = new Dictionary<Items, FF8String> {
  168. {Items.Junction, Memory.Strings.Read(Strings.FileID.MNGRP,2,218) }
  169. };
  170. Data.Add(SectionName.CharacterInfo, new IGMData_CharacterInfo());
  171. Data.Add(SectionName.Stats, new IGMData_Stats());
  172. Data.Add(SectionName.Commands, new IGMData_Commands());
  173. Data.Add(SectionName.Help, new IGMData_Help());
  174. Data.Add(SectionName.TopMenu, new IGMData_TopMenu());
  175. Data.Add(SectionName.Title, new IGMData_Container(
  176. new IGMDataItem_Box(Titles[Items.Junction], pos: new Rectangle(615, 0, 225, 66))));
  177. Data.Add(SectionName.TopMenu_Junction, new IGMData_TopMenu_Junction());
  178. Data.Add(SectionName.TopMenu_Off, new IGMData_TopMenu_Off_Group(
  179. new IGMData_Container(
  180. new IGMDataItem_Box(Titles[Items.Off], pos: new Rectangle(0, 12, 169, 54), options: Box_Options.Center | Box_Options.Middle)),
  181. new IGMData_TopMenu_Off()
  182. ));
  183. Data.Add(SectionName.TopMenu_Auto, new IGMData_TopMenu_Auto_Group(
  184. new IGMData_Container(
  185. new IGMDataItem_Box(Titles[Items.Auto], pos: new Rectangle(0, 12, 169, 54), options: Box_Options.Center | Box_Options.Middle)),
  186. new IGMData_TopMenu_Auto()));
  187. Data.Add(SectionName.TopMenu_Abilities, new IGMData_Abilities_Group(
  188. new IGMData_Abilities_Command(),
  189. new IGMData_Abilities_AbilitySlots(),
  190. new IGMData_Abilities_CommandPool(),
  191. new IGMData_Abilities_AbilityPool()
  192. ));
  193. FF8String Yes = Memory.Strings.Read(Strings.FileID.MNGRP, 0, 57);
  194. FF8String No = Memory.Strings.Read(Strings.FileID.MNGRP, 0, 58);
  195. Data.Add(SectionName.RemMag, new IGMData_ConfirmRemMag(data: Memory.Strings.Read(Strings.FileID.MNGRP, 2, 280), title: Icons.ID.NOTICE, opt1: Yes, opt2: No, pos: new Rectangle(180, 174, 477, 216)));
  196. Data.Add(SectionName.RemAll, new IGMData_ConfirmRemAll(data: Memory.Strings.Read(Strings.FileID.MNGRP, 2, 279), title: Icons.ID.NOTICE, opt1: Yes, opt2: No, pos: new Rectangle(180, 174, 477, 216)));
  197. Data.Add(SectionName.TopMenu_GF_Group, new IGMData_GF_Group(
  198. new IGMData_GF_Junctioned(),
  199. new IGMData_GF_Pool(),
  200. new IGMData_Container(new IGMDataItem_Box(pos: new Rectangle(440, 345, 385, 66)))
  201. ));
  202. base.Init();
  203. }
  204. public void ReInit(Characters c, Characters vc)
  205. {
  206. Character = c;
  207. VisableCharacter = vc;
  208. ReInit();
  209. }
  210. public new enum Mode
  211. {
  212. TopMenu,
  213. TopMenu_Junction,
  214. TopMenu_Off,
  215. TopMenu_Auto,
  216. Abilities,
  217. Abilities_Commands,
  218. Abilities_Abilities,
  219. RemMag,
  220. RemAll,
  221. TopMenu_GF_Group
  222. }
  223. public new Mode mode;
  224. protected override bool Inputs()
  225. {
  226. bool ret = false;
  227. switch (mode)
  228. {
  229. case Mode.TopMenu:
  230. ret = ((IGMData_TopMenu)Data[SectionName.TopMenu]).Inputs();
  231. break;
  232. case Mode.TopMenu_Junction:
  233. ret = ((IGMData_TopMenu_Junction)Data[SectionName.TopMenu_Junction]).Inputs();
  234. break;
  235. case Mode.TopMenu_Off:
  236. ret = ((IGMData_TopMenu_Off_Group)Data[SectionName.TopMenu_Off]).Inputs();
  237. break;
  238. case Mode.TopMenu_Auto:
  239. ret = ((IGMData_TopMenu_Auto_Group)Data[SectionName.TopMenu_Auto]).Inputs();
  240. break;
  241. case Mode.Abilities:
  242. ret = ((IGMData_Abilities_Group)Data[SectionName.TopMenu_Abilities]).Inputs();
  243. break;
  244. case Mode.Abilities_Commands:
  245. ret = ((IGMData_Abilities_Group)Data[SectionName.TopMenu_Abilities]).ITEM[2, 0].Inputs();
  246. break;
  247. case Mode.Abilities_Abilities:
  248. ret = ((IGMData_Abilities_Group)Data[SectionName.TopMenu_Abilities]).ITEM[3, 0].Inputs();
  249. break;
  250. case Mode.RemMag:
  251. ret = ((IGMData_ConfirmDialog)Data[SectionName.RemMag]).Inputs();
  252. break;
  253. case Mode.RemAll:
  254. ret = ((IGMData_ConfirmDialog)Data[SectionName.RemAll]).Inputs();
  255. break;
  256. case Mode.TopMenu_GF_Group:
  257. ret = ((IGMData_GF_Group)Data[SectionName.TopMenu_GF_Group]).ITEM[1, 0].Inputs();
  258. break;
  259. default:
  260. break;
  261. }
  262. return ret;
  263. }
  264. public override void Draw()
  265. {
  266. StartDraw();
  267. base.Draw();
  268. EndDraw();
  269. }
  270. private class IGMData_CharacterInfo : IGMData
  271. {
  272. public IGMData_CharacterInfo() : base(1, 15, new IGMDataItem_Empty(new Rectangle(20, 153, 395, 255)))
  273. {
  274. }
  275. /// <summary>
  276. /// Things that may of changed before screen loads or junction is changed.
  277. /// </summary>
  278. public override void ReInit()
  279. {
  280. base.ReInit();
  281. ITEM[0, 0] = new IGMDataItem_Face((Faces.ID)VisableCharacter, new Rectangle(X + 12, Y, 96, 144));
  282. ITEM[0, 2] = new IGMDataItem_String(Memory.Strings.GetName(VisableCharacter), new Rectangle(X + 117, Y + 0, 0, 0));
  283. if (Memory.State.Characters != null)
  284. {
  285. ITEM[0, 4] = new IGMDataItem_Int(Memory.State.Characters[Character].Level, new Rectangle(X + 117 + 35, Y + 54, 0, 0), 13, numtype: Icons.NumType.sysFntBig, padding: 1, spaces: 6);
  286. ITEM[0, 5] = Memory.State.Party != null && Memory.State.Party.Contains(Character)
  287. ? new IGMDataItem_Icon(Icons.ID.InParty, new Rectangle(X + 278, Y + 48, 0, 0), 6)
  288. : null;
  289. ITEM[0, 7] = new IGMDataItem_Int(Memory.State.Characters[Character].CurrentHP(VisableCharacter), new Rectangle(X + 152, Y + 108, 0, 0), 13, numtype: Icons.NumType.sysFntBig, padding: 1, spaces: 6);
  290. ITEM[0, 9] = new IGMDataItem_Int(Memory.State.Characters[Character].MaxHP(VisableCharacter), new Rectangle(X + 292, Y + 108, 0, 0), 13, numtype: Icons.NumType.sysFntBig, padding: 1, spaces: 5);
  291. ITEM[0, 11] = new IGMDataItem_Int((int)Memory.State.Characters[Character].Experience, new Rectangle(X + 192, Y + 198, 0, 0), 13, numtype: Icons.NumType.Num_8x8_2, padding: 1, spaces: 9);
  292. ITEM[0, 13] = new IGMDataItem_Int(Memory.State.Characters[Character].ExperienceToNextLevel, new Rectangle(X + 192, Y + 231, 0, 0), 13, numtype: Icons.NumType.Num_8x8_2, padding: 1, spaces: 9);
  293. }
  294. }
  295. /// <summary>
  296. /// Things fixed at startup.
  297. /// </summary>
  298. protected override void Init()
  299. {
  300. ITEM[0, 1] = new IGMDataItem_Icon(Icons.ID.MenuBorder, new Rectangle(X + 10, Y - 2, 100, 148), scale: new Vector2(1f));
  301. ITEM[0, 3] = new IGMDataItem_String(Misc[Items.LV], new Rectangle(X + 117, Y + 54, 0, 0));
  302. ITEM[0, 6] = new IGMDataItem_String(Misc[Items.HP], new Rectangle(X + 117, Y + 108, 0, 0));
  303. ITEM[0, 8] = new IGMDataItem_String(Misc[Items.ForwardSlash], new Rectangle(X + 272, Y + 108, 0, 0));
  304. ITEM[0, 10] = new IGMDataItem_String(Misc[Items.CurrentEXP] + new FF8String("\n") + Misc[Items.NextLEVEL], new Rectangle(X, Y + 192, 0, 0));
  305. ITEM[0, 12] = new IGMDataItem_Icon(Icons.ID.P, new Rectangle(X + 372, Y + 198, 0, 0), 2);
  306. ITEM[0, 14] = new IGMDataItem_Icon(Icons.ID.P, new Rectangle(X + 372, Y + 231, 0, 0), 2);
  307. base.Init();
  308. }
  309. }
  310. private class IGMData_Stats : IGMData
  311. {
  312. public IGMData_Stats() : base(10, 4, new IGMDataItem_Box(pos: new Rectangle(0, 414, 840, 216)), 2, 5)
  313. {
  314. }
  315. /// <summary>
  316. /// Convert stat to correct icon id.
  317. /// </summary>
  318. private static Dictionary<Kernel_bin.Stat, Icons.ID> Stat2Icon = new Dictionary<Kernel_bin.Stat, Icons.ID>
  319. {
  320. { Kernel_bin.Stat.HP, Icons.ID.Stats_Hit_Points },
  321. { Kernel_bin.Stat.STR, Icons.ID.Stats_Strength },
  322. { Kernel_bin.Stat.VIT, Icons.ID.Stats_Vitality },
  323. { Kernel_bin.Stat.MAG, Icons.ID.Stats_Magic },
  324. { Kernel_bin.Stat.SPR, Icons.ID.Stats_Spirit },
  325. { Kernel_bin.Stat.SPD, Icons.ID.Stats_Speed },
  326. { Kernel_bin.Stat.EVA, Icons.ID.Stats_Evade },
  327. { Kernel_bin.Stat.LUCK, Icons.ID.Stats_Luck },
  328. { Kernel_bin.Stat.HIT, Icons.ID.Stats_Hit_Percent },
  329. };
  330. /// <summary>
  331. /// Things that may of changed before screen loads or junction is changed.
  332. /// </summary>
  333. public override void ReInit()
  334. {
  335. base.ReInit();
  336. if (Memory.State.Characters != null)
  337. {
  338. List<Kernel_bin.Abilities> unlocked = Memory.State.Characters[Character].UnlockedGFAbilities;
  339. ITEM[5, 0] = new IGMDataItem_Icon(Icons.ID.Icon_Status_Attack, new Rectangle(SIZE[5].X + 200, SIZE[5].Y, 0, 0),
  340. (byte)(unlocked.Contains(Kernel_bin.Abilities.ST_Atk_J) ? 2 : 7));
  341. ITEM[5, 1] = new IGMDataItem_Icon(Icons.ID.Icon_Status_Defense, new Rectangle(SIZE[5].X + 240, SIZE[5].Y, 0, 0),
  342. (byte)(unlocked.Contains(Kernel_bin.Abilities.ST_Def_Jx1) ||
  343. unlocked.Contains(Kernel_bin.Abilities.ST_Def_Jx2) ||
  344. unlocked.Contains(Kernel_bin.Abilities.ST_Def_Jx4) ? 2 : 7));
  345. ITEM[5, 2] = new IGMDataItem_Icon(Icons.ID.Icon_Elemental_Attack, new Rectangle(SIZE[5].X + 280, SIZE[5].Y, 0, 0),
  346. (byte)(unlocked.Contains(Kernel_bin.Abilities.Elem_Atk_J) ? 2 : 7));
  347. ITEM[5, 3] = new IGMDataItem_Icon(Icons.ID.Icon_Elemental_Defense, new Rectangle(SIZE[5].X + 320, SIZE[5].Y, 0, 0),
  348. (byte)(unlocked.Contains(Kernel_bin.Abilities.Elem_Def_Jx1) ||
  349. unlocked.Contains(Kernel_bin.Abilities.Elem_Def_Jx2) ||
  350. unlocked.Contains(Kernel_bin.Abilities.Elem_Def_Jx4) ? 2 : 7));
  351. foreach (Kernel_bin.Stat stat in (Kernel_bin.Stat[])Enum.GetValues(typeof(Kernel_bin.Stat)))
  352. {
  353. int pos = (int)stat;
  354. if (pos >= 5) pos++;
  355. FF8String name = Kernel_bin.MagicData[Memory.State.Characters[Character].Stat_J[stat]].Name;
  356. if (name.Length == 0) name = Misc[Items._];
  357. ITEM[pos, 0] = new IGMDataItem_Icon(Stat2Icon[stat], new Rectangle(SIZE[pos].X, SIZE[pos].Y, 0, 0), 2);
  358. ITEM[pos, 1] = new IGMDataItem_String(name, new Rectangle(SIZE[pos].X + 80, SIZE[pos].Y, 0, 0));
  359. if (!unlocked.Contains(Kernel_bin.Stat2Ability[stat]))
  360. {
  361. ((IGMDataItem_Icon)ITEM[pos, 0]).Pallet = ((IGMDataItem_Icon)ITEM[pos, 0]).Faded_Pallet = 7;
  362. ((IGMDataItem_String)ITEM[pos, 1]).Colorid = Font.ColorID.Grey;
  363. }
  364. ITEM[pos, 2] = new IGMDataItem_Int(Memory.State.Characters[Character].TotalStat(stat, VisableCharacter), new Rectangle(SIZE[pos].X + 152, SIZE[pos].Y, 0, 0), 2, Icons.NumType.sysFntBig, spaces: 10);
  365. ITEM[pos, 3] = stat == Kernel_bin.Stat.HIT || stat == Kernel_bin.Stat.EVA
  366. ? new IGMDataItem_String(Misc[Items.Percent], new Rectangle(SIZE[pos].X + 350, SIZE[pos].Y, 0, 0))
  367. : null;
  368. }
  369. }
  370. }
  371. protected override void InitShift(int i, int col, int row)
  372. {
  373. base.InitShift(i, col, row);
  374. SIZE[i].Inflate(-22, -8);
  375. SIZE[i].Offset(0, 4 + (-2 * row));
  376. }
  377. /// <summary>
  378. /// Things fixed at startup.
  379. /// </summary>
  380. protected override void Init() => base.Init();
  381. }
  382. private class IGMData_Commands : IGMData
  383. {
  384. public IGMData_Commands() : base(4, 1, new IGMDataItem_Box(pos: new Rectangle(615, 150, 210, 192), title: Icons.ID.COMMAND), 1, 4)
  385. {
  386. }
  387. /// <summary>
  388. /// Things that may of changed before screen loads or junction is changed.
  389. /// </summary>
  390. public override void ReInit()
  391. {
  392. base.ReInit();
  393. if (Memory.State.Characters != null)
  394. {
  395. ITEM[0, 0] = new IGMDataItem_String(
  396. Kernel_bin.BattleCommands[
  397. Memory.State.Characters[Character].Abilities.Contains(Kernel_bin.Abilities.Mug) ?
  398. 13 :
  399. 1].Name,
  400. SIZE[0]);
  401. for (int pos = 1; pos < SIZE.Length; pos++)
  402. {
  403. ITEM[pos, 0] = Memory.State.Characters[Character].Commands[pos - 1] != Kernel_bin.Abilities.None ? new IGMDataItem_String(
  404. Kernel_bin.Commandabilities[Memory.State.Characters[Character].Commands[pos - 1]].Name,
  405. SIZE[pos]) : null;
  406. }
  407. }
  408. }
  409. protected override void InitShift(int i, int col, int row)
  410. {
  411. base.InitShift(i, col, row);
  412. SIZE[i].Inflate(-22, -8);
  413. SIZE[i].Offset(0, 12 + (-8 * row));
  414. }
  415. /// <summary>
  416. /// Things fixed at startup.
  417. /// </summary>
  418. protected override void Init() => base.Init();
  419. }
  420. private class IGMData_Help : IGMData
  421. {
  422. public FF8String Data { get => ((IGMDataItem_Box)CONTAINER).Data; set => ((IGMDataItem_Box)CONTAINER).Data = value; }
  423. public IGMData_Help() : base(0, 0, new IGMDataItem_Box(IGM_Junction.Descriptions[Items.Junction], pos: new Rectangle(15, 69, 810, 78), title: Icons.ID.HELP))
  424. {
  425. }
  426. }
  427. private class IGMData_TopMenu : IGMData
  428. {
  429. public new Dictionary<Items, FF8String> Descriptions { get; private set; }
  430. public IGMData_TopMenu() : base(4, 1, new IGMDataItem_Box(pos: new Rectangle(0, 12, 610, 54)), 4, 1)
  431. {
  432. }
  433. protected override void InitShift(int i, int col, int row)
  434. {
  435. base.InitShift(i, col, row);
  436. SIZE[i].Inflate(-40, -12);
  437. SIZE[i].Offset(20 + (-20 * (col > 1 ? col : 0)), 0);
  438. }
  439. protected override void Init()
  440. {
  441. base.Init();
  442. ITEM[0, 0] = new IGMDataItem_String(Titles[Items.Junction], SIZE[0]);
  443. Cursor_Status |= Cursor_Status.Enabled;
  444. Cursor_Status |= Cursor_Status.Horizontal;
  445. Cursor_Status |= Cursor_Status.Vertical;
  446. Descriptions = new Dictionary<Items, FF8String> {
  447. {Items.Junction, Memory.Strings.Read(Strings.FileID.MNGRP,2,218) },
  448. {Items.Off, Memory.Strings.Read(Strings.FileID.MNGRP,2,220) },
  449. {Items.Auto, Memory.Strings.Read(Strings.FileID.MNGRP,2,222) },
  450. {Items.Ability, Memory.Strings.Read(Strings.FileID.MNGRP,2,224) },
  451. };
  452. }
  453. public override void ReInit()
  454. {
  455. if (Memory.State.Characters != null)
  456. {
  457. var color = (Memory.State.Characters[Character].JunctionnedGFs == Saves.GFflags.None) ? Font.ColorID.Grey : Font.ColorID.White;
  458. ITEM[1, 0] = new IGMDataItem_String(Titles[Items.Off], SIZE[1],color);
  459. ITEM[2, 0] = new IGMDataItem_String(Titles[Items.Auto], SIZE[2], color);
  460. ITEM[3, 0] = new IGMDataItem_String(Titles[Items.Ability], SIZE[3], color);
  461. for (int i = 1; i <= 3; i++)
  462. BLANKS[i] = Memory.State.Characters[Character].JunctionnedGFs == Saves.GFflags.None;
  463. }
  464. base.ReInit();
  465. }
  466. public override void Inputs_CANCEL()
  467. {
  468. base.Inputs_CANCEL();
  469. if (State == MainMenuStates.IGM_Junction)
  470. {
  471. State = MainMenuStates.InGameMenu;
  472. InGameMenu.ReInit();
  473. Fade = 0.0f;
  474. }
  475. }
  476. public override void Inputs_OKAY()
  477. {
  478. switch (CURSOR_SELECT)
  479. {
  480. case 0:
  481. InGameMenu_Junction.Data[SectionName.TopMenu_Junction].Enabled = true;
  482. Cursor_Status |= Cursor_Status.Blinking;
  483. InGameMenu_Junction.mode = Mode.TopMenu_Junction;
  484. break;
  485. case 1:
  486. InGameMenu_Junction.Data[SectionName.TopMenu_Off].Enabled = true;
  487. Cursor_Status |= Cursor_Status.Blinking;
  488. InGameMenu_Junction.mode = Mode.TopMenu_Off;
  489. break;
  490. case 2:
  491. InGameMenu_Junction.Data[SectionName.TopMenu_Auto].Enabled = true;
  492. Cursor_Status |= Cursor_Status.Blinking;
  493. InGameMenu_Junction.mode = Mode.TopMenu_Auto;
  494. break;
  495. case 3:
  496. InGameMenu_Junction.Data[SectionName.TopMenu_Abilities].Enabled = true;
  497. Cursor_Status |= Cursor_Status.Blinking;
  498. InGameMenu_Junction.mode = Mode.Abilities;
  499. break;
  500. }
  501. base.Inputs_OKAY();
  502. }
  503. public override bool Update()
  504. {
  505. bool ret = base.Update();
  506. if (InGameMenu_Junction != null && InGameMenu_Junction.mode == Mode.TopMenu && Enabled)
  507. {
  508. FF8String Changed = null;
  509. switch (CURSOR_SELECT)
  510. {
  511. case 0:
  512. Changed = Descriptions[Items.Junction];
  513. break;
  514. case 1:
  515. Changed = Descriptions[Items.Off];
  516. break;
  517. case 2:
  518. Changed = Descriptions[Items.Auto];
  519. break;
  520. case 3:
  521. Changed = Descriptions[Items.Ability];
  522. break;
  523. }
  524. if (Changed != null)
  525. ((IGMDataItem_Box)InGameMenu_Junction.Data[SectionName.Help].CONTAINER).Data = Changed;
  526. }
  527. return ret;
  528. }
  529. }
  530. private class IGMData_TopMenu_Junction : IGMData
  531. {
  532. public new Dictionary<Items, FF8String> Descriptions { get; private set; }
  533. public override void Inputs_CANCEL()
  534. {
  535. base.Inputs_CANCEL();
  536. InGameMenu_Junction.mode = Mode.TopMenu;
  537. Enabled = false;
  538. }
  539. public override void Inputs_OKAY()
  540. {
  541. base.Inputs_OKAY();
  542. InGameMenu_Junction.mode = Mode.TopMenu_GF_Group;
  543. InGameMenu_Junction.Data[SectionName.TopMenu_GF_Group].Enabled = true;
  544. }
  545. public IGMData_TopMenu_Junction() : base(2, 1, new IGMDataItem_Box(pos: new Rectangle(210, 12, 400, 54)), 2, 1)
  546. {
  547. }
  548. public override bool Update()
  549. {
  550. Update_String();
  551. if (InGameMenu_Junction != null)
  552. {
  553. if (InGameMenu_Junction.mode == Mode.TopMenu_Junction)
  554. Cursor_Status &= ~Cursor_Status.Blinking;
  555. else
  556. Cursor_Status |= Cursor_Status.Blinking;
  557. }
  558. return base.Update();
  559. }
  560. protected override void InitShift(int i, int col, int row)
  561. {
  562. base.InitShift(i, col, row);
  563. SIZE[i].Inflate(-40, -12);
  564. SIZE[i].Offset(20 + (-20 * (col > 1 ? col : 0)), 0);
  565. }
  566. protected override void Init()
  567. {
  568. base.Init();
  569. ITEM[0, 0] = new IGMDataItem_String(Titles[Items.GF], SIZE[0]);
  570. ITEM[1, 0] = new IGMDataItem_String(Titles[Items.Magic], SIZE[1]);
  571. Cursor_Status |= Cursor_Status.Enabled;
  572. Cursor_Status |= Cursor_Status.Horizontal;
  573. Cursor_Status |= Cursor_Status.Vertical;
  574. Descriptions = new Dictionary<Items, FF8String> {
  575. {Items.GF,Memory.Strings.Read(Strings.FileID.MNGRP,2,263)},
  576. {Items.Magic,Memory.Strings.Read(Strings.FileID.MNGRP,2,265)},
  577. };
  578. Enabled = false;
  579. }
  580. private void Update_String()
  581. {
  582. if (InGameMenu_Junction != null && InGameMenu_Junction.mode == Mode.TopMenu_Junction && Enabled)
  583. {
  584. FF8String Changed = null;
  585. switch (CURSOR_SELECT)
  586. {
  587. case 0:
  588. Changed = Descriptions[Items.GF];
  589. break;
  590. case 1:
  591. Changed = Descriptions[Items.Magic];
  592. break;
  593. }
  594. if (Changed != null && InGameMenu_Junction != null)
  595. ((IGMDataItem_Box)InGameMenu_Junction.Data[SectionName.Help].CONTAINER).Data = Changed;
  596. }
  597. }
  598. }
  599. private class IGMData_TopMenu_Off : IGMData
  600. {
  601. public IGMData_TopMenu_Off() : base(2, 1, new IGMDataItem_Box(pos: new Rectangle(165, 12, 445, 54)), 2, 1)
  602. {
  603. }
  604. public new Dictionary<Items, FF8String> Descriptions { get; private set; }
  605. private void Update_String()
  606. {
  607. if (InGameMenu_Junction != null && InGameMenu_Junction.mode == Mode.TopMenu_Off && Enabled)
  608. {
  609. FF8String Changed = null;
  610. switch (CURSOR_SELECT)
  611. {
  612. case 0:
  613. Changed = Descriptions[Items.RemMag];
  614. break;
  615. case 1:
  616. Changed = Descriptions[Items.RemAll];
  617. break;
  618. }
  619. if (Changed != null && InGameMenu_Junction != null)
  620. ((IGMDataItem_Box)InGameMenu_Junction.Data[SectionName.Help].CONTAINER).Data = Changed;
  621. }
  622. }
  623. protected override void InitShift(int i, int col, int row)
  624. {
  625. base.InitShift(i, col, row);
  626. SIZE[i].Inflate(-40, -12);
  627. SIZE[i].Offset(20 + (-20 * (col > 1 ? col : 0)), 0);
  628. }
  629. public override bool Update()
  630. {
  631. bool ret = base.Update();
  632. Update_String();
  633. if (InGameMenu_Junction != null)
  634. {
  635. if (InGameMenu_Junction.mode == Mode.TopMenu_Off)
  636. Cursor_Status &= ~Cursor_Status.Blinking;
  637. else
  638. Cursor_Status |= Cursor_Status.Blinking;
  639. }
  640. return ret;
  641. }
  642. protected override void Init()
  643. {
  644. base.Init();
  645. ITEM[0, 0] = new IGMDataItem_String(Titles[Items.RemMag], SIZE[0]);
  646. ITEM[1, 0] = new IGMDataItem_String(Titles[Items.RemAll], SIZE[1]);
  647. Cursor_Status |= Cursor_Status.Enabled;
  648. Cursor_Status |= Cursor_Status.Horizontal;
  649. Cursor_Status |= Cursor_Status.Vertical;
  650. Descriptions = new Dictionary<Items, FF8String> {
  651. {Items.RemMag,Memory.Strings.Read(Strings.FileID.MNGRP,2,278)},
  652. {Items.RemAll,Memory.Strings.Read(Strings.FileID.MNGRP,2,276)},
  653. };
  654. }
  655. public override void Inputs_OKAY()
  656. {
  657. base.Inputs_OKAY();
  658. switch (CURSOR_SELECT)
  659. {
  660. case 0:
  661. InGameMenu_Junction.Data[SectionName.RemMag].Enabled = true;
  662. InGameMenu_Junction.mode = Mode.RemMag;
  663. break;
  664. case 1:
  665. InGameMenu_Junction.Data[SectionName.RemAll].Enabled = true;
  666. InGameMenu_Junction.mode = Mode.RemAll;
  667. break;
  668. }
  669. }
  670. public override void Inputs_CANCEL()
  671. {
  672. base.Inputs_CANCEL();
  673. InGameMenu_Junction.Data[SectionName.TopMenu_Off].Enabled = false;
  674. InGameMenu_Junction.mode = Mode.TopMenu;
  675. }
  676. }
  677. private class IGMData_TopMenu_Auto : IGMData
  678. {
  679. public IGMData_TopMenu_Auto() : base(3, 1, new IGMDataItem_Box(pos: new Rectangle(165, 12, 445, 54)), 3, 1)
  680. {
  681. }
  682. protected override void InitShift(int i, int col, int row)
  683. {
  684. base.InitShift(i, col, row);
  685. SIZE[i].Inflate(-40, -12);
  686. SIZE[i].Offset(20 + (-20 * (col > 1 ? col : 0)), 0);
  687. }
  688. public new Dictionary<Items, FF8String> Descriptions { get; private set; }
  689. private void Update_String()
  690. {
  691. if (InGameMenu_Junction != null && InGameMenu_Junction.mode == Mode.TopMenu_Auto && Enabled)
  692. {
  693. FF8String Changed = null;
  694. switch (CURSOR_SELECT)
  695. {
  696. case 0:
  697. Changed = Descriptions[Items.AutoAtk];
  698. break;
  699. case 1:
  700. Changed = Descriptions[Items.AutoDef];
  701. break;
  702. case 2:
  703. Changed = Descriptions[Items.AutoMag];
  704. break;
  705. }
  706. if (Changed != null && InGameMenu_Junction != null)
  707. ((IGMDataItem_Box)InGameMenu_Junction.Data[SectionName.Help].CONTAINER).Data = Changed;
  708. }
  709. }
  710. public override bool Update()
  711. {
  712. bool ret = base.Update();
  713. Update_String();
  714. return ret;
  715. }
  716. protected override void Init()
  717. {
  718. base.Init();
  719. ITEM[0, 0] = new IGMDataItem_String(Titles[Items.AutoAtk], SIZE[0]);
  720. ITEM[1, 0] = new IGMDataItem_String(Titles[Items.AutoDef], SIZE[1]);
  721. ITEM[2, 0] = new IGMDataItem_String(Titles[Items.AutoMag], SIZE[2]);
  722. Cursor_Status |= Cursor_Status.Enabled;
  723. Cursor_Status |= Cursor_Status.Horizontal;
  724. Cursor_Status |= Cursor_Status.Vertical;
  725. Descriptions = new Dictionary<Items, FF8String> {
  726. //{Items.HP, Memory.Strings.Read(Strings.FileID.MNGRP,2,226) },
  727. //{Items.Str, Memory.Strings.Read(Strings.FileID.MNGRP,2,228) },
  728. //{Items.Vit, Memory.Strings.Read(Strings.FileID.MNGRP,2,230) },
  729. //{Items.Mag, Memory.Strings.Read(Strings.FileID.MNGRP,2,232) },
  730. //{Items.Spr, Memory.Strings.Read(Strings.FileID.MNGRP,2,234) },
  731. //{Items.Spd, Memory.Strings.Read(Strings.FileID.MNGRP,2,236) },
  732. //{Items.Luck, Memory.Strings.Read(Strings.FileID.MNGRP,2,238) },
  733. //{Items.Hit, Memory.Strings.Read(Strings.FileID.MNGRP,2,240) },
  734. //{Items.ST_A,Memory.Strings.Read(Strings.FileID.MNGRP,2,244)},
  735. //{Items.ST_D,Memory.Strings.Read(Strings.FileID.MNGRP,2,246)},
  736. //{Items.EL_A,Memory.Strings.Read(Strings.FileID.MNGRP,2,248)},
  737. //{Items.EL_D,Memory.Strings.Read(Strings.FileID.MNGRP,2,250)},
  738. //{Items.ST_A_D,Memory.Strings.Read(Strings.FileID.MNGRP,2,252)},
  739. //{Items.EL_A_D,Memory.Strings.Read(Strings.FileID.MNGRP,2,254)},
  740. //{ Items.Stats,Memory.Strings.Read(Strings.FileID.MNGRP,2,256)},
  741. //{Items.ST_A2,Memory.Strings.Read(Strings.FileID.MNGRP,2,258)},
  742. //{Items.GF,Memory.Strings.Read(Strings.FileID.MNGRP,2,263)},
  743. //{Items.Magic,Memory.Strings.Read(Strings.FileID.MNGRP,2,265)},
  744. {Items.AutoAtk,Memory.Strings.Read(Strings.FileID.MNGRP,2,270)},
  745. {Items.AutoMag,Memory.Strings.Read(Strings.FileID.MNGRP,2,272)},
  746. {Items.AutoDef,Memory.Strings.Read(Strings.FileID.MNGRP,2,274)},
  747. //{Items.RemMag,Memory.Strings.Read(Strings.FileID.MNGRP,2,278)},
  748. //{Items.RemAll,Memory.Strings.Read(Strings.FileID.MNGRP,2,276)},
  749. //{Items.RemovealljunctionedGFandmagic,Memory.Strings.Read(Strings.FileID.MNGRP,2,279)},
  750. //{Items.Removealljunctionedmagic,Memory.Strings.Read(Strings.FileID.MNGRP,2,280)},
  751. //{Items.ChooseGFtojunction,Memory.Strings.Read(Strings.FileID.MNGRP,2,281)},
  752. //{Items.Chooseslottojunction,Memory.Strings.Read(Strings.FileID.MNGRP,2,282)},
  753. //{Items.Choosemagictojunction,Memory.Strings.Read(Strings.FileID.MNGRP,2,283)},
  754. };
  755. }
  756. public override void Inputs_CANCEL()
  757. {
  758. base.Inputs_CANCEL();
  759. InGameMenu_Junction.Data[SectionName.TopMenu_Auto].Enabled = false;
  760. InGameMenu_Junction.mode = Mode.TopMenu;
  761. }
  762. }
  763. private class IGMData_Abilities_Group : IGMData_Group
  764. {
  765. public IGMData_Abilities_Group(params IGMData[] d) : base(d)
  766. {
  767. }
  768. public override void Inputs_Square()
  769. {
  770. skipdata = true;
  771. base.Inputs_Square();
  772. skipdata = false;
  773. IGMDataItem_IGMData i = ((IGMDataItem_IGMData)ITEM[0, 0]);
  774. IGMDataItem_IGMData i2 = ((IGMDataItem_IGMData)ITEM[3, 0]);
  775. if (i != null && i.Data != null)
  776. {
  777. if (CURSOR_SELECT >= i.Data.Count)
  778. {
  779. Memory.State.Characters[Character].Commands[CURSOR_SELECT - 1] = Kernel_bin.Abilities.None;
  780. InGameMenu_Junction.Data[SectionName.TopMenu_Abilities].ReInit();
  781. InGameMenu_Junction.Data[SectionName.Commands].ReInit();
  782. }
  783. else
  784. {
  785. Memory.State.Characters[Character].Abilities[CURSOR_SELECT - i.Data.Count] = Kernel_bin.Abilities.None;
  786. InGameMenu_Junction.ReInit();
  787. }
  788. }
  789. }
  790. public override void Inputs_CANCEL()
  791. {
  792. skipdata = true;
  793. base.Inputs_CANCEL();
  794. skipdata = false;
  795. InGameMenu_Junction.Data[SectionName.TopMenu_Abilities].Enabled = false;
  796. InGameMenu_Junction.mode = Mode.TopMenu;
  797. }
  798. protected override void Init()
  799. {
  800. base.Init();
  801. Cursor_Status |= Cursor_Status.Enabled;
  802. Enabled = false;
  803. }
  804. public override void ReInit()
  805. {
  806. base.ReInit();
  807. IGMDataItem_IGMData i = ((IGMDataItem_IGMData)ITEM[0, 0]);
  808. IGMDataItem_IGMData i2 = ((IGMDataItem_IGMData)ITEM[1, 0]);
  809. if (i != null && i.Data != null && i2 != null && i2.Data != null)
  810. {
  811. SIZE = new Rectangle[i.Data.Count + i2.Data.Count];
  812. Array.Copy(i.Data.SIZE, SIZE, i.Data.Count);
  813. Array.Copy(i2.Data.SIZE, 0, SIZE, i.Data.Count, i2.Data.Count);
  814. CURSOR = new Point[i.Data.Count + i2.Data.Count];
  815. Array.Copy(i.Data.CURSOR, CURSOR, i.Data.Count);
  816. Array.Copy(i2.Data.CURSOR, 0, CURSOR, i.Data.Count, i2.Data.Count);
  817. BLANKS = new bool[i.Data.Count + i2.Data.Count];
  818. Array.Copy(i.Data.BLANKS, BLANKS, i.Data.Count);
  819. Array.Copy(i2.Data.BLANKS, 0, BLANKS, i.Data.Count, i2.Data.Count);
  820. }
  821. if (CURSOR_SELECT == 0)
  822. CURSOR_SELECT = 1;
  823. }
  824. public override bool Update()
  825. {
  826. bool ret = base.Update();
  827. if (InGameMenu_Junction != null && InGameMenu_Junction.mode == Mode.Abilities)
  828. {
  829. Cursor_Status &= ~Cursor_Status.Blinking;
  830. IGMDataItem_IGMData i = ((IGMDataItem_IGMData)ITEM[0, 0]);
  831. IGMDataItem_IGMData i2 = ((IGMDataItem_IGMData)ITEM[1, 0]);
  832. if (i != null && i.Data != null && i2 != null && i2.Data != null)
  833. {
  834. if (CURSOR_SELECT >= i.Data.Count)
  835. {
  836. if (i2.Data.Descriptions != null && i2.Data.Descriptions.ContainsKey(CURSOR_SELECT - i.Data.Count))
  837. {
  838. ((IGMDataItem_Box)InGameMenu_Junction.Data[SectionName.Help].CONTAINER).Data = i2.Data.Descriptions[CURSOR_SELECT - i.Data.Count];
  839. }
  840. }
  841. else
  842. {
  843. if (i.Data.Descriptions != null && i.Data.Descriptions.ContainsKey(CURSOR_SELECT))
  844. {
  845. ((IGMDataItem_Box)InGameMenu_Junction.Data[SectionName.Help].CONTAINER).Data = i.Data.Descriptions[CURSOR_SELECT];
  846. }
  847. }
  848. }
  849. }
  850. else
  851. Cursor_Status |= Cursor_Status.Blinking;
  852. return ret;
  853. }
  854. public override bool Inputs()
  855. {
  856. skipdata = true;
  857. bool ret = base.Inputs();
  858. skipdata = false;
  859. IGMDataItem_IGMData i = ((IGMDataItem_IGMData)ITEM[0, 0]);
  860. IGMDataItem_IGMData i2 = ((IGMDataItem_IGMData)ITEM[3, 0]);
  861. if (ret && i != null && i.Data != null)
  862. {
  863. if (CURSOR_SELECT >= i.Data.Count)
  864. i2.Data.Enabled = true;
  865. else
  866. i2.Data.Enabled = false;
  867. }
  868. return ret;
  869. }
  870. public override void Inputs_OKAY()
  871. {
  872. base.Inputs_OKAY();
  873. IGMDataItem_IGMData i = ((IGMDataItem_IGMData)ITEM[0, 0]);
  874. IGMDataItem_IGMData i2 = ((IGMDataItem_IGMData)ITEM[3, 0]);
  875. if (i != null && i.Data != null)
  876. {
  877. if (CURSOR_SELECT >= i.Data.Count)
  878. InGameMenu_Junction.mode = Mode.Abilities_Abilities;
  879. else
  880. InGameMenu_Junction.mode = Mode.Abilities_Commands;
  881. }
  882. }
  883. }
  884. private class IGMData_TopMenu_Off_Group : IGMData_Group
  885. {
  886. public IGMData_TopMenu_Off_Group(params IGMData[] d) : base(d)
  887. {
  888. }
  889. public override void Draw()
  890. {
  891. if (Enabled)
  892. {
  893. Cursor_Status |= (Cursor_Status.Draw | Cursor_Status.Blinking);
  894. base.Draw();
  895. Tuple<Rectangle, Point, Rectangle> i = ((IGMDataItem_Box)(((IGMData_Container)(((IGMDataItem_IGMData)ITEM[0, 0]).Data)).CONTAINER)).Dims;
  896. if (i != null)
  897. CURSOR[0] = i.Item2;
  898. }
  899. }
  900. protected override void Init()
  901. {
  902. base.Init();
  903. Enabled = false;
  904. }
  905. }
  906. private class IGMData_TopMenu_Auto_Group : IGMData_Group
  907. {
  908. public IGMData_TopMenu_Auto_Group(params IGMData[] d) : base(d)
  909. {
  910. }
  911. public override void Draw()
  912. {
  913. if (Enabled)
  914. {
  915. Cursor_Status |= (Cursor_Status.Draw | Cursor_Status.Blinking);
  916. base.Draw();
  917. Tuple<Rectangle, Point, Rectangle> i = ((IGMDataItem_Box)(((IGMData_Container)(((IGMDataItem_IGMData)ITEM[0, 0]).Data)).CONTAINER)).Dims;
  918. if (i != null)
  919. CURSOR[0] = i.Item2;
  920. }
  921. }
  922. protected override void Init()
  923. {
  924. base.Init();
  925. Enabled = false;
  926. }
  927. }
  928. private class IGMData_Abilities_Command : IGMData
  929. {
  930. public IGMData_Abilities_Command() : base(4, 2, new IGMDataItem_Box(pos: new Rectangle(0, 198, 435, 216), title: Icons.ID.COMMAND), 1, 4)
  931. {
  932. }
  933. protected override void Init()
  934. {
  935. base.Init();
  936. CURSOR[0] = Point.Zero; //disable this cursor location
  937. }
  938. protected override void InitShift(int i, int col, int row)
  939. {
  940. base.InitShift(i, col, row);
  941. SIZE[i].Inflate(-22, -8);
  942. SIZE[i].Offset(0, 12 + (-8 * row));
  943. CURSOR[i].X += 40;
  944. }
  945. public override void ReInit()
  946. {
  947. base.ReInit();
  948. if (Memory.State.Characters != null)
  949. {
  950. for (int i = 0; i < Count; i++)
  951. {
  952. if (i == 0)
  953. {
  954. ITEM[i, 1] = new IGMDataItem_String(
  955. Kernel_bin.BattleCommands[
  956. Memory.State.Characters[Character].Abilities.Contains(Kernel_bin.Abilities.Mug) ?
  957. 13 :
  958. 1].Name,
  959. new Rectangle(SIZE[i].X + 80, SIZE[i].Y, 0, 0));
  960. }
  961. else
  962. {
  963. ITEM[i, 0] = new IGMDataItem_Icon(Icons.ID.Arrow_Right2, SIZE[i], 9);
  964. ITEM[i, 1] = Memory.State.Characters[Character].Commands[i - 1] != Kernel_bin.Abilities.None ? new IGMDataItem_String(
  965. Icons.ID.Ability_Command, 9,
  966. Kernel_bin.Commandabilities[Memory.State.Characters[Character].Commands[i - 1]].Name,
  967. new Rectangle(SIZE[i].X + 40, SIZE[i].Y, 0, 0)) : null;
  968. var k = Memory.State.Characters[Character].Commands[i - 1];
  969. Descriptions[i] = k== Kernel_bin.Abilities.None?null:Kernel_bin.Commandabilities[k].BattleCommand.Description;
  970. }
  971. }
  972. }
  973. }
  974. }
  975. private class IGMData_Abilities_AbilitySlots : IGMData
  976. {
  977. public IGMData_Abilities_AbilitySlots() : base(4, 2, new IGMDataItem_Box(pos: new Rectangle(0, 414, 435, 216), title: Icons.ID.ABILITY), 1, 4)
  978. {
  979. }
  980. protected override void InitShift(int i, int col, int row)
  981. {
  982. base.InitShift(i, col, row);
  983. SIZE[i].Inflate(-22, -8);
  984. SIZE[i].Offset(80, 12 + (-8 * row));
  985. CURSOR[i].X += 40;
  986. }
  987. public override void ReInit()
  988. {
  989. base.ReInit();
  990. if (Memory.State.Characters != null)
  991. {
  992. for (int i = 0; i < Count; i++)
  993. {
  994. int slots = 2;
  995. if (Memory.State.Characters[Character].UnlockedGFAbilities.Contains(Kernel_bin.Abilities.Abilityx3))
  996. slots = 3;
  997. if (Memory.State.Characters[Character].UnlockedGFAbilities.Contains(Kernel_bin.Abilities.Abilityx4))
  998. slots = 4;
  999. if (i < slots)
  1000. {
  1001. ITEM[i, 0] = new IGMDataItem_Icon(Icons.ID.Arrow_Right2, SIZE[i], 9);
  1002. if (Memory.State.Characters[Character].Abilities[i] != Kernel_bin.Abilities.None)
  1003. {
  1004. ITEM[i, 1] = new IGMDataItem_String(
  1005. Kernel_bin.EquipableAbilities[Memory.State.Characters[Character].Abilities[i]].Icon, 9,
  1006. Kernel_bin.EquipableAbilities[Memory.State.Characters[Character].Abilities[i]].Name,
  1007. new Rectangle(SIZE[i].X + 40, SIZE[i].Y, 0, 0));
  1008. Descriptions[i] = Kernel_bin.EquipableAbilities[Memory.State.Characters[Character].Abilities[i]].Description.ReplaceRegion();
  1009. }
  1010. else
  1011. {
  1012. ITEM[i, 1] = null;
  1013. //Descriptions[i] = "";
  1014. }
  1015. BLANKS[i] = false;
  1016. }
  1017. else
  1018. {
  1019. ITEM[i, 0] = null;
  1020. ITEM[i, 1] = null;
  1021. BLANKS[i] = true;
  1022. //Descriptions[i] = "";
  1023. }
  1024. }
  1025. }
  1026. }
  1027. }
  1028. public abstract class IGMData_Pool<T, T2> : IGMData
  1029. {
  1030. public IGMData_Pool(int count, int depth, IGMDataItem container = null, int? rows = null, int? pages = null) : base(count + 2, depth, container, 1, rows) => DefaultPages = pages ?? 1;
  1031. public int DefaultPages { get; private set; }
  1032. public int Pages { get; protected set; }
  1033. public int Page { get; protected set; }
  1034. public T2[] Contents { get; private set; }
  1035. protected T Source { get; set; }
  1036. protected override void Init()
  1037. {
  1038. base.Init();
  1039. Cursor_Status |= Cursor_Status.Enabled;
  1040. Cursor_Status |= Cursor_Status.Vertical;
  1041. Page = 0;
  1042. Contents = new T2[rows];
  1043. SIZE[Count - 2].X = X + 6;
  1044. SIZE[Count - 2].Y = Y + Height - 28;
  1045. SIZE[Count - 1].X = X + Width - 24;
  1046. SIZE[Count - 1].Y = Y + Height - 28;
  1047. }
  1048. public override void ReInit()
  1049. {
  1050. base.ReInit();
  1051. Pages = DefaultPages;
  1052. ITEM[Count - 2, 0] = new IGMDataItem_Icon(Icons.ID.Arrow_Left, SIZE[Count - 2], 2, 7);
  1053. ITEM[Count - 1, 0] = new IGMDataItem_Icon(Icons.ID.Arrow_Right2, SIZE[Count - 1], 2, 7);
  1054. }
  1055. public override bool Inputs()
  1056. {
  1057. bool ret = false;
  1058. if (Pages > 1 && CONTAINER.Pos.Contains(Input.MouseLocation.Transform(Focus)))
  1059. {
  1060. if (Input.Button(Buttons.MouseWheelup))
  1061. {
  1062. PAGE_PREV();
  1063. ret = true;
  1064. }
  1065. else if (Input.Button(Buttons.MouseWheeldown))
  1066. {
  1067. PAGE_NEXT();
  1068. ret = true;
  1069. }
  1070. if (ret)
  1071. {
  1072. Input.ResetInputLimit();
  1073. if (!skipsnd)
  1074. init_debugger_Audio.PlaySound(0);
  1075. return ret;
  1076. }
  1077. }
  1078. ret = base.Inputs();
  1079. if (Pages > 1 && !ret)
  1080. {
  1081. if (Input.Button(Buttons.Left))
  1082. {
  1083. PAGE_PREV();
  1084. ret = true;
  1085. }
  1086. else if (Input.Button(Buttons.Right))
  1087. {
  1088. PAGE_NEXT();
  1089. ret = true;
  1090. }
  1091. if (ret)
  1092. {
  1093. Input.ResetInputLimit();
  1094. if (!skipsnd)
  1095. init_debugger_Audio.PlaySound(0);
  1096. }
  1097. }
  1098. return ret;
  1099. }
  1100. protected virtual void PAGE_NEXT()
  1101. {
  1102. Page++;
  1103. if (Page >= Pages)
  1104. Page = 0;
  1105. }
  1106. protected virtual void PAGE_PREV()
  1107. {
  1108. Page--;
  1109. if (Page < 0)
  1110. Page = Pages - 1;
  1111. }
  1112. public virtual void UpdateTitle()
  1113. {
  1114. }
  1115. }
  1116. private class IGMData_Abilities_CommandPool : IGMData_Pool<Dictionary<Kernel_bin.Abilities, Kernel_bin.Command_abilities>, Kernel_bin.Abilities>
  1117. {
  1118. public IGMData_Abilities_CommandPool() : base(11, 1, new IGMDataItem_Box(pos: new Rectangle(435, 150, 405, 480), title: Icons.ID.COMMAND), 11, Kernel_bin.Commandabilities.Count / 11 + (Kernel_bin.Commandabilities.Count % 11 > 0 ? 1 : 0)) => Source = Kernel_bin.Commandabilities;
  1119. protected override void InitShift(int i, int col, int row)
  1120. {
  1121. base.InitShift(i, col, row);
  1122. SIZE[i].Inflate(-22, -8);
  1123. SIZE[i].Offset(60, 12 + (-4 * row));
  1124. }
  1125. public override void Inputs_OKAY()
  1126. {
  1127. skipsnd = true;
  1128. init_debugger_Audio.PlaySound(31);
  1129. base.Inputs_OKAY();
  1130. if (Contents[CURSOR_SELECT] != Kernel_bin.Abilities.None && !BLANKS[CURSOR_SELECT])
  1131. {
  1132. int target = InGameMenu_Junction.Data[SectionName.TopMenu_Abilities].CURSOR_SELECT - 1;
  1133. Memory.State.Characters[Character].Commands[target] = Contents[CURSOR_SELECT];
  1134. InGameMenu_Junction.mode = Mode.Abilities;
  1135. InGameMenu_Junction.Data[SectionName.TopMenu_Abilities].ReInit();
  1136. InGameMenu_Junction.Data[SectionName.Commands].ReInit();
  1137. }
  1138. }
  1139. public override void Inputs_CANCEL()
  1140. {
  1141. base.Inputs_CANCEL();
  1142. InGameMenu_Junction.mode = Mode.Abilities;
  1143. }
  1144. public override void UpdateTitle()
  1145. {
  1146. base.UpdateTitle();
  1147. if (Pages == 1)
  1148. {
  1149. ((IGMDataItem_Box)CONTAINER).Title = Icons.ID.COMMAND;
  1150. ITEM[11, 0] = ITEM[12, 0] = null;
  1151. }
  1152. else
  1153. switch (Page)
  1154. {
  1155. case 0:
  1156. ((IGMDataItem_Box)CONTAINER).Title = Icons.ID.COMMAND_PG1;
  1157. break;
  1158. case 1:
  1159. ((IGMDataItem_Box)CONTAINER).Title = Icons.ID.COMMAND_PG2;
  1160. break;
  1161. }
  1162. }
  1163. public override bool Update()
  1164. {
  1165. if (InGameMenu_Junction != null && InGameMenu_Junction.mode != Mode.Abilities_Commands)
  1166. Cursor_Status &= ~Cursor_Status.Enabled;
  1167. else
  1168. {
  1169. Cursor_Status |= Cursor_Status.Enabled;
  1170. }
  1171. int pos = 0;
  1172. int skip = Page * rows;
  1173. for (int i = 0;
  1174. Memory.State.Characters != null &&
  1175. i < Memory.State.Characters[Character].UnlockedGFAbilities.Count &&
  1176. pos < rows; i++)
  1177. {
  1178. if (Memory.State.Characters[Character].UnlockedGFAbilities[i] != Kernel_bin.Abilities.None)
  1179. {
  1180. Kernel_bin.Abilities j = (Memory.State.Characters[Character].UnlockedGFAbilities[i]);
  1181. if (Source.ContainsKey(j) && skip-- <= 0)
  1182. {
  1183. Font.ColorID cid = Memory.State.Characters[Character].Commands.Contains(j) ? Font.ColorID.Grey : Font.ColorID.White;
  1184. BLANKS[pos] = cid == Font.ColorID.Grey ? true : false;
  1185. ITEM[pos, 0] = new IGMDataItem_String(
  1186. Icons.ID.Ability_Command, 9,
  1187. Source[j].Name,
  1188. new Rectangle(SIZE[pos].X, SIZE[pos].Y, 0, 0), cid);
  1189. Contents[pos] = j;
  1190. pos++;
  1191. }
  1192. }
  1193. }
  1194. for (; pos < rows; pos++)
  1195. {
  1196. ITEM[pos, 0] = null;
  1197. BLANKS[pos] = true;
  1198. Contents[pos] = Kernel_bin.Abilities.None;
  1199. }
  1200. if (Contents[CURSOR_SELECT] != Kernel_bin.Abilities.None && InGameMenu_Junction.mode == Mode.Abilities_Commands)
  1201. ((IGMDataItem_Box)InGameMenu_Junction.Data[SectionName.Help].CONTAINER).Data = Source[Contents[CURSOR_SELECT]].Description.ReplaceRegion();
  1202. UpdateTitle();
  1203. if (Contents[CURSOR_SELECT] == Kernel_bin.Abilities.None)
  1204. CURSOR_NEXT();
  1205. if (Pages > 1)
  1206. {
  1207. if (Contents[0] == Kernel_bin.Abilities.None)
  1208. {
  1209. Pages = Page;
  1210. PAGE_NEXT();
  1211. return Update();
  1212. }
  1213. else if (Contents[rows - 1] == Kernel_bin.Abilities.None)
  1214. Pages = Page + 1;
  1215. }
  1216. return base.Update();
  1217. }
  1218. }
  1219. private class IGMData_Abilities_AbilityPool : IGMData_Pool<Dictionary<Kernel_bin.Abilities, Kernel_bin.Equipable_Ability>, Kernel_bin.Abilities>
  1220. {
  1221. public IGMData_Abilities_AbilityPool() : base(11, 1, new IGMDataItem_Box(pos: new Rectangle(435, 150, 405, 480), title: Icons.ID.ABILITY), 11, Kernel_bin.EquipableAbilities.Count / 11 + (Kernel_bin.EquipableAbilities.Count % 11 > 0 ? 1 : 0)) => Source = Kernel_bin.EquipableAbilities;
  1222. protected override void Init()
  1223. {
  1224. base.Init();
  1225. Enabled = false;
  1226. }
  1227. protected override void InitShift(int i, int col, int row)
  1228. {
  1229. base.InitShift(i, col, row);
  1230. SIZE[i].Inflate(-22, -8);
  1231. SIZE[i].Offset(60, 12 + (-4 * row));
  1232. }
  1233. public override void Inputs_OKAY()
  1234. {
  1235. skipsnd = true;
  1236. init_debugger_Audio.PlaySound(31);
  1237. base.Inputs_OKAY();
  1238. if (Contents[CURSOR_SELECT] != Kernel_bin.Abilities.None && !BLANKS[CURSOR_SELECT])
  1239. {
  1240. int target = InGameMenu_Junction.Data[SectionName.TopMenu_Abilities].CURSOR_SELECT - 4;
  1241. Memory.State.Characters[Character].Abilities[target] = Contents[CURSOR_SELECT];
  1242. InGameMenu_Junction.mode = Mode.Abilities;
  1243. InGameMenu_Junction.ReInit(); // can be more specific if you want to find what is being changed.
  1244. }
  1245. }
  1246. public override void Inputs_CANCEL()
  1247. {
  1248. base.Inputs_CANCEL();
  1249. InGameMenu_Junction.mode = Mode.Abilities;
  1250. }
  1251. public override void UpdateTitle()
  1252. {
  1253. base.UpdateTitle();
  1254. if (Pages == 1)
  1255. {
  1256. ((IGMDataItem_Box)CONTAINER).Title = Icons.ID.ABILITY;
  1257. ITEM[11, 0] = ITEM[12, 0] = null;
  1258. }
  1259. else
  1260. switch (Page)
  1261. {
  1262. case 0:
  1263. ((IGMDataItem_Box)CONTAINER).Title = Icons.ID.ABILITY_PG1;
  1264. break;
  1265. case 1:
  1266. ((IGMDataItem_Box)CONTAINER).Title = Icons.ID.ABILITY_PG2;
  1267. break;
  1268. case 2:
  1269. ((IGMDataItem_Box)CONTAINER).Title = Icons.ID.ABILITY_PG3;
  1270. break;
  1271. case 3:
  1272. ((IGMDataItem_Box)CONTAINER).Title = Icons.ID.ABILITY_PG4;
  1273. break;
  1274. }
  1275. }
  1276. public override bool Update()
  1277. {
  1278. if (InGameMenu_Junction != null && InGameMenu_Junction.mode != Mode.Abilities_Abilities)
  1279. Cursor_Status &= ~Cursor_Status.Enabled;
  1280. else
  1281. Cursor_Status |= Cursor_Status.Enabled;
  1282. int pos = 0;
  1283. int skip = Page * rows;
  1284. for (int i = 0;
  1285. Memory.State.Characters != null &&
  1286. i < Memory.State.Characters[Character].UnlockedGFAbilities.Count &&
  1287. pos < rows; i++)
  1288. {
  1289. if (Memory.State.Characters[Character].UnlockedGFAbilities[i] != Kernel_bin.Abilities.None)
  1290. {
  1291. Kernel_bin.Abilities j = Memory.State.Characters[Character].UnlockedGFAbilities[i];
  1292. if (Source.ContainsKey(j))
  1293. {
  1294. if (skip > 0)
  1295. {
  1296. skip--;
  1297. continue;
  1298. }
  1299. Font.ColorID cid = Memory.State.Characters[Character].Abilities.Contains(j) ? Font.ColorID.Grey : Font.ColorID.White;
  1300. BLANKS[pos] = cid == Font.ColorID.Grey ? true : false;
  1301. ITEM[pos, 0] = new IGMDataItem_String(
  1302. Source[j].Icon, 9,
  1303. Source[j].Name,
  1304. new Rectangle(SIZE[pos].X, SIZE[pos].Y, 0, 0), cid);
  1305. Contents[pos] = j;
  1306. pos++;
  1307. }
  1308. }
  1309. }
  1310. for (; pos < rows; pos++)
  1311. {
  1312. ITEM[pos, 0] = null;
  1313. BLANKS[pos] = true;
  1314. Contents[pos] = Kernel_bin.Abilities.None;
  1315. }
  1316. if (Contents[CURSOR_SELECT] != Kernel_bin.Abilities.None && InGameMenu_Junction.mode == Mode.Abilities_Abilities)
  1317. ((IGMDataItem_Box)InGameMenu_Junction.Data[SectionName.Help].CONTAINER).Data = Source[Contents[CURSOR_SELECT]].Description.ReplaceRegion();
  1318. UpdateTitle();
  1319. if (Contents[CURSOR_SELECT] == Kernel_bin.Abilities.None)
  1320. CURSOR_NEXT();
  1321. if (Pages > 1)
  1322. {
  1323. if (Contents[0] == Kernel_bin.Abilities.None)
  1324. {
  1325. Pages = Page;
  1326. PAGE_NEXT();
  1327. return Update();
  1328. }
  1329. else if (Contents[rows - 1] == Kernel_bin.Abilities.None)
  1330. Pages = Page + 1;
  1331. }
  1332. return base.Update();
  1333. }
  1334. }
  1335. public abstract class IGMData_ConfirmDialog : IGMData
  1336. {
  1337. protected int startcursor;
  1338. protected FF8String[] opt;
  1339. public IGMData_ConfirmDialog(FF8String data, Icons.ID title, FF8String opt1, FF8String opt2, Rectangle? pos, int startcursor = 0) : base(2, 1, new IGMDataItem_Box(data, pos, title), 1, 2)
  1340. {
  1341. this.startcursor = startcursor;
  1342. opt = new FF8String[Count];
  1343. opt[0] = opt1;
  1344. opt[1] = opt2;
  1345. ITEM[0, 0] = new IGMDataItem_String(opt[0], SIZE[0]);
  1346. ITEM[1, 0] = new IGMDataItem_String(opt[1], SIZE[1]);
  1347. }
  1348. protected override void Init()
  1349. {
  1350. SIZE[0] = new Rectangle(212 + X, 117 + Y, 52, 30);
  1351. SIZE[1] = new Rectangle(212 + X, 156 + Y, 52, 30);
  1352. base.Init();
  1353. Enabled = false;
  1354. }
  1355. public override void ReInit()
  1356. {
  1357. base.ReInit();
  1358. CURSOR_SELECT = startcursor;
  1359. Cursor_Status |= Cursor_Status.Enabled;
  1360. Cursor_Status |= Cursor_Status.Vertical;
  1361. Cursor_Status |= Cursor_Status.Horizontal;
  1362. }
  1363. }
  1364. private sealed class IGMData_ConfirmRemMag : IGMData_ConfirmDialog
  1365. {
  1366. public IGMData_ConfirmRemMag(FF8String data, Icons.ID title, FF8String opt1, FF8String opt2, Rectangle pos) : base(data, title, opt1, opt2, pos) => startcursor = 1;
  1367. public override void Inputs_OKAY()
  1368. {
  1369. switch (CURSOR_SELECT)
  1370. {
  1371. case 0:
  1372. base.Inputs_OKAY();
  1373. Memory.State.Characters[Character].Stat_J = Memory.State.Characters[Character].Stat_J.ToDictionary(e => e.Key, e => (byte)0);
  1374. Memory.State.Characters[Character].Elem_Atk_J = 0;
  1375. Memory.State.Characters[Character].Elem_Def_J = Memory.State.Characters[Character].Elem_Def_J.ConvertAll(Item => (byte)0);
  1376. Memory.State.Characters[Character].ST_Atk_J = 0;
  1377. Memory.State.Characters[Character].ST_Def_J = Memory.State.Characters[Character].ST_Def_J.ConvertAll(Item => (byte)0);
  1378. skipsnd = true;
  1379. Inputs_CANCEL();
  1380. skipsnd = false;
  1381. InGameMenu_Junction.ReInit();
  1382. break;
  1383. case 1:
  1384. Inputs_CANCEL();
  1385. break;
  1386. }
  1387. }
  1388. public override void Inputs_CANCEL()
  1389. {
  1390. base.Inputs_CANCEL();
  1391. InGameMenu_Junction.Data[SectionName.RemMag].Enabled = false;
  1392. InGameMenu_Junction.mode = Mode.TopMenu_Off;
  1393. }
  1394. }
  1395. private sealed class IGMData_ConfirmRemAll : IGMData_ConfirmDialog
  1396. {
  1397. public IGMData_ConfirmRemAll(FF8String data, Icons.ID title, FF8String opt1, FF8String opt2, Rectangle pos) : base(data, title, opt1, opt2, pos) => startcursor = 1;
  1398. public override void Inputs_OKAY()
  1399. {
  1400. switch (CURSOR_SELECT)
  1401. {
  1402. case 0:
  1403. base.Inputs_OKAY();
  1404. Memory.State.Characters[Character].Stat_J = Memory.State.Characters[Character].Stat_J.ToDictionary(e => e.Key, e => (byte)0);
  1405. Memory.State.Characters[Character].Elem_Atk_J = 0;
  1406. Memory.State.Characters[Character].Elem_Def_J = Memory.State.Characters[Character].Elem_Def_J.ConvertAll(Item => (byte)0);
  1407. Memory.State.Characters[Character].ST_Atk_J = 0;
  1408. Memory.State.Characters[Character].ST_Def_J = Memory.State.Characters[Character].ST_Def_J.ConvertAll(Item => (byte)0);
  1409. Memory.State.Characters[Character].Commands = Memory.State.Characters[Character].Commands.ConvertAll(Item => Kernel_bin.Abilities.None);
  1410. Memory.State.Characters[Character].Abilities = Memory.State.Characters[Character].Abilities.ConvertAll(Item => Kernel_bin.Abilities.None);
  1411. Memory.State.Characters[Character].JunctionnedGFs = Saves.GFflags.None;
  1412. InGameMenu_Junction.Data[SectionName.RemAll].Enabled = false;
  1413. InGameMenu_Junction.Data[SectionName.TopMenu_Off].Enabled = false;
  1414. InGameMenu_Junction.mode = Mode.TopMenu;
  1415. InGameMenu_Junction.Data[SectionName.TopMenu].CURSOR_SELECT = 0;
  1416. InGameMenu_Junction.ReInit();
  1417. break;
  1418. case 1:
  1419. Inputs_CANCEL();
  1420. break;
  1421. }
  1422. }
  1423. public override void Inputs_CANCEL()
  1424. {
  1425. base.Inputs_CANCEL();
  1426. InGameMenu_Junction.Data[SectionName.RemAll].Enabled = false;
  1427. InGameMenu_Junction.mode = Mode.TopMenu_Off;
  1428. }
  1429. }
  1430. private class IGMData_GF_Group : IGMData_Group
  1431. {
  1432. public IGMData_GF_Group(params IGMData[] d) : base(d)
  1433. {
  1434. }
  1435. protected override void Init()
  1436. {
  1437. base.Init();
  1438. Enabled = false;
  1439. }
  1440. }
  1441. private class IGMData_GF_Junctioned : IGMData
  1442. {
  1443. public IGMData_GF_Junctioned() : base(16, 1, new IGMDataItem_Box(pos: new Rectangle(0, 141, 440, 282)), 2, 8)
  1444. {
  1445. }
  1446. protected override void InitShift(int i, int col, int row)
  1447. {
  1448. base.InitShift(i, col, row);
  1449. SIZE[i].Inflate(-45, -8);
  1450. SIZE[i].Offset((-10 * col), 0);
  1451. }
  1452. protected override void Init()
  1453. {
  1454. Table_Options |= Table_Options.FillRows;
  1455. base.Init();
  1456. }
  1457. public override void ReInit()
  1458. {
  1459. base.ReInit();
  1460. if (Memory.State.Characters != null)
  1461. {
  1462. IEnumerable<Enum> availableFlags = Enum.GetValues(typeof(Saves.GFflags)).Cast<Enum>();
  1463. int pos = 0;
  1464. foreach (Enum flag in availableFlags.Where(Memory.State.Characters[Character].JunctionnedGFs.HasFlag))
  1465. {
  1466. if ((Saves.GFflags)flag == Saves.GFflags.None) continue;
  1467. ITEM[pos, 0] = new IGMDataItem_String(
  1468. Memory.State.GFs[Saves.ConvertGFEnum[(Saves.GFflags)flag]].Name, SIZE[pos]);
  1469. pos++;
  1470. }
  1471. for (; pos < Count; pos++)
  1472. ITEM[pos, 0] = null;
  1473. }
  1474. }
  1475. }
  1476. private class IGMData_GF_Pool : IGMData_Pool<Saves.Data, GFs>
  1477. {
  1478. public IGMData_GF_Pool() : base(5, 3, new IGMDataItem_Box(pos: new Rectangle(440, 149, 385, 193), title: Icons.ID.GF), 4, 4)
  1479. {
  1480. }
  1481. protected override void InitShift(int i, int col, int row)
  1482. {
  1483. base.InitShift(i, col, row);
  1484. SIZE[i].Inflate(-22, -8);
  1485. SIZE[i].Offset(0, 12 + (-8 * row));
  1486. }
  1487. public Dictionary<GFs, Characters> JunctionedGFs { get; private set; }
  1488. public List<GFs> UnlockedGFs { get; private set; }
  1489. private void addGF(ref int pos, GFs g, Font.ColorID color = Font.ColorID.White)
  1490. {
  1491. ITEM[pos, 0] = new IGMDataItem_String(Memory.Strings.GetName(g), SIZE[pos], color);
  1492. ITEM[pos, 1] = JunctionedGFs.ContainsKey(g) ? new IGMDataItem_Icon(Icons.ID.GF_Junction, new Rectangle(SIZE[pos].X + SIZE[pos].Width - 100, SIZE[pos].Y, 0, 0)) : null;
  1493. ITEM[pos, 2] = new IGMDataItem_Int(Source.GFs[g].Level, new Rectangle(SIZE[pos].X + SIZE[pos].Width - 50, SIZE[pos].Y, 0, 0), spaces: 3);
  1494. BLANKS[pos] = false;
  1495. Contents[pos] = g;
  1496. pos++;
  1497. }
  1498. protected override void Init()
  1499. {
  1500. base.Init();
  1501. SIZE[rows] = SIZE[0];
  1502. SIZE[rows].Y = Y;
  1503. ITEM[rows, 2] = new IGMDataItem_Icon(Icons.ID.Size_16x08_Lv_, new Rectangle(SIZE[rows].X + SIZE[rows].Width - 30, SIZE[rows].Y, 0, 0), scale: new Vector2(2.5f));
  1504. }
  1505. public override void ReInit()
  1506. {
  1507. Source = Memory.State;
  1508. JunctionedGFs = Source.JunctionedGFs();
  1509. UnlockedGFs = Source.UnlockedGFs();
  1510. int pos = 0;
  1511. int skip = Page * rows;
  1512. foreach (GFs g in UnlockedGFs.Where(g => !JunctionedGFs.ContainsKey(g)))
  1513. {
  1514. if (pos >= rows) break;
  1515. if (skip-- <= 0)
  1516. {
  1517. addGF(ref pos, g);
  1518. }
  1519. }
  1520. foreach (GFs g in UnlockedGFs.Where(g => JunctionedGFs.ContainsKey(g) && JunctionedGFs[g] == Character))
  1521. {
  1522. if (pos >= rows) break;
  1523. if (skip-- <= 0)
  1524. {
  1525. addGF(ref pos, g, Font.ColorID.Grey);
  1526. }
  1527. }
  1528. foreach (GFs g in UnlockedGFs.Where(g => JunctionedGFs.ContainsKey(g) && JunctionedGFs[g] != Character))
  1529. {
  1530. if (pos >= rows) break;
  1531. if (skip-- <= 0)
  1532. {
  1533. addGF(ref pos, g, Font.ColorID.Dark_Gray);
  1534. }
  1535. }
  1536. for (; pos < rows; pos++)
  1537. {
  1538. ITEM[pos, 0] = null;
  1539. ITEM[pos, 1] = null;
  1540. ITEM[pos, 2] = null;
  1541. BLANKS[pos] = true;
  1542. }
  1543. base.ReInit();
  1544. UpdateTitle();
  1545. UpdateCharacter();
  1546. }
  1547. public override void UpdateTitle()
  1548. {
  1549. base.UpdateTitle();
  1550. if (Pages == 1)
  1551. {
  1552. ((IGMDataItem_Box)CONTAINER).Title = Icons.ID.GF;
  1553. ITEM[Count - 1, 0] = ITEM[Count - 2, 0] = null;
  1554. }
  1555. else
  1556. switch (Page)
  1557. {
  1558. case 0:
  1559. ((IGMDataItem_Box)CONTAINER).Title = Icons.ID.GF_PG1;
  1560. break;
  1561. case 1:
  1562. ((IGMDataItem_Box)CONTAINER).Title = Icons.ID.GF_PG2;
  1563. break;
  1564. case 2:
  1565. ((IGMDataItem_Box)CONTAINER).Title = Icons.ID.GF_PG3;
  1566. break;
  1567. case 3:
  1568. ((IGMDataItem_Box)CONTAINER).Title = Icons.ID.GF_PG4;
  1569. break;
  1570. }
  1571. }
  1572. private void UpdateCharacter()
  1573. {
  1574. if (InGameMenu_Junction != null)
  1575. {
  1576. GFs g = Contents[CURSOR_SELECT];
  1577. IGMDataItem_IGMData i = (IGMDataItem_IGMData)((IGMData_GF_Group)InGameMenu_Junction.Data[SectionName.TopMenu_GF_Group]).ITEM[2, 0];
  1578. ((IGMDataItem_Box)i.Data.CONTAINER).Data = JunctionedGFs.Count > 0 && JunctionedGFs.ContainsKey(g) ? Memory.Strings.GetName(JunctionedGFs[g]) : null;
  1579. }
  1580. }
  1581. protected override void PAGE_PREV()
  1582. {
  1583. base.PAGE_PREV();
  1584. ReInit();
  1585. }
  1586. protected override void PAGE_NEXT()
  1587. {
  1588. base.PAGE_NEXT();
  1589. ReInit();
  1590. }
  1591. public override int CURSOR_PREV()
  1592. {
  1593. int ret = base.CURSOR_PREV();
  1594. UpdateCharacter();
  1595. return ret;
  1596. }
  1597. public override int CURSOR_NEXT()
  1598. {
  1599. int ret = base.CURSOR_NEXT();
  1600. UpdateCharacter();
  1601. return ret;
  1602. }
  1603. public override void Inputs_CANCEL()
  1604. {
  1605. base.Inputs_CANCEL();
  1606. InGameMenu_Junction.Data[SectionName.TopMenu_GF_Group].Enabled = false;
  1607. InGameMenu_Junction.mode = Mode.TopMenu_Junction;
  1608. }
  1609. public override void Inputs_OKAY()
  1610. {
  1611. skipsnd = true;
  1612. init_debugger_Audio.PlaySound(31);
  1613. base.Inputs_OKAY();
  1614. GFs select = Contents[CURSOR_SELECT];
  1615. Characters c = JunctionedGFs.ContainsKey(select) ? JunctionedGFs[select] : Character;
  1616. if (c != Characters.Blank)
  1617. {
  1618. if (c != Character)
  1619. {
  1620. //show error msg
  1621. }
  1622. else
  1623. {
  1624. //Purge everything that you can't have anymore. Because the GF provided for you.
  1625. List<Kernel_bin.Abilities> a = (Source.Characters[c]).UnlockedGFAbilities;
  1626. Source.Characters[c].JunctionnedGFs ^= Saves.ConvertGFEnum.FirstOrDefault(x => x.Value == select).Key;
  1627. List<Kernel_bin.Abilities> b = (Source.Characters[c]).UnlockedGFAbilities;
  1628. foreach (Kernel_bin.Abilities r in a.Except(b).Where(v => !Kernel_bin.Junctionabilities.ContainsKey(v)))
  1629. {
  1630. if (Kernel_bin.Commandabilities.ContainsKey(r))
  1631. {
  1632. Source.Characters[c].Commands.Remove(r);
  1633. Source.Characters[c].Commands.Add(Kernel_bin.Abilities.None);
  1634. }
  1635. else if (Kernel_bin.EquipableAbilities.ContainsKey(r))
  1636. {
  1637. Source.Characters[c].Abilities.Remove(r);
  1638. Source.Characters[c].Abilities.Add(Kernel_bin.Abilities.None);
  1639. }
  1640. }
  1641. foreach (Kernel_bin.Abilities r in a.Except(b).Where(v => Kernel_bin.Junctionabilities.ContainsKey(v)))
  1642. {
  1643. if (Kernel_bin.Stat2Ability.ContainsValue(r))
  1644. Source.Characters[c].Stat_J[Kernel_bin.Stat2Ability.FirstOrDefault(x => x.Value == r).Key] = 0;
  1645. else switch (r)
  1646. {
  1647. case Kernel_bin.Abilities.ST_Atk_J:
  1648. Source.Characters[c].ST_Atk_J = 0;
  1649. break;
  1650. case Kernel_bin.Abilities.Elem_Atk_J:
  1651. Source.Characters[c].Elem_Atk_J = 0;
  1652. break;
  1653. case Kernel_bin.Abilities.Elem_Def_Jx1:
  1654. case Kernel_bin.Abilities.Elem_Def_Jx2:
  1655. case Kernel_bin.Abilities.Elem_Def_Jx4:
  1656. var count = 0;
  1657. if (b.Contains(Kernel_bin.Abilities.Elem_Def_Jx4))
  1658. count = 4;
  1659. else if (b.Contains(Kernel_bin.Abilities.Elem_Def_Jx2))
  1660. count = 2;
  1661. else if (b.Contains(Kernel_bin.Abilities.Elem_Def_Jx1))
  1662. count = 1;
  1663. for (; count < Source.Characters[c].Elem_Def_J.Count; count++)
  1664. Source.Characters[c].Elem_Def_J[count] = 0;
  1665. break;
  1666. case Kernel_bin.Abilities.ST_Def_Jx1:
  1667. case Kernel_bin.Abilities.ST_Def_Jx2:
  1668. case Kernel_bin.Abilities.ST_Def_Jx4:
  1669. count = 0;
  1670. if (b.Contains(Kernel_bin.Abilities.ST_Def_Jx4))
  1671. count = 4;
  1672. else if (b.Contains(Kernel_bin.Abilities.ST_Def_Jx2))
  1673. count = 2;
  1674. else if (b.Contains(Kernel_bin.Abilities.ST_Def_Jx1))
  1675. count = 1;
  1676. for (; count < Source.Characters[c].ST_Def_J.Count; count++)
  1677. Source.Characters[c].ST_Def_J[count] = 0;
  1678. break;
  1679. case Kernel_bin.Abilities.Abilityx3:
  1680. case Kernel_bin.Abilities.Abilityx4:
  1681. count = 2;
  1682. if (b.Contains(Kernel_bin.Abilities.Abilityx4))
  1683. count = 4;
  1684. else if (b.Contains(Kernel_bin.Abilities.Abilityx3))
  1685. count = 3;
  1686. for (; count < Source.Characters[c].Abilities.Count; count++)
  1687. Source.Characters[c].Abilities[count] = Kernel_bin.Abilities.None;
  1688. break;
  1689. }
  1690. }
  1691. InGameMenu_Junction.ReInit();
  1692. }
  1693. }
  1694. }
  1695. }
  1696. }
  1697. }
  1698. }