Skip to content

Conversation

A1mDev
Copy link

@A1mDev A1mDev commented Oct 19, 2025

Description:

  • The actual size of CTakeDamageInfo is 96 bytes.

  • Updated CTakeDamageInfo to include new class fields (m_flRadius and m_iDamageVictimIndex) for clarity and future compatibility.

  • Existing hooks remain fully compatible.

  • Crashes in SourceMod do not occur due to an incorrect stack, because the structure is always passed by reference or pointer.

  • Updating the structure is recommended for cases where manual access to all fields or other special use cases is required.

DataMap CTakeDamageInfo:

.data:00F096A0                               ; datamap_t * DataMapInit<CTakeDamageInfo>(CTakeDamageInfo *)::dataDesc
.data:00F096A0 00                            _ZZ11DataMapInitI15CTakeDamageInfoEP9datamap_tPT_E8dataDesc db    0
.data:00F096E4 82 EE C0 00                                   dd offset aMVecdamageforc ; "m_vecDamageForce"
.data:00F096E8 00                                            db    0
.data:00F09724 93 EE C0 00                                   dd offset aMVecdamageposi ; "m_vecDamagePosition"
.data:00F09728 0C                                            db  0Ch
.data:00F09764 A7 EE C0 00                                   dd offset aMVecreportedpo ; "m_vecReportedPosition"
.data:00F09768 18                                            db  18h
.data:00F097A4 BD EE C0 00                                   dd offset aMHinflictor  ; "m_hInflictor"
.data:00F097A8 30                                            db  30h ; 0
.data:00F097E4 CA EE C0 00                                   dd offset aMHattacker   ; "m_hAttacker"
.data:00F097E8 34                                            db  34h ; 4
.data:00F09824 46 9E BF 00                                   dd offset aMHweapon     ; "m_hWeapon"
.data:00F09828 38                                            db  38h ; 8
.data:00F09864 56 8E BF 00                                   dd offset aMFldamage    ; "m_flDamage"
.data:00F09868 3C                                            db  3Ch ; <
.data:00F098A4 D6 EE C0 00                                   dd offset aMFlmaxdamage ; "m_flMaxDamage"
.data:00F098A8 40                                            db  40h ; @
.data:00F098E4 E4 EE C0 00                                   dd offset aMFlbasedamage ; "m_flBaseDamage"
.data:00F098E8 44                                            db  44h ; D
.data:00F09924 F3 EE C0 00                                   dd offset aMBitsdamagetyp ; "m_bitsDamageType"
.data:00F09928 48                                            db  48h ; H
.data:00F09964 04 EF C0 00                                   dd offset aMIdamagecustom ; "m_iDamageCustom"
.data:00F09968 4C                                            db  4Ch ; L
.data:00F099A4 14 EF C0 00                                   dd offset aMIdamagestats ; "m_iDamageStats"
.data:00F099A8 50                                            db  50h ; P
.data:00F099E4 23 EF C0 00                                   dd offset aMIammotype   ; "m_iAmmoType"
.data:00F099E8 54                                            db  54h ; T
.data:00F09A24 02 BB BF 00                                   dd offset aMFlradius    ; "m_flRadius"
.data:00F09A28 58                                            db  58h ; X
.data:00F09A64 2F EF C0 00                                   dd offset aMIdamagevictim ; "m_iDamageVictimIndex"
.data:00F09A68 5C                                            db  5Ch ; \

Screen from game library:
Screen 2025-10-19 191403

Verification:

  • The sourcemod was successfully built using the updated hl2sdk-l4d2.

…of the structure is 96 bytes.

- Updated `CTakeDamageInfo` to include new class fields (`m_flRadius` and `m_iDamageVictimIndex`) for clarity and future compatibility.

- Existing hooks remain fully compatible.

- Crashes in SourceMod do not occur due to an incorrect stack, because the structure is always passed by reference or pointer.

- Updating the structure is recommended for cases where manual access to all fields or other special use cases is required.
Copy link
Member

@psychonic psychonic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@psychonic psychonic merged commit 8f881e2 into alliedmodders:l4d2 Oct 19, 2025
@A1mDev A1mDev deleted the l4d2_takedamage branch October 19, 2025 19:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants