Bertilsson Posted August 9, 2013 Share Posted August 9, 2013 (edited) I+1 did not help... Will try changing order and will also test if it helps to declare tmpIndex = tmpIndex + ... and move that around a little to see what happens. Edit tmpIndex += (I * (-1 ** I)); does not make any difference result is still:[6, 5, 3, 0, <> 0-11, ...] Edited August 9, 2013 by Bertilsson Link to comment Share on other sites More sharing options...
Bertilsson Posted August 9, 2013 Share Posted August 9, 2013 (edited) Fixed it. simulated function Init(XComPlayerController _controller, UIFxsMovie _manager, UI_FxsScreen _screen, XGMission kMission, bool bNav) { local XGShip_Dropship kSkyranger; PanelInit(_controller, _manager, _screen); bCanNavigate = bNav; kSkyranger = kMission.GetAssignedSkyranger(); tmpIndex = 6; I = 1; J0x7B: // End:0xED [Loop If] if(I <= 12) { m_arrFillOrderIndex.AddItem(tmpIndex); // End:0xCB if((I % 2) == 1) { tmpIndex -= I; } // End:0xDF else { tmpIndex += I; } ++ I; // [Loop Continue] goto J0x7B; } m_arrUIOptions.Add(12); //return; } Hex code in XComStrategyGame.upk, decimal offset 2375915 D4 16 00 00 AB 1F 00 00 00 00 00 00 CE 16 00 00 00 00 00 00 00 00 00 00 D4 16 00 00 00 00 00 00 39 00 00 00 24 07 00 00 FD 00 00 00 C5 00 00 00 1B 57 21 00 00 00 00 00 00 00 D4 16 00 00 00 D3 16 00 00 00 D2 16 00 00 4A 16 14 2D 01 C6 16 00 00 2D 00 D0 16 00 00 0F 00 CF 16 00 00 19 00 D1 16 00 00 0A 00 53 37 00 00 00 1B 8B 0E 00 00 00 00 00 00 16 0F 00 E5 16 00 00 2C 06 0F 00 95 16 00 00 26 07 ED 00 98 00 95 16 00 00 2C 0C 16 55 01 C7 16 00 00 03 00 00 E5 16 00 00 16 07 CB 00 9A FD 00 95 16 00 00 2C 02 16 26 16 A2 00 E5 16 00 00 00 95 16 00 00 16 06 DF 00 A1 00 E5 16 00 00 00 95 16 00 00 16 A5 00 95 16 00 00 16 06 7B 00 54 01 C8 16 00 00 2C 0C 16 04 0B 53 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 00 00 00 02 01 02 00 FC 12 00 00 00 00 00 00 With DGC.ini skyranger capacity = 10 and no OTS upgrades:Soldier pawn 0-5 is properly placed in centre before scrolling exactly above slot 3-8 and maped correctly to each slot. Slot 2 and 9 has soldiers loaded and shows OTS naggers if soldiers are cleared from them. Slot 1 and 10 has soldiers loaded but they cannot be cleared. Slot 0 and 11 are hidden (if only someone had suspected that possibilily :wink: ) So I guess next step is to get rid of the naggers in updatedata and see if they are responsible for issue with slot 1 and 10... Edit: Rewrote entire post :smile: Edited August 10, 2013 by Bertilsson Link to comment Share on other sites More sharing options...
XMarksTheSpot Posted August 10, 2013 Share Posted August 10, 2013 (edited) Fixed it.Good job :thumbsup:If you'd want the code to be a bit more compact I'd suggest you use a ternary operator like so: tmpIndex += I%2 ? -I : I Generally you don't need to test for == 1, through implicit casting non-zero values will always be interpreted as true, and I%2 can only ever by 1 or 0. </smartass> :geek: I'll test your hex change and see for myself what issues remain later. Again, good work so far :smile: Edited August 10, 2013 by XMarksTheSpot Link to comment Share on other sites More sharing options...
Bertilsson Posted August 10, 2013 Share Posted August 10, 2013 I was thinking in the lines of terniary operator but didn't want to risk introducing anything that possibly did not work the way I expected it to (I was after all trying to work around something that didn't work that way), and decided to do it as plain and low tech as I possibly could instead. But yes there is room for optimization if needed :) Link to comment Share on other sites More sharing options...
Bertilsson Posted August 10, 2013 Share Posted August 10, 2013 I think throwing out this line in the init function: m_iMaxSlots = kSkyranger.GetCapacity(); results in this line the updatedata function: m_arrUIOptions[iOption].bUnavailable = iDropShipIdx >= m_iMaxSlots; To use m_iMaxSlots default value = 6. Adding it back into the init function requires 29 bytes and there is currently 24 available... So I guess it is time to look into the terniary operator, since getting rid of +1 only saves 3 bytes :) Link to comment Share on other sites More sharing options...
Bertilsson Posted August 10, 2013 Share Posted August 10, 2013 (edited) Broken slots repaired (by making space to put back m_iMaxSlots = kSkyranger.GetCapacity(); ) with 3 bytes to spare... simulated function Init(XComPlayerController _controller, UIFxsMovie _manager, UI_FxsScreen _screen, XGMission kMission, bool bNav) { local XGShip_Dropship kSkyranger; PanelInit(_controller, _manager, _screen); bCanNavigate = bNav; kSkyranger = kMission.GetAssignedSkyranger(); m_iMaxSlots = kSkyranger.GetCapacity(); tmpIndex = 6; I = 1; J0xA4: // End:0x10A [Loop If] if(I <= 12) { m_arrFillOrderIndex.AddItem(tmpIndex); tmpIndex += ((I % 2) ? 0 - I : I); ++ I; // [Loop Continue] goto J0xA4; } m_arrUIOptions.Add(12); //return; } Hex code in XComStrategyGame.upk, decimal offset 2375915 D4 16 00 00 AB 1F 00 00 00 00 00 00 CE 16 00 00 00 00 00 00 00 00 00 00 D4 16 00 00 00 00 00 00 39 00 00 00 24 07 00 00 1A 01 00 00 C5 00 00 00 1B 57 21 00 00 00 00 00 00 00 D4 16 00 00 00 D3 16 00 00 00 D2 16 00 00 4A 16 14 2D 01 C6 16 00 00 2D 00 D0 16 00 00 0F 00 CF 16 00 00 19 00 D1 16 00 00 0A 00 53 37 00 00 00 1B 8B 0E 00 00 00 00 00 00 16 0F 01 C4 16 00 00 19 00 CF 16 00 00 0A 00 E7 3D 00 00 00 1B AF 0E 00 00 00 00 00 00 16 0F 00 E5 16 00 00 2C 06 0F 00 95 16 00 00 26 07 0A 01 98 00 95 16 00 00 2C 0C 16 55 01 C7 16 00 00 03 00 00 E5 16 00 00 16 A1 00 E5 16 00 00 45 FD 00 95 16 00 00 2C 02 16 0C 00 93 25 00 95 16 00 00 16 09 00 00 95 16 00 00 16 A5 00 95 16 00 00 16 06 A4 00 54 01 C8 16 00 00 2C 0C 16 04 0B 53 0B 0B 0B 00 00 00 02 01 02 00 FC 12 00 00 00 00 00 00 Edit: Those 3 bytes could be used to make size of m_arrFillOrderIndex = m_iMaxSlots ;) Edited August 10, 2013 by Bertilsson Link to comment Share on other sites More sharing options...
XMarksTheSpot Posted August 10, 2013 Share Posted August 10, 2013 (edited) Broken slots repaired (by making space to put back m_iMaxSlots = kSkyranger.GetCapacity(); ) with 3 bytes to spare...Yes, this is looking great, good job!Haven't noticed the m_iMaxSlots = kSkyranger.GetCapacity() line missing earlier, good thing you caught that one yourself :thumbsup: Edited August 10, 2013 by XMarksTheSpot Link to comment Share on other sites More sharing options...
Bertilsson Posted August 10, 2013 Share Posted August 10, 2013 (edited) I have done some testing now and as far as I can tell everything except pawns for slot 6-11 works exactly as they should :smile:And OTS naggers locations could probably be made dynamic with very little effort... And if it turns out to be effort involved I recommend getting rid of them by simply assigning them to low slot values which makes them never appear. Edited August 10, 2013 by Bertilsson Link to comment Share on other sites More sharing options...
Bertilsson Posted August 10, 2013 Share Posted August 10, 2013 (edited) Dynamic OTS nagger locations:Object Code: simulated function UpdateData() { local UISquadList_UnitBox kOption; local int iSoldier, iOption, iDropShipIdx; local TSoldierLoadout kLoadout; iOption = 0; J0x0B: // End:0xB6 [Loop If] if(iOption < m_arrUIOptions.Length) { m_arrUIOptions[iOption].bEmpty = true; iDropShipIdx = m_arrFillOrderIndex.Find(iOption); m_arrUIOptions[iOption].bUnavailable = iDropShipIdx >= m_iMaxSlots; ++ iOption; // [Loop Continue] goto J0x0B; } // End:0x148 if(UISquadSelect(screen).GetMgr().ITEMTREE().CanFacilityBeBuilt(12)) { m_arrUIOptions[m_arrFillOrderIndex[m_iMaxSlots + 1]].bHint = true; } // End:0x2C0 else { // End:0x2C0 if(UISquadSelect(screen).GetMgr().HQ().HasFacility(12)) { // End:0x232 if(!UISquadSelect(screen).GetMgr().BARRACKS().HasOTSUpgrade(2)) { m_arrUIOptions[m_arrFillOrderIndex[m_iMaxSlots + 1]].bHint = true; } // End:0x2C0 if(!UISquadSelect(screen).GetMgr().BARRACKS().HasOTSUpgrade(1)) { m_arrUIOptions[m_arrFillOrderIndex[m_iMaxSlots]].bHint = true; } } } iSoldier = 0; J0x2CB: // End:0x3BA [Loop If] if(iSoldier < UISquadSelect(screen).GetMgr().m_arrSoldiers.Length) { kLoadout = UISquadSelect(screen).GetMgr().m_arrSoldiers[iSoldier]; m_arrUIOptions[m_arrFillOrderIndex[kLoadout.iDropshipIndex]] = CreateSoldierOption(kLoadout); ++ iSoldier; // [Loop Continue] goto J0x2CB; } iOption = 0; J0x3C5: // End:0x562 [Loop If] if(iOption < m_arrUIOptions.Length) { kOption = m_arrUIOptions[iOption]; // End:0x554 if(kOption.bEmpty) { kOption.iIndex = -1; kOption.iStatus = -1; kOption.strName = ""; kOption.strNickName = ""; kOption.classDesc = ""; kOption.classLabel = ""; kOption.item1 = ""; kOption.item2 = ""; kOption.bEmpty = true; m_arrUIOptions[iOption] = kOption; } ++ iOption; // [Loop Continue] goto J0x3C5; } UpdateDisplay(); //return; } Hexcode: XcomStrategyGame.upk, decimal offset 2379041 F2 16 00 00 AB 1F 00 00 00 00 00 00 ED 16 00 00 00 00 00 00 00 00 00 00 F2 16 00 00 00 00 00 00 25 01 00 00 3A 1E 00 00 6F 05 00 00 B4 03 00 00 0F 00 F0 16 00 00 25 07 B6 00 96 00 F0 16 00 00 36 01 C8 16 00 00 16 14 2D 35 B9 16 00 00 C3 16 00 00 00 01 10 00 F0 16 00 00 01 C8 16 00 00 27 0F 00 EF 16 00 00 46 01 C7 16 00 00 0A 00 00 F0 16 00 00 16 14 2D 35 B8 16 00 00 C3 16 00 00 00 01 10 00 F0 16 00 00 01 C8 16 00 00 99 00 EF 16 00 00 01 C4 16 00 00 16 A5 00 F0 16 00 00 16 06 0B 00 07 48 01 19 19 19 2E B3 16 00 00 01 14 FB FF FF 0A 00 86 16 00 00 00 1B 91 0F 00 00 00 00 00 00 16 0A 00 C7 00 00 00 00 1B 1A 15 00 00 00 00 00 00 16 0C 00 D2 35 00 00 00 1B 14 05 00 00 00 00 00 00 2C 0C 16 14 2D 35 B7 16 00 00 C3 16 00 00 00 01 10 10 92 01 C4 16 00 00 26 16 01 C7 16 00 00 01 C8 16 00 00 27 06 C0 02 07 C0 02 19 19 19 2E B3 16 00 00 01 14 FB FF FF 0A 00 86 16 00 00 00 1B 91 0F 00 00 00 00 00 00 16 0A 00 A0 00 00 00 00 1B 5C 11 00 00 00 00 00 00 16 0C 00 FC 32 00 00 00 1B 0D 11 00 00 00 00 00 00 2C 0C 16 07 32 02 81 19 19 19 2E B3 16 00 00 01 14 FB FF FF 0A 00 86 16 00 00 00 1B 91 0F 00 00 00 00 00 00 16 0A 00 A8 00 00 00 00 1B F4 02 00 00 00 00 00 00 16 0C 00 54 28 00 00 00 1B 17 11 00 00 00 00 00 00 24 02 16 16 14 2D 35 B7 16 00 00 C3 16 00 00 00 01 10 10 92 01 C4 16 00 00 26 16 01 C7 16 00 00 01 C8 16 00 00 27 07 C0 02 81 19 19 19 2E B3 16 00 00 01 14 FB FF FF 0A 00 86 16 00 00 00 1B 91 0F 00 00 00 00 00 00 16 0A 00 A8 00 00 00 00 1B F4 02 00 00 00 00 00 00 16 0C 00 54 28 00 00 00 1B 17 11 00 00 00 00 00 00 24 01 16 16 14 2D 35 B7 16 00 00 C3 16 00 00 00 01 10 10 01 C4 16 00 00 01 C7 16 00 00 01 C8 16 00 00 27 0F 00 F1 16 00 00 25 07 BA 03 96 00 F1 16 00 00 36 19 19 2E B3 16 00 00 01 14 FB FF FF 0A 00 86 16 00 00 00 1B 91 0F 00 00 00 00 00 00 16 09 00 0F 23 00 00 00 01 0F 23 00 00 16 0F 00 EE 16 00 00 10 00 F1 16 00 00 19 19 2E B3 16 00 00 01 14 FB FF FF 0A 00 86 16 00 00 00 1B 91 0F 00 00 00 00 00 00 16 09 00 0F 23 00 00 00 01 0F 23 00 00 0F 10 10 35 08 17 00 00 11 17 00 00 00 00 00 EE 16 00 00 01 C7 16 00 00 01 C8 16 00 00 1C 15 17 00 00 00 EE 16 00 00 16 A5 00 F1 16 00 00 16 06 CB 02 0F 00 F0 16 00 00 25 07 62 05 96 00 F0 16 00 00 36 01 C8 16 00 00 16 0F 00 F2 16 00 00 10 00 F0 16 00 00 01 C8 16 00 00 07 54 05 2D 35 B9 16 00 00 C3 16 00 00 00 00 00 F2 16 00 00 0F 35 C2 16 00 00 C3 16 00 00 00 01 00 F2 16 00 00 1D FF FF FF FF 0F 35 BB 16 00 00 C3 16 00 00 00 01 00 F2 16 00 00 1D FF FF FF FF 0F 35 C1 16 00 00 C3 16 00 00 00 01 00 F2 16 00 00 1F 00 0F 35 C0 16 00 00 C3 16 00 00 00 01 00 F2 16 00 00 1F 00 0F 35 BF 16 00 00 C3 16 00 00 00 01 00 F2 16 00 00 1F 00 0F 35 BE 16 00 00 C3 16 00 00 00 01 00 F2 16 00 00 1F 00 0F 35 BD 16 00 00 C3 16 00 00 00 01 00 F2 16 00 00 1F 00 0F 35 BC 16 00 00 C3 16 00 00 00 01 00 F2 16 00 00 1F 00 14 2D 35 B9 16 00 00 C3 16 00 00 00 01 00 F2 16 00 00 27 0F 10 00 F0 16 00 00 01 C8 16 00 00 00 F2 16 00 00 A5 00 F0 16 00 00 16 06 C5 03 1B B1 2B 00 00 00 00 00 00 16 04 0B 53 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 00 00 00 02 01 82 00 AC 2B 00 00 00 00 00 00 The reason why I like the JumpAssistant tool: (-17) Token HD 80 05 at hex storage offset 0 + 40: Target Memory 0x0580 has been changed to 056F. (0) Token 06 00 00 at hex storage offset 0 + 42: Target Memory 0x0000 has not changed. (0) Token 0A 00 00 at hex storage offset 0 + 109: Target Memory 0x0000 has not changed. (0) Token 06 0B 00 at hex storage offset 0 + 160: Target Memory 0x000B has not changed. (0) Token 07 B6 00 at hex storage offset 0 + 56: Target Memory 0x00B6 has not changed. (-34) Token 07 6A 01 at hex storage offset 0 + 163: Target Memory 0x016A has been changed to 0148. (-24) Token 07 4A 02 at hex storage offset 0 + 338: Target Memory 0x024A has been changed to 0232. (-17) Token 06 D1 02 at hex storage offset 0 + 266: Target Memory 0x02D1 has been changed to 02C0. (-17) Token 07 D1 02 at hex storage offset 0 + 269: Target Memory 0x02D1 has been changed to 02C0. (-17) Token 07 D1 02 at hex storage offset 0 + 443: Target Memory 0x02D1 has been changed to 02C0. (-17) Token 06 DC 02 at hex storage offset 0 + 704: Target Memory 0x02DC has been changed to 02CB. (-17) Token 07 CB 03 at hex storage offset 0 + 552: Target Memory 0x03CB has been changed to 03BA. (-17) Token 06 D6 03 at hex storage offset 0 + 968: Target Memory 0x03D6 has been changed to 03C5. (-17) Token 07 65 05 at hex storage offset 0 + 747: Target Memory 0x0565 has been changed to 0554. (-17) Token 07 73 05 at hex storage offset 0 + 714: Target Memory 0x0573 has been changed to 0562. Edit: I have now tested that the dynamic OTS naggers does not cause any issues if skyranger capacity exceeds the 12 slots.No problem having 14 soldiers... The 2 without dedicated slots end up in slot0 just like before and they quantum physically share spawn locations with soldier 7 and 8 in the tactical game. So except for the missing pawns 6-11 I say this mod is pretty much complete now :D Edit humm... something is broken in the attached toolboks mod... Don't use it yet. False alarm it is working as it should and it is compatible with long war 2 beta Edit: Later code exist: http://forums.nexusmods.com/index.php?/topic/804076-rd-to-increase-squad-size/?p=8745567 Edited August 10, 2013 by Bertilsson Link to comment Share on other sites More sharing options...
XMarksTheSpot Posted August 10, 2013 Share Posted August 10, 2013 So except for the missing pawns 6-11 I say this mod is pretty much complete now :DVery cool :)I've only one minor thing to remark, in the Init() function you chose to implement -I as 0 - I. I just wanted to point out that using the negation pre-operator (0x8F) to flip the sign would be proper, but that's a rather cosmetical change as your way is very much functional (and needs only a single byte more than negation).Keep up the good work :cool: Link to comment Share on other sites More sharing options...
Recommended Posts