author | terom |
Sat, 06 Dec 2008 19:14:58 +0000 | |
changeset 224 | e6faefba2ec1 |
parent 223 | 2fcaf54ed37b |
child 239 | 550397d9d479 |
permissions | -rw-r--r-- |
185
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff
changeset
|
1 |
#ifndef NETWORKCLIENT_HH |
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff
changeset
|
2 |
#define NETWORKCLIENT_HH |
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff
changeset
|
3 |
|
186 | 4 |
#include "../GameState.hh" |
5 |
#include "Session.hh" |
|
6 |
#include "Object.hh" |
|
185
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff
changeset
|
7 |
|
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff
changeset
|
8 |
// forward-declare |
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff
changeset
|
9 |
class NetworkClientLocalPlayer; |
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff
changeset
|
10 |
class NetworkClientRemotePlayer; |
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff
changeset
|
11 |
|
187 | 12 |
class NetworkClient { |
209
68cc4248a508
sneak in some ugly ugly ugly Multiple Inheritance that hopefully nobody ever notices
terom
parents:
203
diff
changeset
|
13 |
friend class NetworkClientPlayerHelper; |
185
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff
changeset
|
14 |
friend class NetworkClientLocalPlayer; |
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff
changeset
|
15 |
friend class NetworkClientRemotePlayer; |
223 | 16 |
friend class NetworkClientProjectile; |
185
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff
changeset
|
17 |
|
187 | 18 |
protected: |
19 |
GameState &state; |
|
20 |
CL_SlotContainer slots; |
|
21 |
||
185
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff
changeset
|
22 |
NetworkSession netsession; |
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff
changeset
|
23 |
NetworkNode *server; |
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff
changeset
|
24 |
|
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff
changeset
|
25 |
NetworkObject_ClientController netobjs; |
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff
changeset
|
26 |
|
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff
changeset
|
27 |
public: |
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff
changeset
|
28 |
NetworkClient (GameState &state, const NetworkAddress &connect_to); |
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff
changeset
|
29 |
|
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff
changeset
|
30 |
private: |
200
2dbf40661580
better NetworkBuffer/Packet stuff + some additional Physics+Network stuff + random fixes
terom
parents:
187
diff
changeset
|
31 |
void on_create (NetworkObject_Client *obj, NetworkMessageID msg_id, NetworkPacketInput &pkt); |
185
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff
changeset
|
32 |
|
200
2dbf40661580
better NetworkBuffer/Packet stuff + some additional Physics+Network stuff + random fixes
terom
parents:
187
diff
changeset
|
33 |
void on_server_hello (NetworkObject_Client *obj, NetworkPacketInput &pkt); |
2dbf40661580
better NetworkBuffer/Packet stuff + some additional Physics+Network stuff + random fixes
terom
parents:
187
diff
changeset
|
34 |
void on_player_info (NetworkObject_Client *obj, NetworkPacketInput &pkt); |
2dbf40661580
better NetworkBuffer/Packet stuff + some additional Physics+Network stuff + random fixes
terom
parents:
187
diff
changeset
|
35 |
void on_player_join (NetworkObject_Client *obj, NetworkPacketInput &pkt); |
223 | 36 |
void on_projectile_create (NetworkObject_Client *obj, NetworkPacketInput &pkt); |
203
3ec7ab40755f
send initial terrain data to clients using a new NETCHAN_TERRAIN_ARRAY channel using raw BigNetworkPacket
terom
parents:
200
diff
changeset
|
37 |
|
3ec7ab40755f
send initial terrain data to clients using a new NETCHAN_TERRAIN_ARRAY channel using raw BigNetworkPacket
terom
parents:
200
diff
changeset
|
38 |
void on_terrain_array (NetworkPacketInput &pkt, NetworkNode *node); |
185
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff
changeset
|
39 |
|
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff
changeset
|
40 |
public: |
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff
changeset
|
41 |
void player_quit (NetworkClientRemotePlayer *player); |
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff
changeset
|
42 |
}; |
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff
changeset
|
43 |
|
223 | 44 |
class NetworkClientObjectHelper { |
200
2dbf40661580
better NetworkBuffer/Packet stuff + some additional Physics+Network stuff + random fixes
terom
parents:
187
diff
changeset
|
45 |
protected: |
185
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff
changeset
|
46 |
NetworkClient &client; |
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff
changeset
|
47 |
|
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff
changeset
|
48 |
CL_SlotContainer slots; |
200
2dbf40661580
better NetworkBuffer/Packet stuff + some additional Physics+Network stuff + random fixes
terom
parents:
187
diff
changeset
|
49 |
|
185
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff
changeset
|
50 |
NetworkObject_Client *obj; |
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff
changeset
|
51 |
|
223 | 52 |
NetworkClientObjectHelper (NetworkClient &client, NetworkObject_Client *obj); |
53 |
}; |
|
54 |
||
55 |
class NetworkClientPlayerHelper : public NetworkClientObjectHelper, public virtual Player { |
|
200
2dbf40661580
better NetworkBuffer/Packet stuff + some additional Physics+Network stuff + random fixes
terom
parents:
187
diff
changeset
|
56 |
protected: |
209
68cc4248a508
sneak in some ugly ugly ugly Multiple Inheritance that hopefully nobody ever notices
terom
parents:
203
diff
changeset
|
57 |
NetworkClientPlayerHelper (NetworkClient &client, Vector position, NetworkObject_Client *obj); |
200
2dbf40661580
better NetworkBuffer/Packet stuff + some additional Physics+Network stuff + random fixes
terom
parents:
187
diff
changeset
|
58 |
|
2dbf40661580
better NetworkBuffer/Packet stuff + some additional Physics+Network stuff + random fixes
terom
parents:
187
diff
changeset
|
59 |
private: |
2dbf40661580
better NetworkBuffer/Packet stuff + some additional Physics+Network stuff + random fixes
terom
parents:
187
diff
changeset
|
60 |
void on_position (NetworkPacketInput &pkt); |
2dbf40661580
better NetworkBuffer/Packet stuff + some additional Physics+Network stuff + random fixes
terom
parents:
187
diff
changeset
|
61 |
void on_dig (NetworkPacketInput &pkt); |
2dbf40661580
better NetworkBuffer/Packet stuff + some additional Physics+Network stuff + random fixes
terom
parents:
187
diff
changeset
|
62 |
}; |
2dbf40661580
better NetworkBuffer/Packet stuff + some additional Physics+Network stuff + random fixes
terom
parents:
187
diff
changeset
|
63 |
|
2dbf40661580
better NetworkBuffer/Packet stuff + some additional Physics+Network stuff + random fixes
terom
parents:
187
diff
changeset
|
64 |
class NetworkClientLocalPlayer : public NetworkClientPlayerHelper, public LocalPlayer { |
185
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff
changeset
|
65 |
public: |
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff
changeset
|
66 |
NetworkClientLocalPlayer (NetworkClient &client, NetworkObject_Client *obj, Vector position); |
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff
changeset
|
67 |
|
221 | 68 |
virtual void handleInput (PlayerInput input); |
185
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff
changeset
|
69 |
}; |
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff
changeset
|
70 |
|
200
2dbf40661580
better NetworkBuffer/Packet stuff + some additional Physics+Network stuff + random fixes
terom
parents:
187
diff
changeset
|
71 |
class NetworkClientRemotePlayer : public NetworkClientPlayerHelper, public RemotePlayer { |
185
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff
changeset
|
72 |
public: |
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff
changeset
|
73 |
NetworkClientRemotePlayer (NetworkClient &client, NetworkObject_Client *obj, Vector position); |
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff
changeset
|
74 |
|
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff
changeset
|
75 |
private: |
200
2dbf40661580
better NetworkBuffer/Packet stuff + some additional Physics+Network stuff + random fixes
terom
parents:
187
diff
changeset
|
76 |
void on_quit (NetworkPacketInput &pkt); |
2dbf40661580
better NetworkBuffer/Packet stuff + some additional Physics+Network stuff + random fixes
terom
parents:
187
diff
changeset
|
77 |
|
185
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff
changeset
|
78 |
}; |
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff
changeset
|
79 |
|
223 | 80 |
class NetworkClientProjectile : public NetworkClientObjectHelper, public Projectile { |
81 |
public: |
|
82 |
NetworkClientProjectile (NetworkClient &client, NetworkObject_Client *obj, Vector position, Vector velocity, |
|
83 |
float explosionRadius); |
|
224
e6faefba2ec1
fixed logger, and network projectiles should work reasonably well now
terom
parents:
223
diff
changeset
|
84 |
|
e6faefba2ec1
fixed logger, and network projectiles should work reasonably well now
terom
parents:
223
diff
changeset
|
85 |
protected: |
e6faefba2ec1
fixed logger, and network projectiles should work reasonably well now
terom
parents:
223
diff
changeset
|
86 |
virtual void onDestroy (Vector position, bool removeGround); |
e6faefba2ec1
fixed logger, and network projectiles should work reasonably well now
terom
parents:
223
diff
changeset
|
87 |
|
e6faefba2ec1
fixed logger, and network projectiles should work reasonably well now
terom
parents:
223
diff
changeset
|
88 |
private: |
e6faefba2ec1
fixed logger, and network projectiles should work reasonably well now
terom
parents:
223
diff
changeset
|
89 |
void on_destroy (NetworkPacketInput &pkt); |
223 | 90 |
}; |
91 |
||
185
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff
changeset
|
92 |
#endif |