Home » MODDING HQ 1.13 » v1.13 Feature Requests » Merc orientation when sector loses focus (My pet peeve since the original game)
|
Re: Merc orientation when sector loses focus[message #363488 is a reply to message #361438]
|
Fri, 09 July 2021 03:20
|
|
rasz |
|
Messages:38
Registered:August 2006 |
|
|
Its worse than you think, the game actually tracks and saves/loads this information to/from savefile
https://github.com/aimnas/ja2-1.13-source-mirror/blob/d6f07a7ef52b7fe277cd85358dc8e1b9e7bc8cc0/SaveLoadGame.cpp#L1918
BOOLEAN SOLDIERTYPE::Load(HWFILE hFile)
numBytesRead = ReadFieldByField(hFile, &this->ubDirection, sizeof(ubDirection), sizeof(UINT8), numBytesRead);
...
numBytesRead = ReadFieldByField(hFile, &this->usAnimState, sizeof(usAnimState), sizeof(UINT16), numBytesRead);
so there must be code somewhere resetting it on purpose every time you unload/load a sector. I dont know here exactly in the code game loads/unloads sectors, and searching for "STANDING" gives back >70 files
Report message to a moderator
|
Private 1st Class
|
|
|
|
Re: Merc orientation when sector loses focus[message #363491 is a reply to message #363490]
|
Fri, 09 July 2021 13:59
|
|
rasz |
|
Messages:38
Registered:August 2006 |
|
|
You can only ever have one Tactical sector loaded at any time. If you have two groups of mercs in two separate sectors going down to tactical for one of them unloads the other one resetting all the mercs ubDirection to as Kurt said looking somewhere into the center and usAnimState to STANDING.
EDIT: Soldier Init List.cpp AddPlacementToWorld
Soldier Add.cpp AddSoldierToSectorNoCalculateDirection
BOOLEAN AddSoldierToSectorNoCalculateDirection( UINT8 ubID )
return( InternalAddSoldierToSector( ubID, FALSE, FALSE, 0, 0 ) );
InternalAddSoldierToSector
sGridNo = FindGridNoFromSweetSpotWithStructData( pSoldier, STANDING, pSoldier->sInsertionGridNo, 7, &ubCalculatedDirection, FALSE );
if( fCalculateDirection )
ubDirection = ubCalculatedDirection;
else
ubDirection = pSoldier->ubInsertionDirection;
...
if(gTacticalStatus.uiFlags & LOADING_SAVED_GAME )
AddSoldierToSectorGridNo( pSoldier, sGridNo, pSoldier->ubDirection, fUseAnimation, usAnimState, usAnimCode );
else
AddSoldierToSectorGridNo( pSoldier, sGridNo, ubDirection, fUseAnimation, usAnimState, usAnimCode );
there it is, checks if we are loading a save and sets ubDirection from save, otherwise overrides it with ubCalculatedDirection calculated with
FindGridNoFromSweetSpotWithStructData( pSoldier, STANDING, pSoldier->sInsertionGridNo, 7, &ubCalculatedDirection, FALSE )
to point at soldiers default sInsertionGridNo, I am guessing it is set to center of sector for all mercs
[Updated on: Fri, 09 July 2021 15:27] Report message to a moderator
|
Private 1st Class
|
|
|
Re: Merc orientation when sector loses focus[message #363492 is a reply to message #363491]
|
Fri, 09 July 2021 17:00
|
|
Shadooow |
|
Messages:109
Registered:April 2009 Location: Czech Republic |
|
|
I can confirm this is happening and you found the right place in code too (at least for direction, stance is elsewhere it seems).
Problem is that I don't see any differentiation between entering the sector the first time (and thus choosing starting position from the insertion overlay) and entering the previously loaded sector where soldiers already were again after it was unloaded.
EDIT: ok I fixed this. Commited the fix into SVN. Playtesting will be needed.
[Updated on: Fri, 09 July 2021 17:24] Report message to a moderator
|
Sergeant
|
|
|
Goto Forum:
Current Time: Fri Mar 29 08:13:25 GMT+2 2024
Total time taken to generate the page: 0.00845 seconds
|