Movement/Physics (Gravity) - Boop - 05-27-2009
I remember someone(genevrier , I think , but I can't find the post so I might be wrong) asking how to manipulate gravity. Well I decided to look into it today (because I had lots of free time) and I found this function:
Click me!
Now some interesting stuff is here:
Code: 0040E6FB |. DC05 60834400 FADD QWORD PTR DS:[448360] ; first one - 1.13333
0040E701 |. E9 8B000000 JMP lf2_load.0040E791
0040E706 |> 83F8 04 CMP EAX,4
0040E709 |. 75 0B JNZ SHORT lf2_load.0040E716
0040E70B |. DD46 48 FLD QWORD PTR DS:[ESI+48]
0040E70E DC05 187A4400 FADD QWORD PTR DS:[447A18] ; 2nd one - 0.85
0040E714 |. EB 7B JMP SHORT lf2_load.0040E791
0040E716 |> 8B56 70 MOV EDX,DWORD PTR DS:[ESI+70]
0040E719 |. 69D2 78010000 IMUL EDX,EDX,178
0040E71F |. 8B840A AC07000>MOV EAX,DWORD PTR DS:[EDX+ECX+7AC]
0040E726 |. 3D EA030000 CMP EAX,3EA
0040E72B |. 75 5B JNZ SHORT lf2_load.0040E788
0040E72D |. 83B9 F4060000 >CMP DWORD PTR DS:[ECX+6F4],7C
0040E734 |. 75 0B JNZ SHORT lf2_load.0040E741
0040E736 |. DD46 48 FLD QWORD PTR DS:[ESI+48]
0040E739 |. DC05 58834400 FADD QWORD PTR DS:[448358] ; 3rd one - 0.17
0040E73F |. EB 50 JMP SHORT lf2_load.0040E791
0040E741 |> 3D EA030000 CMP EAX,3EA
0040E746 |. 75 40 JNZ SHORT lf2_load.0040E788
0040E748 |. 39B9 F4060000 CMP DWORD PTR DS:[ECX+6F4],EDI
0040E74E |. 75 0B JNZ SHORT lf2_load.0040E75B
0040E750 |. DD46 48 FLD QWORD PTR DS:[ESI+48]
0040E753 |. DC05 50834400 FADD QWORD PTR DS:[448350] ; 4th one - 0.425
0040E759 |. EB 36 JMP SHORT lf2_load.0040E791
0040E75B |> 3D EA030000 CMP EAX,3EA
0040E760 |. 75 26 JNZ SHORT lf2_load.0040E788
0040E762 |. 83B9 F4060000 >CMP DWORD PTR DS:[ECX+6F4],65
0040E769 |. 75 0B JNZ SHORT lf2_load.0040E776
0040E76B |. DD46 48 FLD QWORD PTR DS:[ESI+48]
0040E76E |. DC05 60834400 FADD QWORD PTR DS:[448360] ; 5th one - 1.1333333
0040E774 |. EB 1B JMP SHORT lf2_load.0040E791
0040E776 |> 3D EA030000 CMP EAX,3EA
0040E77B |. 75 0B JNZ SHORT lf2_load.0040E788
0040E77D |. DD46 48 FLD QWORD PTR DS:[ESI+48]
0040E780 |. DC05 48834400 FADD QWORD PTR DS:[448348] ; 6th one - 0.56666667
0040E786 |. EB 09 JMP SHORT lf2_load.0040E791
0040E788 |> DD46 48 FLD QWORD PTR DS:[ESI+48]
0040E78B |. DC05 40834400 FADD QWORD PTR DS:[448340] ; Main Gravity - 1.7
1.7 is the gravity for type 0 characters. It is stored in 448340 - a constant variable. It doesn't get changed anywhere. If you set it to 1, then gravity is a lot lower and it's cool and stuff .
The problem is it doesn't affect the other object types . And it looks like every item has it's own stupid value .
Anyway, just posting my findings .
Have fun.
RE: Movement/Physics (Gravity) - Ascor - 05-28-2009
that awesome
is there a possibility to do that with special backgrounds?
RE: Movement/Physics (Gravity) - Boop - 05-29-2009
I made a gravity function:
Code: .data
Grav REAL8 0.5
Grav_r dd 0040E794h
.Code
Gravity proc
cmp eax, 6
jnz short loc_40E706
fld qword ptr ds:[448360h]
fmul qword ptr ds:[Grav]
fld qword ptr [esi+48h]
jmp loc_40E791
; ---------------------------------------------------------------------------
loc_40E706: ; CODE XREF: sub_40E490+266j
cmp eax, 4
jnz short loc_40E716
fld qword ptr ds:[447A18h]
fmul qword ptr ds:[Grav]
fadd qword ptr [esi+48h]
jmp loc_40E791
; ---------------------------------------------------------------------------
loc_40E716: ; CODE XREF: sub_40E490+279j
mov edx, [esi+70h]
imul edx, 178h
mov eax, [edx+ecx+7ACh]
cmp eax, 3EAh
jnz short loc_40E788
cmp dword ptr [ecx+6F4h], 7Ch
jnz short loc_40E741
fld qword ptr ds:[448358h]
fmul qword ptr ds:[Grav]
fadd qword ptr [esi+48h]
jmp short loc_40E791
; ---------------------------------------------------------------------------
loc_40E741: ; CODE XREF: sub_40E490+2A4j
cmp eax, 3EAh
jnz short loc_40E788
cmp [ecx+6F4h], edi
jnz short loc_40E75B
fld qword ptr ds:[448350h]
fmul qword ptr ds:[Grav]
fadd qword ptr [esi+48h]
jmp short loc_40E791
; ---------------------------------------------------------------------------
loc_40E75B: ; CODE XREF: sub_40E490+2BEj
cmp eax, 3EAh
jnz short loc_40E788
cmp dword ptr [ecx+6F4h], 65h
jnz short loc_40E776
fld qword ptr ds:[448360h]
fmul qword ptr ds:[Grav]
fadd qword ptr [esi+48h]
jmp short loc_40E791
; ---------------------------------------------------------------------------
loc_40E776: ; CODE XREF: sub_40E490+2D9j
cmp eax, 3EAh
jnz short loc_40E788
fld qword ptr ds:[448348h]
fmul qword ptr ds:[Grav]
fadd qword ptr [esi+48h]
jmp short loc_40E791
; ---------------------------------------------------------------------------
loc_40E788: ; CODE XREF: sub_40E490+29Bj
; sub_40E490+2B6j ...
fld qword ptr ds:[448340h]
fmul qword ptr ds:[Grav]
fadd qword ptr [esi+48h]
loc_40E791: ; CODE XREF: sub_40E490+271j
; sub_40E490+284j ...
fstp qword ptr [esi+48h]
jmp [Grav_r]
Gravity endp
invoke JmpPatch,0040E6F3h, addr Gravity
Grav is the factor by which all the Gravity stuff is multiplied. The function is still buggy (I think I'm multiplying variables I shouldn't be touching ), so some times items don't fall or something. Not sure really . Anyway have fun .
[youtube]K-cMcO7D4rc[/youtube]
A bad video showing how gravity is affected when you half it(I know it's not a very good demonstration, but yeah ).
RE: Movement/Physics (Gravity) - Ascor - 05-29-2009
f*** this is awesome
can henry jump forever with this or is it limited?
RE: Movement/Physics (Gravity) - Drahcir - 05-30-2009
I really think we could use this in the forum mod.
RE: Movement/Physics (Gravity) - JossuaDC - 05-30-2009
(05-30-2009, 06:46 PM)Drahcir Wrote: I really think we could use this in the forum mod. Hell no.
HÉÉÉÉÉÉÉÉLL NO.
RE: Movement/Physics (Gravity) - Drahcir - 05-31-2009
^No, but say Genevrier could get it to vary between backgrounds...
RE: Movement/Physics (Gravity) - Bamboori - 05-31-2009
maybe we could use that for a special planer with extreme low/high gravity
RE: Movement/Physics (Gravity) - The Lost Global Mod - 06-01-2009
this is getting offtopic, guys. Talk about such stuff in the forum mod section.
Thank you.
to the topic:
nice job, as always! keep it up.. you rock
|