0393

From GTAMods Wiki
Revision as of 18:10, 5 July 2017 by Spaceeinstein (talk | contribs) (Created page with "{{OpCode | games = {{Icon|3}} {{Icon|SA}} | command = SET_CHAR_ANIM_SPEED | description = Sets the character's animation speed | syntax1 = {{Icon|3}} 0393: set_a...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

GTA III San Andreas SET_CHAR_ANIM_SPEED


Description
Sets the character's animation speed
Syntax
GTA III 0393: set_actor [char handle] anim_speed [flt]
San Andreas 0393: actor [char handle] perform_animation "[string]" at [flt] times_normal_rate
Parameter
[char handle]
The handle of the character
[flt]
Speed (default 1.0)
[string]
Animation name

This opcode sets the character's animation speed. It was never called in the original script of GTA III.

Disassembled code

This is disassembled code for this opcode from PC v1.0 US.

GTA III

loc_44D7BD:
    mov     eax, [esp+208h+var_204]
    mov     ecx, [esp+208h+var_204]             ; get address of script for thiscall
    add     eax, 10h                            ; get address of script's current instruction pointer
    push    2                                   ; push 2 for two parameters to collect
    push    eax                                 ; push address of script's current instruction pointer
    call    CRunningScript::CollectParameters   ; call CRunningScript::CollectParameters(uint *,short)
    mov     eax, ds:ScriptParams[0]             ; get value of first parameter, the ped handle
    mov     ecx, ds:CPools::ms_pPedPool         ; get address of ped pool for thiscall
    push    eax                                 ; push ped handle
    call    CPool_CPed_CPlayerPed::GetAt        ; call CPool<CPed, CPlayerPed>::GetAt(int) to get address of ped
    mov     eax, [eax+4Ch]                      ; offset ped address by 0x4C to get address of RpClump
    push    eax                                 ; push address of RpClump
    call    RpAnimBlendClumpGetFirstAssociation ; call RpAnimBlendClumpGetFirstAssociation(RpClump *)
    test    eax, eax                            ; check whether or not returned address is nonzero
    pop     ecx
    jz      short loc_44D7F8
    fld     ds:ScriptParams[1]                  ; get value of second parameter, a floating-point value representing the speed
    fstp    dword ptr [eax+24h]                 ; offset returned address by 0x24 and set it to the value
loc_44D7F8:
    xor     al, al                              ; return 0

Keywords

set, character, actor, anim, animation, speed, rate