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

[INFO] Fakemeta & Ham detailed function descriptions and examples


Post New Thread Reply   
 
Thread Tools Display Modes
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 09-11-2009 , 15:51   Re: [INFO] Fakemeta & Ham detailed function descriptions and examples
Reply With Quote #61

I don't understand what you mean. The file is on the CLIENT and material is defined corresponding the texture in this file ONLY. DLLFunc_PM_FindTextureType called on client. Meaning if you use an unknow texture not listed, the material will bon concrete by default.
__________________

Last edited by Arkshine; 09-11-2009 at 15:53.
Arkshine is offline
ot_207
Veteran Member
Join Date: Jan 2008
Location: Romania The Love Country
Old 09-11-2009 , 15:55   Re: [INFO] Fakemeta & Ham detailed function descriptions and examples
Reply With Quote #62

Quote:
Originally Posted by Arkshine View Post
I don't understand what you mean. The file is on the CLIENT and material is defined corresponding the texture in this file ONLY. DLLFunc_PM_FindTextureType called on client. Meaning if you use an unknow texture not listed, the material will bon concrete by default.
Than why does the function not have dllfunc(DLLFunc_PM_FindTextureType, texture_name, player_id) ??????
__________________
My approved plug-ins | Good for newbies! | Problems?

Back, will come around when I have time.
ot_207 is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 09-11-2009 , 16:00   Re: [INFO] Fakemeta & Ham detailed function descriptions and examples
Reply With Quote #63

What. Why are you talking about player id ? lol I think, when the game is loading, it reads the file and loading in memory.

