Jump to content

R&D to Increase Squad Size


Beknatok

Recommended Posts

Yes, from my understanding it should accept any int as parameter and doesn't require the bool.

Instead of bit packing... Couldn't we use the bool to inform the helper function if room is 1 or not?

 

if (Loc == 1) { DEMOUltimateSoldier(SlotIdx, true) } else { DEMOUltimateSoldier(SlotIdx, false) }

Link to comment
Share on other sites

  • Replies 429
  • Created
  • Last Reply

Top Posters In This Topic

So will DEMOUltimateSoldier-function be able to access m_kPawn in the same way as AddToLocation would?

I'm guessing yes, since it is not declared locally and is from what I can tell already declared somewhere else before AddToLocation is called since AddToLocation can use it...

 

Edit: Wait... Don't we still need the Loc value for calling AddUnitToRoomSequence ? :(

Edited by Bertilsson
Link to comment
Share on other sites

But... The more I think about it... I don't think we need to worry about bit packing or sending parameters at all...

 

From my understanding we can just access them right away same way as AddToLocation would... After all isn't that exactly what we do when we borrow I, tmpIndex, etc, from other functions?

 

I made extra sure to only steal things that were explicitly declared as I = 0; before used by the function I stole from... But in this case we actually want to keep the value and have no need to modify it :smile:

Edited by Bertilsson
Link to comment
Share on other sites

So will DEMOUltimateSoldier-function be able to access m_kPawn in the same way as AddToLocation would?

I'm guessing yes, since it is not declared locally and is from what I can tell already declared somewhere else before AddToLocation is called since AddToLocation can use it...

m_kPawn is an instance variable of the XGStrategySoldier class, so it should be accessible from anywhere inside that class.

 

Edit: Wait... Don't we still need the Loc value for calling AddUnitToRoomSequence ? :sad:

Whoops, you're right about that :sweat: Back to bit-packing then :smile:

 

From my understanding we can just access them right away same way as AddToLocation would... After all isn't that exactly what we do when we borrow I, tmpIndex, etc, from other functions?

As far as I know this does apply to local variables declared inside a function's body, I don't know whether this extends to function parameters. From looking at the byte code it appears function parameters are referenced in the same way as local variables, so it might just be possible :smile:

Edited by XMarksTheSpot
Link to comment
Share on other sites

Or my theory while we cross typed is valid :tongue:

 

I think it worth a shot testing.

 

If you write the object code for AddToLocation and DEMOUltimateSoldier for me I can probably find some time to test implementing it tomorrow... Unless you are eager to do it yourself... :smile:

 

Edit: Just realized a bigger problem...

This is 53 bytes:

if(!class'SeqEvent_HQUnits'.static.AddUnitToRoomSequence(HQLocToName(Loc), m_kPawn, SlotIdx % 6))

 

And DemoUltimateSolder only has ~125 usable bytes in total...

Edited by Bertilsson
Link to comment
Share on other sites

Rewriting DemoUltimate Soldiers logic to this might help with that?

 

if (!class'SeqEvent_HQUnits'.static.AddUnitToRoomSequence(HQLocToName(Loc), m_kPawn, (SlotIdx <=5 ) ? SlotIdx : SlotIdx % 6 )

 

Edit: But then we would basically be back at always using SlotIdx % 6... And might as well let AddToLocation do that call and only call DemoUltimateSolder to move soldiers and nothing else...

 

Edit again: But we have only 8 spare bytes in AddToLocation... and calling DemoUltimateSoldier is minimum 11 bytes :( gah!

Edited by Bertilsson
Link to comment
Share on other sites

If you write the object code for AddToLocation and DEMOUltimateSoldier for me I can probably find some time to test implementing it tomorrow... Unless you are eager to do it yourself... :smile:

Hmmm, let's see... first off, inside AddToLocation():

before:
	CreatePawn(SoldierState);
	RoomName = HQLocToName(Loc);
	// End:0x129
	if(!class'SeqEvent_HQUnits'.static.AddUnitToRoomSequence(RoomName, m_kPawn, SlotIdx))
	{
		DestroyPawn();
	}

after:
        CreatePawn(SoldierState);
	DEMOUltimateSoldier(0, (Loc == 1) && (SlotIdx >= 6));

Inside DEMOUltimateSoldier():

before:
	m_kSoldier.iRank = 7;
	if(bPsi)
	{
		m_kSoldier.iPsiRank = 4;
		m_kChar.bHasPsiGift = true;
	}
	SetClass(eClass);
	GiveTopTreePerks(true);
	GiveBottomTreePerks(true);
	if(bPsi)
	{
		GivePsiPerks();
	}
	return;

after:
	if (bPsi)
	{
		SlotIdx = SlotIdx % 6;
	}
	if (!class'SeqEvent_HQUnits'.static.AddUnitToRoomSequence(HQLocToName(Loc), m_kPawn, SlotIdx))
	{
		DestroyPawn();
		return;
	}
	if (bPsi)
	{
		m_kPawn.Move(vect(10.0, 10.0, 0.0))
	}
	return;

A few pointers:

Move() uses the native function token 0x0A

vect() uses a 'vector const token' 0x23

Edited by XMarksTheSpot
Link to comment
Share on other sites

A few pointers:

Move() uses the native function token 0x0A

vect() uses a 'vector const token' 0x23

Vect() I am already familiar with...

vect(float x,float y, float z) is written like this: 23xxxxyyyyzzzz (13 bytes)

 

But where does the move token get into the picture?

 

Like this?

0A m_kPawn 23xxxxyyyyzzzz 16

 

Or like this?

m_kPawn.Move(0Axxxxyyyyzzzz)

 

I guess I could probably look at some existing code...

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...