Exemplo n.º 1
0
    def render(self):
        read_game = self.env.read_game
        wn = self.env.weapon_names
        frame = self.env.frame
        
        if not read_game.is_in_game:    return
        if wn.weapon_models is None:    return

        cur_wp = wn.get_current_weapon()
        weapon_model = wn.get_weapon_model(cur_wp)
        ammo_str = "%i" % wn.get_ammo(cur_wp)
        if weapon_model.find(DUAL_WEAPON) > 0:      # check if dual weapon
            lh_model = weapon_model.replace(DUAL_WEAPON, LEFT_HAND)
            # look for previous or next weapon
            if wn.get_weapon_model(cur_wp - 1) == lh_model:
                ammo_str = "%i/%i" % (wn.get_ammo(cur_wp), wn.get_ammo(cur_wp - 1))
            elif wn.get_weapon_model(cur_wp + 1) == lh_model:
                ammo_str = "%i/%i" % (wn.get_ammo(cur_wp), wn.get_ammo(cur_wp + 1))
        draw_string_center(frame.ammo_font,
                           read_game.resolution_x - AMMO_COUNTER_MARGIN_RIGHT,
                           read_game.resolution_y - AMMO_COUNTER_MARGIN_BOTTOM,
                           AMMO_COUNTER_BACK_COLOR, ammo_str)
        draw_string_center(frame.ammo_font,
                           read_game.resolution_x - AMMO_COUNTER_MARGIN_RIGHT - AMMO_COUNTER_BACK_OFFSET,
                           read_game.resolution_y - AMMO_COUNTER_MARGIN_BOTTOM - AMMO_COUNTER_BACK_OFFSET,
                           AMMO_COUNTER_TEXT_COLOR, ammo_str)
    def render(self):
        read_game = self.env.read_game
        wn = self.env.weapon_names
        frame = self.env.frame
        
        if not read_game.is_in_game:
            self.reinit()
            return
        
        # is the current lethal weapon "frag grenades"
        frag_active = wn.get_weapon_model(wn.get_frag_grenade()) == "frag_grenade_mp"
        frag_ammo = wn.get_ammo(wn.get_frag_grenade())

        if keys["KEY_GRENADECOOKING_ACTIVE"] and frag_active:
            if keys["KEY_GRENADECOOKING"] and frag_ammo > 0:
                # starting countdown
                self.time_begin_cooking = read_game.game_time
                
            if self.time_begin_cooking is not None:
                # print cooking indicator
                cooking_time = GRENADECOOKING_TIMER - (read_game.game_time - self.time_begin_cooking) / 1000.0
                if cooking_time <= 0:
                    self.reinit()
                else:
                    text = "Cooking: %.1f" % cooking_time 
                    draw_string_center(frame.cooking,
                                       read_game.resolution_x / 2, read_game.resolution_y/2 + GRENADECOOKING_CENTER_Y,
                                       GRENADECOOKING_FONT_COLOR, text)
        else:
            self.reinit()
Exemplo n.º 3
0
    def render(self):
        frame = self.env.frame
        read_game = self.env.read_game
        
        if keys["KEY_STATUS"]:
            if keys["KEY_STATUS_UP"]:
                draw_line(frame.line, 0, 9, 845, 0, 20, STATUS_COLOR_LINE)
                text_y = 3
            else:
                draw_line(frame.line, 0, read_game.resolution_y - 10, 845, 0, 20, STATUS_COLOR_LINE)
                text_y = read_game.resolution_y-15
    
            for i in range(1, 13):
                if keys_raw[vk_codes.VK_F1+i-1] & KEY_TOGGLE:
                    color = STATUS_COLOR_ACTIVE
                else:
                    color = STATUS_COLOR_INACTIVE
                label = "F" + str(i) + ":" + getattr(Config, "F"+str(i)+"_LABEL")
                draw_string_left(frame.status_font, (i-1)*70 + 5, text_y, 65, 15, color, label)
            
        if read_game.is_in_game and keys["KEY_INSPECT_WEAPON_NAME"]:
            weapon_model = self.env.weapon_names.get_weapon_model(self.env.read_game.my_player.weapon_num)
            if weapon_model is not None:
                draw_string_center(frame.rage_font, read_game.resolution_x - 250, read_game.resolution_y - 10, 0xA0FFFF00, weapon_model)

        if keys["KEY_FPS_VIEWER"]:
            self.calc_fps()
            if self.fps > 0:
                draw_string_center(frame.rage_font, read_game.resolution_x - 50, read_game.resolution_y - 10, 0xA0FFFF00, "FPS=%.0f" % self.fps)
        else:
            self.reset_fps()
