{$CLEO .cs}
//-------------MAIN---------------
thread 'CARREC'
:CARRECORD_01
wait 0
if and
Player.Defined($PLAYER_CHAR)
00E0: player $PLAYER_CHAR driving
jf @CARRECORD_01
if and
0AB0: key_pressed 67 // C
0AB0: key_pressed 82 // R
jf @CARRECORD_01
:CARRECORD_02
wait 0
if and
Player.Defined($PLAYER_CHAR)
00E0: player $PLAYER_CHAR driving
jf @CARRECORD_01
if or
8AB0: NOT key_pressed 67 // C
8AB0: NOT key_pressed 82 // R
jf @CARRECORD_02
03C1: 0@ = player $PLAYER_CHAR car_no_save
018C: play_sound 14 at 0.0 0.0 0.0
:CARRECORD_03
wait 0
0AD1: show_formatted_text_highpriority "Car Recording Script is ~t~ready. ~h~Press ~o~R ~h~to start recording. ~h~Press ~p~P ~h~to play record." time 100
if and
Player.Defined($PLAYER_CHAR)
00E0: player $PLAYER_CHAR driving
8039: NOT 0@ == -1
00DC: player $PLAYER_CHAR driving 0@
jf @CARRECORD_CANCEL
if
0AB0: key_pressed 82 // R
jf @CARRECORD_PLAY
if
8AB0: NOT key_pressed 67 // C
jf @CARRECORD_CANCEL
:CARRECORD_04
wait 0
if and
Player.Defined($PLAYER_CHAR)
00E0: player $PLAYER_CHAR driving
8039: NOT 0@ == -1
00DC: player $PLAYER_CHAR driving 0@
jf @CARRECORD_CANCEL
if
8AB0: NOT key_pressed 82 // R
jf @CARRECORD_04
0006: 1@ = 4000000 // memory limit
0AC8: 2@ = allocate_memory_size 1@
0006: 3@ = 0x00 // allocated memory offset
018C: play_sound 16 at 0.0 0.0 0.0
0006: 16@ = 0
:CARRECORD_05
0AD1: show_formatted_text_highpriority "~o~RECORDING: %d ms ~h~Press ~x~R ~h~to finish recording." time 100 16@
if and
Player.Defined($PLAYER_CHAR)
00E0: player $PLAYER_CHAR driving
8039: NOT 0@ == -1
jf @CARRECORD_END
if and
00DC: player $PLAYER_CHAR driving 0@
8AB0: NOT key_pressed 82 // R
jf @CARRECORD_END
0AB1: call_scm_func @CARRECORD_RECORDING 4 0@ 2@ 3@ 16@ 3@
wait 0
0085: 15@ = 1@
0062: 15@ -= 3@
000E: 15@ -= 0x50 // 80 bytes
001B: 0 > 15@ // if memory full
jf @CARRECORD_05
//jump @CARRECORD_END
:CARRECORD_END
0AB1: call_scm_func @CARRECORD_RECORDTOCR 2 2@ 3@
0AC9: free_allocated_memory 2@
018C: play_sound 10 at 0.0 0.0 0.0
0AD1: show_formatted_text_highpriority "Car Recording ~x~is finished. ~h~Time: ~x~%d ms." time 3000 16@
jump @CARRECORD_01
:CARRECORD_CANCEL
wait 0
if or
8AB0: NOT key_pressed 67 // C
8AB0: NOT key_pressed 82 // R
jf @CARRECORD_CANCEL
018C: play_sound 13 at 0.0 0.0 0.0
0AD1: show_formatted_text_highpriority "Car Recording Script ~y~deactivated!" time 2000
jump @CARRECORD_01
:CARRECORD_PLAY
if
0AB0: key_pressed 80 // P
jf @CARRECORD_03
:CARRECORD_PLAY_02
wait 0
if and
Player.Defined($PLAYER_CHAR)
00E0: player $PLAYER_CHAR driving
8039: NOT 0@ == -1
00DC: player $PLAYER_CHAR driving 0@
jf @CARRECORD_CANCEL
if
8AB0: NOT key_pressed 80 // P
jf @CARRECORD_PLAY_02
if
0AAB: file_exists "cleo\carrec.cr"
jf @CARRECORD_CANCEL
//04C4: create_coordinate 1@ 2@ 3@ from_actor $PLAYER_ACTOR offset 0.0 0.0 2.0
//012A: put_player $PLAYER_CHAR at 1@ 2@ 3@ and_remove_from_car
//0464: put_actor $PLAYER_ACTOR into_turret_on_car 0@ at_car_offset 0.0 0.0 1.0 position 0 angle 0.0 with_weapon 0
//wait 0
0AB1: call_scm_func @CARRECORD_READCR 0 2@ 1@
:CARRECORD_PLAY_START
0006: 3@ = 0x00 // allocated memory offset
018C: play_sound 16 at 0.0 0.0 0.0
0227: 14@ = car 0@ health
0006: 16@ = 0
046C: 15@ = car 0@ driver
0039: 15@ == -1
jf @CARRECORD_PLAY_05
03A2: set_car_status 0@ to 3
:CARRECORD_PLAY_05
0AD1: show_formatted_text_highpriority "~p~RECORD PLAYBACK: %d ms ~h~Press ~p~P ~h~to finish playback." time 100 16@
//Camera.OnPed($PLAYER_ACTOR, 0, 2)
if and
Player.Defined($PLAYER_CHAR)
//00E0: player $PLAYER_CHAR driving
8039: NOT 0@ == -1
jf @CARRECORD_PLAY_END
if// and
//00DC: player $PLAYER_CHAR driving 0@
8AB0: NOT key_pressed 80 // P
jf @CARRECORD_PLAY_END
0AB1: call_scm_func @CARRECORD_RECORDPLAYBACK 4 0@ 2@ 3@ 16@ 3@
wait 0
0224: set_car 0@ health_to 14@
0085: 15@ = 1@
0062: 15@ -= 3@
000E: 15@ -= 0x50 // 80 bytes
001B: 0 > 15@ // if playback is finished
jf @CARRECORD_PLAY_05
jump @CARRECORD_PLAY_START
:CARRECORD_PLAY_END
0AC9: free_allocated_memory 2@
//0465: remove_actor $PLAYER_ACTOR from_turret_mode
//Camera.Restore_WithJumpCut
018C: play_sound 10 at 0.0 0.0 0.0
0AD1: show_formatted_text_highpriority "Car record playback ~x~is finished. ~h~Time: ~x~%d ms." time 3000 16@
jump @CARRECORD_01
:CARRECORD_RECORDING
// Recording Time:
0085: 15@ = 1@
005A: 15@ += 2@
0A8C: write_memory 15@ size 4 value 3@ virtual_protect 1 // recording time
000A: 15@ += 0x04
0A97: 14@ = car 0@ struct
// Recording Matrix:
0085: 13@ = 14@
000A: 13@ += 0x04 // right x
0A8D: 12@ = read_memory 13@ size 4 virtual_protect 1
0A8C: write_memory 15@ size 4 value 12@ virtual_protect 1 // recording right x
000A: 15@ += 0x04
000A: 13@ += 0x04 // right y
0A8D: 12@ = read_memory 13@ size 4 virtual_protect 1
0A8C: write_memory 15@ size 4 value 12@ virtual_protect 1 // recording right y
000A: 15@ += 0x04
000A: 13@ += 0x04 // right z
0A8D: 12@ = read_memory 13@ size 4 virtual_protect 1
0A8C: write_memory 15@ size 4 value 12@ virtual_protect 1 // recording right z
000A: 15@ += 0x04
000A: 13@ += 0x08 // up x
0A8D: 12@ = read_memory 13@ size 4 virtual_protect 1
0A8C: write_memory 15@ size 4 value 12@ virtual_protect 1 // recording up x
000A: 15@ += 0x04
000A: 13@ += 0x04 // up y
0A8D: 12@ = read_memory 13@ size 4 virtual_protect 1
0A8C: write_memory 15@ size 4 value 12@ virtual_protect 1 // recording up y
000A: 15@ += 0x04
000A: 13@ += 0x04 // up z
0A8D: 12@ = read_memory 13@ size 4 virtual_protect 1
0A8C: write_memory 15@ size 4 value 12@ virtual_protect 1 // recording up z
000A: 15@ += 0x04
000A: 13@ += 0x08 // at x
0A8D: 12@ = read_memory 13@ size 4 virtual_protect 1
0A8C: write_memory 15@ size 4 value 12@ virtual_protect 1 // recording at x
000A: 15@ += 0x04
000A: 13@ += 0x04 // at y
0A8D: 12@ = read_memory 13@ size 4 virtual_protect 1
0A8C: write_memory 15@ size 4 value 12@ virtual_protect 1 // recording at y
000A: 15@ += 0x04
000A: 13@ += 0x04 // at z
0A8D: 12@ = read_memory 13@ size 4 virtual_protect 1
0A8C: write_memory 15@ size 4 value 12@ virtual_protect 1 // recording at z
000A: 15@ += 0x04
000A: 13@ += 0x08 // position x
0A8D: 12@ = read_memory 13@ size 4 virtual_protect 1
0A8C: write_memory 15@ size 4 value 12@ virtual_protect 1 // recording position x
000A: 15@ += 0x04
000A: 13@ += 0x04 // position y
0A8D: 12@ = read_memory 13@ size 4 virtual_protect 1
0A8C: write_memory 15@ size 4 value 12@ virtual_protect 1 // recording position y
000A: 15@ += 0x04
000A: 13@ += 0x04 // position z
0A8D: 12@ = read_memory 13@ size 4 virtual_protect 1
0A8C: write_memory 15@ size 4 value 12@ virtual_protect 1 // recording position z
000A: 15@ += 0x04
// Recording Movement Speed:
0085: 13@ = 14@
000A: 13@ += 0x70 // x push
0A8D: 12@ = read_memory 13@ size 4 virtual_protect 1
0A8C: write_memory 15@ size 4 value 12@ virtual_protect 1 // recording x push
000A: 15@ += 0x04
000A: 13@ += 0x04 // y push
0A8D: 12@ = read_memory 13@ size 4 virtual_protect 1
0A8C: write_memory 15@ size 4 value 12@ virtual_protect 1 // recording y push
000A: 15@ += 0x04
000A: 13@ += 0x04 // z push
0A8D: 12@ = read_memory 13@ size 4 virtual_protect 1
0A8C: write_memory 15@ size 4 value 12@ virtual_protect 1 // recording z push
000A: 15@ += 0x04
// Recording Turn Speed:
000A: 13@ += 0x04 // x turn speed
0A8D: 12@ = read_memory 13@ size 4 virtual_protect 1
0A8C: write_memory 15@ size 4 value 12@ virtual_protect 1 // recording x turn speed
000A: 15@ += 0x04
000A: 13@ += 0x04 // y turn speed
0A8D: 12@ = read_memory 13@ size 4 virtual_protect 1
0A8C: write_memory 15@ size 4 value 12@ virtual_protect 1 // recording y turn speed
000A: 15@ += 0x04
000A: 13@ += 0x04 // z turn speed
0A8D: 12@ = read_memory 13@ size 4 virtual_protect 1
0A8C: write_memory 15@ size 4 value 12@ virtual_protect 1 // recording z turn speed
000A: 2@ += 0x50
:CARRECORD_RECORDING_RETURN
0AB2: ret 1 2@
:CARRECORD_RECORDTOCR
0AA7: call_function 0x48DF90 num_params 2 pop 2 "wb" "cleo\\carrec.cr" 15@ // FILE *file = CFileMgr::Open("cleo\carrec.cr", "wb");
0AC7: 13@ = var 14@ offset // float *var_offset = &vars[3];
0006: 12@ = 0x00
:CARRECORD_RECORDTOCR_02
if
001D: 1@ > 12@
jf @CARRECORD_RECORDTOCR_RETURN
0085: 11@ = 0@
005A: 11@ += 12@
0A8D: 14@ = read_memory 11@ size 4 virtual_protect 1
0AA5: call 0x48DF30 num_params 3 pop 3 4 13@ 15@ // CFileMgr::Write(file, var_offset, 4);
000A: 12@ += 0x04
jump @CARRECORD_RECORDTOCR_02
:CARRECORD_RECORDTOCR_RETURN
0AA5: call 0x48DEA0 num_params 1 pop 1 15@ // CFileMgr::Close(file);
0AB2: ret 0
:CARRECORD_READCR
0AA7: call_function 0x48DF90 num_params 2 pop 2 "rb" "cleo\\carrec.cr" 15@ // file = CFileMgr::Open("cleo\carrec.cr", "rb");
// Get file size to 14@:
0AA5: call 0x48DEE0 num_params 3 pop 3 2 0 15@ // CFileMgr::Seek(file, 0, SEEK_END);
0AA7: call_function 0x652D50 num_params 1 pop 1 15@ 14@ // size = ftell(file);
// Go to beginning of the file:
0AA5: call 0x48DEE0 num_params 3 pop 3 0 0 15@ // CFileMgr::Seek(file, 0, SEEK_SET);
// Now start reading:
0AC8: 13@ = allocate_memory_size 14@
0006: 12@ = 0x00
:CARRECORD_READCR_02
if
801D: NOT 12@ > 14@
jf @CARRECORD_READCR_RETURN
0085: 11@ = 13@
005A: 11@ += 12@
0AA5: call 0x48DF50 num_params 3 pop 3 4 11@ 15@ // CFileMgr::Read(file, var_offset, 4);
000A: 12@ += 0x04
jump @CARRECORD_READCR_02
:CARRECORD_READCR_RETURN
0AA5: call 0x48DEA0 num_params 1 pop 1 15@ // CFileMgr::Close(file);
0AB2: ret 2 13@ 14@
:CARRECORD_RECORDPLAYBACK
// Check Time:
0085: 15@ = 1@
005A: 15@ += 2@
0A8D: 14@ = read_memory 15@ size 4 virtual_protect 1
001D: 3@ > 14@
jf @CARRECORD_RECORDPLAYBACK_RETURN
:CARRECORD_RECORDPLAYBACK_2
000A: 2@ += 0x50
0085: 15@ = 1@
005A: 15@ += 2@
0A8D: 14@ = read_memory 15@ size 4 virtual_protect 1
801D: NOT 3@ > 14@
jf @CARRECORD_RECORDPLAYBACK_2
000E: 2@ -= 0x50
0085: 15@ = 1@
005A: 15@ += 2@
000A: 15@ += 0x04
0A97: 14@ = car 0@ struct
// Playback Matrix:
0085: 13@ = 14@
000A: 13@ += 0x04 // right x
0A8D: 12@ = read_memory 15@ size 4 virtual_protect 1
0A8C: write_memory 13@ size 4 value 12@ virtual_protect 1 // playback right x
000A: 15@ += 0x04
000A: 13@ += 0x04 // right y
0A8D: 12@ = read_memory 15@ size 4 virtual_protect 1
0A8C: write_memory 13@ size 4 value 12@ virtual_protect 1 // playback right y
000A: 15@ += 0x04
000A: 13@ += 0x04 // right z
0A8D: 12@ = read_memory 15@ size 4 virtual_protect 1
0A8C: write_memory 13@ size 4 value 12@ virtual_protect 1 // playback right z
000A: 15@ += 0x04
000A: 13@ += 0x08 // up x
0A8D: 12@ = read_memory 15@ size 4 virtual_protect 1
0A8C: write_memory 13@ size 4 value 12@ virtual_protect 1 // playback up x
000A: 15@ += 0x04
000A: 13@ += 0x04 // up y
0A8D: 12@ = read_memory 15@ size 4 virtual_protect 1
0A8C: write_memory 13@ size 4 value 12@ virtual_protect 1 // playback up y
000A: 15@ += 0x04
000A: 13@ += 0x04 // up z
0A8D: 12@ = read_memory 15@ size 4 virtual_protect 1
0A8C: write_memory 13@ size 4 value 12@ virtual_protect 1 // playback up z
000A: 15@ += 0x04
000A: 13@ += 0x08 // at x
0A8D: 12@ = read_memory 15@ size 4 virtual_protect 1
0A8C: write_memory 13@ size 4 value 12@ virtual_protect 1 // playback at x
000A: 15@ += 0x04
000A: 13@ += 0x04 // at y
0A8D: 12@ = read_memory 15@ size 4 virtual_protect 1
0A8C: write_memory 13@ size 4 value 12@ virtual_protect 1 // playback at y
000A: 15@ += 0x04
000A: 13@ += 0x04 // at z
0A8D: 12@ = read_memory 15@ size 4 virtual_protect 1
0A8C: write_memory 13@ size 4 value 12@ virtual_protect 1 // playback at z
000A: 15@ += 0x04
000A: 13@ += 0x08 // position x
0A8D: 12@ = read_memory 15@ size 4 virtual_protect 1
0A8C: write_memory 13@ size 4 value 12@ virtual_protect 1 // playback position x
000A: 15@ += 0x04
000A: 13@ += 0x04 // position y
0A8D: 12@ = read_memory 15@ size 4 virtual_protect 1
0A8C: write_memory 13@ size 4 value 12@ virtual_protect 1 // playback position y
000A: 15@ += 0x04
000A: 13@ += 0x04 // position z
0A8D: 12@ = read_memory 15@ size 4 virtual_protect 1
0A8C: write_memory 13@ size 4 value 12@ virtual_protect 1 // playback position z
000A: 15@ += 0x04
// Playback Movement Speed:
0085: 13@ = 14@
000A: 13@ += 0x70 // x push
0A8D: 12@ = read_memory 15@ size 4 virtual_protect 1
0A8C: write_memory 13@ size 4 value 12@ virtual_protect 1 // playback x push
000A: 15@ += 0x04
000A: 13@ += 0x04 // y push
0A8D: 12@ = read_memory 15@ size 4 virtual_protect 1
0A8C: write_memory 13@ size 4 value 12@ virtual_protect 1 // playback y push
000A: 15@ += 0x04
000A: 13@ += 0x04 // z push
0A8D: 12@ = read_memory 15@ size 4 virtual_protect 1
0A8C: write_memory 13@ size 4 value 12@ virtual_protect 1 // playback z push
000A: 15@ += 0x04
// Playback Turn Speed:
000A: 13@ += 0x04 // x turn speed
0A8D: 12@ = read_memory 15@ size 4 virtual_protect 1
0A8C: write_memory 13@ size 4 value 12@ virtual_protect 1 // playback x turn speed
000A: 15@ += 0x04
000A: 13@ += 0x04 // y turn speed
0A8D: 12@ = read_memory 15@ size 4 virtual_protect 1
0A8C: write_memory 13@ size 4 value 12@ virtual_protect 1 // playback y turn speed
000A: 15@ += 0x04
000A: 13@ += 0x04 // z turn speed
0A8D: 12@ = read_memory 15@ size 4 virtual_protect 1
0A8C: write_memory 13@ size 4 value 12@ virtual_protect 1 // playback z turn speed
000A: 2@ += 0x50
:CARRECORD_RECORDPLAYBACK_RETURN
0AB2: ret 1 2@