Game:
Grand Theft Auto: Vice City on the PC
Tools:
Sanny Builder v3.2.2 by Seemann
CLEO Library
Author:
spaceeinstein
Information:
This page showcases my modifications, in chronological order of release, utilizing CLEO for GTA: Vice City. CLEO is an enhanced scripting extension that allows the use of custom scripting language for Sanny Builder without the need to modify the main script file, main.scm.

Modifications for Vice City


Source codes

const
ZOOM = 0@
ZOOM_CAR = 1@
EFFECT = 2@
end

ZOOM = 180.0
EFFECT = 0
while true
    wait 10 ms
    if
        05EE:   key_pressed 84  // T
    then
        16@ = 0
        ZOOM = 350.0  // minimum zoom set to 350
        ZOOM_CAR = 0.0  // fast car dynamic zoom set to 0
        05DF: write_memory 0x974BEC size 4 value ZOOM virtual_protect 0  // current zoom lvl
        EFFECT = 1
    end
    if
        ZOOM >= 180.0
    then
        if
            16@ > 1000
        then
            ZOOM -= 10.0
            ZOOM_CAR += 10.0
            if
                180.0 > ZOOM
            then
                ZOOM = 180.0  // minimum zoom default 180
                ZOOM_CAR = 170.0  // fast car dynamic zoom default 170.0, difference between max and min (350 - 180 = 170)
                EFFECT = 0
            end
        else
            if
                EFFECT == 1  // prevents crash when game starts loading
            then
                05DF: write_memory 0xA0CFD4 size 4 value 1 virtual_protect 1  // car name stage
                05DF: write_memory 0x978D10 size 4 value 1 virtual_protect 1  // area name stage
            end
        end
    end
    05DF: write_memory 0x4C5CD5 size 4 value ZOOM virtual_protect 1  // in car min zoom
    05DF: write_memory 0x4C5D26 size 4 value ZOOM virtual_protect 1  // on foot min zoom
    05DF: write_memory 0x68FF04 size 4 value ZOOM_CAR virtual_protect 0  // fast car dynamic zoom
    05DF: write_memory 0x68FF0C size 4 value ZOOM virtual_protect 0  // minimum fast car dynamic zoom
end
const
PLAYER_CAR = 0@
TOT_NUM_GRG = 1@
GRG_OFFSET = 2@
GRG_POS_X = 3@
POS_X = 4@
GRG_POS_Y = 5@
POS_Y = 6@
GRG_POS_Z = 7@
POS_Z = 8@
INCREMENT = 9@
GRG_TYPE = 10@
end

var
TOT_NUM_GRG : integer
GRG_OFFSET : integer
GRG_POS_X : integer
GRG_POS_Y : integer
GRG_POS_Z : integer
INCREMENT : integer
GRG_TYPE : integer
end

05E0: TOT_NUM_GRG = read_memory 0x978DA4 size 4 virtual_protect 0  // get total number of created garages
GRG_OFFSET = 0x812668
INCREMENT = 0

