Skip to content

Commit

Permalink
weaponized oppressor
Browse files Browse the repository at this point in the history
  • Loading branch information
ThirteenAG committed Jul 26, 2017
1 parent 35655d4 commit 7821e62
Show file tree
Hide file tree
Showing 4 changed files with 236 additions and 21 deletions.
114 changes: 96 additions & 18 deletions gtasa/SA.OppressorPrototype.sc
Expand Up @@ -11,10 +11,12 @@ SCRIPT_START
LVAR_INT isOppressor
LVAR_INT chargeCount
LVAR_INT tempVar, tempVar2, speedCheck
LVAR_INT timerc

CONST_INT player 0
CONST_INT CVehicleFlyingControl 0x6D85F0
CONST_INT playerBlipColor 0x588687
CONST_INT addr_of_6D8B54 0x6D8B54

//replacing speed value(?) for when bike is in the air, removing annoying sound
speedCheck = 150
Expand All @@ -25,25 +27,41 @@ SCRIPT_START
//restoring player's blip color
WRITE_MEMORY playerBlipColor 1 0xFF 1

//making turns in air easier
WRITE_MEMORY addr_of_6D8B54 4 0x858CEC 1 //0.039

GET_PLAYER_CHAR 0 scplayer

WHILE scplayer >= 0
WAIT 0
timerc += 1

IF IS_PLAYER_PLAYING player
AND IS_CHAR_IN_MODEL scplayer PCJ600
STORE_CAR_CHAR_IS_IN_NO_SAVE scplayer car
GET_VEHICLE_POINTER car carStruct
tempVar = carStruct + 0x42
READ_MEMORY tempVar 1 1 isOppressor
SET_CAR_PROOFS car 0 1 0 1 1
//SET_CAR_PROOFS car 0 1 0 1 1 //for tests only
IF NOT isOppressor = 0x38
IF CLEO_CALL is_car_at_specified_coordinates 0 car 435 2527 16 //airport
SET_CAR_PROOFS car 0 1 0 1 1
ENDIF
ELSE
//PRINT_FORMATTED_NOW "%d" 1 chargeCount

IF IS_BUTTON_PRESSED PAD1 CIRCLE //shoot
SET_CURRENT_CHAR_WEAPON scplayer 0
CLEO_CALL fireOneInstantHitRoundFromHeadLight 0 car
ENDIF

IF IS_BUTTON_PRESSED PAD1 LEFTSHOCK //horn
//AND IS_CAR_IN_AIR_PROPER car
AND timerc > 0
CLEO_CALL fireRocketFromHeadLight 0
timerc = -50
ENDIF

IF IS_BUTTON_PRESSED PAD1 LEFTSTICKY
OR IS_CAR_IN_AIR_PROPER car
speedCheck = 15000 // annoying engine sfx
Expand All @@ -57,7 +75,7 @@ SCRIPT_START
IF IS_BUTTON_PRESSED PAD1 RIGHTSHOCK
AND chargeCount >= 50
timerb = -5000
CLEO_CALL getExhaustPipeOffset 0 car exhaust_x exhaust_y exhaust_z
CLEO_CALL getDummyOffsetById 0 car 6 exhaust_x exhaust_y exhaust_z
CREATE_FX_SYSTEM_ON_CAR_WITH_DIRECTION "explosion_fuel_car" car exhaust_x exhaust_y exhaust_z 0.0 0.0 0.0 1 fx
ENDIF

Expand Down Expand Up @@ -133,22 +151,82 @@ CLEO_RETURN 0
}

{
getExhaustPipeOffset:
LVAR_INT var
fireOneInstantHitRoundFromHeadLight:
LVAR_INT car
LVAR_FLOAT car_x car_y car_z
LVAR_FLOAT car_x2 car_y2 car_z2
LVAR_FLOAT off_x off_y off_z
CLEO_CALL getDummyOffsetById 0 car 0 off_x off_y off_z // headlight id = 0
GET_OFFSET_FROM_CAR_IN_WORLD_COORDS car off_x off_y off_z car_x car_y car_z
off_y += 30.0f
GET_OFFSET_FROM_CAR_IN_WORLD_COORDS car off_x off_y off_z car_x2 car_y2 car_z2
FIRE_SINGLE_BULLET car_x car_y car_z car_x2 car_y2 car_z2 100
LVAR_INT scplayer
GET_PLAYER_CHAR 0 scplayer
REPORT_MISSION_AUDIO_EVENT_AT_CHAR scplayer 1157
CLEO_RETURN 0
}

{
fireRocketFromHeadLight:
LVAR_INT scplayer, car, carStruct, pedStruct, ptr, ptr2, sfx
LVAR_FLOAT car_x car_y car_z
LVAR_FLOAT off_x off_y off_z
GET_PLAYER_CHAR player scplayer
GET_PED_POINTER scplayer pedStruct
STORE_CAR_CHAR_IS_IN_NO_SAVE scplayer car
GET_VEHICLE_POINTER car carStruct
CLEO_CALL getDummyOffsetById 0 car 0 off_x off_y off_z // headlight id = 0
off_y += 0.5f
off_z += 0.5f
GET_OFFSET_FROM_CAR_IN_WORLD_COORDS car off_x off_y off_z car_x car_y car_z
GET_LABEL_POINTER offsets2 ptr
WRITE_MEMORY ptr 4 car_x 1
ptr += 4
WRITE_MEMORY ptr 4 car_y 1
ptr += 4
WRITE_MEMORY ptr 4 car_z 1
GET_LABEL_POINTER offsets2 ptr
GET_LABEL_POINTER CWeapon ptr2
CALL_METHOD 0x73B430 ptr2 2 0 35 35 //cweapon ctor
CALL_METHOD 0x741360 ptr2 5 0 50.0 0 0 ptr carStruct
CLEO_RETURN 0
}
{
offsets2:
DUMP
00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00
ENDDUMP
CWeapon:
DUMP
00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00
ENDDUMP
}

{
getDummyOffsetById:
LVAR_INT car, id
LVAR_FLOAT x y z
GET_VEHICLE_POINTER var var
var += 0x22
READ_MEMORY var 2 1 var //model index
var *= 4
var += 0xA9B0C8
READ_MEMORY var 4 1 var //CModel
var += 0x5C
READ_MEMORY var 4 1 var //vehicle struct
var += 0x48
READ_MEMORY var 4 1 x
var += 4
READ_MEMORY var 4 1 y
var += 4
READ_MEMORY var 4 1 z
id *= 0xC
GET_VEHICLE_POINTER car car
car += 0x22
READ_MEMORY car 2 1 car //model index
car *= 4
car += 0xA9B0C8
READ_MEMORY car 4 1 car //CModel
car += 0x5C
READ_MEMORY car 4 1 car //vehicle struct
car += id
READ_MEMORY car 4 1 x
car += 4
READ_MEMORY car 4 1 y
car += 4
READ_MEMORY car 4 1 z
CLEO_RETURN 0 x y z
}
131 changes: 128 additions & 3 deletions gtavc/VC.OppressorPrototype.sc
Expand Up @@ -10,6 +10,8 @@ SCRIPT_START
LVAR_INT isOppressor
LVAR_INT chargeCount
LVAR_INT tempVar
LVAR_FLOAT tempVar2
LVAR_INT timerc

CONST_INT player 0
CONST_INT dword_60D174 0x60D174
Expand All @@ -19,18 +21,25 @@ SCRIPT_START
CONST_INT cDMAudioPlayOneShot 0x5F9DA0
CONST_INT bAudioClass 0xA10B8A
CONST_INT exhaustParticleId 0x60D4A3
CONST_INT addr_of_flt_69C724 0x5B5AA0
CONST_INT addr_of_5C769C 0x5C769C

