Skip to content

docs: overhaul Pawn include documentation - #395

Open
Nord1cWarr1or wants to merge 9 commits into
rehlds:masterfrom
Nord1cWarr1or:docs/include-docs-overhaul
Open

Nord1cWarr1or wants to merge 9 commits into
rehlds:masterfrom
Nord1cWarr1or:docs/include-docs-overhaul

Conversation

@Nord1cWarr1or

@Nord1cWarr1or Nord1cWarr1or commented Sep 13, 2026 •

Copy link
Copy Markdown
Member

🖤

Purpose

The Pawn includes had drifted from the C++ they document: wrong return types and parameter names, misspelled constants (ITDB_* should be ITBD_* per basemonster.h), whole constant families missing. This PR is a full documentation pass over the include layer, plus a CS-filtered expansion of cssdk_const.inc and a Reunion constants split.

No module behavior is changed — the only C++ edits are doc comments in natives_*.cpp. Existing enum members are not shifted anywhere, so old compiled plugins are unaffected, with two intentional renames noted below.

Approach

1. Engine layer (reapi_engine.inc, reapi_engine_const.inc)

  • added the missing Return type: for RH_GetEntityInit and RH_SV_CheckUserInfo
  • fixed factual errors: get_ucmd (usercmd handle, not entity), get_key_value_buffer (returns cell count), rh_get_client_connect_time (@error instead of a soft 0), Is/ResetModifiedMessageData (MsgIndex → MsgMsgId, -1 argument rules), net_remote_address setter marked not implemented (mutate via set_netadr)
  • new SND_EMIT2_USE_ORIGIN define; ~20 typo/copy-paste doc fixes (lenght, metchan, mvar params, message_const.inc reference, etc.)

2. cssdk_const.inc — rework and expansion

Renames (breaking for out-of-tree plugins that used the old spellings; in-tree usage checked — none):

  • ITDB_* → ITBD_* (plus NERVE_GAS/DROWN_RECOVER/SLOW_BURN/SLOW_FREEZE underscores) — per C++ basemonster.h
  • SHIELDREN_* → SHIELDGREN_* — per real game code (wpn_shared/)

Alias (non-breaking): DMG_EXPLOSION added next to DMG_GRENADE (the ReGameDLL name of the bit).

New constants — each verified against ReGameDLL/ReHLDS headers and checked for in-game consumers; the name-collision sweep vs amxmodx core and reapi includes is clean:

  • item flags: ITEM_FLAG_EXHAUST_SECONDARYAMMO, ITEM_FLAG_CUSTOM
  • player: PLAYER_PREVENT_DDUCK, IN_ACTIVE, ThrowDirection, PlayerIdShowHealth, PlayerIdField
  • game rules: RewardAccount, PaybackForBadThing, SCENARIO_BLOCK_*, DefuserAllocation, CS_KILLS_FOR_DOMINATION
  • weapons: WeaponInfiniteAmmoMode, AmmoType (numbering follows C++, differs from AMXX CsAmmoType), WeaponCostType, ItemCostType, AmmoCostType, ClipGiveDefault, ClipSizeType, WeightWeapon, MaxAmmoType, AutoBuyClassType, WEAPON_SUIT, WEAPON_ALLWEAPONS, WEAPON_ACTIVITY_VOLUME, KNIFE_BODYHIT/WALLHIT_VOLUME
  • messages/HUD: BOMB_FLAG_*, STATUSICON_*, HUD_PRINT*, STATUS_NIGHTVISION_*, ITEM_STATUS_*, FFADE_*, SBAR_*, DHF_*/DHM_*
  • hitboxes: NUM_HITGROUPS; time-based damage: ITBD_END
  • misc: BLOOD_COLOR_DARKRED, GROUP_OP_AND/NAND, VIEW_FIELD_*, CHAN_BOT, MAX_AMMO_SLOTS, MAX_ITEMS, DEFAULT_FOV, NUM_BLENDING, ANIM_SWIM_1/2, ANIM_FIRST_DEATH_SEQUENCE, SF_GAMECOUNTSET_FIREONCE, SF_GAME_PZONE_ONLY_ALIVE, SF_PLAYEREQUIP_REMOVEWEAPONS, SF_GUNTARGET_START_ON, SF_SPARK_TOOGLE/IF_OFF ("TOOGLE" preserved from C++)

Deliberately not added: HL-only relics that CS never sets — EF_NIGHTVISION/SNIPERLASER/FIBERCAMERA and SATCHELCODE have zero consumers in either fork. Keeps the file CS-applicable. Comment fixes: PFLAG_DUCKING ("not"), DEAD_RESPAWNABLE, WeaponState weapon list, FEV_RELIABLE tail, light section header.

