| author | ekku |
| Mon, 24 Nov 2008 21:48:21 +0000 | |
| changeset 102 | 11e9d02af7a6 |
| parent 96 | 4a801210096c |
| child 107 | 505bfa531496 |
| permissions | -rw-r--r-- |
| 5 | 1 |
#ifndef NETWORK_HH |
2 |
#define NETWORK_HH |
|
3 |
||
| 21 | 4 |
#include "NetworkConfig.hh" |
5 |
#include "GameState.hh" |
|
6 |
||
| 13 | 7 |
#include <ClanLib/network.h> |
| 5 | 8 |
|
| 66 | 9 |
const int32_t COORDINATE_MAX = 1 << 30; |
10 |
||
| 21 | 11 |
class NetworkCore {
|
| 24 | 12 |
protected: |
13 |
GameState &state; |
|
| 5 | 14 |
|
| 24 | 15 |
CL_SlotContainer slots; |
|
22
b70d30e1b0fe
all the network code is now there, although it doesn't quite work
terom
parents:
21
diff
changeset
|
16 |
|
| 89 | 17 |
// constructor |
18 |
NetworkCore (GameState &state) : state(state) { }
|
|
| 24 | 19 |
|
| 89 | 20 |
|
| 66 | 21 |
|
22 |
||
|
22
b70d30e1b0fe
all the network code is now there, although it doesn't quite work
terom
parents:
21
diff
changeset
|
23 |
}; |
|
b70d30e1b0fe
all the network code is now there, although it doesn't quite work
terom
parents:
21
diff
changeset
|
24 |
|
| 89 | 25 |
enum NetworkChannel {
|
26 |
/* |
|
27 |
* Core channel used for NetworkSession |
|
28 |
*/ |
|
29 |
NETCHAN_CORE = 0x01, |
|
30 |
}; |
|
| 66 | 31 |
|
|
22
b70d30e1b0fe
all the network code is now there, although it doesn't quite work
terom
parents:
21
diff
changeset
|
32 |
enum NetworkMessage {
|
| 24 | 33 |
NETMSG_PACKET_INVALID = 0x00, |
|
22
b70d30e1b0fe
all the network code is now there, although it doesn't quite work
terom
parents:
21
diff
changeset
|
34 |
|
| 24 | 35 |
/* |
36 |
* You have joined the game: |
|
37 |
* |
|
| 66 | 38 |
* Vector initial_position |
| 24 | 39 |
*/ |
40 |
NETMSG_SERVER_HELLO = 0x0100, |
|
|
22
b70d30e1b0fe
all the network code is now there, although it doesn't quite work
terom
parents:
21
diff
changeset
|
41 |
|
| 24 | 42 |
/* |
43 |
* New client has connected to server: |
|
| 66 | 44 |
* |
45 |
* Vector initial_position |
|
| 24 | 46 |
*/ |
47 |
NETMSG_PLAYER_JOIN = 0x0101, |
|
|
22
b70d30e1b0fe
all the network code is now there, although it doesn't quite work
terom
parents:
21
diff
changeset
|
48 |
|
| 24 | 49 |
/* |
50 |
* Client has left server: |
|
51 |
* |
|
52 |
*/ |
|
53 |
NETMSG_PLAYER_QUIT = 0x0102, |
|
54 |
||
55 |
/* |
|
56 |
* Client has moved |
|
57 |
* |
|
|
96
4a801210096c
fix movement physics+network code to some degree, jumping is now buggy?
terom
parents:
89
diff
changeset
|
58 |
* uint16_t PlayerInput_Move |
| 24 | 59 |
*/ |
60 |
NETMSG_CLIENT_MOVE = 0x0201, |
|
61 |
||
62 |
/* |
|
63 |
* Initial player info |
|
64 |
* |
|
| 66 | 65 |
* Vector initial_position |
| 24 | 66 |
*/ |
67 |
NETMSG_PLAYER_INFO = 0x0300, |
|
68 |
||
69 |
/* |
|
70 |
* Player position update |
|
71 |
* |
|
| 66 | 72 |
* Vector position |
73 |
* Vector velocity |
|
| 24 | 74 |
*/ |
75 |
NETMSG_PLAYER_POSITION = 0x0301, |
|
| 5 | 76 |
}; |
77 |
||
78 |
#endif |