Public Member Functions | |
Net (ScummEngine_v90he *vm) | |
int | hostGame (char *sessionName, char *userName) |
int | joinGame (Common::String IP, char *userName) |
int | addUser (char *shortName, char *longName) |
int | removeUser () |
int | whoSentThis () |
int | whoAmI () |
int | createSession (char *name) |
Creates and host a network game session. More... | |
int | joinSession (int sessionIndex) |
int | joinSessionById (int sessionId) |
int | ifSessionExist (int sessionId) |
int | endSession () |
void | setSessionServer (Common::String sessionServer) |
void | disableSessionJoining () |
void | enableSessionJoining () |
void | setBotsCount (int botsCount) |
Set AI Player count. More... | |
int32 | setProviderByName (int32 parameter1, int32 parameter2) |
Set and initializes the provider given by their name. More... | |
void | setFakeLatency (int time) |
Sets the fake latency. More... | |
bool | destroyPlayer (int32 userId) |
int32 | startQuerySessions (bool connectToSessionServer=true) |
int32 | updateQuerySessions () |
void | stopQuerySessions () |
int | querySessions () |
int | queryProviders () |
int | setProvider (int providerIndex) |
Set the provider by the index. More... | |
int | closeProvider () |
bool | initAll () |
bool | initProvider () |
bool | initSession () |
bool | initUser () |
void | remoteStartScript (int typeOfSend, int sendTypeParam, int priority, int argsCount, int32 *args) |
void | remoteSendArray (int typeOfSend, int sendTypeParam, int priority, int arrayIndex) |
int | remoteStartScriptFunction (int typeOfSend, int sendTypeParam, int priority, int defaultReturnValue, int argsCount, int32 *args) |
void | doNetworkOnceAFrame (int msecs) |
bool | getHostName (char *hostname, int length) |
bool | getIPfromName (char *ip, int ipLength, char *nameBuffer) |
void | getSessionName (int sessionNumber, char *buffer, int length) |
int | getSessionPlayerCount (int sessionNumber) |
void | getProviderName (int providerIndex, char *buffer, int length) |
Get the name of a provider of the given index. More... | |
Public Attributes | |
int | _latencyTime |
bool | _fakeLatency |
bool | _isHost |
int | _myUserId |
int | _fromUserId |
int | _sessionId |
int Scumm::Net::hostGame | ( | char * | sessionName, |
char * | userName | ||
) |
Creates a session and add ourselves as a user.
sessionName | Name if a session. |
userName | User name to add. |
1 | on success. |
0 | on falure. |
int Scumm::Net::joinGame | ( | Common::String | IP, |
char * | userName | ||
) |
Joins a session with the speicified IP address and user name. This gets called when attempting to join a Moonbase Commander game with the –join-game command line param.
IP | IP Address to join |
userName | Username to use. |
1 | on success. |
0 | on failure. |
int Scumm::Net::addUser | ( | char * | shortName, |
char * | longName | ||
) |
Adds a user to the session and assigns a user id.
shortName | Short username |
longName | Long username. |
1 | on success. |
0 | on failure. |
int Scumm::Net::removeUser | ( | ) |
Remove ourselves if we have a user id for this session.
Always | returns 1. |
int Scumm::Net::whoSentThis | ( | ) |
Gets the user id who sent the previously received packet.
Last | sent user id. |
int Scumm::Net::whoAmI | ( | ) |
Gets our assigned user id.
Our | user id. |
int Scumm::Net::createSession | ( | char * | name | ) |
Creates and host a network game session.
name | Session name |
1 | on success. |
0 | on failure. |
int Scumm::Net::joinSession | ( | int | sessionIndex | ) |
Join a session by their given index.
sessionIndex | Index of a session to join. |
1 | on success. |
0 | on falure. |
int Scumm::Net::joinSessionById | ( | int | sessionId | ) |
Join a session by their given id instead of index.
sessionId | ID of session to join |
1 | on success. |
0 | on falure. |
int Scumm::Net::ifSessionExist | ( | int | sessionId | ) |
Checks if the queried session id exist.
sessionId | Session ID to search for. |
1 | if found. |
0 | if not found. |
int Scumm::Net::endSession | ( | ) |
Ends and closes an active game session.
Always | returns 1 |
void Scumm::Net::setSessionServer | ( | Common::String | sessionServer | ) |
Force a session server address to connect to when creating and joining sessions, overriding an existing configuration if any.
sessionServer | Address to a session server address. |
void Scumm::Net::disableSessionJoining | ( | ) |
Disallows anymore players from joining our session.
void Scumm::Net::enableSessionJoining | ( | ) |
Allows more players to join our session.
void Scumm::Net::setBotsCount | ( | int | botsCount | ) |
int32 Scumm::Net::setProviderByName | ( | int32 | parameter1, |
int32 | parameter2 | ||
) |
Set and initializes the provider given by their name.
parameter1 | SCUMM string array providing the name of the provider. |
parameter2 | SCUMM string array providing the optional paramater |
1 | if successful |
0 | on failure. |
void Scumm::Net::setFakeLatency | ( | int | time | ) |
Sets the fake latency.
time | Fake latency time in milliseconds. |
bool Scumm::Net::destroyPlayer | ( | int32 | userId | ) |
Destroys and remove an existing player.
userId | ID of player to remove. |
true | on removed |
false | on failure. |
int32 Scumm::Net::startQuerySessions | ( | bool | connectToSessionServer = true | ) |
Setup and begin to query for active game sessions
connectToSessionServer | Indicates that it should connect to the session server for Internet-wide connections |
1 | if ready |
0 | if not. |
int32 Scumm::Net::updateQuerySessions | ( | ) |
Make a session query request and updates the session list.
void Scumm::Net::stopQuerySessions | ( | ) |
Stops and shuts down querying for sessions.
int Scumm::Net::querySessions | ( | ) |
Shortcut for querying sessions, calls startQuerySessions and returns updateQuerySessions.
int Scumm::Net::queryProviders | ( | ) |
Query aviliable providers.
int Scumm::Net::setProvider | ( | int | providerIndex | ) |
Set the provider by the index.
providerIndex | index of a provider |
1 | if successful |
0 | on failure |
int Scumm::Net::closeProvider | ( | ) |
Close and shutsdown an active provider.
bool Scumm::Net::initAll | ( | ) |
Initializes the provider, session, and adds user all at once.
true | on success. |
false | on failure. |
bool Scumm::Net::initProvider | ( | ) |
Initializes the ENet provider.
bool Scumm::Net::initSession | ( | ) |
Initializes the session.
bool Scumm::Net::initUser | ( | ) |
Initializes the user.
void Scumm::Net::remoteStartScript | ( | int | typeOfSend, |
int | sendTypeParam, | ||
int | priority, | ||
int | argsCount, | ||
int32 * | args | ||
) |
Sends a packet to a remote peer(s) which will call VAR_REMOTE_START_SCRIPT.
typeOfSend | A type of send this packet goes to, can be an indiviual peer, a group, host, or everybody. |
sendTypeParam | A parameter for this type of send, e.g. for an indiviual send, this can be a user id of a peer to send to. |
priority | Tells the provider to ensure that this packet has been sent and received. |
argsCount | Number of args it should contain for the VAR_REMOTE_START_SCRIPT call. |
args | The arguments themselves. |
void Scumm::Net::remoteSendArray | ( | int | typeOfSend, |
int | sendTypeParam, | ||
int | priority, | ||
int | arrayIndex | ||
) |
Sends an SCUMM array to a remote peer(s), calling VAR_NETWORK_RECEIVE_ARRAY_SCRIPT there.
typeOfSend | A type of send this packet goes to, can be an indiviual peer, a group, host, or everybody. |
sendTypeParam | A parameter for this type of send, e.g. for an indiviual send, this can be a user id of a peer to send to. |
priority | Tells the provider to ensure that this packet has been sent and received. |
arrayIndex | An index pointing to an SCUMM array to pack and send with. |
int Scumm::Net::remoteStartScriptFunction | ( | int | typeOfSend, |
int | sendTypeParam, | ||
int | priority, | ||
int | defaultReturnValue, | ||
int | argsCount, | ||
int32 * | args | ||
) |
Sends a packet to a peer calling VAR_NETWORK_RECEIVE_ARRAY_SCRIPT, and it'll return its return value back to us.
typeOfSend | A type of send this packet goes to, can be an indiviual peer, a group, host, or everybody. |
sendTypeParam | A parameter for this type of send, e.g. for an indiviual send, this can be a user id of a peer to send to. |
priority | Tells the provider to ensure that this packet has been sent and received. |
defaultReturnValue | The default return value to return in case of a time out. |
argsCount | Number of args it should contain for the VAR_REMOTE_START_SCRIPT call. |
args | The arguments themselves. |
A | peer's return value. |
defaultReturnValue | if timed out. |
void Scumm::Net::doNetworkOnceAFrame | ( | int | msecs | ) |
A method that should be called once at the beginning of a game loop to send/receive network data.
msecs | milliseconds to service networks for. |
bool Scumm::Net::getHostName | ( | char * | hostname, |
int | length | ||
) |
Gets the host name of the local machine.
hostname | Pointer to store the host name to. |
length | The length of the pointer. |
true | on successful . |
false | on failure. |
bool Scumm::Net::getIPfromName | ( | char * | ip, |
int | ipLength, | ||
char * | nameBuffer | ||
) |
Gets the IP address of the given local host name.
ip | Pointer to store the address to. |
ipLength | The length of the pointer. |
nameBuffer | the Host name itself. |
true | on successful . |
false | on failure.. |
void Scumm::Net::getSessionName | ( | int | sessionNumber, |
char * | buffer, | ||
int | length | ||
) |
Get the session name from the session index.
sessionNumber | The session's index. |
buffer | A buffer to store the name to. |
length | Maximum length of the buffer. |
int Scumm::Net::getSessionPlayerCount | ( | int | sessionNumber | ) |
void Scumm::Net::getProviderName | ( | int | providerIndex, |
char * | buffer, | ||
int | length | ||
) |
Get the name of a provider of the given index.
providerIndex | The provider's index. |
buffer | A buffer to store the name to. |
length | Maximum length of the buffer. |