while true  // check if vc bomb garage exists
    wait 10 ms
    if
        not INCREMENT == TOT_NUM_GRG
    then
        GRG_POS_X = GRG_OFFSET
        GRG_POS_Y = GRG_OFFSET
        GRG_POS_Z = GRG_OFFSET
        GRG_POS_X += 0x1C
        GRG_POS_Y += 0x20
        GRG_POS_Z += 0x24
        05E0: POS_X = read_memory GRG_POS_X size 4 virtual_protect 0
        05E0: POS_Y = read_memory GRG_POS_Y size 4 virtual_protect 0
        05E0: POS_Z = read_memory GRG_POS_Z size 4 virtual_protect 0
        if and
            POS_X == -1163.248
            POS_Y == -1407.282
            POS_Z == 10.157
        then
            GRG_TYPE = 4
            
            while true  // create interaction
                wait 10 ms
                if
                    00E0:   player $PLAYER_CHAR driving
                then
                    03C1: PLAYER_CAR = player $PLAYER_CHAR car
                    if and
                        80E1:   not key_pressed 0 16  // accelerate
                        01B0:   car PLAYER_CAR stopped_in_sphere 1 near_point -1154.91 -1405.25 11.2 radius 5.0 5.0 5.0
                    then
                        0512: permanent_text_box 'SEBOMB0'
                        while true
                            wait 100 ms
                            if
                                80E1:   not key_pressed 0 16  // accelerate
                            then
                                if
                                    0256:   player $PLAYER_CHAR defined
                                then
                                    01B4: set_player $PLAYER_CHAR not_frozen 0
                                    if
                                        GRG_TYPE == 2
                                    then
                                        00BC: text_highpriority 'SEBOMB1' 100 ms 1
                                    end
                                    if
                                        GRG_TYPE == 3
                                    then
                                        00BC: text_highpriority 'SEBOMB2' 100 ms 1
                                    end
                                    if
                                        GRG_TYPE == 4
                                    then
                                        00BC: text_highpriority 'SEBOMB3' 100 ms 1
                                    end
                                    if
                                        00E1:   key_pressed 0 10  // left
                                    then
                                        GRG_TYPE -= 1
                                        if
                                            GRG_TYPE == 1
                                        then
                                            GRG_TYPE = 4
                                        end
                                    end
                                    if
                                        00E1:   key_pressed 0 11  // right
                                    then
                                        GRG_TYPE += 1
                                        if
                                            GRG_TYPE == 5
                                        then
                                            GRG_TYPE = 2
                                        end
                                    end
                                end
                            else
                                if
                                    0256:   player $PLAYER_CHAR defined
                                then
                                    01B4: set_player $PLAYER_CHAR not_frozen 1
                                end
                                05DF: write_memory GRG_OFFSET size 1 value GRG_TYPE virtual_protect 0
                                break
                            end
                        end
                        03E6: remove_text_box
                    end
                end
            end

        else
            GRG_OFFSET += 0xA8
            INCREMENT += 1
        end
    else
        05DC: end_custom_thread
    end
end
const
ADDRESS = 0@
INDEX = 1@
end

0000:
while true
    wait 10 ms
    if
        00E1:   key_pressed 0 19
    then
        if
            00DE:   player $PLAYER_CHAR driving_vehicle_type #SPEEDER
        then
            ADDRESS = 0x5A4EE6
            gosub @gosub
        end
        if
            00DE:   player $PLAYER_CHAR driving_vehicle_type #REEFER
        then
            ADDRESS = 0x5A4F66
            gosub @gosub
        end
        if
            00DE:   player $PLAYER_CHAR driving_vehicle_type #PREDATOR
        then
            ADDRESS = 0x5A4FE6
            gosub @gosub
        end
        if
            00DE:   player $PLAYER_CHAR driving_vehicle_type #DINGHY
        then
            ADDRESS = 0x5A5066
            gosub @gosub
        end
        if
            00DE:   player $PLAYER_CHAR driving_vehicle_type #COASTG
        then
            ADDRESS = 0x5A50E6
            gosub @gosub
        end
        if
            00DE:   player $PLAYER_CHAR driving_vehicle_type #RIO
        then
            ADDRESS = 0x5A5166
            gosub @gosub
        end
        if
            00DE:   player $PLAYER_CHAR driving_vehicle_type #SQUALO
        then
            ADDRESS = 0x5A51E6
            gosub @gosub
        end
        if
            00DE:   player $PLAYER_CHAR driving_vehicle_type #MARQUIS
        then
            ADDRESS = 0x5A5266
            gosub @gosub
        end
        if
            00DE:   player $PLAYER_CHAR driving_vehicle_type #TROPIC
        then
            ADDRESS = 0x5A52E6
            gosub @gosub
        end
    end
end

:gosub
INDEX = 0
while 001B: 12 > INDEX
    wait 0
    05DF: write_memory ADDRESS size 4 value 0.0 virtual_protect 1
    INDEX += 1
    ADDRESS += 0xA
end
return
const
DURATION = 0@
CURRENT_TIME = 1@
ADRENALINE_MODE = 2@
STAGE = 3@
VALUE_1 = 4@
VALUE_2 = 5@
WAIT_TIME = 50
end
var
CURRENT_TIME : integer
WAIT_TIME : integer
end

