Raised This Month: $12 Target: $400
 3% 

fakemeta forward FM_CheckVisibility


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
mrshark45
Member
Join Date: Jan 2016
Old 12-15-2019 , 13:54   fakemeta forward FM_CheckVisibility
Reply With Quote #1

Hey, can someone explain to me what FM_CheckVisibility does, returns and what parameters does it have. I'm modifying a plugin that uses that to render entities when you spectate a bot, the bot position is {8192, 8192, 8192} and I set his view velocity, view position and view angles in FM_AddToFullPack and when a player spectates it the entities on the map doesn't render so the guy who made it used FM_CheckVisibility to render all the entities everytime , and it does a lot of lag, fps drop 150-200.
How can I render entities that are around the view position of the bot only for the players spectating it.
FM_AddToFullPack
PHP Code:
public fw_addtofullpack(es_handle,e,ent,host,hostflags,player,pSet)
{
    if(
global_bot == host)
    {        
        return 
FMRES_IGNORED;
    }
    
    if(
player)
    {        
        if(
ArraySize(bot_sources[plr_source[host]][source_array]) > plr_frame_it[host])
        if(
global_bot == ent && sources_num)
        {
            new 
Float:origin[2][3];
            
pev(hostpev_originorigin[0]);
            
xs_vec_copy(ghost_data[host][frame_origin], origin[1]);
            new 
spec pev(hostpev_iuser2);
            if(
spec && spec != ent)
            {
                
ghost_data[host] = ghost_data[spec];
            }    
            
set_es(es_handleES_Velocityghost_data[host][frame_velocity]);
            
ghost_data[host][frame_angles][0] /= -3.0;
            new 
bool:onground ghost_data[host][frame_velocity][2] == 0.0 true false
            animate_legs
(es_handleghost_data[host][frame_buttons], onground);
            
set_es(es_handleES_Anglesghost_data[host][frame_angles]);
            
set_es(es_handleES_Originghost_data[host][frame_origin]);                
            
set_es(es_handleES_SolidSOLID_NOT);
            
// fix ugly sequence
            
set_es(es_handleES_Sequence 75);
            
set_es(es_handleES_RenderModekRenderTransAdd);            
            
set_es(es_handleES_RenderFxkRenderFxSolidFast0);            
            
//set_es(es_handle, ES_RenderFx, kRenderFxSolidSlow, 0);            
            
set_es(es_handleES_RenderAmtfloatround(get_distance_f(origin[0], origin[1]) * 255.0 360.0floatround_floor));
            
//return FMRES_SUPERCEDE;
        
}
    }
    
    return 
FMRES_IGNORED;

FM_CheckVisibility
PHP Code:
public checkVisibility(id,pset){
        
forward_return(FMV_CELL1);    
        return 
FMRES_SUPERCEDE;

and I'm trying to do something like this, but not for all players
PHP Code:
public checkVisibility(id,pset){
    if(
id){
        
//pev(id, pev_origin, entityOrigin);
        
for(new 033i++){
            if(
is_user_connected(i) && cs_get_user_team(i) == CS_TEAM_SPECTATOR){
                
xs_vec_copy(ghost_data[i][frame_origin], playerOrigin);
                
distance floatsqroot(floatpower(entityOrigin[0] - playerOrigin[0], 2.0)+floatpower(entityOrigin[1] - playerOrigin[1], 2.0)+floatpower(entityOrigin[2] - playerOrigin[2], 2.0))
                
distance get_distance_f(entityOriginplayerOrigin);
                if(
distance 2000.0){
                    
forward_return(FMV_CELL1);    
                    return 
FMRES_SUPERCEDE;    
                }
            }
        }
        
    }
    return 
FMRES_IGNORED;

mrshark45 is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 06:16.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode