[1056] | 1 | /* |
---|
| 2 | * ORXONOX - the hottest 3D action shooter ever to exist |
---|
| 3 | * > www.orxonox.net < |
---|
| 4 | * |
---|
| 5 | * |
---|
| 6 | * License notice: |
---|
| 7 | * |
---|
| 8 | * This program is free software; you can redistribute it and/or |
---|
| 9 | * modify it under the terms of the GNU General Public License |
---|
| 10 | * as published by the Free Software Foundation; either version 2 |
---|
| 11 | * of the License, or (at your option) any later version. |
---|
| 12 | * |
---|
| 13 | * This program is distributed in the hope that it will be useful, |
---|
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 16 | * GNU General Public License for more details. |
---|
| 17 | * |
---|
| 18 | * You should have received a copy of the GNU General Public License |
---|
| 19 | * along with this program; if not, write to the Free Software |
---|
| 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
---|
| 21 | * |
---|
| 22 | * Author: |
---|
| 23 | * ... |
---|
| 24 | * Co-authors: |
---|
| 25 | * ... |
---|
| 26 | * |
---|
| 27 | */ |
---|
| 28 | |
---|
[417] | 29 | // |
---|
| 30 | // C++ Interface: PacketTypes |
---|
| 31 | // |
---|
[592] | 32 | // Description: |
---|
[417] | 33 | // |
---|
| 34 | // |
---|
| 35 | // Author: <>, (C) 2007 |
---|
| 36 | // |
---|
| 37 | // Copyright: See COPYING file that comes with this distribution |
---|
| 38 | // |
---|
| 39 | // |
---|
| 40 | |
---|
[673] | 41 | #ifndef _PacketTypes_H__ |
---|
| 42 | #define _PacketTypes_H__ |
---|
[417] | 43 | |
---|
[777] | 44 | #include "NetworkPrereqs.h" |
---|
[417] | 45 | |
---|
[777] | 46 | namespace network |
---|
| 47 | { |
---|
| 48 | enum packet_id { |
---|
| 49 | ACK, |
---|
| 50 | MOUSE, |
---|
| 51 | KEYBOARD, |
---|
| 52 | CHAT, |
---|
| 53 | GAMESTATE , |
---|
| 54 | CLASSID |
---|
| 55 | }; |
---|
[417] | 56 | |
---|
[777] | 57 | |
---|
[592] | 58 | /** |
---|
[777] | 59 | * This struct defines a gamestate: |
---|
| 60 | * size: total size of the data in *data |
---|
| 61 | * data: pointer to the data allocated in the memory |
---|
| 62 | */ |
---|
[417] | 63 | struct GameState{ |
---|
| 64 | int id; |
---|
[592] | 65 | int size; //!< total size of data |
---|
[436] | 66 | // new ---- change functions |
---|
| 67 | bool diffed; |
---|
[592] | 68 | unsigned char *data; //!< pointer to data |
---|
[417] | 69 | }; |
---|
| 70 | |
---|
[592] | 71 | /** |
---|
[777] | 72 | * this struct defines a gamestate: |
---|
| 73 | * compsize is the size of the compressed data |
---|
| 74 | * normsize is the size of the uncompressed data |
---|
| 75 | * data are the gamestates |
---|
| 76 | */ |
---|
[417] | 77 | struct GameStateCompressed{ |
---|
[592] | 78 | int id; |
---|
| 79 | int compsize; //!< size of compressed data |
---|
| 80 | int normsize; //!< size of uncompressed data |
---|
[436] | 81 | // new ----- change functions |
---|
| 82 | bool diffed; |
---|
[592] | 83 | unsigned char *data; //!< gamestate data |
---|
[417] | 84 | }; |
---|
| 85 | |
---|
| 86 | struct classid{ |
---|
| 87 | int id; |
---|
| 88 | int length; |
---|
| 89 | int clid; |
---|
| 90 | const char *message; |
---|
| 91 | }; |
---|
[592] | 92 | |
---|
| 93 | |
---|
[417] | 94 | struct ack { |
---|
| 95 | int id; |
---|
| 96 | int a; |
---|
| 97 | }; |
---|
| 98 | |
---|
| 99 | struct mouse { |
---|
| 100 | int id; |
---|
| 101 | double x; |
---|
| 102 | double y; |
---|
| 103 | }; |
---|
| 104 | |
---|
| 105 | struct keyboard { |
---|
| 106 | int id; |
---|
| 107 | char press; |
---|
| 108 | }; |
---|
[777] | 109 | //only in this class, not PacketGenerator, used as pattern to put incoming |
---|
| 110 | //bytes inside |
---|
[417] | 111 | struct chat { |
---|
| 112 | int id; |
---|
| 113 | const char* message; |
---|
| 114 | }; |
---|
| 115 | |
---|
| 116 | } |
---|
| 117 | |
---|
[673] | 118 | #endif /* _PacketTypes_H__ */ |
---|