STAGE = 0  // stage 0

while true
    wait WAIT_TIME
    05E0: VALUE_1 = read_memory 0xA10942 size 4 virtual_protect 0
    05E0: VALUE_2 = read_memory 0xA10946 size 2 virtual_protect 0
    if and
        VALUE_1 == 0x55474D45  // ugme
        VALUE_2 == 0x4452  // dr
    then
        STAGE += 1
        05DF: write_memory 0xA10942 size 1 val 0x20 virtual_protect 0
        03E5: text_box 'CHEAT1'
    end
    if
        STAGE == 1  // stage 1
    then
        05E6: DURATION = actor $PLAYER_ACTOR struct
        DURATION += 0x634  // adrenaline duration = future time - current time 
        05E0: CURRENT_TIME = read_memory 0x974B2C size 4 virtual_protect 0  // current time
        CURRENT_TIME += WAIT_TIME  // future time = value, 20000 by default
        05DF: write_memory DURATION size 4 value CURRENT_TIME virtual_protect 0  // set adrenaline duration
        05E6: ADRENALINE_MODE = actor $PLAYER_ACTOR struct
        ADRENALINE_MODE += 0x63B
        05DF: write_memory ADRENALINE_MODE size 1 value 1 virtual_protect 0  // adrenaline mode, does not need reset
    end
    if or
        00E0:   player $PLAYER_CHAR driving
        STAGE == 2  // stage 2
    then
        05E6: DURATION = actor $PLAYER_ACTOR struct
        DURATION += 0x634
        05DF: write_memory DURATION size 4 value 0 virtual_protect 0  // turns off adrenaline
        STAGE = 0
    end
end
const
INDEX = 0@
MEM = 1@
VAL = 2@
end
var
INDEX : integer
MEM : integer
VAL : integer
end

05DF: write_memory 0x5F0457 size 1 value 0xB0 virtual_protect 1  // use siren instead of horn
05DF: write_memory 0x5F04C6 size 1 value 12 virtual_protect 1  // reduce delay after each play
INDEX = 0
while INDEX < 106
    wait 0
    MEM = INDEX  // difference between target vehicle and landstalker
    MEM *= 28  // struct 28 bytes in size
    MEM += 0x6AD1B0  // add to base address
    05E0: VAL = read_memory MEM size 4 virtual_protect 0
    if
        VAL == 0  // check if it doesn't have a siren already
    then
        05DF: write_memory MEM size 4 value 52 virtual_protect 1  // siren/alarm sound
    end
    INDEX += 1
end
05DC: end_custom_thread
{$CLEO .cs}
const
ADDR = 0@
LOCATION = 1@
COLLECTED = 2@
PICKUP_GENERATED = 3@
PICKUP_POLICE = 4@
PICKUP_ENFORCER = 5@
PICKUP_FBIRANCH = 6@
PICKUP_RHINO = 7@
PICKUP_BARRACKS = 8@
PICKUP_AMBULAN = 9@
PICKUP_FIRETRUK = 10@
CAR_CREATED = 11@
CAR_MODEL = 12@
CAR = 13@
ALL_COLLECTED = 0x7F
DISTANCE = 90.0
end

// initialize prereward crane
05E0: COLLECTED = read_memory 0x9B6CE4 size 1 virtual_protect 0  // get collected
if
    not COLLECTED == ALL_COLLECTED
