Raised This Month: $ Target: $400
 0% 

NPC in CS:S


Post New Thread Reply   
 
Thread Tools Display Modes
TheKiwI
Member
Join Date: May 2011
Old 05-04-2011 , 12:32   Re: NPC in CS:S
Reply With Quote #41

Can't wait for linux version !
TheKiwI is offline
raydan
Senior Member
Join Date: Aug 2006
Old 05-05-2011 , 23:51   Re: NPC in CS:S
Reply With Quote #42

if berni dump CAI_BaseNPC virtual offset for windows are much more helpful

And there are some problem in windows offset
Code:
463    CAI_BaseNPC::OnCalcBaseMove(AILocalMoveGoal_t *,float,AIMoveResult_t *)
464    CAI_BaseNPC::OnObstructionPreSteer(AILocalMoveGoal_t *,float,AIMoveResult_t *)
these 2 offsets in windows become 567, 568. how possible?

calling 463 offset will jump to
Code:
text:10051B70                         nullsub_2       proc near               ; CODE XREF: sub_1001E170+E9p
.text:10051B70                                                                 ; sub_1001F270+1Aj ...
.text:10051B70 C3                                      retn
.text:10051B70                         nullsub_2       endp
anyone know?
raydan is offline
miniman
Senior Member
Join Date: Aug 2009
Location: Israel
Old 05-06-2011 , 06:26   Re: NPC in CS:S
Reply With Quote #43

Quote:
Originally Posted by raydan View Post
if berni dump CAI_BaseNPC virtual offset for windows are much more helpful

And there are some problem in windows offset
Code:
463    CAI_BaseNPC::OnCalcBaseMove(AILocalMoveGoal_t *,float,AIMoveResult_t *)
464    CAI_BaseNPC::OnObstructionPreSteer(AILocalMoveGoal_t *,float,AIMoveResult_t *)
these 2 offsets in windows become 567, 568. how possible?

calling 463 offset will jump to
Code:
text:10051B70                         nullsub_2       proc near               ; CODE XREF: sub_1001E170+E9p
.text:10051B70                                                                 ; sub_1001F270+1Aj ...
.text:10051B70 C3                                      retn
.text:10051B70                         nullsub_2       endp
anyone know?
I have a different picture here
Code:
456	CAI_BaseNPC::OverrideMove(float)
457	CAI_BaseNPC::OverrideMoveFacing(AILocalMoveGoal_t  const&,float)
458	CAI_BaseNPC::IsUnusableNode(int,CAI_Hint *)
459	CAI_BaseNPC::ValidateNavGoal(void)
460	CAI_BaseNPC::IsCurTaskContinuousMove(void)
461	CAI_BaseNPC::IsValidMoveAwayDest(Vector  const&)
462	CAI_BaseNPC::OnMovementFailed(void)
463	CAI_BaseNPC::OnMovementComplete(void)
464	CAI_BaseNPC::IsUnreachable(CBaseEntity *)
465	CAI_BaseNPC::CalcYawSpeed(void)
466	CAI_BaseNPC::OnCalcBaseMove(AILocalMoveGoal_t *,float,AIMoveResult_t *)
467	CAI_BaseNPC::OnObstructionPreSteer(AILocalMoveGoal_t *,float,AIMoveResult_t *)
468	CAI_BaseNPC::OnObstructingDoor(AILocalMoveGoal_t *,CBaseDoor *,float,AIMoveResult_t *)
469	CAI_BaseNPC::OnUpcomingPropDoor(AILocalMoveGoal_t *,CBasePropDoor *,float,AIMoveResult_t *)
470	CAI_BaseNPC::GetNodeViewOffset(void)
miniman is offline
raydan
Senior Member
Join Date: Aug 2006
Old 05-06-2011 , 12:20   Re: NPC in CS:S
Reply With Quote #44

tested 465,466,467
465 & 467 will got run-time check failure

466 will call 0x1002A150 and the code are not same as self compile orangebox server.dll (100% different)
raydan is offline
miniman
Senior Member
Join Date: Aug 2009
Location: Israel
Old 05-07-2011 , 04:12   Re: NPC in CS:S
Reply With Quote #45

Quote:
Originally Posted by raydan View Post
tested 465,466,467
465 & 467 will got run-time check failure

