Difference between revisions of "0330"

From GTAMods Wiki
Jump to navigation Jump to search
m
Line 1: Line 1:
__NOTOC__{{Icon|trilogy}} '''SET_PLAYER_NEVER_GETS_TIRED'''
+
__NOTOC__
<hr />
+
{{OpCode
'''Description'''
+
| games      = {{Icon|t}}
: Sets the player to sprint without tiring
+
| command    = SET_PLAYER_NEVER_GETS_TIRED
'''Syntax'''
+
| description = Sets the player to sprint without tiring
: 0330: set_player [''player handle''] infinite_run_to [''int'']
+
| syntax1    = 0330: set_player [''player handle''] infinite_run_to [''int'']
'''Parameter'''
+
| p1t        = [''player handle'']
: [''player handle'']
+
| p1d        = The [[0053|handle of the player]]
:: The [[0053|handle of the player]]
+
| p2t        = [''int'']
: [''int'']
+
| p2d        = 0 = disable (default), {{hint|1|or any value other than 0}} = enable
:: 0 = disable (default), {{hint|1|or any value other than 0}} = enable
+
| native      = [[SET_PLAYER_NEVER_GETS_TIRED]]
'''Native analog'''
+
}}
: [[SET_PLAYER_NEVER_GETS_TIRED]]
 
  
 
This opcode sets the player's ability to sprint without tiring out. The value set with this opcode is saved in [[Saves (GTA 3)#Block 16: Player Info|block 16 of the save file]] in GTA III, [[Saves (GTA VC)#Block 18: Player Info|block 18]] in Vice City, and [[Saves (GTA SA)#Block 15: Player Info|block 15]] in San Andreas.
 
This opcode sets the player's ability to sprint without tiring out. The value set with this opcode is saved in [[Saves (GTA 3)#Block 16: Player Info|block 16 of the save file]] in GTA III, [[Saves (GTA VC)#Block 18: Player Info|block 18]] in Vice City, and [[Saves (GTA SA)#Block 15: Player Info|block 15]] in San Andreas.
  
 
== Disassembled code ==
 
== Disassembled code ==
These are disassembled code for this opcode both from v1.0 US.
+
These are disassembled code for this opcode both from PC v1.0 US.
 
=== GTA III ===
 
=== GTA III ===
<syntaxhighlight lang="asm" style="overflow-x: auto;">
+
<syntaxhighlight lang="nasm" style="overflow-x: auto;">
; call subroutine to collect values from input parameters
+
loc_448C37:
.text:00448C37                mov    eax, [esp+398h+var_388]
+
    mov    eax, [esp+398h+var_388]
.text:00448C3B                mov    ecx, [esp+398h+var_388]
+
    mov    ecx, [esp+398h+var_388]           ; get CRunningScript pointer for thiscall
.text:00448C3F                add    eax, 10h
+
    add    eax, 10h                         ; get address of script's current instruction pointer
.text:00448C42                push    2 ; two parameters to collect
+
    push    2                                 ; push 2 for two parameters to collect
.text:00448C44                push    eax
+
    push    eax                               ; push address of script's current instruction pointer
.text:00448C45                call    CRunningScript__CollectParameters
+
    call    CRunningScript::CollectParameters ; call CRunningScript::CollectParameters
; read collected content
+
    mov    eax, ds:ScriptParams[0]          ; get value of first parameter, the player handle
.text:00448C4A                mov    eax, ds:_opcodeParameter1
+
    imul    eax, 13Ch
.text:00448C4F                imul    eax, 13Ch
+
    add    eax, offset CWorld::Players      ; get address of the player at CWorld::Players + player handle * 0x13C
.text:00448C55                add    eax, offset _playerInfo  ; address of the player info
+
    cmp    ds:ScriptParams[1], 0             ; check whether or not value of second parameter is 0
.text:00448C5A                cmp    ds:_opcodeParameter2, 0 ; check whether or not parameter 2 is set to 0
+
    jz      short loc_448C70
.text:00448C61                jz      short loc_448C70
+
    mov    byte ptr [eax+114h], 1           ; offset player address by 0x114 and set to enable infinite run
.text:00448C63                mov    byte ptr [eax+114h], 1 ; offset 0x114 set to enable infinite run
+
    jmp    short loc_448C77
.text:00448C6A                jmp    short loc_448C77
+
    align 10h
.text:00448C6C                align 10h
+
loc_448C70:
.text:00448C70 loc_448C70:    mov    byte ptr [eax+114h], 0 ; offset 0x114 set to disable infinite run
+
     mov    byte ptr [eax+114h], 0           ; offset player address by 0x114 and set to disable infinite run
.text:00448C77 loc_448C77:    lea    ecx, [esp+398h+var_258]
+
loc_448C77:
.text:00448C7E                call    CMatrix__~CMatrix
+
     lea    ecx, [esp+398h+var_258]
; end
+
    call    CMatrix::~CMatrix
.text:00448C83                xor    al, al
+
    xor    al, al                           ; return 0
.text:00448C85                add    esp, 398h
 
.text:00448C8B                pop    ebp
 
.text:00448C8C                pop    edi
 
.text:00448C8D                pop    esi
 
.text:00448C8E                pop    ebx
 
.text:00448C8F                retn    4
 
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 
=== Vice City ===
 
=== Vice City ===
<syntaxhighlight lang="asm" style="overflow-x: auto;">
+
<syntaxhighlight lang="nasm" style="overflow-x: auto;">
; call subroutine to collect values from input parameters
+
loc_45B950:
.text:0045B950                mov    eax, [esp+2D0h+var_2B8]
+
    mov    eax, [esp+2D0h+var_2B8]