then
    ADDR = 0x7E40C4 // base crane address
    05DF: write_memory ADDR size 4 value -974.0 virtual_protect 1  // x1
    ADDR += 4
    05DF: write_memory ADDR size 4 value -954.0 virtual_protect 1  // x2
    ADDR += 4
    05DF: write_memory ADDR size 4 value -1500.0 virtual_protect 1  // y1
    ADDR += 4
    05DF: write_memory ADDR size 4 value -1480.0 virtual_protect 1  // y2
    ADDR += 16
    05DF: write_memory ADDR size 4 value 2.75 virtual_protect 1  // dest heading
    ADDR += 4
    05DF: write_memory ADDR size 4 value 2.35 virtual_protect 1  // idle rotation
    ADDR += 4
    05DF: write_memory ADDR size 4 value 3.92 virtual_protect 1  // dest rotation
    ADDR += 4
    05DF: write_memory ADDR size 4 value 20.0 virtual_protect 1  // idle dist
    ADDR += 4
    05DF: write_memory ADDR size 4 value 20.0 virtual_protect 1  // dest dist
    ADDR += 4
    05DF: write_memory ADDR size 4 value 25.0 virtual_protect 1  // idle height
    ADDR += 4
    05DF: write_memory ADDR size 4 value 25.0 virtual_protect 1  // dest height
    ADDR += 56
    05DF: write_memory ADDR size 1 value 1 virtual_protect 1  // activity
    05DF: write_memory 0x5A8083 size 1 value 1 virtual_protect 1  // military restriction
    05DF: write_memory 0x5A822A size 1 value 1 virtual_protect 1  // does military crane have this already
    05DF: write_memory 0x5A826B size 1 value 1 virtual_protect 1  // does military crane pick this up
    05DF: write_memory 0x5A8CAE size 1 value 1 virtual_protect 1  // reward military crane
    
    // detect completion
    while true
        wait 1000
        
        // convert crane for reward
        05E0: COLLECTED = read_memory 0x9B6CE4 size 1 virtual_protect 0  // get crane collected cars
        if
            COLLECTED == ALL_COLLECTED  // crane collected 7
        then
            00BA: text_styled 'GA_14' 5000 ms 5  // All the cars. NICE! Here's a little something.
            0109: player $PLAYER money += 20000
            05DF: write_memory 0x7E4130 size 0 value 1 virtual_protect 1  // halt crane activity
            05DF: write_memory 0x7E4132 size 1 value 0 virtual_protect 1  // collected cars
            05DF: write_memory 0x5A8083 size 1 value 0 virtual_protect 1  // military restriction
            05DF: write_memory 0x5A822A size 1 value 0 virtual_protect 1  // does military crane have this already
            05DF: write_memory 0x5A826B size 1 value 0 virtual_protect 1  // does military crane pick this up
            05DF: write_memory 0x5A8CAE size 1 value 0 virtual_protect 1  // reward military crane
            break
        end
    end
end

// initialize reward crane
if
    COLLECTED == ALL_COLLECTED
