I managed to fix the macro almost a year ago, but I’ve only just remembered it.
In short, since version 2.3, the GetHeightAbovePoint macro returns 0 if the vehicle in motion. The correct value is only returned when the vehicle is stationary.
The script macro is primarily used to determine the height of the pantograph to the overhead line, the lowest possible position of lift and ramps.
In newer vehicles, addon's devs have worked around this by reading the value only when stopped, or ignoring zero value.
The patch involves replacing two bytes in the game's exe.
Positions 0x3D2C1E and 0x3D2C1F, relative to the beginning of the file should be 0x90.
This corresponds to two nop instructions. Two identical instructions are needed to overwrite a two-byte jne instruction (0x75 0x0F) without changing the file size.
For those interested, here are some code snippets from 2.3.004 and 2.2.032:
//procedure TRoadVehicleInst.ScriptCallback(n:Integer; stack:PStack; string_stack:PStringStack);
;...
007D37F8 mov eax,dword ptr [esi+8]
007D37FB mov dword ptr [ebp-14],eax
007D37FE mov eax,dword ptr [esi]
007D3800 mov dword ptr [ebp-10],eax
007D3803 mov eax,dword ptr [esi+4]
007D3806 mov dword ptr [ebp-0C],eax
007D3809 mov eax,esi
007D380B call 005D13CC
007D3810 mov eax,esi
007D3812 call 005D13CC
007D3817 cmp byte ptr [ebx+8EC],0;TRoadVehicleInst.debug_b:Boolean
>007D381E jne 007D382F
007D3820 fld dword ptr [ebp-10]
007D3823 fcomp dword ptr ds:[7D3A6C];1:Single
007D3829 wait
007D382A fnstsw al
007D382C sahf
>007D382D jbe 007D383A
007D382F mov dword ptr [esi],44800000
>007D3835 jmp 007D3A31
007D383A push 0
007D383C push 0
007D383E xor ecx,ecx
007D3840 lea edx,[ebp-14]
007D3843 mov eax,ebx
007D3845 call TPhysObjInstance.GetHeightAboveAll
007D384A fstp dword ptr [esi]
007D384C wait
>007D384D jmp 007D3A31
Alles anzeigen
007D35D0 mov eax,dword ptr [esi+8]
007D35D3 mov dword ptr [ebp-14],eax
007D35D6 mov eax,dword ptr [esi]
007D35D8 mov dword ptr [ebp-10],eax
007D35DB mov eax,dword ptr [esi+4]
007D35DE mov dword ptr [ebp-0C],eax
007D35E1 mov eax,esi
007D35E3 call 005D131C
007D35E8 mov eax,esi
007D35EA call 005D131C
007D35EF push 0
007D35F1 push 0
007D35F3 xor ecx,ecx
007D35F5 lea edx,[ebp-14]
007D35F8 mov eax,ebx
007D35FA call TPhysObjInstance.GetHeightAboveAll
007D35FF fstp dword ptr [esi]
007D3601 wait
>007D3602 jmp 007D37E6
Alles anzeigen