Difference between revisions of "0414"

From GTAMods Wiki
Jump to navigation Jump to search
(disassembly)
m
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{Icon|trilogy}} '''SET_FREE_HEALTH_CARE'''
+
__NOTOC__
<hr />
+
{{OpCode
'''Description'''
+
| games      = {{Icon|t}}
: Enables a free hospital visit for the player
+
| command    = SET_FREE_HEALTH_CARE
'''Syntax'''
+
| description = Enables a free hospital visit for the player
: 0414: set_player [''player handle''] single_free_treatment [''int'']
+
| syntax1    = 0414: set_player [''player handle''] single_free_treatment [''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_FREE_HEALTH_CARE]]
'''Native analog'''
+
}}
: [[SET_FREE_HEALTH_CARE]]
 
  
This opcode sets a free hospital visit for the player. When enabled, if the player is wasted, he will not lose any weapons or cash after respawning. The free treatment works once only, so to allow free treatment again, you have to enable it through this opcode again. This opcode was unused in GTA III's original script. 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 in [[Saves_(GTA_SA)#Block_15:_Player_data|block 15]] in San Andreas.
+
This opcode sets a free hospital visit for the player. When enabled, if the player is wasted, he will not lose any weapons or cash after respawning. The free treatment works once only, so to allow free treatment again, you have to enable it through this opcode again. This opcode was never called in the [[Main.scm|original script]] of GTA III. 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 ==
This is disassembled code for this opcode from v1.0 US.
+
These are disassembled code for this opcode both from PC v1.0 US.
 +
=== GTA III ===
 +
<syntaxhighlight lang="nasm">
 +
loc_588D32:
 +
    lea    eax, [ebp+10h]                    ; get address of script's current instruction pointer
 +
    mov    ecx, ebp                          ; get address of script for thiscall
 +
    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 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_588D61
 +
    mov    byte ptr [eax+117h], 1            ; offset player address by 0x117 and set to enable free health care
 +
    jmp    short loc_588D68
 +
loc_588D61:
 +
    mov    byte ptr [eax+117h], 0            ; offset player address by 0x117 and set to disable free health care
 +
loc_588D68:
 +
    xor    al, al                            ; return 0
 +
</syntaxhighlight>
 +
 
 
=== Vice City ===
 
=== Vice City ===
<syntaxhighlight lang="asm" style="overflow-x: auto;">
+
<syntaxhighlight lang="nasm">
; call subroutine to collect values from input parameters
+
loc_608BCE:
.text:00608BCE                lea    eax, [ebx+10h]
+
    lea    eax, [ebx+10h]                   ; get address of script's current instruction pointer
.text:00608BD1                mov    ecx, ebx
+
    mov    ecx, ebx                         ; get address of script for thiscall
.text:00608BD3                push    2 ; two parameters to collect
+
    push    2                                 ; push 2 for two parameters to collect
.text:00608BD5                push    eax
+
    push    eax                               ; push address of script's current instruction pointer
.text:00608BD6                call    CRunningScript__CollectParameters
+
    call    CRunningScript::CollectParameters ; call CRunningScript::CollectParameters(uint *,short)
; read collected content
+
    mov    eax, ds:ScriptParams[0]          ; get value of first parameter, the player handle
.text:00608BDB                mov    eax, ds:_opcodeParameter1
+
    imul    eax, 170h
.text:00608BE0                imul    eax, 170h
+
    add    eax, offset CWorld::Players      ; get address of the player at CWorld::Players + player handle * 0x170
.text:00608BE6                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:00608BEB                cmp    ds:_opcodeParameter2, 0 ; check whether or not parameter 2 is set to 0
+
    jz      short loc_608C00
.text:00608BF2                jz      short loc_608C00
+
    mov    byte ptr [eax+146h], 1           ; offset player address by 0x146 and set to enable free health care
.text:00608BF4                mov    byte ptr [eax+146h], 1 ; offset 0x146 set to enable free treatment
+
    jmp    short loc_608C07
.text:00608BFB                jmp    short loc_608C07
+
    align 10h
.text:00608BFD                align 10h
+
loc_608C00:
.text:00608C00 loc_608C00:    mov    byte ptr [eax+146h], 0 ; offset 0x146 set to disable free treatment
+
     mov    byte ptr [eax+146h], 0           ; offset player address by 0x146 and set to disable free health care
; end
+
loc_608C07:
.text:00608C07 loc_608C07:    xor    al, al
+
     xor    al, al                           ; return 0
.text:00608C09                add    esp, 70h
 
.text:00608C0C                pop    ebp
 
.text:00608C0D                pop    edi
 
.text:00608C0E                pop    esi
 
.text:00608C0F                pop    ebx
 
.text:00608C10                retn    4
 
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 
== Keywords ==
 
== Keywords ==
set, toggle, player, free, treatment, hospital, wasted
+
set, toggle, player, free, treatment, hospital, wasted, healthcare
 
 
[[Category:OpCodes]]
 

Latest revision as of 04:03, 24 May 2017

GTA III Vice City San Andreas SET_FREE_HEALTH_CARE


Description
Enables a free hospital visit for the player
Syntax
0414: set_player [player handle] single_free_treatment [int]
Parameter
[player handle]
The handle of the player
[int]
0 = disable (default), 1 = enable
Native analog
SET_FREE_HEALTH_CARE

This opcode sets a free hospital visit for the player. When enabled, if the player is wasted, he will not lose any weapons or cash after respawning. The free treatment works once only, so to allow free treatment again, you have to enable it through this opcode again. This opcode was never called in the original script of GTA III. 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_588D32:
    lea     eax, [ebp+10h]                    ; get address of script's current instruction pointer
    mov     ecx, ebp                          ; get address of script for thiscall
    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 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_588D61
    mov     byte ptr [eax+117h], 1            ; offset player address by 0x117 and set to enable free health care
    jmp     short loc_588D68
loc_588D61:
    mov     byte ptr [eax+117h], 0            ; offset player address by 0x117 and set to disable free health care
loc_588D68:
    xor     al, al                            ; return 0

Vice City

loc_608BCE:
    lea     eax, [ebx+10h]                    ; get address of script's current instruction pointer
    mov     ecx, ebx                          ; get address of script for thiscall
    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 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_608C00
    mov     byte ptr [eax+146h], 1            ; offset player address by 0x146 and set to enable free health care
    jmp     short loc_608C07
    align 10h
loc_608C00:
    mov     byte ptr [eax+146h], 0            ; offset player address by 0x146 and set to disable free health care
loc_608C07:
    xor     al, al                            ; return 0

Keywords

set, toggle, player, free, treatment, hospital, wasted, healthcare