Exemplo n.º 4
0
 def render(self):
     read_game = self.env.read_game
     frame = self.env.frame
     if not read_game.is_in_game or not keys["KEY_KILLSTREAK"] or read_game.killstreak < 0: return
     
     text = "%i" % read_game.killstreak
     if keys["KEY_BIG_RADAR"]:
         draw_string_center(frame.killstreak_font, read_game.resolution_x - 52 - 512*BIG_RADAR_SCALE, 70, KILLSTREAK_FONT_COLOR, text)       
     else:
         draw_string_center(frame.killstreak_font, read_game.resolution_x - 100, 70, KILLSTREAK_FONT_COLOR, text)         
Exemplo n.º 5
0
 def render(self):
     frame = self.env.frame
     read_game = self.env.read_game
     
     if not read_game.is_in_game:
         self.rage_player_index = -1
         return
     
     do_next = keys["KEY_RAGE_NEXT"]
     do_prev = keys["KEY_RAGE_PREV"]
     do_reset = keys["KEY_RAGE_RESET"]
     
     if do_next or do_prev:
         idx = self.rage_player_index          # player index or 0 if negative
         if do_next: incr = 1
         else:       incr = -1 
         for i in range(PLAYERMAX): #@UnusedVariable
             idx += incr
             if idx >= PLAYERMAX:    idx = 0
             if idx < 0:             idx = PLAYERMAX - 1
             p = read_game.player[idx]
             if p != read_game.my_player and p.type == ET_PLAYER and p.valid and p.alive & ALIVE_FLAG and p.enemy:
                 self.rage_player_index = idx
                 break
         else:
             self.rage_player_index = -1             # none found
     elif do_reset:
         self.rage_player_index = -1
             
     # display player name in HUD display       
     if keys["KEY_RAGE_DISPLAY_NAME"]:
         if self.rage_player_index >= 0:
             draw_string_center(frame.rage_font, read_game.screen_center_x, read_game.screen_center_y + 40, RAGE_FONT_COLOR, read_game.player[self.rage_player_index].name)
         else:
             draw_string_center(frame.rage_font, read_game.screen_center_x, read_game.screen_center_y + 40, RAGE_FONT_COLOR, RAGE_RESET_STRING)
     
     # now display player
     if self.rage_player_index >= 0:
         p = read_game.player[self.rage_player_index]
         if p != read_game.my_player and p.type == ET_PLAYER and p.valid and p.alive & ALIVE_FLAG and p.enemy:
             p.color_esp = RAGE_COLOR_ESP
             p.color_map = RAGE_COLOR_MAP
Exemplo n.º 6
0
 def draw_distance_ESP(self, pos, x, y, color):
     distance = (pos - self.env.read_game.my_player.pos).length()
     converted_distance = distance * DISTANCE_ESP_UNIT
     distance_str = "%i %s" % (converted_distance, DISTANCE_ESP_UNIT_NAME)
     draw_string_center(self.env.frame.font, x, y + 12, color, distance_str)
