//Global height override (Rydian)

//Find the fld that loads an entity's height value (+88)
//when it comes into render distance or changes stats/looks.
//Overwrite that with an fld1 to always load a standard height.

var pattern = scan('D9 81 88 00 00 00 C3 CC CC CC CC CC CC CC CC CC D9');

patch(pattern.add(0), [0xD9, 0xE8, 0x90, 0x90, 0x90, 0x90]);

@@ -28,16 +28,92 @@
 ydian)%0A%0A
+//1.0 = Normal%0A//0.2 = Child%0A//-0.4 = Tin Potion%0Avar desiredHeight = -0.4;%0A%0A
 //Find t
@@ -228,203 +228,1208 @@
 .%0A//
-Overwrite that with an fld1 to always load a standard height.%0A%0Avar pattern = scan('D9 81 88 00 00 00 C3 CC CC CC CC CC CC CC CC CC D9');%0A%0Apatch(pattern.add(0)
+We want to inject code to overwrite this read.%0A%0A//The original code signature.%0Avar thePatchLocation = scan('D9 81 88 00 00 00 C3 CC CC CC CC CC CC CC CC CC D9');%0A%0A//The new code that'll be injected.%0Avar thePatch = %5B%0A%090x50,%09%09%09%09%09%09%09// push eax%0A%090xB8
 , 
-%5B
 0x
-D9, 0xE
+00, 0x00, 0x1D, 0x08,%09%09%09%09// mov eax,081D0000%0A%090x89, 0x81, 0x8
 8, 0x
-9
+0
 0, 0x
-9
+0
 0, 0x
-90, 0x90%5D
+00,%09%09%09// mov %5Becx+00000088%5D,eax%0A%090x58,%09%09%09%09%09%09%09// pop eax%0A%090xD9, 0x81, 0x88, 0x00, 0x00, 0x00%09%09%09// fld dword ptr %5Becx+00000088%5D%0A%5D;%0A%0A// Allocate 5 extra bytes beyond the above to fit the jmp back to normal code.%0Avar ourCodeLocation = allocateMemory(thePatch.length + 5);%0A%0A// Debug message to show where the injection is.%0Admsg(ourCodeLocation);%0A// Write our code to that location.%0Apatch(ourCodeLocation, thePatch);%0A%0A// Replace the placeholder value with the desired value.%0ApatchFloat(ourCodeLocation.add(2), desiredHeight);%0A%0A// Insert the jmp at the end of our code block back to the normal code.%0AinsertJmp(ourCodeLocation.add(thePatch.length), thePatchLocation.add(6));%0A%0A// Now our code block is all setup, just make the jmp at thePatchLocation to it.%0Apatch(thePatchLocation, Array(6).fill(0x90)); // 2 instructions take up 6 bytes.%0AinsertJmp(thePatchLocation, ourCodeLocation
 );%0A

Update GlobalHeightOverride.js