Skip to content
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

The rh_emit_sound2 native is broken #242

Open
DarthMan opened this issue Feb 14, 2022 · 2 comments
Open

The rh_emit_sound2 native is broken #242

DarthMan opened this issue Feb 14, 2022 · 2 comments

Comments

@DarthMan
Copy link
Contributor

DarthMan commented Feb 14, 2022

Hello, it seems that the rh_emit_sound2 native is broken. I wrote a plugin example that I tested on TFC.

Didn't test in other mods, but since it's broken on Team Fortress Classic, I guess it is on all of them.
Hope it will be fixed :)

#include <amxmodx>
#include <reapi>

new const umbrella_sound[] = "weapons/cbar_miss1.wav";

public plugin_init() {
    register_clcmd("say /sound", "PlaySound");
}

public PlaySound(id) {
    rh_emit_sound2(id, id, CHAN_ITEM, umbrella_sound, VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
}

public plugin_precache() {
    precache_sound(umbrella_sound);
}
@WPMGPRoSToTeMa
Copy link
Contributor

WPMGPRoSToTeMa commented Feb 14, 2022

rh_emit_sound2 uses checks that are specific to the CS gamedll:
https://github.com/s1lentq/reapi/blob/efcc3952b5d2a96280521d98d1ec6072c5d39175/reapi/src/natives/natives_misc.cpp#L2657-L2663

CHECK_CONNECTED uses has_disconnected field which is present only in CS. IsNetClient also cannot be used in cross-game code because function offsets inside vtables aren't the same across the different games.

rh_update_user_info is also affected by this:
https://github.com/s1lentq/reapi/blob/efcc3952b5d2a96280521d98d1ec6072c5d39175/reapi/src/natives/natives_misc.cpp#L2689-L2690

There are also common natives affected:

  • GetGrenadeType - but I hope it should be CS-specific anyway
  • engset_view
  • GetBonePosition - not sure
  • GetAttachment - not sure
  • SetThink - should rely on gamedata to be not CS-specific
  • SetTouch - same as SetThink
  • SetUse - same as SetThink
  • SetBlocked - same as SetThink
  • SetMoveDone - same as SetThink
  • is_entity

@DarthMan
Copy link
Contributor Author

rh_emit_sound2 uses checks that are specific to the CS gamedll:

https://github.com/s1lentq/reapi/blob/efcc3952b5d2a96280521d98d1ec6072c5d39175/reapi/src/natives/natives_misc.cpp#L2657-L2663

CHECK_CONNECTED uses has_disconnected field which is present only in CS. IsNetClient also cannot be used in cross-game code because function offsets inside vtables aren't the same across the different games.

rh_update_user_info is also affected by this:

https://github.com/s1lentq/reapi/blob/efcc3952b5d2a96280521d98d1ec6072c5d39175/reapi/src/natives/natives_misc.cpp#L2689-L2690

There are also common natives affected:

  • GetGrenadeType - but I hope it should be RG specific anyway
  • engset_view
  • GetBonePosition - not sure
  • GetAttachment - not sure
  • SetThink - should rely on gamedata to be not RG specific
  • SetTouch - same as SetThink
  • SetUse - same as SetThink
  • SetBlocked - same as SetThink
  • SetMoveDone - same as SetThink
  • is_entity

Then I guess since they rely on CS they must be moved to regamedll or if not in the native description it should be stated that all the mentioned natives are only for CS only.

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

No branches or pull requests

2 participants