View Single Post
Re: Hooking into HL2 DLL ?
Old
  (#28)
Cheeseh
[rcbot]
 
Cheeseh's Avatar
 
Status: Offline
Posts: 361
Join Date: Dec 2003
Location: China
Default Re: Hooking into HL2 DLL ? - 18-01-2005

botmans method is this ...

PHP Code:

void CBot 
:: runPlayerMove()
{
    static 
CUserCmd cmd;
    static 
bf_write write_buf;
    static 
bf_read read_buf;
    static 
unsigned char buffer[CMD_BUFFER_SIZE];  // shared buffer between write_buf and read_buf (EVIL!!!)

    //////////////////////////////////
    
memset(&cmd0sizeof(cmd));
    
//////////////////////////////////
    
cmd.forwardmove m_fForwardSpeed;
    
cmd.sidemove m_fSideSpeed;
    
cmd.upmove m_fUpSpeed;
    
cmd.buttons m_iButtons;
    
cmd.impulse m_iImpulse;
    
cmd.viewangles m_vViewAngles;

    
// SteveC:
    // this changes the fixangle from absolute (which isn't coded for) to none
    // note: has to be run here because it doesn't work in the addbot routine?!?!?
    
m_pBaseEdict->PlayerData()->fixangle FIXANGLE_NONE;
    
    
//////////////////////////////////
    
write_buf.StartWritingbufferCMD_BUFFER_SIZE );
    
WriteUsercmd( &write_buf, &cmd );  // by magic the same data appears in the read_buf!!!
    
read_buf.StartReadingbufferCMD_BUFFER_SIZE );  // this is truly EVIL!!!
    
gameclients->ProcessUsercmds(m_pEdict, &read_buf110falsefalse);
    
//////////////////////////////////

it still works, but as said before (again ) SteveC's CBasePlayer->ProcessUserCmds doesn't work anymore
  
Reply With Quote