Exemplo n.º 7
0
    def render(self):
        read_game = self.env.read_game
        frame = self.env.frame
        weapon_names = self.env.weapon_names
        if not read_game.is_in_game: return
        
        if keys["KEY_BOXESP"]:
            for idx in range(PLAYERMAX):
                p = read_game.player[idx]
                if (p.type == ET_PLAYER) and p.valid and p.alive and p != read_game.my_player:
                    # colors already calculated
                    feet, head, size_x, size_y = self.calc_size_xy(p)
                    if feet and head:
                        p.color_esp = self.get_faded_color(p.pos, p.color_esp)

                        if keys["KEY_BOXESP"]:
                            draw_box(frame.line, feet.x - size_x/2, feet.y, size_x, -size_y, COLOR_BOX_OUTER_WIDTH, p.color_esp)
                            if keys["KEY_WEAPON_ESP"]:
                                name_esp_str = "%s [%s]" % (p.name, weapon_names.get_weapon_name(p.weapon_num))
                            else:
                                name_esp_str = p.name
                            draw_string_center(frame.font, feet.x, feet.y - size_y, COLOR_PLAYER_NAME, name_esp_str)
                        if keys["KEY_BOX_SNAPLINE"] and p.enemy and p.alive & ALIVE_FLAG:
                            draw_line_abs(frame.line, read_game.screen_center_x, read_game.resolution_y,
                                  feet.x, feet.y, COLOR_BOX_LINE_WIDTH, p.color_esp)      # w/h ratio
                        if keys["KEY_BOXESP"]:
                            self.draw_distance_ESP(p.pos, feet.x, feet.y, COLOR_PLAYER_NAME)
                        if keys["KEY_TRIGGERBOT"] and keys["KEY_TRIGGER_BOT_KEY"]:
                            if p.alive & ALIVE_FLAG and p.enemy and p.pose != 0:
                                if (read_game.screen_center_x > feet.x - size_x/2) and (read_game.screen_center_x < feet.x + size_x/2):
                                    if (read_game.screen_center_y > feet.y - size_y) and (read_game.screen_center_y < feet.y ):
                                        #print "try trigger bot"
                                        if self.env.ticks - self.last_trigger_tick > 5:
                                            #print "triggerbot fire"
                                            self.last_trigger_tick = self.env.ticks
                                            windll.User32.keybd_event(TRIGGER_BOT_FIRE_KEY, 0x12, 0, 0)
                                            windll.User32.keybd_event(TRIGGER_BOT_FIRE_KEY, 0x12, KEYEVENTF_KEYUP, 0)
                            
                            
        
        #=======================================================================
        # pp = cast(pointer(read_game.mw2_entity), POINTER(c_int))
        # for i in range(ENTITIESMAX):
        #    #type = pp[0xE0/4 + 0x204/4*i]
        #    type = pp[0x38 + 0x81*i]
        #    if type == ET_TURRET or type == ET_EXPLOSIVE or type==ET_HELICOPTER or type==ET_PLANE:
        #=======================================================================
        for idx in range(ENTITIESMAX):
            e = read_game.mw2_entity.arr[idx]
            if e.type == ET_TURRET and e.alive & ALIVE_FLAG and keys["KEY_BOXESP"]:
                if e.owner_turret >= 0 and e.owner_turret < PLAYERMAX:
                    self.env.tracker.track_entity(idx, e.owner_turret)
                    if read_game.player[e.owner_turret].enemy:
                        head_pos = VECTOR(e.pos.x, e.pos.y, e.pos.z + 20)       # eyepos of standing player
                        feet = read_game.world_to_screen(e.pos)
                        head = read_game.world_to_screen(head_pos)
                        if feet and head:
                            size_y = feet.y - head.y
                            if size_y < 5:  size_y = 5
                            size_x = size_y / 2.75
                            draw_box(frame.line, feet.x - size_x/2, feet.y, size_x, -size_y, COLOR_BOX_OUTER_WIDTH, COLOR_SENTRY)
                    
            elif e.type == ET_EXPLOSIVE and e.alive & ALIVE_FLAG:
                #self.draw_explosive(e)
                self.track_explosive(idx)
                    
            elif (e.type == ET_HELICOPTER or e.type == ET_PLANE) and e.alive & ALIVE_FLAG and keys["KEY_BOXESP"]:
                if e.owner_air >= 0 and e.owner_air < PLAYERMAX:
                    self.env.tracker.track_entity(idx, e.owner_air)
                    if e.type == ET_PLANE or read_game.player[e.owner_air].enemy:
                        # all planes are shown because we don't know if they are enemies
                        head_pos = VECTOR(e.pos.x, e.pos.y, e.pos.z + 100)       # eyepos of standing player
                        feet = read_game.world_to_screen(e.pos)
                        head = read_game.world_to_screen(head_pos)
                        if feet and head:
                            size_y = feet.y - head.y
                            if size_y < 10:  size_y = 10
                            size_x = size_y
                            draw_box(frame.line, feet.x - size_x/2, feet.y, size_x, -size_y, COLOR_BOX_OUTER_WIDTH, COLOR_PLANE)
                            if keys["KEY_BOX_SNAPLINE"]:
                                draw_line_abs(frame.line, read_game.screen_center_x, read_game.resolution_y,
                                      feet.x, feet.y, COLOR_BOX_LINE_WIDTH, COLOR_PLANE)
                        
        self.loop_tracked_explo()