466 will call 0x1002A150 and the code are not same as self compile orangebox server.dll (100% different)
the vtable is completely different on windows we will have hard time finding this function
miniman is offline
raydan
Senior Member
Join Date: Aug 2006
Old 05-09-2011 , 00:58   Re: NPC in CS:S
Reply With Quote #46

when will CEntity support custom entity keyvalues, i working on npc_template_maker, need custom entity parse correct values
raydan is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 05-09-2011 , 01:18   Re: NPC in CS:S
Reply With Quote #47

Quote:
Originally Posted by raydan View Post
when will CEntity support custom entity keyvalues
  1. Posting CEntity questions in the CEntity thread makes a lot more sense.
  2. When someone writes it. If you do it, just send me a patch and I'll look it over and add it.
__________________
asherkin is offline
raydan
Senior Member
Join Date: Aug 2006
Old 05-09-2011 , 03:55   Re: NPC in CS:S
Reply With Quote #48

Quote:
Originally Posted by asherkin View Post
  1. Posting CEntity questions in the CEntity thread makes a lot more sense.
  2. When someone writes it. If you do it, just send me a patch and I'll look it over and add it.
i try yo make it work, i detour "ParseKeyValue" function.
but it look like overwrite some invalid address in some where
raydan is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 05-09-2011 , 04:19   Re: NPC in CS:S
Reply With Quote #49

Quote:
Originally Posted by predcrab
Datamaps are so incredibly wrong, it's past being not funny and it's funny again
For normal entity the declare datamap macros calculate the offset from CBaseEntity* to the field
and store this offset
when you request a datamap it takes the thisptr, adds the offset and away we go
By adding the same macros into your custom class, the offsets are generated between CEntity* and the prop
yet at lookup time it's added to the thisptr, CBaseEntity
so your test code looks like it's working, but its just modifying random memory on the valve entity
not the var in the CEntity
use a debugger to break and check if you want
The fix shouldn't be too hard
change the datamap creation code to build its own chain of datamap blocks, and not inject them into the valve list
then reimplement (ie copy) the datamap search code from CBE::AcceptInput() into CE:AcceptInput()
__________________
asherkin is offline
raydan
Senior Member
Join Date: Aug 2006
Old 05-09-2011 , 04:31   Re: NPC in CS:S
Reply With Quote #50

i know Input & output problems, my i fix is

Code:
void TheClass::InputSpawnMultiple( inputdata_t &inputdata )
{
    TheClass*ptr = ((TheClass *)CEntity::Instance(reinterpret_cast<CBaseEntity *>(this)));
    ptr->MakeMultipleNPCS( inputdata.value.Int() );
}

The keyvalue fix code? i still working on it
Code:
DETOUR_DECL_STATIC5(ParseKeyValue, bool, void *, pObject, typedescription_t *, pFields, int, iNumFields, const char *, szKeyName, const char *, szValue)
{
    if(entity_keyvalue)
    {
        CEntity *cent = CEntity::Instance((CBaseEntity *)pObject);
        entity_keyvalue = false;
        if(cent && cent->IsCustomEntity())
        {
            bool ret = false;
            datamap_t *dmap = NULL;
            for ( dmap = cent->GetDataDescMap(); dmap != NULL; dmap = dmap->baseMap )
            {
                if(strcmp(dmap->dataClassName,"CEntity") == 0)
                {
                    break;
                }

                ret = ParseKeyvalue(cent, dmap->dataDesc, dmap->dataNumFields, szKeyName, szValue);
                if(ret)
                    return true;
            }
            
            if(dmap == NULL)
                return true;

            for ( dmap = dmap->baseMap; dmap != NULL; dmap = dmap->baseMap )
            {
                ret = DETOUR_STATIC_CALL(ParseKeyValue)(pObject, dmap->dataDesc, dmap->dataNumFields, szKeyName,szValue);
                if(ret)
                    return true;
            }
            //datamap_t *map = cent->GetDataDescMap();
            //bool ret = ParseKeyvalue(cent, pFields, iNumFields, szKeyName,szValue);
            //if(!ret)
            //{
                //entity_keyvalue = true;
            //    ret = DETOUR_STATIC_CALL(ParseKeyValue)(pObject, pFields, iNumFields, szKeyName,szValue);
            //}
            return true;
        }
    }

    return DETOUR_STATIC_CALL(ParseKeyValue)(pObject, pFields, iNumFields, szKeyName,szValue);
}
raydan 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 02:34.


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