{$CLEO} // copmarkers.txt const aCopMarkers = 0@ copMarker = 1@ copMarkerType = 2@ copMarkerEntity = 3@ copMarkerTime = 4@ i = 5@ pedType = 6@ carModel = 7@ bCopMarkersInitialized = 8@ pedPosX = 9@ pedPosY = 10@ pedPosZ = 11@ playerPosX = 12@ playerPosY = 13@ playerPosZ = 14@ markerPosX = 15@ markerPosY = 16@ markerPosZ = 17@ pPedPos = 18@ pMarkerPos = 19@ aTexture = 20@ fMarkerDistance = 21@ tempTime = 22@ vertexBuffer = 23@ pedCar = 24@ debugCounter = 24@ debugCounterPeds = 25@ fMarkerAngle = 25@ debugCounterCars = 26@ debugCounterHelis = 27@ dwTimer = 32@ CopMarker_NULL = 0 CopMarker_PED = 1 CopMarker_CAR = 2 CopMarker_HELI = 3 CopMarker_SIZE = 9 CopMarker_MAX = 63 PedType_COP = 6 TimeToSwitchColor = 1000 TimeToSwitchColorHalf = 500 radar_level = 0x882C00 radar_lower = 0x882C08 radar_higher = 0x882C04 radar_police_chase = 0x882C0C radar_police_heli = 0x882C10 // CRadar TransformRealWorldPointToRadarSpace = 0x583530 GetDistanceAndNormalize = 0x5832F0 ClipRadarPoly = 0x583480 // red color 140 61 64 // blue color 74 148 159 end {$I begin} 0AC6: aCopMarkers = label @copmarkers_buf offset 0AC7: pPedPos = var pedPosX offset 0AC7: pMarkerPos = var markerPosX offset 0AC8: vertexBuffer = allocate_memory_size 112 while true wait 0 gosub @copmarkers end goto @copmarkers_end :copmarkers if player.Defined(0) then if 010F: player 0 wanted_level > 0 then if bCopMarkersInitialized == false then gosub @copMarkers__Init bCopMarkersInitialized = true end gosub @copMarkers__Scan for i = 0 to CopMarker_MAX 0085: copMarker = i copMarker *= CopMarker_SIZE 005A: copMarker += aCopMarkers 0A8D: copMarkerType = read_memory copMarker size 1 virtual_protect 0 if copMarkerType <> copMarker_NULL then copMarker += 1 0A8D: copMarkerEntity = read_memory copMarker size 4 virtual_protect 0 if copMarkerType == CopMarker_PED then if not actor.Defined(copMarkerEntity) then copMarker -= 1 0A8C: write_memory copMarker size 1 value CopMarker_NULL virtual_protect 0 continue else if or actor.Dead(copMarkerEntity) 0449: actor copMarkerEntity in_a_car actor.Driving(copMarkerEntity) then copMarker -= 1 0A8C: write_memory copMarker size 1 value CopMarker_NULL virtual_protect 0 continue end end else if copMarkerType == CopMarker_CAR then if not actor.Defined(copMarkerEntity) then copMarker -= 1 0A8C: write_memory copMarker size 1 value CopMarker_NULL virtual_protect 0 continue else if or actor.Dead(copMarkerEntity) not actor.Driving(copMarkerEntity) then copMarker -= 1 0A8C: write_memory copMarker size 1 value CopMarker_NULL virtual_protect 0 continue end end else if copMarkerType == CopMarker_HELI then if not car.Defined(copMarkerEntity) then copMarker -= 1 0A8C: write_memory copMarker size 1 value CopMarker_NULL virtual_protect 0 continue else if or 8185: not car copMarkerEntity health >= 250 00DB: actor $3 in_car copMarkerEntity then copMarker -= 1 0A8C: write_memory copMarker size 1 value CopMarker_NULL virtual_protect 0 continue end end end end end copMarker += 4 0A8D: copMarkerTime = read_memory copMarker size 4 virtual_protect 0 gosub @copMarker__Draw // debug { debugCounter = 0 debugCounterPeds = 0 debugCounterCars = 0 debugCounterHelis = 0 for i = 0 to CopMarker_MAX 0085: copMarker = i copMarker *= CopMarker_SIZE 005A: copMarker += aCopMarkers 0A8D: copMarkerType = read_memory copMarker size 1 virtual_protect 0 if copMarkerType <> CopMarker_NULL then inc(debugCounter) if copMarkerType == CopMarker_PED then inc(debugCounterPeds) else if copMarkerType == CopMarker_CAR then inc(debugCounterCars) else if copMarkerType == CopMarker_HELI then inc(debugCounterHelis) end end end end end 0AD1: show_formatted_text_highpriority "%d peds: %d cars: %d helis: %d" time 100 debugCounter debugCounterPeds debugCounterCars debugCounterHelis } // end end else bCopMarkersInitialized = false end end return :copMarkers__Init for i = 0 to CopMarker_MAX 0085: copMarker = i copMarker *= CopMarker_SIZE 005A: copMarker += aCopMarkers 0A8C: write_memory copMarker size 1 value CopMarker_NULL virtual_protect 0 end return :copMarker__Draw if copMarkerType == CopMarker_PED then actor.StorePos(copMarkerEntity, pedPosX, pedPosY, pedPosZ) 0AA5: call TransformRealWorldPointToRadarSpace num_params 2 pop 2 pPedPos pMarkerPos 0AA5: call GetDistanceAndNormalize num_params 1 pop 1 pMarkerPos 0AE9: pop_float fMarkerDistance if fMarkerDistance < 1.0 then 0AA5: call ClipRadarPoly num_params 2 pop 2 pMarkerPos pPedPos // we got screen pos to pedPosX and pedPosY actor.StorePos($3, playerPosX, playerPosY, playerPosZ) 0063: playerPosZ -= pedPosZ // we still can use it, because all previous functions work with 2D vectors only if playerPosZ > 2.0 then 0A8D: aTexture = read_memory radar_lower size 4 virtual_protect 0 else if playerPosZ < -2.0 then 0A8D: aTexture = read_memory radar_higher size 4 virtual_protect 0 else 0A8D: aTexture = read_memory radar_level size 4 virtual_protect 0 end end 0085: tempTime = dwTimer 0062: tempTime -= copMarkerTime if tempTime < TimeToSwitchColor then if tempTime < TimeToSwitchColorHalf then 0AB1: call_scm_function @drawIcon 9 vertexBuffer pedPosX pedPosY size 14.0 texture aTexture color_RGBA 140 61 64 255 else 0AB1: call_scm_function @drawIcon 9 vertexBuffer pedPosX pedPosY size 14.0 texture aTexture color_RGBA 74 148 159 255 end else 0AB1: call_scm_function @drawIcon 9 vertexBuffer pedPosX pedPosY size 14.0 texture aTexture color_RGBA 74 148 159 255 0A8C: write_memory copMarker size 4 value dwTimer virtual_protect 0 end end else if copMarkerType == CopMarker_CAR then 0811: pedCar = actor copMarkerEntity car car.StorePos(pedCar, pedPosX, pedPosY, pedPosZ) 0AA5: call TransformRealWorldPointToRadarSpace num_params 2 pop 2 pPedPos pMarkerPos 0AA5: call GetDistanceAndNormalize num_params 1 pop 1 pMarkerPos 0AE9: pop_float fMarkerDistance if fMarkerDistance < 1.0 then 0AA5: call ClipRadarPoly num_params 2 pop 2 pMarkerPos pPedPos // we got screen pos to pedPosX and pedPosY actor.StorePos($3, playerPosX, playerPosY, playerPosZ) 0063: playerPosZ -= pedPosZ // we still can use it, because all previous functions work with 2D vectors only 0A8D: aTexture = read_memory radar_police_chase size 4 virtual_protect 0 0085: tempTime = dwTimer 0062: tempTime -= copMarkerTime 0093: fMarkerAngle = integer tempTime to_float fMarkerAngle /= 2.777777777777778 if tempTime < TimeToSwitchColor then if tempTime < TimeToSwitchColorHalf then 0AB1: call_scm_function @drawIconWithRotation 10 vertexBuffer pedPosX pedPosY size 24.0 angle fMarkerAngle texture aTexture color_RGBA 140 61 64 255 else 0AB1: call_scm_function @drawIconWithRotation 10 vertexBuffer pedPosX pedPosY size 24.0 angle fMarkerAngle texture aTexture color_RGBA 74 148 159 255 end else 0AB1: call_scm_function @drawIconWithRotation 10 vertexBuffer pedPosX pedPosY size 24.0 angle fMarkerAngle texture aTexture color_RGBA 74 148 159 255 0A8C: write_memory copMarker size 4 value dwTimer virtual_protect 0 end end else if copMarkerType == CopMarker_HELI then car.StorePos(copMarkerEntity, pedPosX, pedPosY, pedPosZ) 0AA5: call TransformRealWorldPointToRadarSpace num_params 2 pop 2 pPedPos pMarkerPos 0AA5: call GetDistanceAndNormalize num_params 1 pop 1 pMarkerPos 0AE9: pop_float fMarkerDistance if fMarkerDistance < 1.0 then 0AA5: call ClipRadarPoly num_params 2 pop 2 pMarkerPos pPedPos // we got screen pos to pedPosX and pedPosY actor.StorePos($3, playerPosX, playerPosY, playerPosZ) 0063: playerPosZ -= pedPosZ // we still can use it, because all previous functions work with 2D vectors only 0A8D: aTexture = read_memory radar_police_heli size 4 virtual_protect 0 0085: tempTime = dwTimer 0062: tempTime -= copMarkerTime 0093: fMarkerAngle = integer tempTime to_float fMarkerAngle /= 2.777777777777778 if tempTime < TimeToSwitchColor then if tempTime < TimeToSwitchColorHalf then 0AB1: call_scm_function @drawIconWithRotation 10 vertexBuffer pedPosX pedPosY size 24.0 angle fMarkerAngle texture aTexture color_RGBA 140 61 64 255 else 0AB1: call_scm_function @drawIconWithRotation 10 vertexBuffer pedPosX pedPosY size 24.0 angle fMarkerAngle texture aTexture color_RGBA 74 148 159 255 end else 0AB1: call_scm_function @drawIconWithRotation 10 vertexBuffer pedPosX pedPosY size 24.0 angle fMarkerAngle texture aTexture color_RGBA 74 148 159 255 0A8C: write_memory copMarker size 4 value dwTimer virtual_protect 0 end end end end end return // SCM function: :drawIcon // 0AB1: call_scm_function @drawIcon 9 vertices 0@ screenXY 1@ 2@ size 4.0 texture 3@ color_RGBA 4@ 5@ 6@ 255 { 0@ vertices 1@ worldX 2@ worldY 3@ size 4@ texture 5@ colorR 6@ colorG 7@ colorB 8@ colorA } 0A8D: 11@ = read_memory 0xC17048 size 4 virtual_protect 0 0093: 11@ = integer 11@ to_float 3@ /= 1024.0 006B: 3@ *= 11@ 3@ /= 2.0 0087: 13@ = 1@ 0087: 14@ = 2@ 0063: 13@ -= 3@ 0063: 14@ -= 3@ 0D41: set_vertices 0@ vertex 1 xyz 13@ 14@ 0.0 rhw 3.33 RGBA 5@ 6@ 7@ 8@ uv 0.0 0.0 screenY 1 0087: 13@ = 1@ 0087: 14@ = 2@ 0063: 13@ -= 3@ 005B: 14@ += 3@ 0D41: set_vertices 0@ vertex 2 xyz 13@ 14@ 0.0 rhw 3.33 RGBA 5@ 6@ 7@ 8@ uv 0.0 1.0 screenY 1 0087: 13@ = 1@ 0087: 14@ = 2@ 005B: 13@ += 3@ 005B: 14@ += 3@ 0D41: set_vertices 0@ vertex 3 xyz 13@ 14@ 0.0 rhw 3.33 RGBA 5@ 6@ 7@ 8@ uv 1.0 1.0 screenY 1 0087: 13@ = 1@ 0087: 14@ = 2@ 005B: 13@ += 3@ 0063: 14@ -= 3@ 0D41: set_vertices 0@ vertex 4 xyz 13@ 14@ 0.0 rhw 3.33 RGBA 5@ 6@ 7@ 8@ uv 1.0 0.0 screenY 1 0D40: draw_2d_shape_type 5 texture 4@ numVerts 4 pVerts 0@ vertexAlpha 0 srcBlend 5 dstBlend 6 priority 1 0AB2: ret 0 // SCM function: :drawIconWithRotation // 0AB1: call_scm_function @drawIcon 10 vertices 0@ screenXY 1@ 2@ size 4.0 angle 3@ texture 4@ color_RGBA 5@ 6@ 7@ 255 { 0@ vertices 1@ worldX 2@ worldY 3@ size 4@ angle 5@ texture 6@ colorR 7@ colorG 8@ colorB 9@ colorA } 0A8D: 11@ = read_memory 0xC17048 size 4 virtual_protect 0 0093: 11@ = integer 11@ to_float 3@ /= 1024.0 006B: 3@ *= 11@ 3@ /= 2.0 0087: 13@ = 1@ 0087: 14@ = 2@ 0063: 13@ -= 3@ 0063: 14@ -= 3@ 0D41: set_vertices 0@ vertex 1 xyz 13@ 14@ 0.0 rhw 3.33 RGBA 6@ 7@ 8@ 9@ uv 0.0 0.0 screenY 1 0087: 13@ = 1@ 0087: 14@ = 2@ 0063: 13@ -= 3@ 005B: 14@ += 3@ 0D41: set_vertices 0@ vertex 2 xyz 13@ 14@ 0.0 rhw 3.33 RGBA 6@ 7@ 8@ 9@ uv 0.0 1.0 screenY 1 0087: 13@ = 1@ 0087: 14@ = 2@ 005B: 13@ += 3@ 005B: 14@ += 3@ 0D41: set_vertices 0@ vertex 3 xyz 13@ 14@ 0.0 rhw 3.33 RGBA 6@ 7@ 8@ 9@ uv 1.0 1.0 screenY 1 0087: 13@ = 1@ 0087: 14@ = 2@ 005B: 13@ += 3@ 0063: 14@ -= 3@ 0D41: set_vertices 0@ vertex 4 xyz 13@ 14@ 0.0 rhw 3.33 RGBA 6@ 7@ 8@ 9@ uv 1.0 0.0 screenY 1 0D45: rotate_2d_vertices_shape 0@ num_verts 4 aroundXY 1@ 2@ angle 4@ 0D40: draw_2d_shape_type 5 texture 5@ numVerts 4 pVerts 0@ vertexAlpha 0 srcBlend 5 dstBlend 6 priority 1 0AB2: ret 0 :copMarkers__Scan {$I forallpeds} 089F: get_actor ped pedtype_to pedType if and pedType == PedType_COP not actor.Dead(ped) then if actor.Driving(ped) then gosub @copMarkers__isExist if copMarkerType == CopMarker_NULL then gosub @copMarker__CreateForCar end else if 8449: not actor ped in_a_car then gosub @copMarkers__isExist if copMarkerType == CopMarker_NULL then gosub @copMarker__CreateForPed end end end end {$I for_end} {$I forallcars} 0441: carModel = car veh model if or carModel == #POLMAV carModel == #HUNTER then if and 0185: car veh health >= 250 80DB: not actor $3 in_car veh then gosub @copMarkers__isExist if copMarkerType == CopMarker_NULL then gosub @copMarker__CreateForHeli end end end {$I for_end} return :copMarker__CreateForPed gosub @copMarkers__findEmpty // returns to copMarkerType if copMarkerType == CopMarker_NULL then 0A8C: write_memory copMarker size 1 value CopMarker_PED virtual_protect 0 copMarker += 1 0A8C: write_memory copMarker size 4 value ped virtual_protect 0 copMarker += 4 0A8C: write_memory copMarker size 4 value dwTimer virtual_protect 0 end return :copMarker__CreateForCar gosub @copMarkers__findEmpty // returns to copMarkerType if copMarkerType == CopMarker_NULL then 0A8C: write_memory copMarker size 1 value CopMarker_CAR virtual_protect 0 copMarker += 1 0A8C: write_memory copMarker size 4 value ped virtual_protect 0 copMarker += 4 0A8C: write_memory copMarker size 4 value dwTimer virtual_protect 0 end return :copMarker__CreateForHeli gosub @copMarkers__findEmpty // returns to copMarkerType if copMarkerType == CopMarker_NULL then 0A8C: write_memory copMarker size 1 value CopMarker_HELI virtual_protect 0 copMarker += 1 0A8C: write_memory copMarker size 4 value veh virtual_protect 0 copMarker += 4 0A8C: write_memory copMarker size 4 value dwTimer virtual_protect 0 end return :copMarkers__findEmpty for i = 0 to CopMarker_MAX 0085: copMarker = i copMarker *= CopMarker_SIZE 005A: copMarker += aCopMarkers 0A8D: copMarkerType = read_memory copMarker size 1 virtual_protect 0 if copMarkerType == CopMarker_NULL then return end end return :copMarkers__isExist for i = 0 to CopMarker_MAX 0085: copMarker = i copMarker *= CopMarker_SIZE 005A: copMarker += aCopMarkers 0A8D: copMarkerType = read_memory copMarker size 1 virtual_protect 0 if copMarkerType <> CopMarker_NULL then copMarker += 1 0A8D: copMarkerEntity = read_memory copMarker size 4 virtual_protect 0 if 003B: ped == copMarkerEntity then copMarkerType = true return end end end copMarkerType = CopMarker_NULL return :copmarkers_buf //struct copmarker { BYTE type DWORD owner (ped/driver/heli) DWORD timeCreated } // types { CopMarker_NULL CopMarker_PED CopMarker_CAR CopMarker_HELI } hex 00 00000000 00000000 00 00000000 00000000 00 00000000 00000000 00 00000000 00000000 00 00000000 00 00000000 00 00000000 00 00000000 00 00000000 00000000 00 00000000 00000000 00 00000000 00000000 00 00000000 00000000 00 00000000 00000000 00 00000000 00000000 00 00000000 00 00000000 00 00000000 00 00000000 00 00000000 00000000 00 00000000 00000000 00 00000000 00000000 00 00000000 00000000 00 00000000 00000000 00 00000000 00000000 00 00000000 00 00000000 00 00000000 00 00000000 00 00000000 00000000 00 00000000 00000000 00 00000000 00000000 00 00000000 00000000 00 00000000 00000000 00 00000000 00000000 00 00000000 00 00000000 00 00000000 00 00000000 00 00000000 00000000 00 00000000 00000000 00 00000000 00000000 00 00000000 00000000 00 00000000 00000000 00 00000000 00000000 00 00000000 00 00000000 00 00000000 00 00000000 00 00000000 00000000 00 00000000 00000000 00 00000000 00000000 00 00000000 00000000 00 00000000 00000000 00 00000000 00000000 00 00000000 00 00000000 00 00000000 00 00000000 00 00000000 00000000 00 00000000 00000000 00 00000000 00000000 00 00000000 00000000 00 00000000 00000000 00 00000000 00000000 00 00000000 00 00000000 00 00000000 00 00000000 00 00000000 00000000 00 00000000 00000000 00 00000000 00000000 00 00000000 00000000 00 00000000 00000000 00 00000000 00000000 00 00000000 00 00000000 00 00000000 00 00000000 00 00000000 00000000 00 00000000 00000000 end :copmarkers_end