//replacing speed value when exhaust particle disappear
speedCheck = 130.0f
GET_VAR_POINTER speedCheck tempVar
WRITE_MEMORY dword_60D174 4 tempVar 1
//restoring player's blip color
WRITE_MEMORY playerBlipColor 1 0xFF 1
WRITE_MEMORY playerBlipColor 1 0xFF 1
//making turns in air easier
WRITE_MEMORY addr_of_flt_69C724 4 0x6B272C 1 //0.039
//missiles hunter id
WRITE_MEMORY addr_of_5C769C 4 155 1 //hunter

GET_PLAYER_CHAR 0 scplayer

WHILE scplayer >= 0
WAIT 0
timerc += 1

IF IS_PLAYER_PLAYING player
AND IS_PLAYER_IN_MODEL player PCJ600
Expand All @@ -44,7 +53,20 @@ SCRIPT_START
SET_CAR_PROOFS car 0 1 0 1 1
ENDIF
ELSE
//PRINT_FORMATTED_NOW "%d" 1 chargeCount
//PRINT_FORMATTED_NOW "%x" 1 carStruct

IF IS_BUTTON_PRESSED PAD1 CIRCLE //shoot
SET_CURRENT_CHAR_WEAPON scplayer 0
CLEO_CALL fireOneInstantHitRoundFromHeadLight 0
ENDIF

IF IS_BUTTON_PRESSED PAD1 LEFTSHOCK //horn
//AND IS_CAR_IN_AIR_PROPER car
AND timerc > 0
WRITE_MEMORY addr_of_5C769C 4 191 1 //PCJ600
CLEO_CALL fireRocketFromHeadLight 0 car
timerc = -50
ENDIF

IF IS_BUTTON_PRESSED PAD1 RIGHTSTICKY
OR IS_CAR_IN_AIR_PROPER car
Expand All @@ -56,7 +78,7 @@ SCRIPT_START
WRITE_MEMORY engineSfxSound 4 264 1 // annoying engine sfx
ENDIF

IF IS_BUTTON_PRESSED PAD1 RIGHTSHOCK
IF IS_BUTTON_PRESSED PAD1 RIGHTSHOCK
AND chargeCount >= 50
timerb = -5000
ENDIF
Expand Down Expand Up @@ -108,6 +130,7 @@ SCRIPT_START
speedCheck = 130.0f
WRITE_MEMORY exhaustParticleId 1 67 1
WRITE_MEMORY playerBlipColor 1 0xFF 1
WRITE_MEMORY addr_of_5C769C 4 155 1 //hunter
ENDIF

ENDWHILE
Expand All @@ -133,4 +156,106 @@ CSET int_z player_z
IS_AUSTRALIAN_GAME // gives false
ENDIF
CLEO_RETURN 0
}

{
fireOneInstantHitRoundFromHeadLight:
LVAR_INT car, ptr, ptr2, sfx
LVAR_FLOAT car_x car_y car_z
LVAR_FLOAT off_x off_y off_z
STORE_CAR_PLAYER_IS_IN_NO_SAVE player car
CLEO_CALL getDummyOffsetById 0 car 0 off_x off_y off_z // headlight id = 0
GET_OFFSET_FROM_CAR_IN_WORLD_COORDS car off_x off_y off_z car_x car_y car_z
GET_LABEL_POINTER offsets ptr
WRITE_MEMORY ptr 4 car_x 1
ptr += 4
WRITE_MEMORY ptr 4 car_y 1
ptr += 4
WRITE_MEMORY ptr 4 car_z 1
off_y += 30.0f
GET_OFFSET_FROM_CAR_IN_WORLD_COORDS car off_x off_y off_z car_x car_y car_z
ptr += 4
WRITE_MEMORY ptr 4 car_x 1
ptr += 4
WRITE_MEMORY ptr 4 car_y 1
ptr += 4
WRITE_MEMORY ptr 4 car_z 1
GET_LABEL_POINTER offsets ptr
ptr2 = ptr + 0xC
CALL_FUNCTION 0x5C9BB0 3 3 1000 ptr2 ptr
GET_VEHICLE_POINTER car sfx
sfx += 0x64
READ_MEMORY sfx 4 1 sfx
CALL_METHOD_RETURN cDMAudioPlayOneShot bAudioClass 3 0 0.0 55 sfx sfx
CLEO_RETURN 0
}
{
offsets:
DUMP
00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00
ENDDUMP
}

