Amulets & Armor  v1.02
Open Source Game
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
Macros | Functions | Variables
CLIENT

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 */
 

Functions

T_void ClientAttack (T_void)
 
T_void ClientAttackSent (T_word32 extraData, T_packetEitherShortOrLong *p_packet)
 
T_void ClientCheckScrolling (T_void)
 
T_void ClientCreateGlobalAreaSound (T_sword16 x, T_sword16 y, T_word16 radius, T_word16 soundID)
 
T_void ClientCreateProjectile (E_effectMissileType type, T_word16 duration, T_word16 power)
 
E_clientDialResult ClientDialIn (T_byte8 *p_init, T_byte8 *p_dial)
 
T_void ClientDied (T_void)
 
T_void ClientDoSteal (T_void)
 
E_Boolean ClientDropInventoryItem (T_word16 numItems, T_word16 itemType, T_word16 accData)
 
T_void ClientFinish (T_void)
 
T_void ClientForceGotoPlace (T_word16 placeNumber, T_word16 startLocation)
 
E_changePasswordStatus ClientGetChangePasswordStatus (T_void)
 
E_checkPasswordStatus ClientGetCheckPasswordStatus (T_void)
 
E_clientConnectionType ClientGetConnectionType (T_void)
 
E_createCharStatus ClientGetCreateCharacterStatus (T_void)
 
T_word32 ClientGetCurrentPlace (T_void)
 
T_word32 ClientGetCurrentServerID (T_void)
 
T_word16 ClientGetCurrentStartLocation (T_void)
 
E_deleteCharStatus ClientGetDeleteCharacterStatus (T_void)
 
T_word16 ClientGetDelta (T_void)
 
E_loadCharStatus ClientGetLoadCharacterStatus (T_void)
 
T_word16 ClientGetLoginId (T_void)
 
E_clientMode ClientGetMode (T_void)
 
E_clientSaveCharStatus ClientGetSaveCharStatus (T_void)
 
E_requestEnterStatus ClientGetServerEnterStatus (T_void)
 
T_void ClientGotoForm (T_word32 formNumber)
 
T_void ClientGotoPlace (T_word32 locationNumber, T_word16 startLocation)
 
T_void ClientHandleKeyboard (E_keyboardEvent event, T_word16 scankey)
 
T_void ClientHandleOverlay (T_word16 left, T_word16 top, T_word16 right, T_word16 bottom)
 
T_void ClientInit (T_void)
 
T_void ClientInitMouseAndColor (T_void)
 
E_Boolean ClientIsActive (T_void)
 
E_Boolean ClientIsAttemptingLogout (T_void)
 
E_Boolean ClientIsDead ()
 
E_Boolean ClientIsGod (T_void)
 
E_Boolean ClientIsInGame (T_void)
 
E_Boolean ClientIsInit (T_void)
 
E_Boolean ClientIsInView (T_void)
 
E_Boolean ClientIsLogin (T_void)
 
E_Boolean ClientIsPaused (T_void)
 
T_void ClientLogin (T_void)
 
T_void ClientLogoff (T_void)
 
T_void ClientLogoffFinish (T_word32 extraData, T_packetEitherShortOrLong *p_packet)
 
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)
 
T_void ClientResetPauseGame (T_void)
 
T_void ClientSetActive (T_void)
 
T_void ClientSetAdventureNumber (T_word16 adventureNum)
 
T_void ClientSetChangePasswordStatus (E_changePasswordStatus status)
 
T_void ClientSetCheckPasswordStatus (E_checkPasswordStatus status)
 
T_void ClientSetClientSyncStatus (T_byte8 *p_msg)
 
T_void ClientSetConnectionType (E_clientConnectionType type)
 
T_void ClientSetCreateCharacterStatus (E_createCharStatus status)
 
T_void ClientSetCurrentPlace (T_word32 newPlace)
 
T_void ClientSetCurrentServerID (T_word32 newServerID)
 
T_void ClientSetCurrentStartLocation (T_word16 newStartLocation)
 
T_void ClientSetDeleteCharacterStatus (E_deleteCharStatus status)
 
T_void ClientSetInactive (T_void)
 
T_void ClientSetLoadCharacterStatus (E_loadCharStatus status)
 
T_void ClientSetLoginId (T_word16 loginId)
 
T_void ClientSetMode (E_clientMode newMode)
 
T_void ClientSetNextPlace (T_word16 nextPlace, T_byte8 nextStart)
 
