Amulets & Armor
v1.02
Open Source Game
|
Client Player Actions. More...
Macros | |
#define | CLIENT_NUM_TALK_MODES 3 |
#define | ClientSetDeadState(state) (G_deadState = (state)) |
#define | PLAYER_ATTACK_DISTANCE 40 |
#define | PLAYER_ATTACK_HEIGHT 30 |
#define | PLAYER_ATTACK_RADIUS 10 |
#define | TIME_BETWEEN_PICK_LOCKS 140 /* 2 seconds */ |
#define | TIME_BETWEEN_STEALS 140 /* 2 seconds */ |
Variables | |
char | G_clientSyncStatus [50] = "" |
T_word16 | G_loginId = 0xFFFF |
T_word16 | G_mapAorB = 0 |
T_mapHandle | G_mapHandleA = MAP_HANDLE_BAD |
T_mapHandle | G_mapHandleB = MAP_HANDLE_BAD |
E_Boolean | G_serverActive |
T_word32 | G_syncCount = 0 |
Client Player Actions.
An interface between the player ("client" here) and originally the server world is the Client system. The game system has the player make requests to the world through the Client interface.
Much of this code is the player "top level" control and has a mix of many pieces of code.
The game keyboard controls are handled in ClientHandleKeyboard().
#define CLIENT_NUM_TALK_MODES 3 |
#define ClientSetDeadState | ( | state) | (G_deadState = (state)) |
#define PLAYER_ATTACK_DISTANCE 40 |
#define PLAYER_ATTACK_HEIGHT 30 |
#define PLAYER_ATTACK_RADIUS 10 |
#define TIME_BETWEEN_PICK_LOCKS 140 /* 2 seconds */ |
#define TIME_BETWEEN_STEALS 140 /* 2 seconds */ |
T_void ClientAttackSent | ( | T_word32 | extraData, |
T_packetEitherShortOrLong * | p_packet | ||
) |
ClientAttackSent confirms that the attack was done.
ClientCheckScrolling checks to see if the player has pressed either the Page up or Page down keys to scroll the messages.
ClientCreateGlobalAreaSound causes an area sound to be created that all players hear.
x | – X center for area sound |
y | – Y center for area sound |
radius | – range of sound from center |
soundID | – sound number |
T_void ClientCreateProjectile | ( | E_effectMissileType | type, |
T_word16 | duration, | ||
T_word16 | power | ||
) |
E_clientDialResult ClientDialIn | ( | T_byte8 * | p_init, |
T_byte8 * | p_dial | ||
) |
E_changePasswordStatus ClientGetChangePasswordStatus | ( | T_void | ) |
E_checkPasswordStatus ClientGetCheckPasswordStatus | ( | T_void | ) |
E_clientConnectionType ClientGetConnectionType | ( | T_void | ) |
E_createCharStatus ClientGetCreateCharacterStatus | ( | T_void | ) |
ClientGetCurrentPlace returns the number of the current place.
ClientGetCurrentServerID returns the id of the current server.
ClientGetCurrentStartLocation returns what position within a place client is at.
E_deleteCharStatus ClientGetDeleteCharacterStatus | ( | T_void | ) |
ClientGetDelta returns the number of timer clicks (ticks) that have passed since this routine was last called.
E_loadCharStatus ClientGetLoadCharacterStatus | ( | T_void | ) |
ClientGetLoginId retrieves the 'login ID' of the client.
E_clientMode ClientGetMode | ( | T_void | ) |
ClientGetMode returns the mode that the client is in.
E_clientSaveCharStatus ClientGetSaveCharStatus | ( | T_void | ) |
ClientSetSaveCharStatus sets what status the last attempt to save a character is in.
E_requestEnterStatus ClientGetServerEnterStatus | ( | T_void | ) |
ClientGetServerEnterStatus gets what state in enter the server we are in.
ClientGotoForm starts up a form that is either hardcoded or communications based.
formNumber | – Number of form to load. |
ClientGotoPlace tells the client to initiate a request to go to a different location.
locationNumber | – location number |
startLocation | – Location within map |
T_void ClientHandleKeyboard | ( | E_keyboardEvent | event, |
T_word16 | scankey | ||
) |
Only ClientSendMessage if not interpreted
ClientHandleOverlay is called when the 3D engine is done drawing the 3d view. This routine draws everything that is to appear on top of the 3D view.
left | – left edge of view |
top | – top edge of view |
right | – right edge of view |
bottom | – bottom edge of view |
Register my callback routines with the command queue.
Make note of the fact that we are now "up"
ClientInit starts up and cleans up any initial items needed by the client.
Simple put, "Am I logged into the server?"
ClientIsAttemptingLogout returns true if the client is logging out of the system.
E_Boolean ClientIsDead | ( | void | ) |
ClientIsActive returns TRUE if the client is initialized.
Simple put, "Am I logged into the server?"
ClientLogin requests to login into the server.
NOTE: It is assumed that the client has already attached to server and there is a data communications path open.
Get a quick pointer.
Request a login as the character of my choice.
ClientLogoff tells the server that the client is leaving.
NOTE: It is assumed that the client has already attached to server and there is a data communications path open.
T_void ClientLogoffFinish | ( | T_word32 | extraData, |
T_packetEitherShortOrLong * | p_packet | ||
) |
ClientLogoffFinish declares the client no longer on. This routine closes out the client and anything else that must be done.
T_void ClientMakeObjectGoSplat | ( | T_3dObject * | p_obj, |
T_word16 | amount, | ||
E_effectDamageType | damageType, | ||
E_effectDamageType | defenseType, | ||
E_bloodEffect | bloodType | ||
) |
T_void ClientObjectShootObject | ( | T_word16 | objectType, |
T_word16 | sourceObject, | ||
T_word16 | angle, | ||
T_word16 | velocity | ||
) |
Get a pointer to our projectile-add packet
We are requesting a fireball...
... shot by this player ...
... with speed 50 ...
Target.
Now we just send the packet.
T_void ClientSetChangePasswordStatus | ( | E_changePasswordStatus | status) |
T_void ClientSetCheckPasswordStatus | ( | E_checkPasswordStatus | status) |
T_void ClientSetConnectionType | ( | E_clientConnectionType | type) |
T_void ClientSetCreateCharacterStatus | ( | E_createCharStatus | status) |
ClientSetCurrentPlace declares where the current place is.
newPlace | – Number of current place |
ClientSetCurrentServerID sets the id of the current server.
newServerID | – Server ID |
ClientSetCurrentStartLocation returns what position within a place client is at.
newStartLocation | – Number of current start location |
T_void ClientSetDeleteCharacterStatus | ( | E_deleteCharStatus | status) |
T_void ClientSetLoadCharacterStatus | ( | E_loadCharStatus | status) |
ClientSetLoginId stores the 'login ID' of the client.
loginId | – login ID |
T_void ClientSetMode | ( | E_clientMode | newMode) |
ClientSetMode declares the mode that the client is in.
newMode | – mode client is in. |
T_void ClientSetSaveCharStatus | ( | E_clientSaveCharStatus | status) |
ClientSetSaveCharStatus sets what status the last attempt to save a character is in.
status | – New save char status |
T_void ClientSetServerEnterStatus | ( | E_requestEnterStatus | status) |
ClientSetServerEnterStatus sets what state in enter the server we are in.
status | – New status |
ClientShootFireball creates a fireball object and requests that the server add it to the game.
Get a pointer to our projectile-add packet
We are requesting a fireball...
... shot by this player ...
... with speed 50 ...
... and Z velocity (don't let the 'angle' name fool you... :)
based on whether we are targeting anything.
No target.
Target.
Now we just send the packet.
T_void ClientShootFireballAck | ( | T_word32 | extraData, |
T_packetEitherShortOrLong * | p_packet | ||
) |
ClientShootFireballAck confirms that a fireball was sent, and emits the fireball-shooting sound.
Do I share a machine with the server?
Player type.
Make the object invisible, so I don't have my view blocked
by myself.
Initialize the movement of the player.
Initialize again to ensure the correct location.
ClientTakeDamage is the one routine that should be called when a player takes damage.
amount | – Amount of damage to give |
T_void ClientThrowObject | ( | T_3dObject * | p_obj, |
T_sword16 | throwspeed, | ||
T_word16 | angle | ||
) |
ClientThrowObject is called to throw an object at a given speed and angle.
p_obj | – Object to throw. |
throwspeed | – Speed to throw object |
angle | – Angle to throw along. |
ClientUpdate does all the activities that a client needs to do for a single time slice.
T_void ClientUpdateHealth | ( | ) |
void IClientHandleMapKeys | ( | T_word16 | scankey) |
T_void IClientLoginAck | ( | T_word32 | extraData, |
T_packetEitherShortOrLong * | p_packet | ||
) |
IClientLoginAck notes that the player is successfully connected to the server.
void OutputItems | ( | void | ) |
char G_clientSyncStatus[50] = "" |
T_word16 G_loginId = 0xFFFF |
T_word16 G_mapAorB = 0 |
T_mapHandle G_mapHandleA = MAP_HANDLE_BAD |
ClientHandleKeyboard takes care of all keyboard events created by the client.
event | – Keyboard event to process |
scanKey | – Key to go with event |
T_mapHandle G_mapHandleB = MAP_HANDLE_BAD |
E_Boolean G_serverActive |
T_word32 G_syncCount = 0 |