3. reapi_gamedll_const.inc

  • added missing Return type: lines: RG_RoundEnd, RG_HandleMenu_ChooseTeam, RG_CBasePlayer_TakeHealth, RG_CBasePlayer_SetClientUserInfoName, RG_CBasePlayer_Observer_IsValidTarget (with ATYPE_CLASSPTR note), RG_CBasePlayer_HasRestrictItem
  • KickBack: full weapon list + up_max param name fix; m_pVIP/m_pVIPQueue relabeled to class CBasePlayer *; m_iIgnoreGlobalChat typed IgnoreChatMsg

4. Reunion API split — constants moved to the new reapi_reunion_const.inc (client_auth_type, reu_authkey_kind, AuthIdType); documented REU_GetAuthKeyKind, REU_SetConnectTime, REU_GetSerializedId.

5. reapi.inc / reapi_rechecker.inc — hookchain native documentation corrected; RegisterQueryFile contract documented.

6. C++ doc sync — natives_common.cpp: get_key_value_buffer doc synced with the .inc, mixed-up amx_GetBodygroup/amx_SetBodygroup doc blocks swapped; natives_misc.cpp: "independant ... with via" typo.

Open Questions and Pre-Merge TODOs

  • Every added constant has an in-game consumer; HL-only relics left out on purpose.
  • No value/order shifts of existing enum members — additions are append-only, and the positional .inc ↔ member_list.h ↔ member_list.cpp mapping stays in sync.
  • Name-collision word-boundary sweep vs amxmodx core and reapi includes — clean.
  • CRLF line endings preserved.

Learning

Audit method: 235 engine-layer checks and 983 cssdk-constant checks against the ReHLDS/ReGameDLL sources, plus a global reverse sweep of ~95 constant families. PLAYER_PREVENT_DDUCK supersedes #392 (the same single constant, added here with the full PLAYER_* iuser3 context). The renames are the only breaking part — affected plugins need a two-line rename. Module bug fixes follow separately in #390; the VTC API 3.1 work is #396.

See also: #392, #390, #396

…ion layers

Full read-only audit of include doc-comments against ReHLDS/ReGameDLL
sources, followed by approved fixes.

reapi_engine.inc / reapi_engine_const.inc (engine layer, 235 checks):
- add missing Return type for RH_GetEntityInit / RH_SV_CheckUserInfo
- fix factual errors: get_ucmd (usercmd handle, not entity),
  get_key_value_buffer (returns cell count), rh_get_client_connect_time
  (@error instead of soft 0), Is/ResetModifiedMessageData (MsgIndex ->
  MsgMsgId, "-1" argument rules), net_remote_address setter marked as
  not implemented (mutate the address via set_netadr)
- new SND_EMIT2_USE_ORIGIN define; ~20 typo/copy-paste doc fixes
  (lenght, metchan, mvar params, message_const.inc reference, etc.)

cssdk_const.inc (constant parity vs vendored cssdk + ReGameDLL/ReHLDS,
983 checks):
- renames: ITDB_* -> ITBD_*, SHIELDREN_* -> SHIELDGREN_* (match C++)
- DMG_EXPLOSION alias next to DMG_GRENADE (ReGameDLL name of the bit)
- new constants: BLOOD_COLOR_DARKRED, ITEM_FLAG_EXHAUST_SECONDARYAMMO/
  ITEM_FLAG_CUSTOM, PLAYER_PREVENT_DDUCK, DHF_*/DHM_* hint flags,
  ThrowDirection, sbar_data, PlayerIdShowHealth/PlayerIdField,
  WeaponInfiniteAmmoMode, AmmoType, RewardAccount, PaybackForBadThing
  (all verified against ReGameDLL)
- comment fixes: PFLAG_DUCKING, DEAD_RESPAWNABLE, WeaponState weapon
  list, FEV_RELIABLE tail, "light" section header

reapi_gamedll_const.inc: add missing Return type lines (RG_RoundEnd,
RG_HandleMenu_ChooseTeam, RG_CBasePlayer_TakeHealth,
RG_CBasePlayer_SetClientUserInfoName, RG_CBasePlayer_Observer_IsValidTarget
with ATYPE_CLASSPTR note, RG_CBasePlayer_HasRestrictItem), KickBack full
weapon list and up_max param name, m_pVIP/m_pVIPQueue relabeled to
class CBasePlayer *, m_iIgnoreGlobalChat typed IgnoreChatMsg.

reapi_reunion.inc: split constants into new reapi_reunion_const.inc
(client_auth_type, reu_authkey_kind, AuthIdType) and document new
natives (REU_GetAuthKeyKind, REU_SetConnectTime, REU_GetSerializedId).

natives_common.cpp: sync get_key_value_buffer docs with .inc, swap
mixed-up amx_Get/amx_SetBodygroup doc blocks
natives_misc.cpp: fix "independant ... with via" typo
…meDLL/ReHLDS

Second batch of the cssdk_const expansion (CS-applicability filter
applied: HL-only relics like EF_NIGHTVISION/SNIPERLASER/FIBERCAMERA
are intentionally NOT added - neither fork ever sets those bits).

New constants:
- user-message payloads: BOMB_FLAG_*, STATUSICON_*, HUD_PRINT*
  (HUD_PRINTRADIO has no AMXX print_* analog), STATUS_NIGHTVISION_*,
  ITEM_STATUS_*
