| 4 |
|
int total_players = 0; |
| 5 |
|
uint16_t max_connections = MAX_CONNECTIONS; |
| 6 |
|
|
| 7 |
< |
player_info* FLrServer_AddPlayer(int ip, char* name, bool is_server) { |
| 7 |
> |
player_info* FLrServer_AddPlayer(int ip, char* name, bool is_server, bool is_bot) { |
| 8 |
|
flatline_packet new_char = {0}; |
| 9 |
|
CharacterObject* Char; |
| 10 |
|
uint32_t player_slot = 0; |
| 37 |
|
server: ; |
| 38 |
|
//memset( new_char, 0, sizeof(new_char); |
| 39 |
|
//new_char = {0}; |
| 40 |
+ |
new_char.new_player.Playernumber = playerlist_slot; |
| 41 |
|
Char = &new_char.new_player.Character; |
| 42 |
|
memset(Char, 0, sizeof(CharacterObject)); |
| 43 |
|
Char->Header.Type = 'CHAR'; |
| 44 |
|
//Char->OSD.Options = char_dontaim; |
| 45 |
|
sprintf(Char->OSD.Name,"%s",name); |
| 46 |
|
sprintf(Char->OSD.Class, "%s", "konoko_generic"); |
| 47 |
< |
|
| 48 |
< |
|
| 47 |
> |
if(is_bot) { |
| 48 |
> |
Char->OSD.MeleeID = 22; |
| 49 |
> |
Char->OSD.JobID = 1; |
| 50 |
> |
Char->OSD.MinimalAlertLevel = 4; |
| 51 |
> |
Char->OSD.InvestigatingAlertLevel = 4; |
| 52 |
> |
Char->OSD.InitialAlertLevel = 4; |
| 53 |
> |
Char->OSD.StartJobAlertLevel = 4; |
| 54 |
> |
} |
| 55 |
> |
else if( !is_server ) |
| 56 |
> |
{ |
| 57 |
> |
Char->Header.Position.X = PlayerList[0]->Chr->Position.X; |
| 58 |
> |
Char->Header.Position.Y = PlayerList[0]->Chr->Position.Y; |
| 59 |
> |
Char->Header.Position.Z = PlayerList[0]->Chr->Position.Z; |
| 60 |
> |
} |
| 61 |
|
|
| 62 |
|
//TMrInstance_GetDataPtr('ONCC', "striker_easy_1", PlayerList[playerlist_slot]->Chr->ONCC); |
| 63 |
|
|
| 66 |
|
if(!is_server) { |
| 67 |
|
ONrGameState_NewCharacter(Char, NULL, NULL, &(player_slot)); |
| 68 |
|
//move this to a set up characters function... |
| 69 |
< |
ONgGameState->CharacterStorage[player_slot].field_1E8 = 0; |
| 69 |
> |
if(!is_bot) ONgGameState->CharacterStorage[player_slot].charType = 0; |
| 70 |
|
|
| 71 |
|
PlayerList[playerlist_slot] = Players+player_slot; |
| 72 |
|
PlayerList[playerlist_slot]->spawnnumber = player_slot; |
| 73 |
|
PlayerList[playerlist_slot]->Chr = &((Character *)(((GameState * )(ONgGameState))->CharacterStorage))[player_slot]; |
| 74 |
|
// PlayerList[playerlist_slot]->Chr->Flags = chr_dontaim | chr_unkillable; //&= 0xFFBFFFFF; //WTF |
| 75 |
< |
PlayerList[playerlist_slot]->Chr->Flags &= 0xFFBFFFFF; //WTF |
| 75 |
> |
if(!is_bot) PlayerList[playerlist_slot]->Chr->Flags &= 0xFFBFFFFF; //WTF |
| 76 |
|
sprintf(PlayerList[playerlist_slot]->Chr->Name, "%.31s", name); |
| 77 |
|
UDPServer_SendToAll( (char*)&new_char, sizeof(new_player) + FLATLINE_HEADER ); |
| 78 |
|
|
| 94 |
|
} |
| 95 |
|
|
| 96 |
|
void FLrServer_Initialize(){ |
| 97 |
< |
FLrServer_AddPlayer(inet_addr("127.0.0.1"), "host", 1); |
| 97 |
> |
FLrServer_AddPlayer(inet_addr("127.0.0.1"), "host", 1, 0); |
| 98 |
|
} |
| 99 |
|
|
| 100 |
|
//UDPServer_SendToAll |
| 118 |
|
} |
| 119 |
|
} |
| 120 |
|
return players; |
| 121 |
< |
} |
| 121 |
> |
} |
| 122 |
> |
|
| 123 |
> |
void FLsPublic_Event( unsigned int eventIndex, int * args ) |
| 124 |
> |
{ |
| 125 |
> |
int numArgs = FLrEvent_GetNumArgs( eventIndex ); |
| 126 |
> |
flatline_packet eventPacket = {0}; |
| 127 |
> |
eventPacket.id = FLATLINE_EVENT; |
| 128 |
> |
eventPacket.flatline_event.event_index = eventIndex; |
| 129 |
> |
memcpy( eventPacket.flatline_event.intArray, args, sizeof(int) * numArgs ); |
| 130 |
> |
UDPServer_SendToAll( &eventPacket, sizeof(int) * (numArgs + 1) + FLATLINE_HEADER ); |
| 131 |
> |
} |
| 132 |
> |
|