-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
helper_functions: added IsPlayer and Center own implementations to not rely on hooked virtual functions #540
base: master
Are you sure you want to change the base?
Conversation
…ntity is a player
…d with its own function
…with its own function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you want an answer, is it really necessary to overloading the same function first with each individual argument, and then only with edict_t as an argument?
Makes sense
if (!(ent->v.flags & FL_CLIENT)) | ||
return false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd move this above the strcmp because it's a much cheaper check.
void *pToucher = pevToucher->pContainingEntity->pvPrivateData; | ||
_IsPlayer IsPlayerFunc = *reinterpret_cast<_IsPlayer *>(*reinterpret_cast<uintptr_t *>(pToucher) + offFuncIsPlayer); | ||
if (!IsPlayerFunc(pToucher)) | ||
if (!helper_functions::IsPlayer(pevToucher->pContainingEntity)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd squash this commit into the previous one
|
||
Vector playerCenter; | ||
Vector inflictorCenter; | ||
entvars_t *pev = *reinterpret_cast<entvars_t**>(reinterpret_cast<uintptr_t>(thisptr) + 4); // _Smiley: TODO: replace it with GET_PEV macro once it's merged. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same, I'd squash. And now you can GET_PEV too
If you want an answer, is it really necessary to overloading the same function first with each individual argument, and then only with
edict_t
as an argument? I'll answer yes, because it solves two issues at once:edict_t
: you can simply give only the edict as input, and the rest the function will do everything for you, wonderful, isn’t it?edict_t
Also In case someone wants to merge it if I would inactive for a while: simply rebase to the latest master as soon as #531 is merged to solve the build errors