Exemplo n.º 8
0
    def render(self):
        if not DEBUG:   return
        
        read_game = self.env.read_game
        frame = self.env.frame
        #if not read_game.is_in_game or not keys["KEY_INSPECTOR"]: return
        if keys["KEY_INSPECTOR"]: 
#            for i in range(PLAYERMAX):
#                print "Player #%i: %s" % (i, read_game.player[i].name)
            for idx in range(ENTITIESMAX):
                e = read_game.cod7_entity.arr[idx]
                spot = read_game.world_to_screen(e.pos)
                if spot:
                    cur_angle_dist = self.sq(spot.x - read_game.screen_center_x, spot.y - read_game.screen_center_y)
                    if cur_angle_dist < 50 * 50:      # not too far from center
                        s = "[idx=%i(%x), typ=%i, weap=%i]" % (idx, idx, e.type, e.weapon)
                        draw_string_center(frame.font, spot.x, spot.y, 0xFFFFFFFF, s)
                        print s
                        #print dump_obj(e)
#                        if e.owner_scr1 >= 0 and e.owner_scr1 < 2047:
#                            ee = read_game.mw2_entity.arr[e.owner_scr1]
#                            print "[idx=%i(%x), typ=%i, weap=%i]" % (e.owner_scr1, e.owner_scr1, ee.type, ee.WeaponNum)
#                            print dump_obj(ee)
#                        if e.owner_scr2 >= 0 and e.owner_scr2 < 2047:
#                            ee = read_game.mw2_entity.arr[e.owner_scr2]
#                            print "[idx=%i(%x), typ=%i, weap=%i]" % (e.owner_scr2, e.owner_scr2, ee.type, ee.WeaponNum)
#                            print dump_obj(ee)
                        #=======================================================
                        # if e.type == ET_EXPLOSIVE:
                        #    print "dump explo"
                        #    print dump_obj(e)
                        #=======================================================
        
        if keys["KEY_INSPECT_POS"]:                 # print my player's position NUMPAD1
            pos = read_game.my_pos
            ang = read_game.view_angles
            print "time=%i ticks=%i perk=%i pos=(%.2f, %.2f, %.2f) angles=(%.2f, %.2f, %.2f)" % (read_game.game_time, self.env.ticks, read_game.my_player.perk,
                                                                                           pos.x, pos.y, pos.z, ang.x, ang.y, ang.z)
        
        if keys["KEY_INSPECT_DUMP"]:                # dump some memory structures NUMPAD9
            #mem = dumped()
            #read_game._RPM(0x6727F13, mem)
            #read_game._RPM(0x6727F10, mem)
            #print dump_obj(mem)
            #read_game._RPM(0x64DA350, mem)
            i = 0
            print "player #%i" % i
            print dump_obj(read_game.cod7_entity.arr[i])
            print "client info"
            print dump_obj(read_game.cod7_clientinfo.arr[i])
            #del mem
            
        if keys["KEY_INSPECT_DUMP_CG"]:        # NUMPAD 8
            #i = read_game.local_client_num
            #print "Current player, pose=%x, isalive=%x|%x" % (read_game.cod7_clientinfo.arr[i].pose, read_game.cod7_entity.arr[i].isalive, read_game.cod7_entity.arr[i].isalive2)
            #print dump_obj(read_game.cgs)
            mem = dumped()
            read_game._RPM(self.env.offsets.RXCD_T, mem)
            print dump_obj(mem)
            
        if keys["KEY_INSPECT_DUMP_PLAYERS"]:        # NUMPAD 7
            print "local_client=%i" % read_game.local_client_num
            for i in range(PLAYERMAX):
                print "Player #%i: %s, Team:%i" % (i, read_game.player[i].name, read_game.player[i].team)

        if keys["KEY_INSPECT_AMMO"]:
            for i in range(AMMOMAX):
                ammo = read_game.cg.ammos[i]
                print "Ammo[%i] (%i)%s = %i" % (i, ammo.weapon_id, self.env.weapon_names.get_weapon_model(ammo.weapon_id), ammo.ammo)
