Reminder: Internet Explorer 6 or below are NOT supported.





There are currently 79 users playing Freelancer on
40 servers. | April. 19, 2021 |
The Starport Forum Index
>
The Shipyard
>
Speciality Modding
>
FLHook Development
>
HkCb_GeneralDmg not called on shield damage?
Browsing this Thread:
1 Anonymous Users
HkCb_GeneralDmg not called on shield damage? |
||||
---|---|---|---|---|
Starport Admin
![]() ![]() Joined:
2009/2/21 21:42 Group:
Webmasters Registered Users
Posts:
3520
![]() |
I'll have to say I'm somewhat surprised by this but apparently Hook's HkCb_GeneralDmg is only called when hull damage happens; shield damage is completely ignored. HkCb_AddDmgEntry however is called on every damage taken, which means iDmgTo is invalid for shield damage.
Now, that part of Hook has always looked like a giant hack, what with having to hook three separate locations (0x6D653F4, 0x6D672CC and 0x6D6761C) with the code to determine the object handled by HkCb_AddDmgEntry... Is there a fourth location missing, or is there a more direct way of obtaining the object being damaged directly in HkCb_AddDmgEntry?
Posted on: 2015/4/21 2:16
|
|||
"Cynicism is not realistic and tough. It's unrealistic and kind of cowardly because it means you don't have to try." -Peggy Noonan |
||||
|
Re: HkCb_GeneralDmg not called on shield damage? |
||||
---|---|---|---|---|
Just can't stay away
![]() ![]() Joined:
2008/6/16 20:41 Group:
Registered Users FLServer Admins Trusted Speciality Developers
Posts:
312
![]() |
Isnt there the DamageList which you could use to obtain from whom the damge comes and who is suffering the damage?
Not sure why those global dmgto stuff is used there... Or is that not your question?
Posted on: 2015/4/21 17:52
|
|||
![]() |
||||
|
Re: HkCb_GeneralDmg not called on shield damage? |
||||
---|---|---|---|---|
Starport Admin
![]() ![]() Joined:
2009/2/21 21:42 Group:
Webmasters Registered Users
Posts:
3520
![]() |
DamageList does not contain the object ID of what is being damaged.
Posted on: 2015/4/21 18:10
|
|||
"Cynicism is not realistic and tough. It's unrealistic and kind of cowardly because it means you don't have to try." -Peggy Noonan |
||||
|
Re: HkCb_GeneralDmg not called on shield damage? |
||||
---|---|---|---|---|
Just can't stay away
![]() ![]() Joined:
2008/6/16 20:41 Group:
Registered Users FLServer Admins Trusted Speciality Developers
Posts:
312
![]() |
HM could you get the CShip anywhere from this entry? It contains
struct IObjRW * get_target(void)const ; I am just thinking if this could be away, although i dont know how to get the CShip Object. And there is IObjInspectImpl* HkGetInspect (uint x_uiClientID) or typedef bool (__cdecl *_GetShipInspect)(uint &x_ruiShip, IObjInspectImpl* &inspect, uint &x_ruiDunno) But i suspect thats not what your are looking for. At least in the last case the x_ruiShipId can be retrieved from the DamageList as far as i understand it.
Posted on: 2015/4/21 18:33
|
|||
![]() |
||||
|
Re: HkCb_GeneralDmg not called on shield damage? |
||||
---|---|---|---|---|
Starport Admin
![]() ![]() Joined:
2009/2/21 21:42 Group:
Webmasters Registered Users
Posts:
3520
![]() |
I want to know the ship or solar being damaged. None of those can give me this. You don't know the client ID of the player being damaged, so HkGetInspect/_GetShipInspect is pointless. Assuming that the attacker's target is always what is being damaged is wrong in so many cases it's not worth considering.
EDIT: In an ideal world we'd be able to have a mapping of DamageList to object and vice-versa, but it doesn't look like the DamageList is stored in a CEqObj or IObjInspectImpl* and I'm not even sure if a singular DamageList is used, or rather a sequence of small ones.
Posted on: 2015/4/21 18:40
|
|||
"Cynicism is not realistic and tough. It's unrealistic and kind of cowardly because it means you don't have to try." -Peggy Noonan |
||||
|
Re: HkCb_GeneralDmg not called on shield damage? |
||||
---|---|---|---|---|
Home away from home
![]() ![]() Joined:
2009/8/16 2:58 From Qld, Aus.
Group:
Registered Users FLServer Admins Trusted Speciality Developers Senior Members
Posts:
1985
![]() |
It looks like shield damage is handled at 6CEA740, so I think you just need to add additional calls to HkCb_GeneralDmg at 6D65458, 6D67330 & 6D67680.
Posted on: 2015/4/22 2:55
|
|||
|
Re: HkCb_GeneralDmg not called on shield damage? |
||||
---|---|---|---|---|
Starport Admin
![]() ![]() Joined:
2009/2/21 21:42 Group:
Webmasters Registered Users
Posts:
3520
![]() |
After a bit of integration work, it seems to be working exactly as expected! All shield hits now trigger HkCb_GeneralDmg and I've committed the changes to the SVN for anyone who'd like to have that functionality as well. As usual, adoxa, you save me
![]() Now all I need to figure out is the damage's source so I can trace back the munition archetype. EDIT: From what I can tell, it would appear that the damage has already been applied by the time 6CEA740 or its equivalent hull function are called, so in order to find the projectile that did the damage I'd probably need to trace back the munitions earlier. Player beam hits (I only really care about beams) can be traced using MunitionCollision events, but NPC beam hits are harder (I'm guessing they'd be found somewhere in PhySys::GenerateCollisions(CBeam*)) and matching the beams with the GeneralDmg call would be quite tricky.
Posted on: 2015/4/22 5:26
|
|||
"Cynicism is not realistic and tough. It's unrealistic and kind of cowardly because it means you don't have to try." -Peggy Noonan |
||||
|