Thread Rating:
  • 1 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Movement/Physics (Gravity)
#3
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 :p), so some times items don't fall or something. Not sure really :p. Anyway have fun :D.


[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 :p).
[Image: doty7Xn.gif]

10 ʏᴇᴀʀs sɪɴᴄᴇ ɪʀᴄ ɢᴏᴏᴅ.ɪ ᴡᴀʟᴋ ᴛʜʀᴏᴜɢʜ ᴛʜᴇ ᴇᴍᴘᴛʏ sᴛʀᴇᴇᴛs ᴛʀʏɪɴɢ ᴛᴏ ᴛʜɪɴᴋ ᴏғ sᴏᴍᴇᴛʜɪɴɢ ᴇʟsᴇ ʙᴜᴛ ᴍʏ ᴘᴀᴛʜ ᴀʟᴡᴀʏs ʟᴇᴀᴅs ᴛᴏ ᴛʜᴇ ɪʀᴄ. ɪ sᴛᴀʀᴇ ᴀᴛ ᴛʜᴇ sᴄʀᴇᴇɴ ғᴏʀ ʜᴏᴜʀs ᴀɴᴅ ᴛʀʏ ᴛᴏ sᴜᴍᴍᴏɴ ᴛʜᴇ ɢᴏᴏᴅ ɪʀᴄ. ɪ ᴡᴀᴛᴄʜ ᴏᴛʜᴇʀ ɪʀᴄ ᴄʜᴀɴɴᴇʟs ʙᴜᴛ ɪᴛ ɪs ɴᴏ ɢᴏᴏᴅ. ɪ ᴘᴇsᴛᴇʀ ᴢᴏʀᴛ ᴀɴᴅ ᴛʀʏ ᴛᴏ ʀᴇsɪsᴛ ʜɪs sᴇxɪɴᴇss ʙᴜᴛ ɪᴛ ɪs ᴀʟʟ ᴍᴇᴀɴɪɴɢʟᴇss. ᴛʜᴇ ᴇɴᴅ ɪs ɴᴇᴀʀ.ɪ ᴛʜᴇɴ ᴜsᴜᴀʟʟʏ ʀᴇᴀᴅ sᴏᴍᴇ ᴏʟᴅ ɪʀᴄ ʟᴏɢs ᴀɴᴅ ᴄʀʏ ᴍʏsᴇʟғ ᴛᴏ sʟᴇᴇᴘ.


Reply
Thanks given by:


Messages In This Thread
Movement/Physics (Gravity) - by Boop - 05-27-2009, 06:00 PM
RE: Movement/Physics (Gravity) - by Ascor - 05-28-2009, 05:18 PM
RE: Movement/Physics (Gravity) - by Boop - 05-29-2009, 10:49 AM
RE: Movement/Physics (Gravity) - by Ascor - 05-29-2009, 03:02 PM
RE: Movement/Physics (Gravity) - by Drahcir - 05-30-2009, 06:46 PM
RE: Movement/Physics (Gravity) - by JossuaDC - 05-30-2009, 08:03 PM
RE: Movement/Physics (Gravity) - by Drahcir - 05-31-2009, 10:10 PM
RE: Movement/Physics (Gravity) - by Bamboori - 05-31-2009, 10:21 PM



Users browsing this thread: 2 Guest(s)