- ScreenFade flags: FFADE_IN/OUT/MODULATE/STAYOUT/LONGFADE
- CHAN_BOT (ReHLDS bot chatter channel)
- SCENARIO_BLOCK_* (mp_round_infinite flags "a".."k")
- menus: ChooseTeamMenuSlot, VGUIMenuSlot, BuyItemMenuSlot
- weapon bitfield masks: WEAPON_SUIT, WEAPON_ALLWEAPONS
- view cone: VIEW_FIELD_FULL/WIDE/NARROW/ULTRA_NARROW
- misc: IN_ACTIVE composite, NUM_BLENDING, ANIM_SWIM_1/2,
  ANIM_FIRST_DEATH_SEQUENCE, WEAPON_ACTIVITY_VOLUME, DEFAULT_FOV,
  CS_KILLS_FOR_DOMINATION, KNIFE_BODYHIT/WALLHIT_VOLUME
- point additions: MAX_AMMO_SLOTS, MAX_ITEMS, NUM_HITGROUPS,
  ITBD_END, SF_GAMECOUNTSET_FIREONCE, SF_GAME_PZONE_ONLY_ALIVE,
  SF_PLAYEREQUIP_REMOVEWEAPONS, SF_GUNTARGET_START_ON,
  SF_SPARK_TOOGLE/IF_OFF ("TOOGLE" preserved from C++)

All values verified against ReGameDLL/ReHLDS headers; no name
collisions with amxmodx/core or reapi includes (word-boundary sweep).
Expansion batch: port the big constant enums that plugins could not
use before (values verified 1:1 against ReGameDLL weapontype.h,
gamerules.h, weapons.h):

- AutoBuyClassType (15 autobuy bits)
- ItemCostType / AmmoCostType / WeaponCostType (item, ammo and
  weapon default prices; AmmoCostType grenade entries reference
  ItemCostType values, as in C++)
- ClipGiveDefault (28, KNIFE entry kept commented as in C++)
- ClipSizeType (24 clip sizes)
- WeightWeapon (29 weights)
- MaxAmmoType (10 base + 4 ReGameDLL custom grenade/C4 caps)
- SATCHELCODE (grenade satchel use codes)
- DefuserAllocation (mp_defuser_allocation modes)

Word-boundary collision sweep vs amxmodx core and reapi includes:
clean.
Port the util.h group operation codes (placed next to the
VIEW_FIELD_* block, mirroring source order). Values verified against
ReGameDLL regamedll/dlls/util.h:36-37; resurrected from an old local
commit (65e855d). No name collisions with amxmodx core or reapi
includes (word-boundary sweep).
- remove SATCHELCODE enum: HL satchel-charge relic, UseSatchelCharges
  is NOXREF and never called in CS paths (violates the
  CS-applicability filter)
- move KNIFE_BODYHIT_VOLUME/KNIFE_WALLHIT_VOLUME out of the
  m_iWeaponFlash block into the m_iWeaponVolume block where they
  belong: both are m_iWeaponVolume values set by wpn_knife.cpp
  (body hit = 128, wall hit = int(flVol * 512))
… contract

- HC_BYPASS: document void-only behavior (on returning hookchains it acts like HC_CONTINUE)
- GetHookChainReturn: maxlen is required for ATYPE_STRING, not optional; clarify @return
- SetHookChainArg: remove phantom maxlen param, add missing @PARAM type, clarify post behavior (later post forwards still see the changed argument)
- add missing @return blocks: DisableHookChain, SetHookChainReturn (+@error: strict AType check, ATYPE_TRACE unsupported), get_viewent
- reapi_rechecker.inc: declare QueryFileHook tag enum (INVALID_QUERYFILE_HOOK), document hash=-1 semantics (RES_TYPE_EXISTS with -1 becomes RES_TYPE_HASH_ANY), fix ResourceType comment grammar
Documents existing VTC behavior: soundFilePath is relative to the game directory and must be a valid PCM WAV file (8 or 16 bit). The broadcast receiver note and the block natives documentation live in the module PR (feat/vtc-api31-block-natives).
@Nord1cWarr1or
Nord1cWarr1or force-pushed the docs/include-docs-overhaul branch from 7186360 to 21a9c07 Compare September 14, 2026 10:21
@Nord1cWarr1or Nord1cWarr1or changed the title docs: include documentation overhaul (engine/cssdk/gamedll/reunion) + cssdk constants expansion docs: overhaul Pawn include documentation Sep 23, 2026
Mirrors the implicit zeroed sbar state (no target under the crosshair) so Pawn plugins can compare the target type against a named constant instead of a magic 0.

Note: upstream ReGameDLL (player.h) defines only SBAR_TARGETTYPE_TEAMMATE/ENEMY/HOSTAGE; the zero state is unnamed there, so 0 is taken from the zero-initialized newSBarState behavior.
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.

1 participant