diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d0bdbe69..4e868418 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -52,23 +52,25 @@ jobs: linux: name: 'Linux' - runs-on: ubuntu-latest - container: s1lentq/linux86buildtools:latest + runs-on: ubuntu-20.04 outputs: app-version: ${{ steps.app-version.outputs.version }} - env: - ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true - steps: - name: Checkout uses: actions/checkout@v3 with: fetch-depth: 0 - - name: Build using Intel C++ Compiler 19.0 + - name: Check dependencies + run: | + sudo dpkg --add-architecture i386 + sudo apt-get update + sudo apt-get install -y gcc-multilib g++-multilib + + - name: Build run: | - rm -rf build && CC=icc CXX=icpc cmake -B build && cmake --build build -j8 + rm -rf build && CC=gcc CXX=g++ cmake -B build && cmake --build build -j8 - name: Reading appversion.h id: app-version diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 00000000..5781ed3a --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,550 @@ +# [ReAPI](https://github.com/rehlds/ReAPI) Changelog + +--- + +## [`5.24.0.300`](https://github.com/rehlds/ReAPI/releases/tag/5.24.0.300) - 2023-12-12 + +> [!CAUTION] +> This version is compatible with [ReGameDLL](https://github.com/rehlds/ReGameDLL_CS/) version [5.26.0.668](https://github.com/rehlds/ReGameDLL_CS/releases/tag/5.26.0.668) and higher! +> +> `Older versions are not supported.` +> +> Update `only` with [ReGameDLL](https://github.com/rehlds/ReGameDLL_CS/). + +### Added +* `API`: + * Implemented `RG_CreateWeaponBox` hook by @dystopm in https://github.com/rehlds/ReAPI/pull/275 + * Implemented `RG_PM_LadderMove` hook by @ShadowsAdi in https://github.com/rehlds/ReAPI/pull/254 + * CSPlayer and CKnife additions + headers refactory by @dystopm in https://github.com/rehlds/ReAPI/pull/277 + * Added rg_set/get_global_iteminfo natives by @dystopm in https://github.com/rehlds/ReAPI/pull/279 + * Implement `RH_ExecuteServerStringCmd` hook by @ShadowsAdi in https://github.com/rehlds/ReAPI/pull/263 + * New `gamedll` hookchains by @dystopm in https://github.com/rehlds/ReAPI/pull/280 +* Added ITEM_FLAG_NOFIREUNDERWATER to cssdk_const.inc by @fl0werD in https://github.com/rehlds/ReAPI/pull/267 +* Added a new argument removeAmmo to the rg_remove_items_by_slot native by @Javekson in https://github.com/rehlds/ReAPI/pull/283 +* Added new trace flags to cssdk_const.inc by @justgo97 in https://github.com/rehlds/ReAPI/pull/278 +* Added m_flEjectBrass description by @RauliTop in https://github.com/rehlds/ReAPI/pull/274 +* `rg_give_defusekit()`: + * Added player team check by @Giferns in https://github.com/rehlds/ReAPI/pull/234 +* Added GetBodygroup, SetBodygroup, GetSequenceInfo natives by @dystopm in https://github.com/rehlds/ReAPI/pull/294 +* Implemented RH_SV_AllowPhysent hook by @justgo97 in https://github.com/rehlds/ReAPI/pull/265 +* Implemented `rh_get_client_connect_time()` native by @FEDERICOMB96 in https://github.com/rehlds/ReAPI/pull/259 +* Implemented CCSEntity members to export in AMXX headers by @dystopm in https://github.com/rehlds/ReAPI/pull/296 + +### Changed +* `API upgrade`: 15 new natives by @dystopm in https://github.com/rehlds/ReAPI/pull/297 + * rg_spawn_grenade: Spawns a grenade entity with specified parameters. + * rg_create_weaponbox: Spawns a weaponbox entity with specified properties. + * rg_remove_entity: Removes an entity using gamedll's UTIL_Remove function. + * rg_decal_trace: Creates a decal in the world based on a traceresult. + * rg_emit_texture_sound: Emits a sound based on a traceresult simulating a bullet hit. + * rg_add_ammo_registry: Generates an ammo slot in the game's logic. + * rg_weapon_deploy: Deploys a weapon attached to a player. + * rg_weapon_reload: Reloads a weapon or a player's active weapon. + * rg_weapon_shotgun_reload: Forces shotgun reload thinking on a weapon or a player's active weapon. + * rg_weapon_send_animation: Sends a weapon animation to a player. + * rg_weapon_kickback: Emits a recoil effect on a weapon's player. + * rg_switch_best_weapon: Switches a player's current weapon to the best one on their inventory. + * rg_disappear: Makes a player disappear from the world. + * rg_set_observer_mode: Sets a player's current Observer mode. + * rg_death_notice: Emits a death notice. +* Refactored `rg_remove_items_by_slot` and updated the return logic by @Javekson in https://github.com/rehlds/ReAPI/pull/288 +* Updated the return logic of `rg_drop_item` and `rg_drop_items_by_slot` by @Javekson in https://github.com/rehlds/ReAPI/pull/289 +* Headers update, rename `m_bHasSecondaryAttack`, `CSPlayer` member additions by @dystopm in https://github.com/rehlds/ReAPI/pull/293 +* Improved include descriptions `rg_fire_bullets`, `rg_fire_buckshots` and `rg_fire_bullets3` by @RauliTop in https://github.com/rehlds/ReAPI/pull/245 +* Improved description for `rg_get_weapon_info` by @Nord1cWarr1or in https://github.com/rehlds/ReAPI/pull/269 + +### Fixed +* Fixed `TimeBasedDamage enum` typo at cssdk_const.inc by @RauliTop in https://github.com/rehlds/ReAPI/pull/256 +* Fixed error 029: invalid expression for IsRoundExpireEvent by @Javekson in https://github.com/rehlds/ReAPI/pull/286 +* Fixed `rg_transfer_c4`: prevent C4 destruction on arg receiver = 0 by @Javekson in https://github.com/rehlds/ReAPI/pull/291 +* Fixed GiveC4 hook callback return type by @dystopm in https://github.com/rehlds/ReAPI/pull/295 + +## New Contributors +* @justgo97 made their first contribution in https://github.com/rehlds/ReAPI/pull/265 +* @RauliTop made their first contribution in https://github.com/rehlds/ReAPI/pull/245 +* @Giferns made their first contribution in https://github.com/rehlds/ReAPI/pull/234 +* @dystopm made their first contribution in https://github.com/rehlds/ReAPI/pull/275 +* @Javekson made their first contribution in https://github.com/rehlds/ReAPI/pull/283 + +**Full Changelog**: [5.22.0.253...5.24.0.300](https://github.com/rehlds/ReAPI/compare/5.22.0.253...5.24.0.300) + +## [`5.22.0.254`](https://github.com/rehlds/ReAPI/releases/tag/5.22.0.254) - 2022-09-19 + +### Added +* Implemented `RH_*_Precache_*`, `RH_SV_AddResource`, `RH_SV_ClientPrintf` & `RH_SV_CheckUserInfo` hooks by @ShadowsAdi in https://github.com/rehlds/ReAPI/pull/249 + +## New Contributors +* @ShadowsAdi made their first contribution in https://github.com/rehlds/ReAPI/pull/249 + +**Full Changelog**: [5.21.0.252...5.22.0.254](https://github.com/rehlds/ReAPI/compare/5.21.0.252...5.22.0.254) + +## [`5.21.0.252`](https://github.com/rehlds/ReAPI/releases/tag/5.21.0.252) - 2022-02-04 + +### Added +* Added a new native `REU_GetAuthKey` +* Add `GitHub Action` for Remove old artifacts by @wopox1337 in https://github.com/rehlds/ReAPI/pull/230 + +### Changed +* Reverted "Add `GitHub Action` for Remove old artifacts" by @wopox1337 in https://github.com/rehlds/ReAPI/pull/231 + +### Fixed +* Fixed wrong native error description by @Nord1cWarr1or in https://github.com/rehlds/ReAPI/pull/236 + +**Full Changelog**: [5.21.0.248...5.21.0.252](https://github.com/rehlds/ReAPI/compare/5.21.0.248...5.21.0.252) + +## [`5.21.0.248`](https://github.com/rehlds/ReAPI/releases/tag/5.21.0.248) - 2021-10-25 + +### Added +* Added `ClientConnected()` hook by @bionext03 in https://github.com/rehlds/ReAPI/pull/223 +* Added `pr_dlls.h` & fix `GetEntityInit()` return type by @wopox1337 in https://github.com/rehlds/ReAPI/pull/228 +* Implemented `GetEntityInit()` hook by @francoromaniello in https://github.com/rehlds/ReAPI/pull/215 +* Implemented `SV_EmitPings()` hook by @francoromaniello in https://github.com/rehlds/ReAPI/pull/212 +* Implemented `rh_get_net_from()` native by @francoromaniello in https://github.com/rehlds/ReAPI/pull/221 +* Implemented `SV_ConnectClient()` hook by @francoromaniello in https://github.com/rehlds/ReAPI/pull/220 +* Implemented `Con_Printf()` hook by @francoromaniello in https://github.com/rehlds/ReAPI/pull/222 +* API members for new CVars `sv_enablebunnyhopping` and `sv_autobunnyhopping` by @aleeperezz16 in https://github.com/rehlds/ReAPI/pull/225 +* cssdk_const.inc: Added `ScoreAttrib` constants by @Nord1cWarr1or in https://github.com/rehlds/ReAPI/pull/214 +* API: Added hooks `ED_Alloc()` and `ED_Free()` by @DarthMan in https://github.com/rehlds/ReAPI/pull/227 + +## New Contributors +* @bionext03 made their first contribution in https://github.com/rehlds/ReAPI/pull/223 +* @aleeperezz16 made their first contribution in https://github.com/rehlds/ReAPI/pull/225 +* @DarthMan made their first contribution in https://github.com/rehlds/ReAPI/pull/227 + +**Full Changelog**: [5.20.0.236...5.21.0.248](https://github.com/rehlds/ReAPI/compare/5.20.0.236...5.21.0.248) + +## [`5.20.0.236`](https://github.com/rehlds/ReAPI/releases/tag/5.20.0.236) - 2021-09-14 + +### Fixed +* `player.h`: fix `ForEachItem()` items iteration @wopox1337; +* `ReAPI_gamedll_const.inc`: fix: `m_rgbTimeBasedDamage` description @wopox1337; +* Fixed desc typo by @Vaqtincha in https://github.com/rehlds/ReAPI/pull/213 +* Fixed desc typo in EntVars by @FEDERICOMB96 in https://github.com/rehlds/ReAPI/pull/216 + +**Full Changelog**: [5.20.0.231...5.20.0.236](https://github.com/rehlds/ReAPI/compare/5.20.0.231...5.20.0.236) + +## [`5.20.0.231`](https://github.com/rehlds/ReAPI/releases/tag/5.20.0.231) - 2021-09-02 + +### Added +* Added defines for CBasePlayer members by @FEDERICOMB96 in https://github.com/rehlds/ReAPI/pull/195 +* Implemented `CBaseEntity::Fire` hooks. by @FEDERICOMB96 in https://github.com/rehlds/ReAPI/pull/202 +* Implemented player `Pain`, `DeathSound` and `JoiningThink` hooks by @fl0werD in https://github.com/rehlds/ReAPI/pull/209 +* Implemented `RG_CBasePlayer_Observer_SetMode` hook by @Lopol2010 in https://github.com/rehlds/ReAPI/pull/208 +* Implemented `RG_CBasePlayer_Observer_FindNextPlayer` hook by @francoromaniello in https://github.com/rehlds/ReAPI/pull/210 +* Added new natives `rg_spawn_head_gib` and `rg_spawn_random_gibs` by @FEDERICOMB96 in https://github.com/rehlds/ReAPI/pull/200 +* Added new native: `rg_fire_buckshots` by @FEDERICOMB96 in https://github.com/rehlds/ReAPI/pull/204 +* Added player zoom constants by @Nord1cWarr1or in https://github.com/rehlds/ReAPI/pull/190 + +### Fixed +* Fixed `rg_plant_bomb` by @francoromaniello in https://github.com/rehlds/ReAPI/pull/196 +* Minor fixes by @Vaqtincha in https://github.com/rehlds/ReAPI/pull/193 + * fixed `rg_remove_items_by_slot()` c4 slot; + * fixed `rg_remove_items_by_slot()` weapon hud; + * added `RG_SpawnRandomGibs()` victim arg. +* Fixed `rg_round_end` WINSTATUS_NONE code by @francoromaniello in https://github.com/rehlds/ReAPI/pull/201 +* Fixed conflict interfaces `vgui.dll` & `swds.dl`l (fix listenserver crash) by @Vaqtincha in https://github.com/rehlds/ReAPI/pull/206 + +## New Contributors +* @Lopol2010 made their first contribution in https://github.com/rehlds/ReAPI/pull/208 + +**Full Changelog**: [5.19.0.217...5.20.0.231](https://github.com/rehlds/ReAPI/compare/5.19.0.217...5.20.0.231) + +## [`5.19.0.217`](https://github.com/rehlds/ReAPI/releases/tag/5.19.0.217) - 2021-06-14 + +### Changed +* hook_list.cpp: Reworked argument parser + +### Fixed +* ReAPI_gamedll_const.inc: fixed AMXX compiler warning +* Fixed arg_amount not used in rg_get_user_ammo by @francoromaniello in https://github.com/rehlds/ReAPI/pull/192 +* Fixed rg_round_end return type by @etojuice in https://github.com/rehlds/ReAPI/pull/194 + +## New Contributors +* @etojuice made their first contribution in https://github.com/rehlds/ReAPI/pull/194 + +**Full Changelog**: [5.19.0.211...5.19.0.217](https://github.com/rehlds/ReAPI/compare/5.19.0.211...5.19.0.217) + +## [`5.19.0.211`](https://github.com/rehlds/ReAPI/releases/tag/5.19.0.211) - 2021-02-05 + +### Changed +* Removed unnecessary filters: `set_rebuy` fix tag mismatch + +### Fixed +* Fixed `AMXX` include files + +**Full Changelog**: [5.19.0.210...5.19.0.211](https://github.com/rehlds/ReAPI/compare/5.19.0.210...5.19.0.211) + +## [`5.19.0.210`](https://github.com/rehlds/ReAPI/releases/tag/5.19.0.210) - 2021-01-04 + +### Added +* Added a new native "rg_plant_bomb" by @francoromaniello in https://github.com/rehlds/ReAPI/pull/178 + +### Fixed +* Fixed `get_ucmd`, `get_pmtrace` natives. https://github.com/rehlds/ReAPI/pull/182 + +**Full Changelog**: [5.18.0.205...5.19.0.210](https://github.com/rehlds/ReAPI/compare/5.18.0.205...5.19.0.210) + +## [`5.18.0.205`](https://github.com/rehlds/ReAPI/releases/tag/5.18.0.205) - 2020-12-18 + +### Added +* CSSDK: + * Implemented DECLARE_CLASS_TYPES for all game classes + +### Fixed +* set/get_member_s: fix missing check for members CCSPlayer/CCSPlayerWeapon + +**Full Changelog**: [5.18.0.203...5.18.0.205](https://github.com/rehlds/ReAPI/compare/5.18.0.203...5.18.0.205) + +## [`5.18.0.203`](https://github.com/rehlds/ReAPI/releases/tag/5.18.0.203) - 2020-12-17 + +### Changed +* API Interfaces: + * make virtual functions pure to explicitly define tables of RTTI. GCC can't resolve them + +### Fixed +* Fix load on Linux + +**Full Changelog**: [5.18.0.202...5.18.0.203](https://github.com/rehlds/ReAPI/compare/5.18.0.202...5.18.0.203) + +## [`5.18.0.202`](https://github.com/rehlds/ReAPI/releases/tag/5.18.0.202) - 2020-12-16 + +### Added +* Implemented g/set_member safe version + +### Changed +* Enabled RTTI +* Adjusted version script + +**Full Changelog**: [5.17.0.200...5.18.0.202](https://github.com/rehlds/ReAPI/compare/5.17.0.200...5.18.0.202) + +## [`5.17.0.200`](https://github.com/rehlds/ReAPI/releases/tag/5.17.0.200) - 2020-12-01 + +### Added +* Implemented native to get the current hookchain handle in amxx callback by @afwn90cj93201nixr2e1re in https://github.com/rehlds/ReAPI/pull/173 +* Added API check if is player can respawn by @fl0werD in https://github.com/rehlds/ReAPI/pull/174 + +**Full Changelog**: [5.16.0.198...5.17.0.200](https://github.com/rehlds/ReAPI/compare/5.16.0.198...5.17.0.200) + +## [`5.16.0.198`](https://github.com/rehlds/ReAPI/releases/tag/5.16.0.198) - 2020-10-10 + +### Added +* Implemented IsReAPIHookOriginalWasCalled which determine whether original function was called or not by @afwn90cj93201nixr2e1re in https://github.com/rehlds/ReAPI/pull/172 + +**Full Changelog**: [5.15.0.197...5.16.0.198](https://github.com/rehlds/ReAPI/compare/5.15.0.197...5.16.0.198) + +## [`5.15.0.197`](https://github.com/rehlds/ReAPI/releases/tag/5.15.0.197) - 2020-07-16 + +### Added +* Implemented members for knife weapon by @afwn90cj93201nixr2e1re in https://github.com/rehlds/ReAPI/pull/168 + +### Changed +* Some changes by @afwn90cj93201nixr2e1re in https://github.com/rehlds/ReAPI/pull/172 + +### Fixed +* Compile warn fix by @Vaqtincha in https://github.com/rehlds/ReAPI/pull/167 + +**Full Changelog**: [5.14.0.195...5.15.0.197](https://github.com/rehlds/ReAPI/compare/5.14.0.195...5.15.0.197) + +## [`5.14.0.195`](https://github.com/rehlds/ReAPI/releases/tag/5.14.0.195) - 2020-05-27 + +### Added +* Implemented CGib by @fl0werD in https://github.com/rehlds/ReAPI/pull/164 + +### Changed +* backed compatibility + +### Fixed +* new line fix + +**Full Changelog**: [5.13.0.194...5.14.0.195](https://github.com/rehlds/ReAPI/compare/5.13.0.194...5.14.0.195) + +## [`5.13.0.194`](https://github.com/rehlds/ReAPI/releases/tag/5.13.0.194) - 2020-05-14 + +### Added +* Added m_bCanShootOverride offset By @fl0werD in https://github.com/rehlds/ReAPI/pull/160 + +### Changed +* Updated SDK + +### Fixed +* Fixed typo + +**Full Changelog**: [5.12.0.192...5.13.0.194](https://github.com/rehlds/ReAPI/compare/5.12.0.192...5.13.0.194) + +## [`5.12.0.192`](https://github.com/rehlds/ReAPI/releases/tag/5.12.0.192) - 2019-12-14 + +### Added +* Added API to set if player can hear another player by @fant1kua in https://github.com/rehlds/ReAPI/pull/158 + +**Full Changelog**: [5.11.0.191...5.12.0.192](https://github.com/rehlds/ReAPI/compare/5.11.0.191...5.12.0.192) + +## [`5.11.0.191`](https://github.com/rehlds/ReAPI/releases/tag/5.11.0.191) - 2019-12-07 + +### Added +* added missed offsets by @fl0werD in https://github.com/rehlds/ReAPI/pull/156 + +**Full Changelog**: [5.11.0.190...5.11.0.191](https://github.com/rehlds/ReAPI/compare/5.11.0.190...5.11.0.191) + +## [`5.11.0.190`](https://github.com/rehlds/ReAPI/releases/tag/5.11.0.190) - 2019-11-09 + +### Added +- Implemented RG_CBasePlayer_DropIdlePlayer hook by @d3m37r4 in [#148](https://github.com/rehlds/ReAPI/pull/148) + +**Full Changelog**: [5.11.0.189...5.11.0.190](https://github.com/rehlds/ReAPI/compare/5.11.0.189...5.11.0.190) + +## [`5.11.0.189`](https://github.com/rehlds/ReAPI/releases/tag/5.11.0.189) - 2019-10-30 + +### Added +- Implemented `RG_CBasePlayerWeapon_CanDeploy` & `CBasePlayerWeapon_DefaultDeploy` hooks by @fant1kua in [#150](https://github.com/rehlds/ReAPI/pull/150) +- Implemented `RG_CBasePlayerWeapon_DefaultReload` hook +- Implemented `RG_CBasePlayerWeapon_DefaultShotgunReload` hook + +**Full Changelog**: [5.10.0.188...5.11.0.189](https://github.com/rehlds/ReAPI/compare/5.10.0.188...5.11.0.189) + +## [`5.10.0.188`](https://github.com/rehlds/ReAPI/releases/tag/5.10.0.188) - 2019-09-06 + +### Changed +* Re-configured `publish.gradle` + +**Full Changelog**: [5.10.0.187...5.10.0.188](https://github.com/rehlds/ReAPI/compare/5.10.0.187...5.10.0.188) + +## [`5.10.0.187`](https://github.com/rehlds/ReAPI/releases/tag/5.10.0.187) - 2019-09-04 + +### Fixed +* Fixed `set_pmove`/`get_pmove` natives by @greymood09 in https://github.com/rehlds/ReAPI/issues/119 + +**Full Changelog**: [5.10.0.186...5.10.0.187](https://github.com/rehlds/ReAPI/compare/5.10.0.186...5.10.0.187) + +## [`5.10.0.186`](https://github.com/rehlds/ReAPI/releases/tag/5.10.0.186) - 2019-08-30 + +### Added +* Implemented `RG_CBasePlayer_UseEmpty` hook by @fant1kua in https://github.com/rehlds/ReAPI/pull/140 +* Added rg_initial`ize_player_counts native by @fant1kua in https://github.com/rehlds/ReAPI/pull/146 +* Added native `rg_check_win_conditions` by @fant1kua in https://github.com/rehlds/ReAPI/pull/144 +* Added `rg_restart_round` native by @fant1kua in https://github.com/rehlds/ReAPI/pull/145 + +### Fixed +* Fixed bug with change team if player is die #142 by @fant1kua in https://github.com/rehlds/ReAPI/pull/143 + +**Full Changelog**: [5.9.0.178...5.10.0.186](https://github.com/rehlds/ReAPI/compare/5.9.0.178...5.10.0.186) + +## [`5.9.0.178`](https://github.com/rehlds/ReAPI/releases/tag/5.9.0.178) - 2019-08-02 + +### Changed +- Removed `debug` print + +**Full Changelog**: [5.9.0.177...5.9.0.178](https://github.com/rehlds/ReAPI/compare/5.9.0.177...5.9.0.178) + +## [`5.9.0.177`](https://github.com/rehlds/ReAPI/releases/tag/5.9.0.177) - 2019-07-29 + +### Added +- Updated `ReAPI.inc` - added `ATYPE_BOOL` and `ATYPE_EVARS` types +- Added option flag `-static-libstdc++` +- Added native rh_client_drop by @d3m37r4 in https://github.com/rehlds/ReAPI/pull/135 +- Added more information about error + +### Fixed +- Fixed `SetHookChainArg` crash due to incorrect pointer to argument + - `hookctx_t` gets the original function as the base address of the arguments, some compilers do UB and so for this reason `hookctx_t` has been reworked and now uses tuple. +- Fixed another crash due AMXX_Assert function. +- Fixed duplicate error and some another errors + +**Full Changelog**: [5.9.0.171...5.9.0.177](https://github.com/rehlds/ReAPI/compare/5.9.0.171...5.9.0.177) + +## [`5.9.0.171`](https://github.com/rehlds/ReAPI/releases/tag/5.9.0.171) - 2019-06-23 + +### Added +- `get_member_game`: support string + +### Fixed +- `GCC` support and fixed warnings +- Fixes [#134](https://github.com/rehlds/ReAPI/issues/134) `rh_get_mapname` fixed incorrectly get length argument + +### Changed +- Updated `README.md` + +**Full Changelog**: [5.9.0.167...5.9.0.171](https://github.com/rehlds/ReAPI/compare/5.9.0.167...5.9.0.171) + +## [`5.9.0.167`](https://github.com/rehlds/ReAPI/releases/tag/5.9.0.167) - 2019-06-06 + +### Added +- Implemented hook `CBasePlayer::HintMessageEx`. Closes [#133](https://github.com/rehlds/ReAPI/issues/133) + - Added native `rg_hint_message​` + - Added news `CBasePlayer` members​ +- Bump minor version `API​` + +**Full Changelog**: [5.8.0.166...5.9.0.167](https://github.com/rehlds/ReAPI/compare/5.8.0.166...5.9.0.167) + +## [`5.8.0.166`](https://github.com/rehlds/ReAPI/releases/tag/5.8.0.166) - 2019-04-17 + +### Fixed +- Fixed typo by @SmiteIsTrashBro in https://github.com/rehlds/ReAPI/pull/130 + - Little typo fix for `var_fuser*`, that are float instead of int. + +### New Contributors +* @SmiteIsTrashBro made their first contribution in https://github.com/rehlds/ReAPI/pull/130 + +**Full Changelog**: [5.8.0.165...5.8.0.166](https://github.com/rehlds/ReAPI/compare/5.8.0.165...5.8.0.166) + +## [`5.8.0.165`](https://github.com/rehlds/ReAPI/releases/tag/5.8.0.165) - 2019-02-13 + +### Fixed +- Merged pull request [#129](https://github.com/rehlds/ReAPI/pull/129) from `Vaqtincha/tmppatch-1` + - Fixed typo + +**Full Changelog**: [5.8.0.163...5.8.0.165](https://github.com/rehlds/ReAPI/compare/5.8.0.163...5.8.0.165) + +## [`5.8.0.163`](https://github.com/rehlds/ReAPI/releases/tag/5.8.0.163) - 2019-01-23 + +### Added +* Added `m_M4A1_flBaseDamageSil`, `m_USP_flBaseDamageSil` and `m_Famas_flBaseDamageBurst` members by @fant1kua in https://github.com/rehlds/ReAPI/pull/126 + +**Full Changelog**: [5.7.0.162...5.8.0.163](https://github.com/rehlds/ReAPI/compare/5.7.0.162...5.8.0.163) + +## [`5.7.0.162`](https://github.com/rehlds/ReAPI/releases/tag/5.7.0.162) - 2019-01-07 + +### Added +- Add `m_flBaseDamage` member by @fant1kua in [#124](https://github.com/rehlds/ReAPI/pull/124) + +**Full Changelog**: [5.6.0.161...5.7.0.162](https://github.com/rehlds/ReAPI/compare/5.6.0.161...5.7.0.162) + +## [`5.6.0.161`](https://github.com/rehlds/ReAPI/releases/tag/5.6.0.161) - 2018-12-23 + +### Changed +- Minor update `cssdk` + +**Full Changelog**: [5.6.0.160...5.6.0.161](https://github.com/rehlds/ReAPI/compare/5.6.0.160...5.6.0.161) + +## [`5.6.0.160`](https://github.com/rehlds/ReAPI/releases/tag/5.6.0.160) - 2018-10-02 + +### Fixed +- Resolved [#121](https://github.com/rehlds/ReAPI/issues/121) +- Fixed conflict `cssdk_const.inc` due to `hlsdk_const.inc` update + +> [!WARNING] +> Removed file `hlsdk_const.inc`, you need manually to take include from `AmxModX 1.9.0` + +**Full Changelog**: [5.6.0.158...5.6.0.160](https://github.com/rehlds/ReAPI/compare/5.6.0.158...5.6.0.160) + +## [`5.6.0.158`](https://github.com/rehlds/ReAPI/releases/tag/5.6.0.158) - 2018-07-09 + +### Fixed +- Fixed `pmove` pointer + +**Full Changelog**: [5.6.0.157...5.6.0.158](https://github.com/rehlds/ReAPI/compare/5.6.0.157...5.6.0.158) + +## [`5.6.0.157`](https://github.com/rehlds/ReAPI/releases/tag/5.6.0.157) - 2018-05-18 + +### Added +- `rg_round_end`: Add option trigger to all hooks + +**Full Changelog**: [5.6.0.156...5.6.0.157](https://github.com/rehlds/ReAPI/compare/5.6.0.156...5.6.0.157) + +## [`5.6.0.156`](https://github.com/rehlds/ReAPI/releases/tag/5.6.0.156) - 2018-05-18 + +### Fixed +- the bypass amxx warning 200 by @wopox1337 in https://github.com/rehlds/ReAPI/pull/113 + - warning 200: `symbol "RG_CBasePlayer_SetSpawnProtecti" is truncated to 31 characters` + +**Full Changelog**: [5.6.0.155...5.6.0.156](https://github.com/rehlds/ReAPI/compare/5.6.0.155...5.6.0.156) + +## [`5.6.0.155`](https://github.com/rehlds/ReAPI/releases/tag/5.6.0.155) - 2018-02-25 + +### Fixed +* Fixed copypaste errors by @In-line in https://github.com/rehlds/ReAPI/pull/103 + +### Changed +- Replaced `SetTouch` to `SetBlocked` in `CEntityCallback::SetBlocked` by @In-line in https://github.com/rehlds/ReAPI/pull/109 +- Updated `regamedll api` version +- Added hookchain and getter/setter for spawn protection + - Added hookchain for `IsPenetrableEntity` + +**Full Changelog**: [5.5.0.150...5.6.0.155](https://github.com/rehlds/ReAPI/compare/5.5.0.150...5.6.0.155) + +## [`5.5.0.150`](https://github.com/rehlds/ReAPI/releases/tag/5.5.0.150) - 2018-02-25 + +### Fixed +- Fixed `rg_set_iteminfo` allocate string via engine + +### Changed +- Enhanced `rg_remove_item`: add new param remove ammunition + +**Full Changelog**: [5.5.0.148...5.5.0.150](https://github.com/rehlds/ReAPI/compare/5.5.0.148...5.5.0.150) + +## [`5.5.0.148`](https://github.com/rehlds/ReAPI/releases/tag/5.5.0.148) - 2018-02-09 + +### Added +- Added `getAmxVector` to simplify vector converting code + +### Fixed +- Fixed `RG_ThrowFlashbang` never be called + +### Changed +- bump `minor` version + +**Full Changelog**: [5.2.0.145...5.5.0.148](https://github.com/rehlds/ReAPI/compare/5.2.0.145...5.5.0.148) + +## [`5.2.0.145`](https://github.com/rehlds/ReAPI/releases/tag/5.2.0.145) - 2018-01-28 + +### Added +- `rg_round_end`: add safe checks to index of bounds + +### Changed +- Updated `regamedll API` and implemented hookschain's: + - `CSGameRules::CanPlayerHearPlayer`, + - `CBasePlayer::SwitchTeam`, + - `CBasePlayer::CanSwitchTeam`, + - `CBasePlayer::ThrowGrenade`, + - `CWeaponBox::SetModel`, + - `CGrenade::DefuseBombStart`, + - `CGrenade::DefuseBombEnd`, + - `CGrenade::ExplodeHeGrenade`, + - `CGrenade::ExplodeFlashbang`, + - `CGrenade::ExplodeSmokeGrenade`, + - `CGrenade::ExplodeBomb`, + - `ThrowHeGrenade`, + - `ThrowFlashbang`, + - `ThrowSmokeGrenade` + +**Full Changelog**: [5.2.0.143...5.2.0.145](https://github.com/rehlds/ReAPI/compare/5.2.0.143...5.2.0.145) + +## [`5.2.0.143`](https://github.com/rehlds/ReAPI/releases/tag/5.2.0.143) - 2017-12-11 + +### Fixed +- Fixed crash `rg_get_iteminfo` + +**Full Changelog**: [5.2.0.142...5.2.0.143](https://github.com/rehlds/ReAPI/compare/5.2.0.142...5.2.0.143) + +## [`5.2.0.142`](https://github.com/rehlds/ReAPI/releases/tag/5.2.0.142) - 2017-11-27 + +### Added +* Natives misc by @s1lentq in https://github.com/rehlds/ReAPI/pull/6 +* Added `rh_update_user_info` by @WPMGPRoSToTeMa in https://github.com/rehlds/ReAPI/pull/11 +* Added `rg_reset_maxspeed` native by @ivanmaxlogiudice in https://github.com/rehlds/ReAPI/pull/28 +* Added tag safety for `get`/`set_member` by @WPMGPRoSToTeMa in https://github.com/rehlds/ReAPI/pull/62 + +### Fixed +* Fixed return value to match api changes by @voed in https://github.com/rehlds/ReAPI/pull/5 +* Fixed context data for nested hookchain forwards, added member natives by @theAsmodai in https://github.com/rehlds/ReAPI/pull/10 +* Fixed `DeathNotice` hook crash (#12) by @WPMGPRoSToTeMa in https://github.com/rehlds/ReAPI/pull/13 +* Fixed natives `rg_set_iteminfo`/`rg_get_iteminfo` in https://github.com/rehlds/ReAPI/pull/92 + +### Changed +* Refactoring by @theAsmodai in https://github.com/rehlds/ReAPI/pull/4 +* Allow get knife info with `rg_get_weapon_info` by @ivanmaxlogiudice in https://github.com/rehlds/ReAPI/pull/38 +* Allow get `WEAPON_C4` & `WEAPON_KNIFE` info by @ivanmaxlogiudice in https://github.com/rehlds/ReAPI/pull/52 +* Grammar and spelling corrections in comments by @OciXCrom in https://github.com/rehlds/ReAPI/pull/74 +* `StartDeathCam()` immediately when changing team to spectator via rg_set_user_team by @In-line in https://github.com/rehlds/ReAPI/pull/81 +* Comments for parsing docgen by @s008nyx in https://github.com/rehlds/ReAPI/pull/90 +* Comments & descriptions improvements by @voed in https://github.com/rehlds/ReAPI/pull/91 + +### New Contributors +* @theAsmodai made their first contribution in https://github.com/rehlds/ReAPI/pull/4 +* @voed made their first contribution in https://github.com/rehlds/ReAPI/pull/5 +* @s1lentq made their first contribution in https://github.com/rehlds/ReAPI/pull/6 +* @WPMGPRoSToTeMa made their first contribution in https://github.com/rehlds/ReAPI/pull/11 +* @ivanmaxlogiudice made their first contribution in https://github.com/rehlds/ReAPI/pull/28 +* @OciXCrom made their first contribution in https://github.com/rehlds/ReAPI/pull/74 +* @s008nyx made their first contribution in https://github.com/rehlds/ReAPI/pull/90 + +**Full Changelog**: [5.2.0.142](https://github.com/rehlds/ReAPI/commits/5.2.0.142) diff --git a/README.md b/README.md index 8b40dbb0..c457b811 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Reapi [![Download](https://img.shields.io/github/downloads/s1lentq/ReGameDLL_CS/latest/total)](https://github.com/s1lentq/reapi/releases/latest) [![Downloads](https://img.shields.io/github/downloads/s1lentq/reapi/total)]() [![Percentage of issues still open](http://isitmaintained.com/badge/open/s1lentq/reapi.svg)](http://isitmaintained.com/project/s1lentq/reapi "Percentage of issues still open") [![License: GPL v3](https://img.shields.io/badge/License-GPL%20v3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0) +# [ReAPI](https://github.com/rehlds/ReAPI) [![Download](https://img.shields.io/github/downloads/s1lentq/ReGameDLL_CS/latest/total)](https://github.com/s1lentq/ReAPI/releases/latest) [![Downloads](https://img.shields.io/github/downloads/s1lentq/ReAPI/total)]() [![Percentage of issues still open](http://isitmaintained.com/badge/open/s1lentq/ReAPI.svg)](http://isitmaintained.com/project/s1lentq/ReAPI "Percentage of issues still open") [![License: GPL v3](https://img.shields.io/badge/License-GPL%20v3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0) AMX Mod X module, using API regamedll & rehlds @@ -23,7 +23,7 @@ LLVM (Clang) >= 6.0 (Optional) ### Building #### Windows -Use `Visual Studio` to build, open `msvc/reapi.sln` and just select from the solution configurations list `Release` or `Debug` +Use `Visual Studio` to build, open `msvc/ReAPI.sln` and just select from the solution configurations list `Release` or `Debug` #### Linux diff --git a/reapi/extra/amxmodx/scripting/include/cssdk_const.inc b/reapi/extra/amxmodx/scripting/include/cssdk_const.inc index 821bbe9f..01afb258 100644 --- a/reapi/extra/amxmodx/scripting/include/cssdk_const.inc +++ b/reapi/extra/amxmodx/scripting/include/cssdk_const.inc @@ -141,6 +141,8 @@ #define EF_FORCEVISIBILITY 2048 // force visibility #define EF_OWNER_VISIBILITY 4096 // visibility for owner #define EF_OWNER_NO_VISIBILITY 8192 // no visibility for owner +#define EF_NOSLERP 16384 // no slerp flag for this entity (addtofullpack) +#define EF_FOLLOWKEEPRENDER 32768 // the entity following will not copy the render (like it follows nothing) /** * Break Model Defines diff --git a/reapi/extra/amxmodx/scripting/include/reapi.inc b/reapi/extra/amxmodx/scripting/include/reapi.inc index 16160295..b3cbfe21 100644 --- a/reapi/extra/amxmodx/scripting/include/reapi.inc +++ b/reapi/extra/amxmodx/scripting/include/reapi.inc @@ -120,8 +120,11 @@ enum { HC_CONTINUE = 0, // Plugin didn't take any action HC_SUPERCEDE, // Skip real function, use my return value - HC_BREAK // Skip all forwards and real function, use my return value + HC_BREAK, // Skip all forwards and real function, use my return value // @note Warning: Be very careful, using this type of return will skip calls for all following AMXX plugins + + HC_BYPASS // Skip calls for all following AMXX plugins, but call the original function + // @note Warning: In PRE skips all forwards including POST forwards }; /** diff --git a/reapi/extra/amxmodx/scripting/include/reapi_engine.inc b/reapi/extra/amxmodx/scripting/include/reapi_engine.inc index be36a7da..1107451a 100644 --- a/reapi/extra/amxmodx/scripting/include/reapi_engine.inc +++ b/reapi/extra/amxmodx/scripting/include/reapi_engine.inc @@ -280,14 +280,16 @@ native rh_get_net_from(output[], len); native rh_get_client_connect_time(const index); /* -* Checks if a specific entity is fully packed in a given frame for a host client. +* Checks if a specific entity is present in the host's outgoing entity table for a given frame, +* indicating it has passed the visibility check (AddToFullPack) and is ready for client transmission. * -* @param index Client index for whom we are checking the entity. +* @param host Host index for whom we are checking the entity. (Host cannot be a fake client) * @param entity Entity index to find in the table of entities for the given frame. * @param frame Frame index where to look. Default is -1, which checks the previous frame. * @note To check in the current frame, this native should be called at the end of the server frame. * -* @return Returns true if the entity is fully packed and ready to be sent to all clients in the given frame, otherwise false. +* @return Returns true if the entity is present in the host's outgoing entity table and +* ready to be sent to all clients in the given frame, otherwise false. */ native bool:rh_is_entity_fullpacked(const host, const entity, const frame = -1); diff --git a/reapi/extra/amxmodx/scripting/include/reapi_gamedll_const.inc b/reapi/extra/amxmodx/scripting/include/reapi_gamedll_const.inc index 30c0f559..3677d137 100644 --- a/reapi/extra/amxmodx/scripting/include/reapi_gamedll_const.inc +++ b/reapi/extra/amxmodx/scripting/include/reapi_gamedll_const.inc @@ -1094,7 +1094,7 @@ enum GamedllFunc_CSGameRules /* * Description: Can this player take damage from this attacker? - * Return type: float + * Return type: BOOL * Params: (const index, const attacker) */ RG_CSGameRules_FPlayerCanTakeDamage, @@ -1260,6 +1260,41 @@ enum GamedllFunc_CSGameRules * Params: (const pKiller, const pVictim, const pAssister, const pevInflictor, const killerWeaponName[], const DeathMessageFlags:iDeathMessageFlags, const KillRarity:iRarityOfKill) */ RG_CSGameRules_SendDeathMessage, + + /* + * Description: Called when the game over condition is being checked. + * Return type: bool + * Params: () + */ + RG_CSGameRules_CheckGameOver, + + /* + * Description: Called when the time limit condition is being checked. + * Return type: bool + * Params: () + */ + RG_CSGameRules_CheckTimeLimit, + + /* + * Description: Called when the frag limit condition is being checked. + * Return type: bool + * Params: () + */ + RG_CSGameRules_CheckFragLimit, + + /* + * Description: Called when the max rounds condition is being checked. + * Return type: bool + * Params: () + */ + RG_CSGameRules_CheckMaxRounds, + + /* + * Description: Called when the win limit condition is being checked. + * Return type: bool + * Params: () + */ + RG_CSGameRules_CheckWinLimit, }; /** diff --git a/reapi/include/cssdk/dlls/gamerules.h b/reapi/include/cssdk/dlls/gamerules.h index 5bb125d0..2526e402 100644 --- a/reapi/include/cssdk/dlls/gamerules.h +++ b/reapi/include/cssdk/dlls/gamerules.h @@ -555,6 +555,13 @@ class CHalfLifeMultiplay: public CGameRules virtual void SendDeathMessage(CBaseEntity *pKiller, CBasePlayer *pVictim, CBasePlayer *pAssister, entvars_t *pevInflictor, const char *killerWeaponName, int iDeathMessageFlags, int iRarityOfKill) = 0; + // Check various conditions to end the map. + virtual BOOL CheckGameOver() = 0; + virtual BOOL CheckTimeLimit() = 0; + virtual BOOL CheckFragLimit() = 0; + virtual BOOL CheckMaxRounds() = 0; + virtual BOOL CheckWinLimit() = 0; + public: bool ShouldSkipShowMenu() const { return m_bSkipShowMenu; } void MarkShowMenuSkipped() { m_bSkipShowMenu = false; } diff --git a/reapi/include/cssdk/dlls/regamedll_api.h b/reapi/include/cssdk/dlls/regamedll_api.h index c0aa993a..d8abb97f 100644 --- a/reapi/include/cssdk/dlls/regamedll_api.h +++ b/reapi/include/cssdk/dlls/regamedll_api.h @@ -630,6 +630,26 @@ typedef IHookChainRegistryClass IReGameHookRegistry_CBa typedef IHookChainClass IReGameHook_CBasePlayer_RemoveAllItems; typedef IHookChainRegistryClass IReGameHookRegistry_CBasePlayer_RemoveAllItems; +// CHalfLifeMultiplay::CheckGameOver hook +typedef IHookChain IReGameHook_CSGameRules_CheckGameOver; +typedef IHookChainRegistry IReGameHookRegistry_CSGameRules_CheckGameOver; + +// CHalfLifeMultiplay::CheckTimeLimit hook +typedef IHookChain IReGameHook_CSGameRules_CheckTimeLimit; +typedef IHookChainRegistry IReGameHookRegistry_CSGameRules_CheckTimeLimit; + +// CHalfLifeMultiplay::CheckFragLimit hook +typedef IHookChain IReGameHook_CSGameRules_CheckFragLimit; +typedef IHookChainRegistry IReGameHookRegistry_CSGameRules_CheckFragLimit; + +// CHalfLifeMultiplay::CheckMaxRounds hook +typedef IHookChain IReGameHook_CSGameRules_CheckMaxRounds; +typedef IHookChainRegistry IReGameHookRegistry_CSGameRules_CheckMaxRounds; + +// CHalfLifeMultiplay::CheckWinLimit hook +typedef IHookChain IReGameHook_CSGameRules_CheckWinLimit; +typedef IHookChainRegistry IReGameHookRegistry_CSGameRules_CheckWinLimit; + class IReGameHookchains { public: virtual ~IReGameHookchains() {} @@ -792,6 +812,12 @@ class IReGameHookchains { virtual IReGameHookRegistry_CBasePlayer_PlayerDeathThink *CBasePlayer_PlayerDeathThink() = 0; virtual IReGameHookRegistry_CBasePlayer_Observer_Think *CBasePlayer_Observer_Think() = 0; virtual IReGameHookRegistry_CBasePlayer_RemoveAllItems *CBasePlayer_RemoveAllItems() = 0; + + virtual IReGameHookRegistry_CSGameRules_CheckGameOver *CSGameRules_CheckGameOver() = 0; + virtual IReGameHookRegistry_CSGameRules_CheckTimeLimit *CSGameRules_CheckTimeLimit() = 0; + virtual IReGameHookRegistry_CSGameRules_CheckFragLimit *CSGameRules_CheckFragLimit() = 0; + virtual IReGameHookRegistry_CSGameRules_CheckMaxRounds *CSGameRules_CheckMaxRounds() = 0; + virtual IReGameHookRegistry_CSGameRules_CheckWinLimit *CSGameRules_CheckWinLimit() = 0; }; struct ReGameFuncs_t { diff --git a/reapi/src/hook_callback.cpp b/reapi/src/hook_callback.cpp index fb228ad6..35bb5b12 100644 --- a/reapi/src/hook_callback.cpp +++ b/reapi/src/hook_callback.cpp @@ -1766,6 +1766,56 @@ void CSGameRules_SendDeathMessage(IReGameHook_CSGameRules_SendDeathMessage *chai callVoidForward(RG_CSGameRules_SendDeathMessage, original, indexOfPDataAmx(pKiller), indexOfEdict(pVictim->pev), indexOfPDataAmx(pAssister), indexOfEdictAmx(pevInflictor), killerWeaponName, iDeathMessageFlags, iRarityOfKill); } +BOOL CSGameRules_CheckGameOver(IReGameHook_CSGameRules_CheckGameOver *chain) +{ + auto original = [chain]() + { + return chain->callNext(); + }; + + return callForward(RG_CSGameRules_CheckGameOver, original); +} + +BOOL CSGameRules_CheckTimeLimit(IReGameHook_CSGameRules_CheckTimeLimit *chain) +{ + auto original = [chain]() + { + return chain->callNext(); + }; + + return callForward(RG_CSGameRules_CheckTimeLimit, original); +} + +BOOL CSGameRules_CheckFragLimit(IReGameHook_CSGameRules_CheckFragLimit *chain) +{ + auto original = [chain]() + { + return chain->callNext(); + }; + + return callForward(RG_CSGameRules_CheckFragLimit, original); +} + +BOOL CSGameRules_CheckMaxRounds(IReGameHook_CSGameRules_CheckMaxRounds *chain) +{ + auto original = [chain]() + { + return chain->callNext(); + }; + + return callForward(RG_CSGameRules_CheckMaxRounds, original); +} + +BOOL CSGameRules_CheckWinLimit(IReGameHook_CSGameRules_CheckWinLimit *chain) +{ + auto original = [chain]() + { + return chain->callNext(); + }; + + return callForward(RG_CSGameRules_CheckWinLimit, original); +} + /* * VTC functions */ diff --git a/reapi/src/hook_callback.h b/reapi/src/hook_callback.h index 84356d3a..c04e14fc 100644 --- a/reapi/src/hook_callback.h +++ b/reapi/src/hook_callback.h @@ -5,10 +5,13 @@ // hookchain return type enum HookChainState { - HC_CONTINUE = 0, // plugin didn't take any action - HC_SUPERCEDE, // skip real function, use my return value - HC_BREAK // skip all forwards and real function, use my return value - // @note Warning: Be very careful using this type of return will skip calls for all following AMXX the plugins. + HC_CONTINUE = 0, // Plugin didn't take any action + HC_SUPERCEDE, // Skip real function, use my return value + HC_BREAK, // Skip all forwards and real function, use my return value + // @note Warning: Be very careful using this type of return will skip calls for all following AMXX the plugins + + HC_BYPASS // Skip calls for all following AMXX plugins, but call the original function + // @note Warning: In PRE skips all forwards including POST forwards }; // api types @@ -168,15 +171,17 @@ NOINLINE void DLLEXPORT _callVoidForward(hook_t* hook, original_t original, f_ar if (likely(fwd->GetState() == FSTATE_ENABLED)) { hookCtx->SetId(fwd->GetIndex()); // set current handler hook - auto ret = g_amxxapi.ExecuteForward(fwd->GetFwdIndex(), std::forward(args)...); + int ret = g_amxxapi.ExecuteForward(fwd->GetFwdIndex(), std::forward(args)...); hookCtx->ResetId(); - if (unlikely(ret == HC_BREAK)) { + if (unlikely(ret == HC_BREAK)) return; - } if (unlikely(ret > hc_state)) hc_state = ret; + + if (unlikely(ret == HC_BYPASS)) + break; } } @@ -187,16 +192,19 @@ NOINLINE void DLLEXPORT _callVoidForward(hook_t* hook, original_t original, f_ar hook->wasCalled = true; } - for (auto fwd : hook->post) + if (hc_state != HC_BYPASS) { - if (likely(fwd->GetState() == FSTATE_ENABLED)) + for (auto fwd : hook->post) { - hookCtx->SetId(fwd->GetIndex()); // set current handler hook - auto ret = g_amxxapi.ExecuteForward(fwd->GetFwdIndex(), std::forward(args)...); - hookCtx->ResetId(); - - if (unlikely(ret == HC_BREAK)) - break; + if (likely(fwd->GetState() == FSTATE_ENABLED)) + { + hookCtx->SetId(fwd->GetIndex()); // set current handler hook + int ret = g_amxxapi.ExecuteForward(fwd->GetFwdIndex(), std::forward(args)...); + hookCtx->ResetId(); + + if (unlikely(ret == HC_BREAK || ret == HC_BYPASS)) + break; + } } } @@ -567,6 +575,12 @@ void CBasePlayer_Observer_Think(IReGameHook_CBasePlayer_Observer_Think *chain, C void CBasePlayer_RemoveAllItems(IReGameHook_CBasePlayer_RemoveAllItems *chain, CBasePlayer *pthis, BOOL removeSuit); void CSGameRules_SendDeathMessage(IReGameHook_CSGameRules_SendDeathMessage *chain, CBaseEntity *pKiller, CBasePlayer *pVictim, CBasePlayer *pAssister, entvars_t *pevInflictor, const char *killerWeaponName, int iDeathMessageFlags, int iRarityOfKill); +BOOL CSGameRules_CheckGameOver(IReGameHook_CSGameRules_CheckGameOver *chain); +BOOL CSGameRules_CheckTimeLimit(IReGameHook_CSGameRules_CheckTimeLimit *chain); +BOOL CSGameRules_CheckFragLimit(IReGameHook_CSGameRules_CheckFragLimit *chain); +BOOL CSGameRules_CheckMaxRounds(IReGameHook_CSGameRules_CheckMaxRounds *chain); +BOOL CSGameRules_CheckWinLimit(IReGameHook_CSGameRules_CheckWinLimit *chain); + /* * VTC functions */ diff --git a/reapi/src/hook_list.cpp b/reapi/src/hook_list.cpp index df094509..da5b1e71 100644 --- a/reapi/src/hook_list.cpp +++ b/reapi/src/hook_list.cpp @@ -248,6 +248,11 @@ hook_t hooklist_gamerules[] = { DLL(CSGameRules_TeamStacked), DLL(CSGameRules_PlayerGotWeapon), DLL(CSGameRules_SendDeathMessage), + DLL(CSGameRules_CheckGameOver), + DLL(CSGameRules_CheckTimeLimit), + DLL(CSGameRules_CheckFragLimit), + DLL(CSGameRules_CheckMaxRounds), + DLL(CSGameRules_CheckWinLimit), }; hook_t hooklist_grenade[] = { diff --git a/reapi/src/hook_list.h b/reapi/src/hook_list.h index 1618afd4..795002b8 100644 --- a/reapi/src/hook_list.h +++ b/reapi/src/hook_list.h @@ -308,6 +308,11 @@ enum GamedllFunc_CSGameRules RG_CSGameRules_TeamStacked, RG_CSGameRules_PlayerGotWeapon, RG_CSGameRules_SendDeathMessage, + RG_CSGameRules_CheckGameOver, + RG_CSGameRules_CheckTimeLimit, + RG_CSGameRules_CheckFragLimit, + RG_CSGameRules_CheckMaxRounds, + RG_CSGameRules_CheckWinLimit, // [...] }; diff --git a/reapi/src/natives/natives_helper.h b/reapi/src/natives/natives_helper.h index 7ae53d89..658b301e 100644 --- a/reapi/src/natives/natives_helper.h +++ b/reapi/src/natives/natives_helper.h @@ -11,6 +11,8 @@ #define CHECK_INSTANCE_OF(x, y) if (unlikely(dynamic_cast((x::BaseClass *)y) == nullptr)) { AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: invalid entity %d ('%s'), is not an instance of the base class '%s'", __FUNCTION__, indexOfEdict(y->pev), STRING(y->pev->classname), #x); return FALSE; } #define CHECK_REQUIREMENTS(x) if (unlikely(!api_cfg.has##x())) { AMXX_LogError(amx, AMX_ERR_NATIVE, "Native '%s' is not available, %s required.", __FUNCTION__, #x); return FALSE; } if (!g_RehldsMessageManager) { AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: %s message manager not initialized.", __FUNCTION__, #x); return FALSE; } +#define AMX_ENTITY_VALIDATE(x, y) if (unlikely(x < AMX_NULLENT || x > gpGlobals->maxEntities)) { AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: \"%s\" invalid entity index %i", __FUNCTION__, y, x); return FALSE; } + class CAmxArg { public: diff --git a/reapi/src/natives/natives_members.cpp b/reapi/src/natives/natives_members.cpp index 18190101..368570e2 100644 --- a/reapi/src/natives/natives_members.cpp +++ b/reapi/src/natives/natives_members.cpp @@ -939,6 +939,7 @@ cell set_member(AMX *amx, void* pdata, const member_t *member, cell* value, size switch (member->type) { case MEMBER_CLASSPTR: { + AMX_ENTITY_VALIDATE(*value, member->name); // native set_member(_index, any:_member, _value, _elem); CBaseEntity *pEntity = getPrivate(*value); set_member(pdata, member->offset, pEntity, element); @@ -946,6 +947,7 @@ cell set_member(AMX *amx, void* pdata, const member_t *member, cell* value, size } case MEMBER_EHANDLE: { + AMX_ENTITY_VALIDATE(*value, member->name); // native set_member(_index, any:_member, _value, _elem); EHANDLE& ehandle = get_member(pdata, member->offset, element); edict_t *pEdictValue = edictByIndexAmx(*value); @@ -954,6 +956,7 @@ cell set_member(AMX *amx, void* pdata, const member_t *member, cell* value, size } case MEMBER_EDICT: { + AMX_ENTITY_VALIDATE(*value, member->name); // native set_member(_index, any:_member, _value, _elem); edict_t *pEdictValue = edictByIndexAmx(*value); set_member(pdata, member->offset, pEdictValue, element); @@ -961,6 +964,7 @@ cell set_member(AMX *amx, void* pdata, const member_t *member, cell* value, size } case MEMBER_EVARS: { + AMX_ENTITY_VALIDATE(*value, member->name); // native set_member(_index, any:_member, _value, _elem); entvars_t *pev = PEV(*value); set_member(pdata, member->offset, pev, element); diff --git a/reapi/src/natives/natives_misc.cpp b/reapi/src/natives/natives_misc.cpp index 50300b99..3f6a3815 100644 --- a/reapi/src/natives/natives_misc.cpp +++ b/reapi/src/natives/natives_misc.cpp @@ -3683,33 +3683,41 @@ cell AMX_NATIVE_CALL rh_get_client_connect_time(AMX *amx, cell *params) } /* -* Checks if a specific entity is fully packed in a given frame for a host client. +* Checks if a specific entity is present in the host's outgoing entity table for a given frame, +* indicating it has passed the visibility check (AddToFullPack) and is ready for client transmission. * -* @param index Client index for whom we are checking the entity. +* @param host Host index for whom we are checking the entity. (Host cannot be a fake client) * @param entity Entity index to find in the table of entities for the given frame. * @param frame Frame index where to look. Default is -1, which checks the previous frame. * @note To check in the current frame, this native should be called at the end of the server frame. * -* @return Returns true if the entity is fully packed and ready to be sent to all clients in the given frame, otherwise false. +* @return Returns true if the entity is present in the host's outgoing entity table and +* ready to be sent to all clients in the given frame, otherwise false. * * native bool:rh_is_entity_fullpacked(const host, const entity, const frame = -1); */ cell AMX_NATIVE_CALL rh_is_entity_fullpacked(AMX *amx, cell *params) { - enum args_e { arg_count, arg_index, arg_entity, arg_frame }; + enum args_e { arg_count, arg_host, arg_entity, arg_frame }; const int SV_UPDATE_BACKUP = (gpGlobals->maxClients == 1) ? SINGLEPLAYER_BACKUP : MULTIPLAYER_BACKUP; const int SV_UPDATE_MASK = (SV_UPDATE_BACKUP - 1); - CHECK_ISPLAYER(arg_index); + CHECK_ISPLAYER(arg_host); - client_t *pClient = clientOfIndex(params[arg_index]); - CHECK_CLIENT_CONNECTED(pClient, arg_index); + client_t *pHost = clientOfIndex(params[arg_host]); + CHECK_CLIENT_CONNECTED(pHost, arg_host); + + if (pHost->fakeclient) + { + AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: Entity checking for fake client (#%d) is invalid. Fake clients do not process entity updates.", __FUNCTION__, params[arg_host]); + return FALSE; + } int iEntity = params[arg_entity]; int iFrame = params[arg_frame]; - client_frame_t *frame = &pClient->frames[(pClient->netchan.outgoing_sequence + iFrame) & SV_UPDATE_MASK]; + client_frame_t *frame = &pHost->frames[(pHost->netchan.outgoing_sequence + iFrame) & SV_UPDATE_MASK]; packet_entities_t *fullpack = &frame->entities; for (int i = 0; i < fullpack->num_entities; i++) diff --git a/reapi/src/reapi_utils.cpp b/reapi/src/reapi_utils.cpp index ade7779a..3cc99ee7 100644 --- a/reapi/src/reapi_utils.cpp +++ b/reapi/src/reapi_utils.cpp @@ -168,6 +168,9 @@ void GetBonePosition(CBaseEntity *pEntity, int iBone, Vector *pVecOrigin, Vector if (iBone < 0 || iBone >= pstudiohdr->numbones) return; // invalid bone + float flFrame = pEdict->v.frame; + float flAnimTime = pEdict->v.animtime; + // force to update frame StudioFrameAdvanceEnt(pstudiohdr, pEdict); @@ -175,6 +178,10 @@ void GetBonePosition(CBaseEntity *pEntity, int iBone, Vector *pVecOrigin, Vector GET_BONE_POSITION(pEdict, iBone, vecOrigin, vecAngles); pEntity->pev->angles.x = -pEntity->pev->angles.x; + // restore the original state for the entity + pEdict->v.frame = flFrame; + pEdict->v.animtime = flAnimTime; + // ReGameDLL already have fixes angles for non-players entities if (!g_ReGameApi && !pEntity->IsPlayer()) { FixupAngles(pEdict, vecOrigin); @@ -204,11 +211,18 @@ void GetAttachment(CBaseEntity *pEntity, int iAttachment, Vector *pVecOrigin, Ve if (iAttachment < 0 || iAttachment >= pstudiohdr->numattachments) return; // invalid attachment + float flFrame = pEdict->v.frame; + float flAnimTime = pEdict->v.animtime; + // force to update frame StudioFrameAdvanceEnt(pstudiohdr, pEdict); GET_ATTACHMENT(pEdict, iAttachment, vecOrigin, vecAngles); + // restore the original state for the entity + pEdict->v.frame = flFrame; + pEdict->v.animtime = flAnimTime; + // ReGameDLL already have fixes angles for non-players entities if (!g_ReGameApi && !pEntity->IsPlayer()) { FixupAngles(pEdict, vecOrigin); @@ -281,7 +295,7 @@ bool GetSequenceInfo2(CBaseEntity *pEntity, int *piFlags, float *pflFrameRate, f *pflFrameRate = 256.0f; *pflGroundSpeed = 0.0f; } - else + else { *pflFrameRate = pseqdesc->fps * 256.0f / (pseqdesc->numframes - 1); *pflGroundSpeed = Q_sqrt(pseqdesc->linearmovement[0] * pseqdesc->linearmovement[0] + pseqdesc->linearmovement[1] * pseqdesc->linearmovement[1] + pseqdesc->linearmovement[2] * pseqdesc->linearmovement[2]);