author | saiam |
Fri, 28 Nov 2008 22:26:23 +0000 | |
changeset 128 | 890ac82cdcc0 |
parent 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 |
|
107
505bfa531496
send inAir attribute as part of NETWORK_PLAYER_POSITION...
terom
parents:
96
diff
changeset
|
32 |
enum NetworkPhysicsFlags { |
505bfa531496
send inAir attribute as part of NETWORK_PLAYER_POSITION...
terom
parents:
96
diff
changeset
|
33 |
NETWORK_PHYSICS_INAIR = 0x01, |
505bfa531496
send inAir attribute as part of NETWORK_PLAYER_POSITION...
terom
parents:
96
diff
changeset
|
34 |
}; |
505bfa531496
send inAir attribute as part of NETWORK_PLAYER_POSITION...
terom
parents:
96
diff
changeset
|
35 |
|
22
b70d30e1b0fe
all the network code is now there, although it doesn't quite work
terom
parents:
21
diff
changeset
|
36 |
enum NetworkMessage { |
24 | 37 |
NETMSG_PACKET_INVALID = 0x00, |
22
b70d30e1b0fe
all the network code is now there, although it doesn't quite work
terom
parents:
21
diff
changeset
|
38 |
|
24 | 39 |
/* |
40 |
* You have joined the game: |
|
41 |
* |
|
66 | 42 |
* Vector initial_position |
24 | 43 |
*/ |
44 |
NETMSG_SERVER_HELLO = 0x0100, |
|
22
b70d30e1b0fe
all the network code is now there, although it doesn't quite work
terom
parents:
21
diff
changeset
|
45 |
|
24 | 46 |
/* |
47 |
* New client has connected to server: |
|
66 | 48 |
* |
49 |
* Vector initial_position |
|
24 | 50 |
*/ |
51 |
NETMSG_PLAYER_JOIN = 0x0101, |
|
22
b70d30e1b0fe
all the network code is now there, although it doesn't quite work
terom
parents:
21
diff
changeset
|
52 |
|
24 | 53 |
/* |
54 |
* Client has left server: |
|
55 |
* |
|
56 |
*/ |
|
57 |
NETMSG_PLAYER_QUIT = 0x0102, |
|
58 |
||
59 |
/* |
|
60 |
* Client has moved |
|
61 |
* |
|
96
4a801210096c
fix movement physics+network code to some degree, jumping is now buggy?
terom
parents:
89
diff
changeset
|
62 |
* uint16_t PlayerInput_Move |
24 | 63 |
*/ |
64 |
NETMSG_CLIENT_MOVE = 0x0201, |
|
65 |
||
66 |
/* |
|
67 |
* Initial player info |
|
68 |
* |
|
66 | 69 |
* Vector initial_position |
24 | 70 |
*/ |
71 |
NETMSG_PLAYER_INFO = 0x0300, |
|
72 |
||
73 |
/* |
|
74 |
* Player position update |
|
75 |
* |
|
66 | 76 |
* Vector position |
77 |
* Vector velocity |
|
107
505bfa531496
send inAir attribute as part of NETWORK_PLAYER_POSITION...
terom
parents:
96
diff
changeset
|
78 |
* uint8_t NetworkPhysicsFlags |
24 | 79 |
*/ |
80 |
NETMSG_PLAYER_POSITION = 0x0301, |
|
5 | 81 |
}; |
82 |
||
83 |
#endif |