{$CLEO .csa}

thread 'AUTOAIM'

var 
    0@ : Integer  // general purporse
    2@ : Integer  // CPad::GetPad()
end
 
wait 1000

0DD5: 0@ = get_platform
if 
    0@ <> 2 // PSP
then
    end_thread
end                                            

0DD0: 2@ = get_label_addr @eptn_CPad_GetPad
0DDA: 2@ = get_pattern_addr_cstr 2@ index 0

while true
    wait 0
    
    0DDD: 0@ = get_mutex_var 0
    if
        0@ <> 0
    then
        continue
    end
    
    if and
      02F1:   is_char_in_flying_vehicle $PLAYER_CHAR
      807F:   not is_button_pressed 0 button 13
      807F:   not is_button_pressed 0 button 10
     then
        gosub @set_aim
     end   
end

:set_aim
//011F: print_with_number_now 'NUMBER' number 3@ time 100 flag 1        
0DDE: call_func 2@ add_ib 0 __result 'resi' 0@ __pad_index 'i' 0
0@ += 29
0DD9: write_mem_addr 0@ value 1 size 2 add_ib 0 protect 0     
return

:eptn_CPad_GetPad
hex
    "?? ?? ?? ?? 23 20 A4 00 C0 20 04 00 23 10 85 00" 00
end