Exemplo n.º 9
0
    def render(self):
        read_game = self.env.read_game
        frame = self.env.frame
        weapon_names = self.env.weapon_names
        if not read_game.is_in_game: return
        
        # enemy behind indicators
        enemy_behind = enemy_left = enemy_right = INFINITY

        if keys["KEY_BOXESP"]:
            for idx in range(PLAYERMAX):
                p = read_game.player[idx]
                if (p.type == ET_PLAYER) and p.valid and p.alive and p != read_game.my_player:
                    # colors already calculated
                    feet, head, size_x, size_y = self.calc_size_xy(p)
                    if feet and head:
                        p.color_esp = self.get_faded_color(p.pos, p.color_esp)

                        if keys["KEY_BOXESP"]:
                            draw_box(frame.line, feet.x - size_x/2, feet.y, size_x, -size_y, COLOR_BOX_OUTER_WIDTH, p.color_esp)
                            if keys["KEY_WEAPON_ESP"]:
                                name_esp_str = "%s [%s]" % (p.name, weapon_names.get_weapon_model(p.weapon_num))
                            else:
                                name_esp_str = p.name
                            draw_string_center(frame.font, feet.x, feet.y - size_y, COLOR_PLAYER_NAME, name_esp_str)
                        if keys["KEY_BOX_SNAPLINE"] and p.enemy and p.alive & ALIVE_FLAG:
                            draw_line_abs(frame.line, read_game.screen_center_x, read_game.resolution_y,
                                  feet.x, feet.y, COLOR_BOX_LINE_WIDTH, p.color_esp)      # w/h ratio
                        if keys["KEY_BOXESP"]:
                            self.draw_distance_ESP(p.pos, feet.x, feet.y, COLOR_PLAYER_NAME)
                        if keys["KEY_TRIGGERBOT"] and keys["KEY_TRIGGER_BOT_KEY"]:
                            if p.alive & ALIVE_FLAG and p.enemy and p.pose != 0:
                                if (read_game.screen_center_x > feet.x - (size_x/3+1)) and (read_game.screen_center_x < feet.x + (size_x/3+1)):
                                    if (read_game.screen_center_y > feet.y - size_y) and (read_game.screen_center_y < feet.y ):
                                        if self.env.ticks - self.last_trigger_tick >= TRIGGER_BOT_FIRE_TICK_DELAY:
                                            self.last_trigger_tick = self.env.ticks
                                            windll.User32.keybd_event(ord(TRIGGER_BOT_FIRE_KEY), 0x12, 0, 0)
                                            windll.User32.keybd_event(ord(TRIGGER_BOT_FIRE_KEY), 0x12, KEYEVENTF_KEYUP, 0)
                    else:
                        # check if we need to show enemy behind indicator
                        transform = read_game.world_to_screen_transform(p.pos)
                        if transform.z < -10 and p.enemy:
                            distance = (p.pos - self.env.read_game.my_player.pos).length()
                            if abs(transform.x / transform.z) < 1:
                                if distance < enemy_behind:     enemy_behind = distance
                            elif transform.x > 0:
                                if distance < enemy_left:       enemy_left = distance
                            else:
                                if distance < enemy_right:      enemy_right = distance


                            
        if keys["KEY_ENEMY_BEHIND"] and (enemy_behind or enemy_left or enemy_right):
            sprites = self.env.sprites
            if enemy_behind < INFINITY:
                color = self.get_faded_color_dist(ENEMY_BEHIND_COLOR_BLEND, enemy_behind)
                sprites.draw_sprite("down", read_game.screen_center_x, read_game.screen_center_y + ENEMY_BEHIND_Y,
                                    0, color, ENEMY_BEHIND_SCALING)
            if enemy_left < INFINITY:
                color = self.get_faded_color_dist(ENEMY_BEHIND_COLOR_BLEND, enemy_left)
                sprites.draw_sprite("left-down", read_game.screen_center_x - ENEMY_BEHIND_X, read_game.screen_center_y + ENEMY_BEHIND_Y,
                                    0, color, ENEMY_BEHIND_SCALING)
            if enemy_right < INFINITY:
                color = self.get_faded_color_dist(ENEMY_BEHIND_COLOR_BLEND, enemy_right)
                sprites.draw_sprite("right-down", read_game.screen_center_x + ENEMY_BEHIND_X, read_game.screen_center_y + ENEMY_BEHIND_Y,
                                    0, color, ENEMY_BEHIND_SCALING)
                    

        for idx in range(ENTITIESMAX):
            e = read_game.cod7_entity.arr[idx]
            
            if e.type == ET_TURRET and e.alive & ALIVE_FLAG and keys["KEY_BOXESP"]:
                self.env.tracker.track_entity(idx)
                head_pos = VECTOR(e.pos.x, e.pos.y, e.pos.z + 20)       # eyepos of standing player
                feet = read_game.world_to_screen(e.pos)
                head = read_game.world_to_screen(head_pos)
                if feet and head:
                    size_y = feet.y - head.y
                    if size_y < 5:  size_y = 5
                    size_x = size_y / 2.75
                    draw_box(frame.line, feet.x - size_x/2, feet.y, size_x, -size_y, COLOR_BOX_OUTER_WIDTH, COLOR_SENTRY)