T_void ClientSetSaveCharStatus (E_clientSaveCharStatus status)
 
T_void ClientSetServerEnterStatus (E_requestEnterStatus status)
 
T_void ClientShootFireball (T_void)
 
T_void ClientShootFireballAck (T_word32 extraData, T_packetEitherShortOrLong *p_packet)
 
T_void ClientStartPlayer (T_word16 objectId, T_word16 loginId)
 
T_void ClientTakeDamage (T_word16 amount)
 
T_void ClientThrowObject (T_3dObject *p_obj, T_sword16 throwspeed, T_word16 angle)
 
T_void ClientTogglePause (T_void)
 
T_void ClientUpdate (T_void)
 
T_void ClientUpdateHealth (T_void)
 
T_void ClientUpdateHealth ()
 
void IClientHandleMapKeys (T_word16 scankey)
 
T_void IClientLoginAck (T_word32 extraData, T_packetEitherShortOrLong *p_packet)
 
void OutputItems (void)
 

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
 

Detailed Description

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().

See Also
http://www.amuletsandarmor.com/AALicense.txt

Macro Definition Documentation

#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 */

Function Documentation

T_void ClientAttack ( T_void  )

ClientAttack puts the client in the motions of doing an attack.

T_void ClientAttackSent ( T_word32  extraData,
T_packetEitherShortOrLong p_packet 
)

ClientAttackSent confirms that the attack was done.

T_void ClientCheckScrolling ( T_void  )

ClientCheckScrolling checks to see if the player has pressed either the Page up or Page down keys to scroll the messages.

T_void ClientCreateGlobalAreaSound ( T_sword16  x,
T_sword16  y,
T_word16  radius,
T_word16  soundID 
)

ClientCreateGlobalAreaSound causes an area sound to be created that all players hear.

Parameters
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 
)
T_void ClientDied ( T_void  )
T_void ClientDoSteal ( T_void  )
E_Boolean ClientDropInventoryItem ( T_word16  numItems,
T_word16  itemType,
T_word16  accData 
)
T_void ClientFinish ( T_void  )

ClientFinish cleans up the client data and stuff.

T_void ClientForceGotoPlace ( T_word16  placeNumber,
T_word16  startLocation 
)
E_changePasswordStatus ClientGetChangePasswordStatus ( T_void  )
E_checkPasswordStatus ClientGetCheckPasswordStatus ( T_void  )
E_clientConnectionType ClientGetConnectionType ( T_void  )
E_createCharStatus ClientGetCreateCharacterStatus ( T_void  )
T_word32 ClientGetCurrentPlace ( T_void  )

ClientGetCurrentPlace returns the number of the current place.

Returns
Number of current place
T_word32 ClientGetCurrentServerID ( T_void  )

ClientGetCurrentServerID returns the id of the current server.

Returns
Server ID
T_word16 ClientGetCurrentStartLocation ( T_void  )

ClientGetCurrentStartLocation returns what position within a place client is at.

Returns
Number of current start location
E_deleteCharStatus ClientGetDeleteCharacterStatus ( T_void  )
T_word16 ClientGetDelta ( T_void  )

ClientGetDelta returns the number of timer clicks (ticks) that have passed since this routine was last called.

Returns
Ticks since last call.
E_loadCharStatus ClientGetLoadCharacterStatus ( T_void  )
T_word16 ClientGetLoginId ( T_void  )

ClientGetLoginId retrieves the 'login ID' of the client.

Returns
login ID (0xFFFF if not logged in)
E_clientMode ClientGetMode ( T_void  )

ClientGetMode returns the mode that the client is in.

Returns
mode client is in.
E_clientSaveCharStatus ClientGetSaveCharStatus ( T_void  )

ClientSetSaveCharStatus sets what status the last attempt to save a character is in.

Returns
Current save char status
E_requestEnterStatus ClientGetServerEnterStatus ( T_void  )

ClientGetServerEnterStatus gets what state in enter the server we are in.

Returns
status
T_void ClientGotoForm ( T_word32  formNumber)

ClientGotoForm starts up a form that is either hardcoded or communications based.

Parameters
formNumber– Number of form to load.
T_void ClientGotoPlace ( T_word32  locationNumber,
T_word16  startLocation 
)

ClientGotoPlace tells the client to initiate a request to go to a different location.