then
    ADDR = 0x7E40C4 // base crane address
    05DF: write_memory ADDR size 4 value -974.0 virtual_protect 1  // x1
    ADDR += 4
    05DF: write_memory ADDR size 4 value -954.0 virtual_protect 1  // x2
    ADDR += 4
    05DF: write_memory ADDR size 4 value -1530.0 virtual_protect 1  // y1
    ADDR += 4
    05DF: write_memory ADDR size 4 value -1510.0 virtual_protect 1  // y2
    ADDR += 16
    05DF: write_memory ADDR size 4 value 1.18 virtual_protect 1  // dest heading
    ADDR += 4
    05DF: write_memory ADDR size 4 value 3.92 virtual_protect 1  // idle rotation
    ADDR += 4
    05DF: write_memory ADDR size 4 value 2.35 virtual_protect 1  // dest rotation
    ADDR += 4
    05DF: write_memory ADDR size 4 value 5.0 virtual_protect 1  // idle dist
    ADDR += 4
    05DF: write_memory ADDR size 4 value 20.0 virtual_protect 1  // dest dist
    ADDR += 4
    05DF: write_memory ADDR size 4 value 28.0 virtual_protect 1  // idle height
    ADDR += 4
    05DF: write_memory ADDR size 4 value 18.0 virtual_protect 1  // dest height
    ADDR += 56
    05DF: write_memory ADDR size 1 value 2 virtual_protect 1  // activity
    wait 0
    05DF: write_memory ADDR size 1 value 1 virtual_protect 1  // activity
    ADDR += 1
    05DF: write_memory ADDR size 1 value 0 virtual_protect 1  // status
    05DF: write_memory 0x7E4132 size 1 value 0 virtual_protect 1  // collected cars
    05DF: write_memory 0x5A8083 size 1 value 0 virtual_protect 1  // military restriction
    05DF: write_memory 0x5A822A size 1 value 0 virtual_protect 1  // does military crane have this already
    05DF: write_memory 0x5A826B size 1 value 0 virtual_protect 1  // does military crane pick this up
    05DF: write_memory 0x5A8CAE size 1 value 0 virtual_protect 1  // reward military crane
    
    PICKUP_GENERATED = 0
    CAR_CREATED = 0
    while true
        wait 100
        if
            0256:   player $PLAYER_CHAR defined
        then
            if
                00F5:   player $PLAYER_CHAR 0 -969.535 -1500.98 12.7 radius DISTANCE DISTANCE DISTANCE
            then
                if and
                    PICKUP_GENERATED == 0
                    CAR_CREATED == 0
                then
                    gosub @destroy_pickups
                    032B: PICKUP_POLICE = create_weapon_pickup 376 3 ammo 1 at -955.66 -1506.68 12.2
                    032B: PICKUP_ENFORCER = create_weapon_pickup 376 3 ammo 2 at -960.285 -1504.78 12.2
                    032B: PICKUP_FBIRANCH = create_weapon_pickup 376 3 ammo 3 at -964.91 -1502.88 12.2
                    032B: PICKUP_RHINO = create_weapon_pickup 376 3 ammo 4 at -969.535 -1500.98 12.2
                    032B: PICKUP_BARRACKS = create_weapon_pickup 376 3 ammo 5 at -974.16 -1499.08 12.2
                    032B: PICKUP_AMBULAN = create_weapon_pickup 376 3 ammo 6 at -978.785 -1497.18 12.2
                    032B: PICKUP_FIRETRUK = create_weapon_pickup 376 3 ammo 7 at -983.41 -1495.28 12.2
                    05DF: write_memory 0x688230 size 4 value 0x494C4F50 virtual_protect 1  // "POLI"
                    05DF: write_memory 0x688234 size 4 value 0x00524143 virtual_protect 1  // "CAR\0"
                    05DF: write_memory 0x688238 size 4 value 0x4F464E45 virtual_protect 1  // "ENFO"
                    05DF: write_memory 0x68823C size 4 value 0x00524352 virtual_protect 1  // "RCR\0"
                    05DF: write_memory 0x688240 size 4 value 0x52494246 virtual_protect 1  // "FBIR"
                    05DF: write_memory 0x688244 size 4 value 0x00434E41 virtual_protect 1  // "ANC\0"
                    05DF: write_memory 0x688248 size 4 value 0x4E494852 virtual_protect 1  // "RHIN"
                    05DF: write_memory 0x68824C size 4 value 0x0000004F virtual_protect 1  // "O\0\0\0"
                    05DF: write_memory 0x688250 size 4 value 0x52524142 virtual_protect 1  // "BARR"
                    05DF: write_memory 0x688254 size 4 value 0x00534B43 virtual_protect 1  // "CKS\0"
                    05DF: write_memory 0x688258 size 4 value 0x55424D41 virtual_protect 1  // "AMBU"
                    05DF: write_memory 0x68825C size 4 value 0x004E414C virtual_protect 1  // "LAN\0"
                    05DF: write_memory 0x688260 size 4 value 0x45524946 virtual_protect 1  // "FIRE"
                    05DF: write_memory 0x688264 size 4 value 0x004B5254 virtual_protect 1  // "TRK\0"
                    05DF: write_memory 0x43F107 size 4 value 0x0068E934 virtual_protect 1  // pickup glow
                    05DF: write_memory 0x43F120 size 1 value 0 virtual_protect 1  // pickup glow
                    PICKUP_GENERATED = 1
                end
            else
                if
                    PICKUP_GENERATED == 1
                then
                    gosub @destroy_pickups
                end
                CAR_CREATED = 0
            end
            if and
                PICKUP_GENERATED == 1
                CAR_CREATED == 0
            then
                if
                    0214:   pickup PICKUP_POLICE picked_up
                then
                    gosub @destroy_pickups
                    CAR_MODEL = #POLICE
                    gosub @create_car
                end
                if
                    0214:   pickup PICKUP_ENFORCER picked_up
                then
                    gosub @destroy_pickups
                    CAR_MODEL = #ENFORCER
                    gosub @create_car
                end
                if
                    0214:   pickup PICKUP_FBIRANCH picked_up
                then
                    gosub @destroy_pickups
                    CAR_MODEL = #FBIRANCH
                    gosub @create_car
                end
                if
                    0214:   pickup PICKUP_RHINO picked_up
                then
                    gosub @destroy_pickups
                    CAR_MODEL = #RHINO
                    gosub @create_car
                end
                if
                    0214:   pickup PICKUP_BARRACKS picked_up
                then
                    gosub @destroy_pickups
                    CAR_MODEL = #BARRACKS
                    gosub @create_car
                end
                if
                    0214:   pickup PICKUP_AMBULAN picked_up
                then
                    gosub @destroy_pickups
                    CAR_MODEL = #AMBULAN
                    gosub @create_car
                end
                if
                    0214:   pickup PICKUP_FIRETRUK picked_up
                then
                    gosub @destroy_pickups
                    CAR_MODEL = #FIRETRUK
                    gosub @create_car
                end
            end
        end
    end