#                if e.owner_turret >= 0 and e.owner_turret < PLAYERMAX:
#                    self.env.tracker.track_entity(idx, e.owner_turret)
#                    if read_game.player[e.owner_turret].enemy:
#                        head_pos = VECTOR(e.pos.x, e.pos.y, e.pos.z + 20)       # eyepos of standing player
#                        feet = read_game.world_to_screen(e.pos)
#                        head = read_game.world_to_screen(head_pos)
#                        if feet and head:
#                            size_y = feet.y - head.y
#                            if size_y < 5:  size_y = 5
#                            size_x = size_y / 2.75
#                            draw_box(frame.line, feet.x - size_x/2, feet.y, size_x, -size_y, COLOR_BOX_OUTER_WIDTH, COLOR_SENTRY)

            if e.type == ET_EXPLOSIVE and e.alive & ALIVE_FLAG:
                self.track_explosive(idx)
            
            elif e.type == ET_VEHICLE and e.alive & ALIVE_FLAG:
                if weapon_names.get_weapon_model(e.weapon) == "rc_car_weapon_mp":      # RC-XD
                    self.env.tracker.track_rcxd(idx)

            elif (e.type == ET_HELICOPTER or e.type == ET_PLANE) and e.alive & ALIVE_FLAG and keys["KEY_BOXESP"]:
                # all planes are shown because we don't know if they are enemies                
                self.env.tracker.track_entity(idx)
                head_pos = VECTOR(e.pos.x, e.pos.y, e.pos.z + 100)
                feet = read_game.world_to_screen(e.pos)
                head = read_game.world_to_screen(head_pos)
                if feet and head:
                    size_y = feet.y - head.y
                    if size_y < 10:  size_y = 10
                    size_x = size_y
                    draw_box(frame.line, feet.x - size_x/2, feet.y, size_x, -size_y, COLOR_BOX_OUTER_WIDTH, COLOR_PLANE)
                    if keys["KEY_BOX_SNAPLINE"]:
                        draw_line_abs(frame.line, read_game.screen_center_x, read_game.resolution_y,
                              feet.x, feet.y, COLOR_BOX_LINE_WIDTH, COLOR_PLANE)
                        
