Top > 透視投影のやり方


透視投影のやり方

Last-modified: 2015-05-03 (日) 21:31:25

[email protected] [email protected] [email protected]が対象のxyz座標、[email protected]@が画面上に投影した時の画面上の座標。

 {$VERSION 3.1.0023}
  {$CLEO .cs}
  thread 'healthhud'
  {
  012 temp
  345 
  678
  91011
  121314 temp_main 
  
  15 the_obj
  16 
  17 
  18 
  19 
   
  202122 
  232425 
  262728 get_actor get_obj get_other...
  293031 
  
  32 
  33
  }
  :main
  wait 0
  03F0: enable_text_draw 0
  gosub @settei
  gosub @get_actor
  if
  03CA: (check) object [email protected] exists
  then
      0108: destroy_object [email protected]
  end 
  jump @main
  
  //////////////sub///////////////////
  :settei
  if
  8248: (check) not model 1582 available
  then
      0247: load_model 1582
      038B: load_requested_models
      while 8248:   not model 1582 available 
          wait 0
      end
  end
  0107: [email protected] = create_object 1582 at 0.0 0.0 0.0
  09CA: set_object [email protected] immunities BP 1 FP 1 EP 1 CP 1 MP 1
  0750: set_object [email protected] visibility 0
  068E: get_camera_target_point_to [email protected] [email protected] [email protected]
  068D: get_camera_position_to [email protected] [email protected] [email protected]
  0063: [email protected] -= [email protected] // (float) 
  0063: [email protected] -= [email protected] // (float) 
  0063: [email protected] -= [email protected] // (float) 
  0087: [email protected] = [email protected] // (float) 
  0087: [email protected] = [email protected] // (float)
  gosub @atan 
  0509: [email protected] = distance_between_XY [email protected] [email protected] and_XY 0.0 0.0
  0087: [email protected] = [email protected] // (float)
  0087: [email protected] = [email protected] // (float) 
  gosub @atan 
  0087: [email protected] = [email protected] // (float) 
  000B: [email protected] += -270.0
  0013: [email protected] *= -1.0
  0453: set_object [email protected] XY_rotation [email protected] [email protected] angle 0.0
  return
  
  :atan
  0509: [email protected] = distance_between_XY [email protected] [email protected] and_XY 0.0 0.0
  0073: [email protected] /= [email protected] // (float) 
  0073: [email protected] /= [email protected] // (float) 
  0509: [email protected] = distance_between_XY [email protected] [email protected] and_XY 0.0 1.0
  for [email protected] = 0 to 11
     0017: [email protected] /= 2.0 
     006B: [email protected] *= [email protected] // (float) 
     0087: [email protected] = [email protected] // (float)                     
     0013: [email protected] *= -1.0 
     000B: [email protected] += 1.0
     01FB: [email protected] = square_root [email protected] 
     0013: [email protected] *= -1.0 
     000B: [email protected] += 1.0
     006B: [email protected] *= [email protected] // (float) 
     005B: [email protected] += [email protected] // (float) 
     01FB: [email protected] = square_root [email protected] 
  end                                                      
  0013: [email protected] *= 4096.0 
  0017: [email protected] /= 3.141592 
  0013: [email protected] *= 180.0 
  if
  0021:   [email protected] > 0.0 
  then
     0013: [email protected] *= -1.0 
     000B: [email protected] += 360.0
  end
  return
  
  :get_actor
  0A8D: [email protected] = read_memory 0xB74490 size 4 virtual_protect 0
  000A: [email protected] += 0x4
  0A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 0
  for [email protected] = 0 to 35584 step 0x100
      0A8D: [email protected] = read_memory [email protected] size 1 virtual_protect 0
      000A: [email protected] += 0x1
      if and
      0029:   [email protected] >= 0x00 
      001B:   0x80 > [email protected]
      then 
          005A: [email protected] += [email protected] // (int)
          0889: store_actor $PLAYER_ACTOR enter_of_body_position_to [email protected] [email protected] [email protected]
          0889: store_actor [email protected] enter_of_body_position_to [email protected] [email protected] [email protected]
          050A: [email protected] = distance_between_XYZ [email protected] [email protected] [email protected] and_XYZ [email protected] [email protected] [email protected]
          068D: get_camera_position_to [email protected] [email protected] [email protected]      
          if and
          255.0 > [email protected]
          8118: (check) not actor [email protected] dead
          06BD: (check) no_obstacles_between [email protected] [email protected] [email protected] and [email protected] [email protected] [email protected] solid 1 car 0 actor 0 object 0 particle 0
          803C:   not  $PLAYER_ACTOR == [email protected] // (int)
          then
              [email protected] += 1.0//atama
              gosub @getgamen  //56_xy
  //----------------size------------------------
              0087: [email protected] = [email protected] // (float)
              [email protected] = 10.0
              0073: [email protected] /= [email protected] // (float)
              0087: [email protected] = [email protected] // (float)            
              [email protected] *= 0.5
              if
              [email protected] > 2.0
              then
                  [email protected] = 2.0
                  [email protected] = 1.0
              end
              if
              0.5 > [email protected]
              then
                  [email protected] = 0.5
                  [email protected] = 0.25
              end
  //-----------------color--------------------
              gosub @ped_health
          end
      end 
  end
  return
  
  :getgamen
  068D: get_camera_position_to [email protected] [email protected] [email protected]
  0063: [email protected] -= [email protected] // (float) 
  0063: [email protected] -= [email protected] // (float) 
  0063: [email protected] -= [email protected] // (float)
  0013: [email protected] *= -1.0
  0013: [email protected] *= -1.0
  0400: store_coords_to [email protected] [email protected] [email protected] from_object [email protected] with_offset [email protected] [email protected] [email protected]
  0073: [email protected] /= [email protected] // (float) 
  0073: [email protected] /= [email protected] // (float) 
  0801: get_camera_zoom_factor_to [email protected] // float 
  0017: [email protected] /= 2.0 
  02F7: [email protected] = sine [email protected] // (float) 
  02F6: [email protected] = cosine [email protected] // (float) 
  0073: [email protected] /= [email protected] // (float) 
  006B: [email protected] *= [email protected] // (float) 
  006B: [email protected] *= [email protected] // (float) 
  0013: [email protected] *= 324.0
  0013: [email protected] *= 304.0
  if
  0023: 0.0 > [email protected] 
  then
  0007: [email protected] = 640.0 
  0007: [email protected] = 480.0 
  end
  000B: [email protected] += 320.0 
  000B: [email protected] += 223.0
  return
  
  :ped_health
  03F0: enable_text_draw 1
  0A96: [email protected] = actor [email protected] struct
  000A: [email protected] += 0x540
  0A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 0 //now_health
  000A: [email protected] += 0x4
  0A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 0 //max_health
  0073: [email protected] /= [email protected] // (float)
  [email protected] *= 20.0
  [email protected] *= 5.0
  038E: draw_box position [email protected] [email protected] scale [email protected] [email protected] color 255 255 255 alpha 40    //kuro_box
  
  0087: [email protected] = [email protected] // (float)
  006B: [email protected] *= [email protected] // (float)
  0063: [email protected] -= [email protected] // (float)
  [email protected] *= 0.5
  0063: [email protected] -= [email protected] // (float)
  038E: draw_box position [email protected] [email protected] scale [email protected] [email protected] color 255 0 0 alpha 120    //aka_box
  return