diff options
| author | Magnus Auvinen <magnus.auvinen@gmail.com> | 2009-01-11 17:55:23 +0000 |
|---|---|---|
| committer | Magnus Auvinen <magnus.auvinen@gmail.com> | 2009-01-11 17:55:23 +0000 |
| commit | b717297b630dbd1cf226d2b733950c272a85911f (patch) | |
| tree | cf98938faabceebfd8ceb07dffd92296094923a0 /src/game/client | |
| parent | accc4799ede63881ca06ee2e713ffe70161438fc (diff) | |
| download | zcatch-b717297b630dbd1cf226d2b733950c272a85911f.tar.gz zcatch-b717297b630dbd1cf226d2b733950c272a85911f.zip | |
fixed so that the local player is always rendered above the other players
Diffstat (limited to 'src/game/client')
| -rw-r--r-- | src/game/client/components/players.cpp | 45 |
1 files changed, 27 insertions, 18 deletions
diff --git a/src/game/client/components/players.cpp b/src/game/client/components/players.cpp index 0b3a7053..b59e026a 100644 --- a/src/game/client/components/players.cpp +++ b/src/game/client/components/players.cpp @@ -459,26 +459,35 @@ void PLAYERS::render_player( void PLAYERS::on_render() { - for(int i = 0; i < MAX_CLIENTS; i++) + // render other players in two passes, first pass we render the other, second pass we render our self + for(int p = 0; p < 2; p++) { - // only render active characters - if(!gameclient.snap.characters[i].active) - continue; + for(int i = 0; i < MAX_CLIENTS; i++) + { + // only render active characters + if(!gameclient.snap.characters[i].active) + continue; - const void *prev_info = snap_find_item(SNAP_PREV, NETOBJTYPE_PLAYER_INFO, i); - const void *info = snap_find_item(SNAP_CURRENT, NETOBJTYPE_PLAYER_INFO, i); + const void *prev_info = snap_find_item(SNAP_PREV, NETOBJTYPE_PLAYER_INFO, i); + const void *info = snap_find_item(SNAP_CURRENT, NETOBJTYPE_PLAYER_INFO, i); - if(prev_info && info) - { - NETOBJ_CHARACTER prev_char = gameclient.snap.characters[i].prev; - NETOBJ_CHARACTER cur_char = gameclient.snap.characters[i].cur; - - render_player( - &prev_char, - &cur_char, - (const NETOBJ_PLAYER_INFO *)prev_info, - (const NETOBJ_PLAYER_INFO *)info - ); - } + if(prev_info && info) + { + // + bool local = ((const NETOBJ_PLAYER_INFO *)info)->local !=0; + if(p == 0 && local) continue; + if(p == 1 && !local) continue; + + NETOBJ_CHARACTER prev_char = gameclient.snap.characters[i].prev; + NETOBJ_CHARACTER cur_char = gameclient.snap.characters[i].cur; + + render_player( + &prev_char, + &cur_char, + (const NETOBJ_PLAYER_INFO *)prev_info, + (const NETOBJ_PLAYER_INFO *)info + ); + } + } } } |