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

Telemenu: Some bug fixes and small improvements #17

Merged
merged 13 commits into from Jul 3, 2014

Conversation

@Freeman-AM
Copy link
Contributor

commented May 18, 2014

This update feature :

  • The use of float version of origin natives instead of integer version :
    This mainly fix problems encountered due to imprecision of integer origin natives : If the origin is saved by an alive player on the ground, sometimes the teleported player can be stuck on ground, especially in slopes.
  • The ability to save an origin from an alive player in a crouched area or in a crouch state and teleport to it without risking stuck problems.
  • The ability to save the view and use it during teleportion :
    This feature allow you to save the view angles of the player who save the origin and apply them at teleportation on player's angles of teleported player.
  • The use of charsmax in place of hardcoded buffer lengths.
  • The switch format to formatex.

Tested on Counter-Strike 1.6.
It need testing with other games, i think.

@Freeman-AM

This comment has been minimized.

Copy link
Contributor Author

commented May 18, 2014

As suggested, i have removed mentioned hardcoded stuff.
It work well without it under Counter-strike 1.6.

@Freeman-AM

This comment has been minimized.

Copy link
Contributor Author

commented May 19, 2014

Tested in ESF
Hmmm, as i though ducking don't behave like in CS 1.6.
After the teleportation FL_DUCKING is still on player, when it's never the case in normal.
If ingame, it has no effect, it cause some problems with death cam who is too much under the floor. (you can't almost see your body)

My though : we should check if player is ducking at save in the menu and apply ducking state on teleportation only when it's necessary. So that way, it will support all the mods. (there is no crouch in ESF)

What do you guys think about that ?

@Arkshine

This comment has been minimized.

Copy link
Member

commented May 19, 2014

This seems a reasonable idea.

Freeman-AM added 3 commits May 19, 2014
Telemenu: Improve ducking feature
Apply ducking state on teleported player only when the teleportation point is saved by a ducking player.
This feature fix possibles errors that could happen with games that don't use crouch, like ESF, NNK...
And for game like Counter-Strike 1.6, this is more logic.
@Freeman-AM

This comment has been minimized.

Copy link
Contributor Author

commented May 20, 2014

Well, here it come... probably my last commit.

I spend some hours trying to find a workaround to not hardcode things, trying to reproduce game way using Half-Life source code as a base. Well, i failed.

So i ended up retrieving the data from all the games and hardoding pev_view_ofs.

If you have a better working way, of course, it will be considered...

I intentionally remove the duck feature for game that we don't know how their pev_view_ofs work.

@Arkshine

This comment has been minimized.

Copy link
Member

commented May 22, 2014

Patch seems to look good.

I'm not sure about hardcoding all mod in one file, but considering it's just one constant and teleport function is not going to be used often, it will be probably ok to leave as it is.

Though you could avoid to duplicate all code. Creating a function would be welcomed.

@Freeman-AM

This comment has been minimized.

Copy link
Contributor Author

commented May 23, 2014

I can create specific mods version when i can for this plugin, but if so, i will probably go to another pull request rather than continue on this one, to keep it clean.

@Arkshine

This comment has been minimized.

Copy link
Member

commented May 23, 2014

No, it's fine.

But what you can do is at least avoiding code duplication and while you are on it checking one time mod.
Meaning, creating a function where you get and return view_ofs as static value, so all these mod checks will be done just one time and in main function if value is positive, you set pev_view_ofs. It will be more clean this way. (Or you can set pev_flags and pev_view_ofs in this function too, up to you).

Telemenu: Fix some bugs and add some improvements
Bugfixes
- a typo error induced by me, id instead of player
- The second teleportation way of this plugin can only be done when the menuactor is not alive.
There is no crouch in death mod or spectator mod, so i remove this useless call. (Line 134 - 139)
Improvements :
- Check mod VEC_DUCK_VIEW only one time.
- Removal of code duplication
@Freeman-AM

This comment has been minimized.

Copy link
Contributor Author

commented May 24, 2014

Bugfixes

  • a typo error induced by me, id instead of player
  • The second teleportation way of this plugin can only be done when the menuactor is not alive.
    There is no crouch in death mod or spectator mod, so i remove this useless call. (Line 134 - 139)

Improvements :

  • Check mod VEC_DUCK_VIEW only one time.
  • Removal of code duplication
@Freeman-AM

This comment has been minimized.

Copy link
Contributor Author

commented May 25, 2014

Compile well. Will be tested on differents games.

@Freeman-AM

This comment has been minimized.

Copy link
Contributor Author

commented Jul 3, 2014

Test will be done using this code part as a base :

public client_PreThink(id)
{
    if ( is_user_alive(id) )
    {
        new Float:view_ofs[3], Float:mins[3], Float:maxs[3]
        pev(id, pev_view_ofs, view_ofs)
        pev(id, pev_mins, mins)
        pev(id, pev_maxs, maxs)
        client_print(id, print_center, "%s view_ofs[2]: %f mins: %.1f %.1f %.1f  maxs: %.1f %.1f %.1f", (pev(id, pev_flags) & FL_DUCKING) ? "FL_DUCKIN" : "FL_NORMAL", view_ofs[2], mins[0], mins[1], mins[2], maxs[0], maxs[1], maxs[2])
    }
}
Telemenu: Remove ducking feature for Natural Selection because of inc…
…ompatibilities

The main reason to remove this feature and let it behave like normal in Natural Selection is the fact that, in this game, there is different classes. Humans can crouch when some (small) aliens can't and normally never get the FL_DUCKING flag.
There is a small chance to create a teleportion point ducking as human and teleport an alien who will get an unsual flag for an alien.

So to don't mess with the game, this feature is disabled.
@Freeman-AM

This comment has been minimized.

Copy link
Contributor Author

commented Jul 3, 2014

I removed ducking feature for natural selection (1 line removed) due to some incompatibilities, see last commit.

@Freeman-AM

This comment has been minimized.

Copy link
Contributor Author

commented Jul 3, 2014

Read and reread.
Heavily tested and work as intended on :
Counter-Strike (T and CTs)
Counter-Strike: Condition Zero (T and CTs)
Day of Defeat (All classes, both side)
Deathmatch classic (All classes) (no crouch in this game)
Earth's Special Forces (All characters) (no crouch in this game)
Earth's Special Forces beta (All characters) (no crouch in this game)
Half-Life (All classes)
Half-Life: Opposing Force (All classes)
Natural Selection (All classes)
Team Fortress Classic (All classes)
The Specialists (All classes)

IMO, everything is fine and ready to be merged.

@Arkshine

This comment has been minimized.

Copy link
Member

commented Jul 3, 2014

Thanks for your effort and time, it's appreciated.

🚢

Arkshine pushed a commit that referenced this pull request Jul 3, 2014
Vincent Herbet
Merge pull request #17 from Freeman-AM/master
Telemenu: Some bug fixes and small improvements

@Arkshine Arkshine merged commit 17f2006 into alliedmodders:master Jul 3, 2014

1 check passed

continuous-integration/travis-ci The Travis CI build passed
Details

@Arkshine Arkshine added the plugin label Jan 22, 2017

Arkshine pushed a commit that referenced this pull request Jun 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.