Parameters
locationNumber– location number
startLocation– Location within map
T_void ClientHandleKeyboard ( E_keyboardEvent  event,
T_word16  scankey 
)

Only ClientSendMessage if not interpreted

T_void ClientHandleOverlay ( T_word16  left,
T_word16  top,
T_word16  right,
T_word16  bottom 
)

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.

Parameters
left– left edge of view
top– top edge of view
right– right edge of view
bottom– bottom edge of view
T_void ClientInit ( T_void  )

Register my callback routines with the command queue.

Make note of the fact that we are now "up"

T_void ClientInitMouseAndColor ( T_void  )

ClientInit starts up and cleans up any initial items needed by the client.

E_Boolean ClientIsActive ( T_void  )

Simple put, "Am I logged into the server?"

Returns
FALSE = no, TRUE = yes
E_Boolean ClientIsAttemptingLogout ( T_void  )

ClientIsAttemptingLogout returns true if the client is logging out of the system.

Returns
TRUE = attempting logout
E_Boolean ClientIsDead ( void  )
E_Boolean ClientIsGod ( T_void  )
E_Boolean ClientIsInGame ( T_void  )
E_Boolean ClientIsInit ( T_void  )

ClientIsActive returns TRUE if the client is initialized.

Returns
TRUE = client is initialized
E_Boolean ClientIsInView ( T_void  )
E_Boolean ClientIsLogin ( T_void  )

Simple put, "Am I logged into the server?"

Returns
FALSE = no, TRUE = yes
E_Boolean ClientIsPaused ( T_void  )
T_void ClientLogin ( T_void  )

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.

T_void ClientLogoff ( T_void  )

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 ClientResetPauseGame ( T_void  )
T_void ClientSetActive ( T_void  )

ClientSetActive declares the client to now be active.

T_void ClientSetAdventureNumber ( T_word16  adventureNum)
T_void ClientSetChangePasswordStatus ( E_changePasswordStatus  status)
T_void ClientSetCheckPasswordStatus ( E_checkPasswordStatus  status)
T_void ClientSetClientSyncStatus ( T_byte8 p_msg)
T_void ClientSetConnectionType ( E_clientConnectionType  type)
T_void ClientSetCreateCharacterStatus ( E_createCharStatus  status)
T_void ClientSetCurrentPlace ( T_word32  newPlace)

ClientSetCurrentPlace declares where the current place is.

Parameters
newPlace– Number of current place
T_void ClientSetCurrentServerID ( T_word32  newServerID)

ClientSetCurrentServerID sets the id of the current server.

Parameters
newServerID– Server ID
T_void ClientSetCurrentStartLocation ( T_word16  newStartLocation)

ClientSetCurrentStartLocation returns what position within a place client is at.

Parameters
newStartLocation– Number of current start location
T_void ClientSetDeleteCharacterStatus ( E_deleteCharStatus  status)
T_void ClientSetInactive ( T_void  )

ClientSetInactive declares the client to not be active.

T_void ClientSetLoadCharacterStatus ( E_loadCharStatus  status)
T_void ClientSetLoginId ( T_word16  loginId)

ClientSetLoginId stores the 'login ID' of the client.

Parameters
loginId– login ID
T_void ClientSetMode ( E_clientMode  newMode)

ClientSetMode declares the mode that the client is in.

Parameters
newMode– mode client is in.
T_void ClientSetNextPlace ( T_word16  nextPlace,
T_byte8  nextStart 
)
T_void ClientSetSaveCharStatus ( E_clientSaveCharStatus  status)

ClientSetSaveCharStatus sets what status the last attempt to save a character is in.

Parameters
status– New save char status
T_void ClientSetServerEnterStatus ( E_requestEnterStatus  status)

ClientSetServerEnterStatus sets what state in enter the server we are in.

Parameters
status– New status
T_void ClientShootFireball ( T_void  )

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.

T_void ClientStartPlayer ( T_word16  objectId,
T_word16  loginId 
)

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.

T_void ClientTakeDamage ( T_word16  amount)

ClientTakeDamage is the one routine that should be called when a player takes damage.

Parameters
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.

Parameters
p_obj– Object to throw.
throwspeed– Speed to throw object
angle– Angle to throw along.
T_void ClientTogglePause ( T_void  )
T_void ClientUpdate ( T_void  )

ClientUpdate does all the activities that a client needs to do for a single time slice.

T_void ClientUpdateHealth ( T_void  )
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  )

Variable Documentation

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.

Parameters
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