Difference between revisions of "0335"

From GTAMods Wiki
Jump to navigation Jump to search
m
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
{{Icon|trilogy}} '''SET_FREE_RESPRAYS'''
+
__NOTOC__{{OpCode
<hr />
+
| games      = {{Icon|t}}
'''Description'''
+
| command    = SET_FREE_RESPRAYS
: Set spray shops to free
+
| description = Set spray shops to free
'''Syntax'''
+
| syntax1    = 0335: enable_free_respray [''int'']
: 0335: enable_free_respray [''int'']
+
| p1t        = [''int'']
'''Parameter'''
+
| p1d        = 0 = not free, {{hint|1|or any value other than 0}} = free
: [''int'']
+
| native      = [[SET_FREE_RESPRAYS]]
:: 0 = not free, {{hint|1|or any value other than 0}} = free
+
}}
'''Native analog'''
 
: [[SET_FREE_RESPRAYS]]
 
  
This opcode sets all spray shops to free. You can have your vehicle sprayed even with no money, and no money will be deducted after using it. The effect of this opcode carries over into a new game &mdash; if this opcode sets spray shops to free during gameplay, starting a new game will have all spray shops already set to free. The value set with this opcode is saved in [[Saves (GTA VC)#Block 2: Garages|block 2 of the save file]] in Vice City and [[Saves (GTA SA)#Block 3: Garages|block 3]] in San Andreas.
+
This opcode sets all spray shops to free. You can have your vehicle sprayed even with no money, and no money will be deducted after using it. The value set with this opcode is saved in [[Saves (GTA 3)#Block 2: Garages|block 2 of the save file]] in GTA III, [[Saves (GTA VC)#Block 2: Garages|block 2]] in Vice City, and [[Saves (GTA SA)#Block 3: Garages|block 3]] in San Andreas.
 +
 
 +
The effect of this opcode carries over into a new game &mdash; if spray shops are set to free during gameplay, starting a new game will have all spray shops already set to free. This bug is fixed in the [http://www.gtagarage.com/mods/show.php?id=25368 SilentPatch].
 +
 
 +
== Disassembled code ==
 +
These are disassembled code for this opcode both from PC v1.0 US.
 +
=== GTA III ===
 +
<syntaxhighlight lang="nasm">
 +
loc_448E0A:
 +
    mov    eax, [esp+398h+var_388]
 +
    mov    ecx, [esp+398h+var_388]          ; get address of script for thiscall
 +
    add    eax, 10h                          ; get address of script's current instruction pointer
 +
    push    1                                ; push 1 for one parameter to collect
 +
    push    eax                              ; push address of script's current instruction pointer
 +
    call    CRunningScript::CollectParameters ; call CRunningScript::CollectParameters(uint *,short)
 +
    cmp    ds:ScriptParams[0], 0            ; check whether or not value of first parameter is 0
 +
    jz      short loc_448E30
 +
    mov    ds:CGarages::RespraysAreFree, 1  ; set resprays are free
 +
    jmp    short loc_448E37
 +
loc_448E30:
 +
    mov    ds:CGarages::RespraysAreFree, 0  ; set resprays are not free
 +
loc_448E37:
 +
    lea    ecx, [esp+398h+var_258]
 +
    call    CMatrix::~CMatrix
 +
    xor    al, al                            ; return 0
 +
</syntaxhighlight>
 +
 
 +
=== Vice City ===
 +
<syntaxhighlight lang="nasm">
 +
loc_45BA6D:
 +
    mov    eax, [esp+2D0h+var_2B8]
 +
    mov    ecx, [esp+2D0h+var_2B8]          ; get address of script for thiscall
 +
    add    eax, 10h                          ; get address of script's current instruction pointer
 +
    push    1                                ; push 1 for one parameter to collect
 +
    push    eax                              ; push address of script's current instruction pointer
 +
    call    CRunningScript::CollectParameters ; call CRunningScript::CollectParameters(uint *,short)
 +
    cmp    ds:ScriptParams[0], 0            ; check whether or not value of first parameter is 0
 +
    jz      short loc_45BA92
 +
    mov    ds:CGarages::RespraysAreFree, 1  ; set resprays are free
 +
    jmp    short loc_45BA99
 +
loc_45BA92:
 +
    mov    ds:CGarages::RespraysAreFree, 0  ; set resprays are not free
 +
loc_45BA99:
 +
    lea    ecx, [esp+2D0h+var_1B0]
 +
    call    CMatrix::~CMatrix
 +
    xor    al, al                            ; return 0
 +
</syntaxhighlight>
  
 
== Keywords ==
 
== Keywords ==
free, spray, respray, shop, paynspray, pay n spray
+
set, enable, free, spray, respray, shop, paynspray, pay n spray
 
 
[[Category:OpCodes]]
 

Latest revision as of 00:26, 31 August 2017

GTA III Vice City San Andreas SET_FREE_RESPRAYS


Description
Set spray shops to free
Syntax
0335: enable_free_respray [int]
Parameter
[int]
0 = not free, 1 = free
Native analog
SET_FREE_RESPRAYS

This opcode sets all spray shops to free. You can have your vehicle sprayed even with no money, and no money will be deducted after using it. The value set with this opcode is saved in block 2 of the save file in GTA III, block 2 in Vice City, and block 3 in San Andreas.

The effect of this opcode carries over into a new game — if spray shops are set to free during gameplay, starting a new game will have all spray shops already set to free. This bug is fixed in the SilentPatch.

Disassembled code

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

GTA III

loc_448E0A:
    mov     eax, [esp+398h+var_388]
    mov     ecx, [esp+398h+var_388]           ; get address of script for thiscall
    add     eax, 10h                          ; get address of script's current instruction pointer
    push    1                                 ; push 1 for one parameter to collect
    push    eax                               ; push address of script's current instruction pointer
    call    CRunningScript::CollectParameters ; call CRunningScript::CollectParameters(uint *,short)
    cmp     ds:ScriptParams[0], 0             ; check whether or not value of first parameter is 0
    jz      short loc_448E30
    mov     ds:CGarages::RespraysAreFree, 1   ; set resprays are free
    jmp     short loc_448E37
loc_448E30:
    mov     ds:CGarages::RespraysAreFree, 0   ; set resprays are not free
loc_448E37:
    lea     ecx, [esp+398h+var_258]
    call    CMatrix::~CMatrix
    xor     al, al                            ; return 0

Vice City

loc_45BA6D:
    mov     eax, [esp+2D0h+var_2B8]
    mov     ecx, [esp+2D0h+var_2B8]           ; get address of script for thiscall
    add     eax, 10h                          ; get address of script's current instruction pointer
    push    1                                 ; push 1 for one parameter to collect
    push    eax                               ; push address of script's current instruction pointer
    call    CRunningScript::CollectParameters ; call CRunningScript::CollectParameters(uint *,short)
    cmp     ds:ScriptParams[0], 0             ; check whether or not value of first parameter is 0
    jz      short loc_45BA92
    mov     ds:CGarages::RespraysAreFree, 1   ; set resprays are free
    jmp     short loc_45BA99
loc_45BA92:
    mov     ds:CGarages::RespraysAreFree, 0   ; set resprays are not free
loc_45BA99:
    lea     ecx, [esp+2D0h+var_1B0]
    call    CMatrix::~CMatrix
    xor     al, al                            ; return 0

Keywords

set, enable, free, spray, respray, shop, paynspray, pay n spray