Solar Spawning
-
I think all of FL’s structs are 4-byte aligned.
Nice stuff Schmack
Does it work properly with all the struct filled?
-
Does only use 5 values. That’s why I got only 5 and did not include iUnk6.
Count again. It initialises five values.
Concerning iUnk8: I can not confirm that (at least in the sub I analyzed). There only iRep is used by …::Alloc.
iRep is set by pub::Reputation::SetAffiliation.
So one can assume it is indeed boolean, but 4 byte aligned.
Not quite - the alignment is for the following int. bool = 1 byte, int = 4 bytes, so to keep the int DWORD aligned, 3 padding bytes are added after the bool.
I should point out I’m doing all this from the disassembly of content.dll, not from debugging.
-
@FF: Thx. It depends on what you mean with “properly” I noticed none of the mission solars has any weapons visible. I don’t know if there is a way changing that on creation, since there are a few unknown values yet. Setting the iUnk9 to 1 had no effect. If I spawn regular weapon platforms, they don’t attack. Maybe the personality thing does not work like it does for npcs.
The rest works ok, The types in the radar and on the screen match. You can see them from very far, too. The only thing I did not test is giving them names and I don’t know how to do that either, yet
@adoxa: You are misunderstanding me.
Count again. It initialises five values.
That’s what I wrote after that sentence you quoted. You left the important part out.
iRep is set by pub::Reputation::SetAffiliation.
From what I have seen, it is used by both Alloc and SetAffiliation (which would corresponded with the way we set it in FLHook).
Not quite - the alignment is for the following int. bool = 1 byte, int = 4 bytes, so to keep the int DWORD aligned, 3 padding bytes are added after the bool.
DWORD is 4 byte, so we are talking about the same.
I used debugging only for getting a memory dump of the whole struct.
-
@Schmackbolzen: Ah yes, my mistake. You should edit the first post.
-
This is still in development. I suppose for full potential also clienthooking will be needed (I will test some time later how much you can change after a base is spawned). For now it is for developers only, so that we can reverse everything which is needed to make a practical use of it.
@Adoxa: Done.
-
I don’t trust the compiler (since it is from MS) and we are dealing with multiple versions here (no clue whether vc7-vc10 behave the same). Last and first byte depends whether it is big or little endian and to my knowledge the last byte should be used, also the asm code I saw suggests this (also for the programmer it is only important to know, that 1 is true). If anyone wants to try whether setting it to boolean will not change the structs size/composition, be my guest
-
struct member allignment can be setup in source code with #pragma pack keyword. As far as i remember is #pragma pack push 1 before the struct definition and #pragma pack pop (or similar).
see http://msdn.microsoft.com/en-us/library/2e70t5y1(VS.80).aspxWouldnt it be better to leave it for UINT iUnk9; if the alignment is 4 bytes by default?
-
Probably 11 years too late but iUnk8 is the BaseID of the base the Solar is linked to.