#            elif (e.type == ET_HELICOPTER or e.type == ET_PLANE) and e.alive & ALIVE_FLAG and keys["KEY_BOXESP"]:
#                if e.owner_air >= 0 and e.owner_air < PLAYERMAX:
#                    self.env.tracker.track_entity(idx, e.owner_air)
#                    if e.type == ET_PLANE or read_game.player[e.owner_air].enemy:
#                        # all planes are shown because we don't know if they are enemies
#                        head_pos = VECTOR(e.pos.x, e.pos.y, e.pos.z + 100)       # eyepos of standing player
#                        feet = read_game.world_to_screen(e.pos)
#                        head = read_game.world_to_screen(head_pos)
#                        if feet and head:
#                            size_y = feet.y - head.y
#                            if size_y < 10:  size_y = 10
#                            size_x = size_y
#                            draw_box(frame.line, feet.x - size_x/2, feet.y, size_x, -size_y, COLOR_BOX_OUTER_WIDTH, COLOR_PLANE)
#                            if keys["KEY_BOX_SNAPLINE"]:
#                                draw_line_abs(frame.line, read_game.screen_center_x, read_game.resolution_y,
#                                      feet.x, feet.y, COLOR_BOX_LINE_WIDTH, COLOR_PLANE)
#
        if keys["KEY_DOGS_ESP"]:
            for idx in range(DOGSMAX):
                dog = read_game.cod7_dog.arr[idx]
                client_num = dog.client_num             # the entity number holding the dog
                if client_num > 0 and client_num < ENTITIESMAX:     # let's look the real entity
                    e = read_game.cod7_entity.arr[client_num]
                    if e.alive & ALIVE_FLAG:
                        if DEBUG:
                            print "Found living dog idx=%i, clientnum=%i, owner=%i, team=%i"
                            self.env.inspector.dump_entity(client_num)
                        self.env.tracker.track_dog(client_num)
                                    
        self.loop_tracked_explo()
Exemplo n.º 10
0
    def render(self):
        read_game = self.env.read_game
        frame = self.env.frame
        #if not read_game.is_in_game or not keys["KEY_INSPECTOR"]: return
        if keys["KEY_INSPECTOR"]: 
            for i in range(PLAYERMAX):
                print "Player #%i: %s" % (i, read_game.player[i].name)
            for idx in range(ENTITIESMAX):
                e = read_game.mw2_entity.arr[idx]
                spot = read_game.world_to_screen(e.pos)
                if spot:
                    cur_angle_dist = self.sq(spot.x - read_game.screen_center_x, spot.y - read_game.screen_center_y)
                    if cur_angle_dist < 50 * 50:      # not too far from center
                        s = "[idx=%i(%x), typ=%i, weap=%i]" % (idx, idx, e.type, e.WeaponNum)
                        draw_string_center(frame.font, spot.x, spot.y, 0xFFFFFFFF, s)
                        print s
                        print dump_obj(e)
