0335

From GTAModding
Jump to: navigation, search

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