ViewVC Help
View File | Revision Log | View Changeset | Root Listing
root/Oni2/Daodan/MSVC/Flatline_BSL.c
(Generate patch)

Comparing Daodan/MSVC/Flatline_BSL.c (file contents):
Revision 579 by gumby, Thu Jan 13 01:02:52 2011 UTC vs.
Revision 580 by gumby, Fri Jan 14 07:39:14 2011 UTC

# Line 31 | Line 31 | uint16_t ONICALL control_update_rate(sl_
31  
32   uint16_t ONICALL change_name(sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], int* dontuse1, int* dontuse2, sl_arg* ret)
33   {
34 <        
34 >
35          //should also return your name...
36          sprintf(player_name, "%.31s", args[0].value_str32);
37          if(client_connected) {
# Line 72 | Line 72 | uint16_t ONICALL send_message(sl_callinf
72   uint16_t ONICALL connect_to_server(sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], int* dontuse1, int* dontuse2, sl_arg* ret)
73   {
74          if(     NetPlatform_Initalize()) {
75 <        static flatline_packet packet;
76 <        sock = NetUDPSocket_Create(27777);
77 <        address.sin_family = AF_INET; address.sin_port = htons(27777); address.sin_addr.S_un.S_addr = inet_addr(args[0].value_str32 );  
78 <        //address.sin_family = AF_INET; address.sin_port = htons(27777); address.sin_addr.S_un.S_addr = inet_addr("192.168.0.1");      
79 <
80 <        packet.id = CONNECT_SEND;
81 <        memcpy(((connect_send*)(packet.data))->country ,  player_country, 2);
82 <        memcpy(((connect_send*)(packet.data))->name, player_name, 256);
83 <        DDrConsole_PrintF("%s", ((connect_send*)(packet.data))->name);
84 <        CreateThread(NULL, 0, StartClient, &packet, 0, 0);
75 >                static flatline_packet packet;
76 >                sock = NetUDPSocket_Create(27777);
77 >                address.sin_family = AF_INET; address.sin_port = htons(27777); address.sin_addr.S_un.S_addr = inet_addr(args[0].value_str32 );  
78 >                //address.sin_family = AF_INET; address.sin_port = htons(27777); address.sin_addr.S_un.S_addr = inet_addr("192.168.0.1");      
79 >
80 >                packet.id = CONNECT_SEND;
81 >                memcpy(((connect_send*)(packet.data))->country ,  player_country, 2);
82 >                memcpy(((connect_send*)(packet.data))->name, player_name, 256);
83 >                DDrConsole_PrintF("%s", ((connect_send*)(packet.data))->name);
84 >                CreateThread(NULL, 0, StartClient, &packet, 0, 0);
85  
86          }
87  
# Line 110 | Line 110 | uint16_t ONICALL status(sl_callinfo* cal
110                                          j,
111                                          PlayerList[j]->name,
112                                          PlayerList[j]->Chr
113 <                        );
113 >                                        );
114                          }
115                  }
116          }
# Line 132 | Line 132 | uint16_t ONICALL kick(sl_callinfo* calli
132          return 0;
133   }
134  
135 + uint16_t ONICALL ping(sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], int* dontuse1, int* dontuse2, sl_arg* ret)
136 + {
137 +        if(server_started)
138 +        {
139 +                FLsPingAll();
140 +        }
141 +        return 0;
142 + }
143 +
144   CharacterObject* spawnObject = 0;
145   char BINACHARCallback(CharacterObject* inObj, char* userdata)
146   {
# Line 159 | Line 168 | uint16_t ONICALL FLrSpawnHack(sl_callinf
168                          new_char.new_player.Playernumber = playerlist_slot;
169                          new_char.id = NEW_PLAYER;
170                          OBJrObjectType_EnumerateObjects('CHAR',BINACHARCallback, (int)args[0].value_str32);
171 <                //      while(!spawnObject);
171 >                        //      while(!spawnObject);
172                          if(spawnObject)
173                          {
174                                  memcpy(&new_char.new_player.Character, spawnObject, sizeof(CharacterObject) );
# Line 178 | Line 187 | uint16_t ONICALL FLrSpawnHack(sl_callinf
187                          return 0;
188                  }
189          }
190 <        
191 <                return 0;
190 >
191 >        return 0;
192   }
193  
194   uint16_t ONICALL list_players(sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], int* dontuse1, int* dontuse2, sl_arg* ret)
# Line 192 | Line 201 | uint16_t ONICALL list_players(sl_callinf
201                          DDrConsole_PrintF("%i %i | %s", i, PlayerList[i]->spawnnumber, PlayerList[i]->name);
202                  }
203          }
204 < return 0;
204 >        return 0;
205   }
206   uint16_t ONICALL con(sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], int* dontuse1, int* dontuse2, sl_arg* ret)
207   {
# Line 200 | Line 209 | uint16_t ONICALL con(sl_callinfo* callin
209          return 0;
210   }
211  
212 <                
213 < void SLrFlatline_Initialize() {
214 <        
212 >
213 > void SLrFlatline_Initialize()
214 > {
215 >
216          DDrPatch_MakeCall(0x004FA88B, FLrInput_Update_Keys);
217          FLrInput_Update_Keys();
218          SLrGlobalVariable_Register_Int32("skip", "skips", &(((GameState*)ONgGameState)->field_40) );
# Line 216 | Line 226 | void SLrFlatline_Initialize() {
226          SLrScript_Command_Register_Void("kick", "Kicks a client from the server", "clientnum:int", kick);
227          SLrScript_Command_Register_Void("con", "Activates a console", "con:int", con);
228          //SLrScript_Command_Register_ReturnType("ai2_spawn","creates and starts an AI from a character object","ai_name:string [force_spawn:string{\"force\"} | ]", sl_void, spawnAI);
229 +        SLrScript_Command_Register_Void("ping", "pong!", "", ping);
230   }

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)