{
fireRocketFromHeadLight:
LVAR_INT car, carStruct, ptr, ptr2, sfx
LVAR_FLOAT car_x car_y car_z
LVAR_FLOAT off_x off_y off_z
STORE_CAR_PLAYER_IS_IN_NO_SAVE player car
GET_VEHICLE_POINTER car carStruct
CLEO_CALL getDummyOffsetById 0 car 0 off_x off_y off_z // headlight id = 0
off_y += 0.5f
off_z += 0.5f
GET_OFFSET_FROM_CAR_IN_WORLD_COORDS car off_x off_y off_z car_x car_y car_z
GET_LABEL_POINTER offsets2 ptr
WRITE_MEMORY ptr 4 car_x 1
ptr += 4
WRITE_MEMORY ptr 4 car_y 1
ptr += 4
WRITE_MEMORY ptr 4 car_z 1
GET_LABEL_POINTER offsets2 ptr
GET_LABEL_POINTER CWeapon ptr2
CALL_METHOD 0x5D4E20 ptr2 2 2 20 30 //cweapon ctor
CALL_METHOD 0x5CCF90 ptr2 3 3 50.0 ptr carStruct
CLEO_RETURN 0
}
{
offsets2:
DUMP
00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00
ENDDUMP
CWeapon:
DUMP
00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00
ENDDUMP
}

{
getDummyOffsetById:
LVAR_INT car, id
LVAR_INT carStruct, mID, mBase
LVAR_FLOAT car_x car_y car_z
LVAR_FLOAT off_x off_y off_z
GET_VEHICLE_POINTER car carStruct
carStruct += 0x5C
READ_MEMORY carStruct 4 1 mID
mID *= 4
mID += 0x92D4C8
READ_MEMORY mID 4 1 mBase
id *= 0xC
id += 0x50
mBase += id
READ_MEMORY mBase 4 1 off_x
mBase += 4
READ_MEMORY mBase 4 1 off_y
mBase += 4
READ_MEMORY mBase 4 1 off_z
CLEO_RETURN 0 off_x off_y off_z
}
6 changes: 6 additions & 0 deletions tools/gta3sc/config/gta3/cleo.xml
Expand Up @@ -519,6 +519,12 @@
<Arg Type="TEXT_LABEL" AllowPointer="true"/>
</Args>
</Command>
<Command ID="0xac6" Name="GET_LABEL_POINTER" Hash="0xd287a6ce">
<Args>
<Arg Type="LABEL"/>
<Arg Type="INT" Out="true"/>
</Args>
</Command>
<Command ID="0xac7" Name="GET_VAR_POINTER" Hash="0xdfc15673">
<Args>
<Arg Type="PARAM" AllowTextLabel="true"/>
Expand Down
6 changes: 6 additions & 0 deletions tools/gta3sc/config/gtavc/cleo.xml
Expand Up @@ -471,6 +471,12 @@
<Arg Type="TEXT_LABEL" AllowPointer="true"/>
</Args>
</Command>
<Command ID="0xac6" Name="GET_LABEL_POINTER" Hash="0xd287a6ce">
<Args>
<Arg Type="LABEL"/>
<Arg Type="INT" Out="true"/>
</Args>
</Command>
<Command ID="0xac7" Name="GET_VAR_POINTER" Hash="0xdfc15673">
<Args>
<Arg Type="PARAM" AllowTextLabel="true"/>
Expand Down

0 comments on commit 7821e62

Please sign in to comment.