.text:0045B954                mov    ecx, [esp+2D0h+var_2B8]
+
    mov    ecx, [esp+2D0h+var_2B8]           ; get CRunningScript pointer for thiscall
.text:0045B958                add    eax, 10h
+
    add    eax, 10h                         ; get address of script's current instruction pointer
.text:0045B95B                push    2 ; two parameters to collect
+
    push    2                                 ; push 2 for two parameters to collect
.text:0045B95D                push    eax
+
    push    eax                               ; push address of script's current instruction pointer
.text:0045B95E                call    CRunningScript__CollectParameters
+
    call    CRunningScript::CollectParameters ; call CRunningScript::CollectParameters
; read collected content
+
    mov    eax, ds:ScriptParams[0]          ; get value of first parameter, the player handle
.text:0045B963                mov    eax, ds:_opcodeParameter1
+
    imul    eax, 170h
.text:0045B968                imul    eax, 170h
+
    add    eax, offset CWorld::Players      ; get address of the player at CWorld::Players + player handle * 0x170
.text:0045B96E                add    eax, offset _playerInfo  ; address of the player info
+
    cmp    ds:ScriptParams[1], 0             ; check whether or not value of second parameter is 0
.text:0045B973                cmp    ds:_opcodeParameter2, 0 ; check whether or not parameter 2 is set to 0
+
    jz      short loc_45B985
.text:0045B97A                jz      short loc_45B985
+
    mov    byte ptr [eax+140h], 1           ; offset player address by 0x140 and set to enable infinite run
.text:0045B97C                mov    byte ptr [eax+140h], 1 ; offset 0x140 set to enable infinite run
+
    jmp    short loc_45B98C
.text:0045B983                jmp    short loc_45B98C
+
loc_45B985:
.text:0045B985 loc_45B985:    mov    byte ptr [eax+140h], 0 ; offset 0x140 set to disable infinite run
+
     mov    byte ptr [eax+140h], 0           ; offset player address by 0x140 and set to disable infinite run
.text:0045B98C loc_45B98C:    lea    ecx, [esp+2D0h+var_1B0]
+
loc_45B98C:
.text:0045B993                call    CMatrix__~CMatrix
+
     lea    ecx, [esp+2D0h+var_1B0]
; end
+
    call    CMatrix::~CMatrix
.text:0045B998                xor    al, al
+
    xor    al, al                           ; return 0
.text:0045B99A                add    esp, 2D0h
 
.text:0045B9A0                pop    ebp
 
.text:0045B9A1                pop    edi
 
.text:0045B9A2                pop    esi
 
.text:0045B9A3                pop    ebx
 
.text:0045B9A4                retn    4
 
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 
== Keywords ==
 
== Keywords ==
 
set, toggle, player, infinite, run, sprint, never gets tired
 
set, toggle, player, infinite, run, sprint, never gets tired
 
[[Category:OpCodes]]
 

Revision as of 22:40, 7 November 2016

GTA III Vice City San Andreas SET_PLAYER_NEVER_GETS_TIRED


Description
Sets the player to sprint without tiring
Syntax
0330: set_player [player handle] infinite_run_to [int]
Parameter
[player handle]
The handle of the player
[int]
0 = disable (default), 1 = enable
Native analog
SET_PLAYER_NEVER_GETS_TIRED

This opcode sets the player's ability to sprint without tiring out. The value set with this opcode is saved in block 16 of the save file in GTA III, block 18 in Vice City, and block 15 in San Andreas.

Disassembled code

These are disassembled code for this opcode both from PC v1.0 US.

GTA III

loc_448C37:
    mov     eax, [esp+398h+var_388]
    mov     ecx, [esp+398h+var_388]           ; get CRunningScript pointer 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
    mov     eax, ds:ScriptParams[0]           ; get value of first parameter, the player handle
    imul    eax, 13Ch
    add     eax, offset CWorld::Players       ; get address of the player at CWorld::Players + player handle * 0x13C
    cmp     ds:ScriptParams[1], 0             ; check whether or not value of second parameter is 0
    jz      short loc_448C70
    mov     byte ptr [eax+114h], 1            ; offset player address by 0x114 and set to enable infinite run
    jmp     short loc_448C77
    align 10h
loc_448C70:
    mov     byte ptr [eax+114h], 0            ; offset player address by 0x114 and set to disable infinite run
loc_448C77:
    lea     ecx, [esp+398h+var_258]
    call    CMatrix::~CMatrix
    xor     al, al                            ; return 0

Vice City

loc_45B950:
    mov     eax, [esp+2D0h+var_2B8]
    mov     ecx, [esp+2D0h+var_2B8]           ; get CRunningScript pointer 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
    mov     eax, ds:ScriptParams[0]           ; get value of first parameter, the player handle
    imul    eax, 170h
    add     eax, offset CWorld::Players       ; get address of the player at CWorld::Players + player handle * 0x170
    cmp     ds:ScriptParams[1], 0             ; check whether or not value of second parameter is 0
    jz      short loc_45B985
    mov     byte ptr [eax+140h], 1            ; offset player address by 0x140 and set to enable infinite run
    jmp     short loc_45B98C
loc_45B985:
    mov     byte ptr [eax+140h], 0            ; offset player address by 0x140 and set to disable infinite run
loc_45B98C:
    lea     ecx, [esp+2D0h+var_1B0]
    call    CMatrix::~CMatrix
    xor     al, al                            ; return 0

Keywords

set, toggle, player, infinite, run, sprint, never gets tired