end

:destroy_pickups
0215: destroy_pickup PICKUP_POLICE
0215: destroy_pickup PICKUP_ENFORCER
0215: destroy_pickup PICKUP_FBIRANCH
0215: destroy_pickup PICKUP_RHINO
0215: destroy_pickup PICKUP_BARRACKS
0215: destroy_pickup PICKUP_AMBULAN
0215: destroy_pickup PICKUP_FIRETRUK
05DF: write_memory 0x688230 size 4 value 0x4654554F virtual_protect 1  // "OUTF"
05DF: write_memory 0x688234 size 4 value 0x00003154 virtual_protect 1  // "T1\0\0"
05DF: write_memory 0x688238 size 4 value 0x4654554F virtual_protect 1  // "OUTF"
05DF: write_memory 0x68823C size 4 value 0x00003254 virtual_protect 1  // "T2\0\0"
05DF: write_memory 0x688240 size 4 value 0x4654554F virtual_protect 1  // "OUTF"
05DF: write_memory 0x688244 size 4 value 0x00003354 virtual_protect 1  // "T3\0\0"
05DF: write_memory 0x688248 size 4 value 0x4654554F virtual_protect 1  // "OUTF"
05DF: write_memory 0x68824C size 4 value 0x00003454 virtual_protect 1  // "T4\0\0"
05DF: write_memory 0x688250 size 4 value 0x4654554F virtual_protect 1  // "OUTF"
05DF: write_memory 0x688254 size 4 value 0x00003554 virtual_protect 1  // "T5\0\0"
05DF: write_memory 0x688258 size 4 value 0x4654554F virtual_protect 1  // "OUTF"
05DF: write_memory 0x68825C size 4 value 0x00003654 virtual_protect 1  // "T6\0\0"
05DF: write_memory 0x688260 size 4 value 0x4654554F virtual_protect 1  // "OUTF"
05DF: write_memory 0x688264 size 4 value 0x00003754 virtual_protect 1  // "T7\0\0"
05DF: write_memory 0x43F107 size 4 value 0x0068E940 virtual_protect 1  // pickup glow
05DF: write_memory 0x43F120 size 1 value 1 virtual_protect 1  // pickup glow
PICKUP_GENERATED = 0
return

:create_car
0247: request_model CAR_MODEL
while 8248:   not model CAR_MODEL available
    wait 0
end
00A5: CAR = create_car CAR_MODEL at -964.0 -1520.0 18.5
0249: release_model CAR_MODEL
0175: set_car CAR z_angle_to 247.68 
020A: set_car CAR door_status_to 1
01C3: remove_references_to_car CAR
CAR_CREATED = 1
return
A A A
INDEX
Creative Commons License
These works are licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
This page was last modified on 2015-08-22 18:16:15 UTC.
eXTReMe Tracker