#                        if e.owner_scr1 >= 0 and e.owner_scr1 < 2047:
#                            ee = read_game.mw2_entity.arr[e.owner_scr1]
#                            print "[idx=%i(%x), typ=%i, weap=%i]" % (e.owner_scr1, e.owner_scr1, ee.type, ee.WeaponNum)
#                            print dump_obj(ee)
#                        if e.owner_scr2 >= 0 and e.owner_scr2 < 2047:
#                            ee = read_game.mw2_entity.arr[e.owner_scr2]
#                            print "[idx=%i(%x), typ=%i, weap=%i]" % (e.owner_scr2, e.owner_scr2, ee.type, ee.WeaponNum)
#                            print dump_obj(ee)
                        #=======================================================
                        # if e.type == ET_EXPLOSIVE:
                        #    print "dump explo"
                        #    print dump_obj(e)
                        #=======================================================
        
        if keys["KEY_INSPECT_POS"]:                 # print my player's position
            pos = read_game.mw2_mypos
            print "pos= (%.2f, %.2f, %.2f)" % (pos.x, pos.y, pos.z)
            ang = read_game.view_angles
            print "angles= (%.2f, %.2f, %.2f)" % (ang.x, ang.y, ang.z)
        
        if keys["KEY_INSPECT_DUMP"]:                # dump some memory structures
            #mem = dumped()
            #read_game._RPM(0x6727F13, mem)
            #read_game._RPM(0x6727F10, mem)
            #print dump_obj(mem)
            #read_game._RPM(0x64DA350, mem)
            for i in range(8):
                print "player #%i" % i
                print dump_obj(read_game.mw2_entity.arr[i])
                print "client info"
                print dump_obj(read_game.mw2_clientinfo.arr[i])
            #del mem
        
        if keys["KEY_INSPECT_DUMP_PLAYERS"]:
            for i in range(PLAYERMAX):
                print "Player #%i: %s" % (i, read_game.player[i].name)
            #===================================================================
            # print "refdef"
            # print dump_obj(read_game.mw2_refdef)
            # print "viewy"
            # print dump_obj(read_game.mw2_viewy)
            #===================================================================
        
        if False and read_game.is_in_game:
            print "time=%8i, pos2=%.1f %.1f %.1f, pos3=%.1f %.1f %.1f" % (read_game.game_time,
                                                                         read_game.my_player.pos2.x,
                                                                         read_game.my_player.pos2.y,
                                                                         read_game.my_player.pos2.z,
                                                                         read_game.my_player.pos3.x,
                                                                         read_game.my_player.pos3.y,
                                                                         read_game.my_player.pos3.z,
                                                                         )
            
        if False and read_game.is_in_game:
            print "time=%8i, motion=%.1f %.1f %.1f, abs=%.1f" % (read_game.game_time,
                                                                         read_game.my_player.motion.x,
                                                                         read_game.my_player.motion.y,
                                                                         read_game.my_player.motion.z,
                                                                         read_game.my_player.motion.length()
                                                                         )
        if False:
            for e in read_game.mw2_entity.arr:
                if e.type == ET_EXPLOSIVE and e.alive & ALIVE_FLAG:
                    print "time=%8i, pos=%.1f %.1f %.1f" % (read_game.game_time,
                                                                                 e.pos.x,
                                                                                 e.pos.y,
                                                                                 e.pos.z,
                                                                                 )
        if False and read_game.is_in_game:
            print "kills=%i, deaths=%i" % (read_game.kills, read_game.deaths)
                                          
        if False and read_game.is_in_game:
            print "weapon=%i" % read_game.my_player.weapon_num
            
        if keys["KEY_INSPECT_MOVE_MOUSE"]:
            self.env.sched.new(self.move_sequence())