Code:
void PM_InitTextureTypes() {     char buffer[512];     int i, j;     byte *pMemFile;     int fileSize, filePos;     static qboolean bTextureTypeInit = false;     if ( bTextureTypeInit )         return;     memset(&(grgszTextureName[0][0]), 0, CTEXTURESMAX * CBTEXTURENAMEMAX);     memset(grgchTextureType, 0, CTEXTURESMAX);     gcTextures = 0;     memset(buffer, 0, 512);     fileSize = pmove->COM_FileSize( "sound/materials.txt" );     pMemFile = pmove->COM_LoadFile( "sound/materials.txt", 5, NULL );     if ( !pMemFile )         return;     filePos = 0;     // for each line in the file...     while ( pmove->memfgets( pMemFile, fileSize, &filePos, buffer, 511 ) != NULL && (gcTextures < CTEXTURESMAX) )     {         // skip whitespace         i = 0;         while(buffer[i] && isspace(buffer[i]))             i++;                 if (!buffer[i])             continue;         // skip comment lines         if (buffer[i] == '/' || !isalpha(buffer[i]))             continue;         // get texture type         grgchTextureType[gcTextures] = toupper(buffer[i++]);         // skip whitespace         while(buffer[i] && isspace(buffer[i]))             i++;                 if (!buffer[i])             continue;         // get sentence name         j = i;         while (buffer[j] && !isspace(buffer[j]))             j++;         if (!buffer[j])             continue;         // null-terminate name and save in sentences array         j = min (j, CBTEXTURENAMEMAX-1+i);         buffer[j] = 0;         strcpy(&(grgszTextureName[gcTextures++][0]), &(buffer[i]));     }     // Must use engine to free since we are in a .dll     pmove->COM_FreeFile ( pMemFile );     PM_SortTextures();     bTextureTypeInit = true; }

Code:
char PM_FindTextureType( char *name ) {     int left, right, pivot;     int val;     assert( pm_shared_initialized );     left = 0;     right = gcTextures - 1;     while ( left <= right )     {         pivot = ( left + right ) / 2;         val = strnicmp( name, grgszTextureName[ pivot ], CBTEXTURENAMEMAX-1 );         if ( val == 0 )         {             return grgchTextureType[ pivot ];         }         else if ( val > 0 )         {             left = pivot + 1;         }         else if ( val < 0 )         {             right = pivot - 1;         }     }     return CHAR_TEX_CONCRETE; }

PM_FindTextureType is a client-side function.
__________________
Arkshine is offline
ot_207
Veteran Member
Join Date: Jan 2008
Location: Romania The Love Country
Old 09-11-2009 , 16:04   Re: [INFO] Fakemeta & Ham detailed function descriptions and examples
Reply With Quote #64

Then why doesn't it have the player_id in the arguments?
So that the server will now what material to look at.
__________________
My approved plug-ins | Good for newbies! | Problems?

Back, will come around when I have time.
ot_207 is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 09-11-2009 , 16:11   Re: [INFO] Fakemeta & Ham detailed function descriptions and examples
Reply With Quote #65

Player has nothing to do here. Textures/materials stuff is done by the client, not server. ( like you can see the file is read when you load the game ). DLLFunc_PM_FindTextureType calls just PM_FindTextureType function on the client. I don't know how to explain properly sorry. lol. For sure sounds are played by player. If you modify the materials.txt file on your pc, removing all the textures, it will play always the concrete sound only for you. What you you need to understand is the material is found by checking the texture name in this file.
__________________
Arkshine is offline
ot_207
Veteran Member
Join Date: Jan 2008
Location: Romania The Love Country
Old 09-11-2009 , 16:15   Re: [INFO] Fakemeta & Ham detailed function descriptions and examples
Reply With Quote #66

Quote:
Originally Posted by Arkshine View Post
Player has nothing to do here. Textures/materials stuff is done by the client, not server. ( like you can see the file is read when you load the game ). DLLFunc_PM_FindTextureType calls just PM_FindTextureType function on the client. I don't know how to explain properly sorry. lol. For sure sounds are played by player. If you modify the materials.txt file on your pc, removing all the textures, it will play always the concrete sound only for you. What you you need to understand is the material is found by checking the texture name in this file.
I understand that each material is what affects the client but normally the return values should only depend on the server map and server materials.txt and only that! In this situation you are right that the sounds are client side!
__________________
My approved plug-ins | Good for newbies! | Problems?

Back, will come around when I have time.

Last edited by ot_207; 09-11-2009 at 16:18.
ot_207 is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 09-11-2009 , 16:22   Re: [INFO] Fakemeta & Ham detailed function descriptions and examples
Reply With Quote #67

Quote:
only depend on the server map and server materials.txt
It does already that !! Depending the texture used for the map and the texture listed by default in materials.txt you will get the right material or the default one.

[Edit] Ahhh "server". Sorry. Well there is probably a good reason for that.
__________________

Last edited by Arkshine; 09-11-2009 at 16:50.
Arkshine is offline
ot_207
Veteran Member
Join Date: Jan 2008
Location: Romania The Love Country
Old 09-15-2009 , 13:33   Re: [INFO] Fakemeta & Ham detailed function descriptions and examples
Reply With Quote #68

Fakemeta function:
PHP Code:
EngFunc_EntitiesInPVS 
Description:
This function checks entities that are in the PVS of an entity.
It can be used on all entities except worldspawn!

What is PVS?
PVS means potentially visible set, this means that the entities that we have in this list can be seen.
PVS does not hold just the entities that we see!
By knowing this we can get to the conclusion that PVS has the role of limiting data transfer for better internet connection/lower amount of data transfer!

So in small words I want to say something like this:
Code:
Entity that is in PVS => Can be seen => Data Transfer about that entity
Entity that it is not in PVS => Can not be seen => No data transfer => Save bandwidth
How does it work?
Well let's say that every room of the map is a cube.
We find ourselves in a room and that also means that we are in the cube of that room.
We can see the entities in the next rooms because the cubes of that room touch with the cube of the room we are in.

How do I use this function?
Well this function doesn't work like EngFunc_FindEntityInSphere so the HL engine has another method of providing the information.
At first this function returns a start entity and after that we can find the next entity using pev_chain/EV_ENT_chain. And so on, untill pev_chain is NULL.

Example Usage:
PHP Code:
public whatisonPVS(id)
{
    static 
nextchain
    
static class[32]
    
    
next engfunc(EngFunc_EntitiesInPVSid)
    while(
next)
    {
        
pev(nextpev_classname, class, charsmax(class))
        
chain pev(nextpev_chain)
        
        
server_print("Found entity in player (%i) PVS: ent(%i) class(%s)"idnext, class)
        
        if(!
chain)
            break
    
        
next chain
    
}

__________________
My approved plug-ins | Good for newbies! | Problems?

Back, will come around when I have time.

Last edited by ot_207; 09-15-2009 at 13:40.
ot_207 is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 09-15-2009 , 13:37   Re: [INFO] Fakemeta & Ham detailed function descriptions and examples
Reply With Quote #69

Please indent the code properly.
__________________
Arkshine is offline
ot_207
Veteran Member
Join Date: Jan 2008
Location: Romania The Love Country
Old 09-15-2009 , 13:41   Re: [INFO] Fakemeta & Ham detailed function descriptions and examples
Reply With Quote #70

Quote:
Originally Posted by Arkshine View Post
Please indent the code properly.
Done
__________________
My approved plug-ins | Good for newbies! | Problems?

Back, will come around when I have time.
ot_207 is offline
Reply



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 16:37.


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