Changeset 586
- Timestamp:
- Feb 2, 2011, 9:17:19 AM (14 years ago)
- Location:
- Daodan/MSVC
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
Daodan/MSVC/Daodan.c
r574 r586 235 235 DDrPatch_Const(0x0051BB64, regen_patch); 236 236 } 237 238 //Fix crappy ai2_shownames 239 if(1) 240 { 241 //Set distance above head to 4.0 242 DDrPatch_Int32(0x0048C998, 0x005296C8); 243 //texture height 244 DDrPatch_Byte( 0x0048C9DF, 0x3F ); 245 //texture width 246 DDrPatch_NOOP( (char*)0x0048C9CA, 6 ); 247 //Set the text color to whatever we like ;) 248 DDrPatch_NOOP( 0x0048C898, 6 ); 249 DDrPatch_Byte( 0x0048C898, 0x8B ); 250 DDrPatch_Byte( 0x0048C899, 0xCE ); 251 DDrPatch_MakeCall( 0x0048C8A3, FLrHook_DebugNameShadeHack); 252 253 //Make the background black for additive blending 254 DDrPatch_MakeCall( 0x0048C802, FLrHook_DebugNameTextureInit ); 255 } 256 257 if(1) 258 { 259 //DDrPatch_NOOP( 0x004E1957, 6 ); 260 //DDrPatch_MakeCall( 0x004E17F6, FLrHook_Lasers ); 261 } 262 237 263 //Flatline related stuff 238 264 DDrPatch_MakeCall(0x004FBCEA, DDrText_Hook); 239 265 240 DDrPatch_Int32( 0x004B24D2, 266 DDrPatch_Int32( 0x004B24D2, FLrSpawnHack); 241 267 242 268 DDrPatch_NOOP(0x004C26CB, 6); -
Daodan/MSVC/Daodan_Utility.c
r579 r586 145 145 COtTextArea* cons = *(COtTextArea**)0x00571B74; 146 146 char* clipboardText = 0; 147 if( GetAsyncKeyState(0x56) && GetAsyncKeyState(VK_CONTROL))147 if(ONgGameState->Input.Current.Actions1 & Action_Console && GetKeyState(0x56) & 0x80 && GetKeyState(VK_CONTROL) & 0x80 ) 148 148 { 149 149 if(cons && cons->text_entries && cons->num_text_entries) -
Daodan/MSVC/Flatline.c
r585 r586 26 26 #define BETTER_SYNC 27 27 28 bool FLrServer_PacketCallback(char* data, int datalen, int from)29 {30 int i, j;31 bool found_player = 0;32 flatline_packet * packet = (flatline_packet*)data;33 static int recieved = 0;34 sockaddr_in sender;35 sender.sin_family = AF_INET;36 sender.sin_port = htons(27777);37 sender.sin_addr = *((struct in_addr*)(int*)&from);38 39 40 //packet->data[datalen] = '\0';41 42 //DDrConsole_PrintF("Packet \r%d recieved from %i", ++recieved, from);43 44 45 46 //if data[0] != CONNECT_SEND, search in playerlist for ip address47 48 49 50 51 switch(packet->id) {52 flatline_packet connect_recv;53 player_info * playah;54 //rewrite this when we get TCP support.55 //rewrite this before we get TCP support*56 //the way of seeing if there is room for players sucks.57 case CONNECT_SEND:58 ;59 60 connect_recv.id = CONNECT_REPLY;61 62 //if(Players[i].ip == sender.sin_addr.S_un.S_addr) break; //needs to send an error message63 sender.sin_addr.S_un.S_addr = htonl(sender.sin_addr.S_un.S_addr);64 playah = FLrServer_AddPlayer(from,packet->connect_send.name, 0, 0);65 DDrConsole_PrintF("%s connected from %s", packet->connect_send.name, inet_ntoa(sender.sin_addr ) );66 if(!((int)playah > -5 && (int)playah <= 0)) {67 flatline_packet new_char = {0};68 CharacterObject* Char;69 connect_recv.connect_reply.goodtogo = 1;70 connect_recv.connect_reply.player_slot = playah->list_slot;71 DDrConsole_PrintF("Slot: %i", playah->list_slot);72 73 //sending this several times to make sure it gets through. Really need to make up some form of packet tracking.74 NetTCPServer_Send((sockaddr *) &sender, (char*)&connect_recv, sizeof(connect_reply) + FLATLINE_HEADER);75 /* NetTCPServer_Send((sockaddr *) &sender, (char*)&connect_recv, sizeof(connect_reply) + FLATLINE_HEADER);76 NetTCPServer_Send((sockaddr *) &sender, (char*)&connect_recv, sizeof(connect_reply) + FLATLINE_HEADER);77 NetTCPServer_Send((sockaddr *) &sender, (char*)&connect_recv, sizeof(connect_reply) + FLATLINE_HEADER);78 NetTCPServer_Send((sockaddr *) &sender, (char*)&connect_recv, sizeof(connect_reply) + FLATLINE_HEADER);79 Sleep(100);80 */81 new_char.id = NEW_PLAYER;82 Char = &new_char.new_player.Character;83 memset(Char, 0, sizeof(CharacterObject));84 Char->Header.Type = 'CHAR';85 Char->OSD.Options = chr_dontaim;86 for(j = 0; j < max_connections; j++) {87 if(PlayerList[j] != 0) {88 new_char.new_player.Playernumber = j;89 sprintf(Char->OSD.Name,"%s",PlayerList[j]->name);90 91 sprintf(Char->OSD.Class, "%s", TMrInstance_GetInstanceName(PlayerList[j]->Chr->ONCC));92 DDrConsole_PrintF("Class %s", Char->OSD.Class );93 94 sprintf(Char->OSD.Class, "konoko_generic");95 NetTCPServer_Send((sockaddr *) &sender, (char*)&new_char, sizeof(new_player) + FLATLINE_HEADER );96 }97 98 }99 }100 else {101 //fix the error messages...102 DDrConsole_PrintF("Server is full. :(");103 connect_recv.connect_reply.goodtogo = 0;104 sender.sin_addr.S_un.S_addr = htonl(sender.sin_addr.S_un.S_addr);105 memcpy(&connect_recv.connect_reply.message,"Server is full.", sizeof("Server is full."));106 NetTCPServer_Send((sockaddr *) &sender, (char*)&connect_recv, sizeof(bool)*2 + FLATLINE_HEADER + sizeof("Server is full."));107 108 }109 110 111 break;112 case CONNECT_REPLY:113 break; //do nothing...a server shouldn't recieve this type of packet.114 case MESSAGE:115 for(i = 0; i < MAX_PLAYERS; i++) {116 //DDrConsole_PrintF("%i : %i | %s : %s", from, Players[i].ip, inet_ntoa(*(struct in_addr*)&from), inet_ntoa(*(struct in_addr*)&(Players[i].ip)));117 if(Players[i].ip == sender.sin_addr.S_un.S_addr) {118 found_player = 1;119 break;120 }121 }122 if(found_player == 0) return true;123 else {124 char message_buffer[512] = {0};125 flatline_packet message;126 int message_size;127 data[datalen] = 0;128 129 DDrConsole_PrintF("%s: %s", Players[i].name, packet->data);130 sprintf(message_buffer, "%s: %s", Players[i].name, packet->data);131 132 message.id = MESSAGE;133 message_size = sprintf(message.data, "%s", message_buffer);134 COrMessage_Print(message_buffer, "chat", 0);135 UDPServer_SendToAll(&message, message_size + 1 + FLATLINE_HEADER);136 break;137 }138 case CHANGE_NAME:139 ; //wtf, needed or i get an error.140 // DDrConsole_PrintF("Changing Name to: %s", packet->data);141 for(i = 0; i < MAX_PLAYERS; i++) {142 if(PlayerList[i] && PlayerList[i]->ip == sender.sin_addr.S_un.S_addr) {143 found_player = 1;144 break;145 }146 }147 if(found_player == 0) break;148 else {149 bool name_exists = 0;150 for(j = 0; j < MAX_PLAYERS; j++) {151 if(PlayerList[j] && !strcmp(packet->data, PlayerList[j]->name)) {152 name_exists = 1;153 break;154 }155 }156 if(!name_exists) {157 FLsUpdateName( i, packet->data );158 }159 break;160 }161 case PLAYER_INPUT:162 163 for(i = 0; i < max_connections; i++) {164 if(PlayerList[i] != 0 && PlayerList[i]->ip == sender.sin_addr.S_un.S_addr) {165 found_player = 1;166 break;167 }168 }169 170 if(found_player == 0) break;171 else {172 input_struct * packet_input = &packet->input_struct;173 174 175 PlayerList[i]->InputFromClient.Actions1 = packet_input->Actions1;176 PlayerList[i]->InputFromClient.Actions2 = packet_input->Actions2;177 PlayerList[i]->InputFromClient.MouseDeltaX = packet_input->MouseDeltaX;178 PlayerList[i]->InputFromClient.MouseDeltaY = packet_input->MouseDeltaY;179 PlayerList[i]->LastInputTime = packet_input->Time;180 181 break;182 }183 case PK_PONG:184 for(i = 0; i < max_connections; i++) {185 if(PlayerList[i] != 0 && PlayerList[i]->ip == sender.sin_addr.S_un.S_addr) {186 found_player = 1;187 break;188 }189 }190 191 if(found_player == 0) break;192 if(packet->ping != lastPingTime)193 {194 PlayerList[i]->Ping = 999;195 }196 else197 {198 PlayerList[i]->Ping = GetTickCount() - packet->ping;199 }200 break;201 default:202 DDrConsole_PrintF("Warning, recieved badly formed packet!");203 break;204 }205 return true;206 }207 28 208 29 bool FLrServer_Run() … … 295 116 296 117 input_packet.id = PLAYER_INPUT; 297 input_packet.input_struct.Time = ONgGameState->GameTime;118 // input_packet.input_struct.Time = ONgGameState->GameTime; 298 119 input_packet.input_struct.Actions1 = ONgGameState->Input.Current.Actions1; 299 120 input_packet.input_struct.Actions2 = ONgGameState->Input.Current.Actions2; 300 121 input_packet.input_struct.MouseDeltaX = ONgGameState->Input.MouseDeltaX; 301 122 input_packet.input_struct.MouseDeltaY = ONgGameState->Input.MouseDeltaY; 123 input_packet.input_struct.DesiredFacing = ONgGameState->PlayerCharacter->DesiredFacing; 302 124 303 125 sent_bytes = NetUDPSocket_Send(client_sock,(sockaddr *) &address, (char*)&input_packet, sizeof(input_struct) + FLATLINE_HEADER); … … 310 132 311 133 312 if(server_started) 313 { 314 if(ONgGameState->GameTime % 120 == 0) 315 { 316 FLsPingAll(); 317 } 318 319 if(PlayerList[0]) 320 { 321 PlayerList[0]->InputFromClient.Actions1 = ONgGameState->Input.Current.Actions1; 322 PlayerList[0]->InputFromClient.Actions2 = ONgGameState->Input.Current.Actions2; 323 PlayerList[0]->InputFromClient.MouseDeltaX = ONgGameState->Input.MouseDeltaX; 324 PlayerList[0]->InputFromClient.MouseDeltaY = ONgGameState->Input.MouseDeltaY; 325 } 326 FLsSendPlayerData(); 327 } 134 328 135 for(i = 0; i < max_connections; i++) { 329 136 ActiveCharacter * Active_Player; … … 343 150 } 344 151 152 if( server_started && i != 0 ) 153 { 154 PlayerList[i]->Chr->DesiredFacing = PlayerList[i]->FacingFromClient; 155 } 156 345 157 346 158 347 159 //Set the health properly first. 160 //Always overridden by the server because of the chance of random damage and such 348 161 if( client_connected && DoWeUpdateThis( PlayerList[i]->UpdateFlags, PFlag_Health) ) 349 162 { 350 163 PlayerList[i]->Chr->MaxHealth = PlayerList[i]->Health.MaxHealth; 351 164 ONrCharacter_SetHitPoints( PlayerList[i]->Chr, PlayerList[i]->Health.Health); 352 PlayerList[i]->UpdateFlags &= ~( 1 << PFlag_Health ); 353 } 165 //PlayerList[i]->UpdateFlags &= ~( 1 << PFlag_Health ); 166 } 167 354 168 //If the player is dead 355 169 if( PlayerList[i]->Chr->Health == 0 ) … … 415 229 PlayerList[i]->state = STATE_ALIVE; 416 230 417 if( DoWeUpdateThis( PlayerList[i]->UpdateFlags, PFlag_Facing ) ) 231 if( client_connected && DoWeUpdateThis( PlayerList[i]->UpdateFlags, PFlag_Class ) ) 232 { 233 if(PlayerList[i]->Class) 234 { 235 ONrCharacter_SetCharacterClass( PlayerList[i]->Chr, PlayerList[i]->Class ); 236 } 237 PlayerList[i]->UpdateFlags &= ~( 1 << PFlag_Class ); 238 } 239 240 if( client_connected && DoWeUpdateThis( PlayerList[i]->UpdateFlags, PFlag_Facing ) ) 418 241 { 419 242 PlayerList[i]->Chr->Facing = PlayerList[i]->Facings.Facing; 420 PlayerList[i]->Chr->DesiredFacing = PlayerList[i]->Facings.DesiredFacing; 243 if(i != client_slot) 244 { 245 PlayerList[i]->Chr->DesiredFacing = PlayerList[i]->Facings.DesiredFacing; 246 } 421 247 PlayerList[i]->UpdateFlags &= ~( 1 << PFlag_Facing ); 422 248 } … … 425 251 426 252 427 if(client_connected) { 428 Active_Player->PlayingFilm.Flags = 1; 429 } 430 431 432 if( client_connected && DoWeUpdateThis( PlayerList[i]->UpdateFlags, PFlag_Position) ) 433 { 434 Active_Player->PhyContext->Position = PlayerList[i]->Position; 435 436 PlayerList[i]->UpdateFlags &= ~( 1 << PFlag_Position ); 437 } 438 439 440 441 442 if (!(Player->Flags & ONcCharacterFlag_BeingThrown) && 443 DoWeUpdateThis( PlayerList[i]->UpdateFlags, PFlag_Animation) && (PlayerList[i]->Animation)) 444 { 445 // get a pointer to the animation 446 447 448 if (PlayerList[i]->Animation != Active_Player->Animation) 449 { 450 451 /////////////////////////////////// 452 //TODO: Check age of animation 453 /////////////////////////////////// 454 DDrConsole_PrintF("Changing animation from %s to %s", 455 TMrInstance_GetInstanceName( Active_Player->Animation ), 456 TMrInstance_GetInstanceName( PlayerList[i]->Animation ) ); 457 // set the characters animation 458 /*ONrCharacter_SetAnimationInternal(Player, 459 Active_Player, 460 Active_Player->AnimationToState, 461 0, 462 PlayerList[i]->Animation);*/ 463 //ONrCharacter_NewAnimationHook(Player, Active_Player); 464 ONrCharacter_SetAnimationExternal(Player, TRrAnimation_GetFrom(PlayerList[i]->Animation), PlayerList[i]->Animation, 1); 465 //ONrCharacter_NewAnimationHook(Player, Active_Player); 466 } 467 468 469 } 470 PlayerList[i]->UpdateFlags &= ~( 1 << PFlag_Animation ); 471 472 //Don't update the frame if we are waiting to change the animation 473 if(DoWeUpdateThis( PlayerList[i]->UpdateFlags, PFlag_FramePing) && PlayerList[i]->Frame != -1 474 //&& !DoWeUpdateThis( PlayerList[i]->UpdateFlags, PFlag_Animation) 475 ) 476 { 477 if( abs(PlayerList[i]->Frame - Active_Player->Frame) > 2 ) 478 { 479 short AnimationLength; 480 AnimationLength = TRrAnimation_GetDuration(Active_Player->Animation); 481 if (PlayerList[i]->Frame >= AnimationLength) 482 { 483 Active_Player->Frame = AnimationLength - 1; 484 //Active_Player->Frame = 0; 485 } 486 else 487 { 488 Active_Player->Frame = PlayerList[i]->Frame; 489 } 490 } 491 PlayerList[i]->UpdateFlags &= ~( 1 << PFlag_FramePing ); 492 } 493 494 //Increment frame in case we were waiting 495 PlayerList[i]->Frame++; 496 497 if (DoWeUpdateThis( PlayerList[i]->UpdateFlags, PFlag_Throws) 498 && PlayerList[i]->ThrowData.throwName[0] != 0) 499 { 500 if(PlayerList[PlayerList[i]->ThrowData.throwing]) 501 { 502 short throwTarget = PlayerList[PlayerList[i]->ThrowData.throwing]->spawnnumber; 503 if ((throwTarget != Active_Player->throwing) && 504 (PlayerList[i]->ThrowData.throwFrame < 10)) 505 { 506 void *throw_animation; 507 ActiveCharacter* Target; 508 // get the animation 509 510 TMrInstance_GetDataPtr( 511 'TRAM', 512 PlayerList[i]->ThrowData.throwName, 513 &throw_animation); 514 //if (error) return; 515 516 // set the throw target 517 Active_Player->ThrowTargetCharacter = &ONgGameState->CharacterStorage[throwTarget]; 518 Target = ONrGetActiveCharacter(Active_Player->ThrowTargetCharacter); 519 if ((Target->Animation != throw_animation) && 520 // (OldAnimation != Animation) && 521 !(Active_Player->ThrowTargetCharacter->Flags & ONcCharacterFlag_BeingThrown)) 522 { 523 // set the throw variables 524 Active_Player->targetThrow = throw_animation; 525 Active_Player->throwing = throwTarget; 526 527 // run the throw 528 ONrCharacter_NewAnimationHook(Player, Active_Player); 529 530 if (Active_Player->ThrowTargetCharacter) 531 { 532 Target->Frame += 2; 533 DDrConsole_PrintF("Thrown by player %hi", Player->Number ); 534 DDrStartupMessage("Thrown by player %hi", Player->Number ); 535 Target->thrownBy = Player->Number & 0x00ff; 536 } 537 } 538 } 539 } 540 else 541 { 542 DDrConsole_PrintF("Warning, tried to throw nonexistant player %hi", 543 PlayerList[i]->ThrowData.throwing ); 544 } 545 } 546 547 //Always discard old throw data, even if it isnt applied 548 PlayerList[i]->UpdateFlags &= ~( 1 << PFlag_Throws ); 549 550 Active_Input = &(Active_Player->Input); 551 253 254 // Active_Player->PlayingFilm.Flags = 1; 255 256 Active_Input = &(Active_Player->Input); 257 258 552 259 if( (server_started && i !=0) || !server_started ) 553 260 { … … 561 268 Active_Input->Stopped.Actions1 = ~Active_Input->Current.Actions1; 562 269 Active_Input->Stopped.Actions2 = ~Active_Input->Current.Actions2; 563 Active_Input->MouseDeltaX = PlayerList[i]->Input.MouseDeltaX; 564 Active_Input->MouseDeltaY = PlayerList[i]->Input.MouseDeltaY; 270 if(client_connected && i == client_slot) 271 { 272 Active_Input->MouseDeltaX = ONgGameState->Input.MouseDeltaX; 273 Active_Input->MouseDeltaY = ONgGameState->Input.MouseDeltaY; 274 } 275 else 276 { 277 Active_Input->MouseDeltaX = PlayerList[i]->Input.MouseDeltaX; 278 Active_Input->MouseDeltaY = PlayerList[i]->Input.MouseDeltaY; 279 } 565 280 } 566 281 282 { 283 void* ConsoleAnimation = 0; 284 TMrInstance_GetDataPtr( 'TRAM', "KONOKOwatch_idle", &ConsoleAnimation); 285 286 if(!Active_Player->IsInAir && Active_Input->Current.Actions1 & (Action_Console | Action_PauseScreen) 287 && !(PlayerList[i]->Chr->Flags & ONcCharacterFlag_BeingThrown) 288 && Active_Player->ThrowTargetCharacter != -1) 289 { 290 if(ConsoleAnimation && ConsoleAnimation != Active_Player->Animation) 291 { 292 ONrCharacter_SetAnimationExternal(PlayerList[i]->Chr, Active_Player->AnimationFromState, ConsoleAnimation, 10); 293 Player->Flags |= 0x00200000; 294 Active_Player->ForcedAnimationFrames = -1;// TRrAnimation_GetDuration(ConsoleAnimation); 295 } 296 } 297 else if(Active_Input->Stopped.Actions1 & (Action_Console | Action_PauseScreen) ) 298 { 299 Active_Player->ForcedAnimationFrames = 0; 300 } 301 302 } 303 567 304 //Check for character switching requests 568 if(server_started && PlayerList[i]->Chr->Health != 0 && PlayerList[i]->InputFromClient.Actions1 & Action_Block && PlayerList[i]->ShapeshiftCooldown < ONgGameState->GameTime) 569 { 570 int error; 571 572 573 574 ONCC *newClass; 575 short numClasses = (short)TMrInstance_GetTagCount('ONCC'); 576 /* 577 if(Active_Player->Input.Start.Actions1 & Action_Block) 578 { 305 if(server_started && PlayerList[i]->Chr->Health != 0 306 && PlayerList[i]->InputFromClient.Actions1 & Action_Block) 307 { 308 if( PlayerList[i]->ShapeshiftCooldown < ONgGameState->GameTime) 309 { 310 int error; 311 312 313 314 ONCC *newClass; 315 short numClasses = (short)TMrInstance_GetTagCount('ONCC'); 316 /* 317 if(Active_Player->Input.Start.Actions1 & Action_Block) 318 { 579 319 //This might not be getting hit. Find out why, eh? 580 320 PlayerList[i]->ShapeshiftCooldown = ONgGameState->GameTime + 15; 581 }582 else583 {321 } 322 else 323 { 584 324 PlayerList[i]->ShapeshiftCooldown = ONgGameState->GameTime + 5; 585 } 586 */ 587 if (PlayerList[i]->InputFromClient.Actions1 & Action_Crouch) { 588 Player->ONCCnumber += numClasses - 1; 589 } 590 else { 591 Player->ONCCnumber += 1; 592 } 593 594 if (numClasses > 0) { 595 Player->ONCCnumber = Player->ONCCnumber % numClasses; 596 597 error = TMrInstance_GetDataPtr_ByNumber('ONCC', Player->ONCCnumber, &newClass); 598 599 if ((newClass != NULL) && (!error)) { 600 ONrCharacter_SetCharacterClass(Player, newClass); 601 } 602 } 603 325 } 326 */ 327 328 PlayerList[i]->ShapeshiftCooldown = ONgGameState->GameTime + 15; 329 330 if (PlayerList[i]->InputFromClient.Actions1 & Action_Crouch) { 331 Player->ONCCnumber += numClasses - 1; 332 } 333 else { 334 Player->ONCCnumber += 1; 335 } 336 337 if (numClasses > 0) { 338 Player->ONCCnumber = Player->ONCCnumber % numClasses; 339 340 error = TMrInstance_GetDataPtr_ByNumber('ONCC', Player->ONCCnumber, &newClass); 341 342 if ((newClass != NULL) && (!error)) { 343 ONrCharacter_SetCharacterClass(Player, newClass); 344 } 345 } 346 347 } 348 } 349 else 350 { 351 PlayerList[i]->ShapeshiftCooldown = 0; 352 } 353 if(client_connected) { 354 355 if( DoWeUpdateThis( PlayerList[i]->UpdateFlags, PFlag_Position) ) 356 { 357 //Active_Player->PhyContext->Position = PlayerList[i]->Position; 358 359 Active_Player->PhyContext->Position.X = 360 (PlayerList[i]->Position.X + Active_Player->PhyContext->Position.X) / 2; 361 362 Active_Player->PhyContext->Position.Y = 363 (PlayerList[i]->Position.Y + Active_Player->PhyContext->Position.Y) / 2; 364 365 Active_Player->PhyContext->Position.Z = 366 (PlayerList[i]->Position.Z + Active_Player->PhyContext->Position.Z) / 2; 367 368 PlayerList[i]->UpdateFlags &= ~( 1 << PFlag_Position ); 369 } 370 371 372 373 374 if (!(Player->Flags & ONcCharacterFlag_BeingThrown) && 375 DoWeUpdateThis( PlayerList[i]->UpdateFlags, PFlag_Animation) && (PlayerList[i]->Animation)) 376 { 377 // get a pointer to the animation 378 379 380 if (PlayerList[i]->Animation != Active_Player->Animation) 381 { 382 383 /////////////////////////////////// 384 //TODO: Check age of animation 385 /////////////////////////////////// 386 // set the characters animation 387 /*ONrCharacter_SetAnimationInternal(Player, 388 Active_Player, 389 Active_Player->AnimationToState, 390 0, 391 PlayerList[i]->Animation);*/ 392 //ONrCharacter_NewAnimationHook(Player, Active_Player); 393 ONrCharacter_SetAnimationExternal(Player, TRrAnimation_GetFrom(PlayerList[i]->Animation), PlayerList[i]->Animation, 1); 394 //ONrCharacter_NewAnimationHook(Player, Active_Player); 395 } 396 397 398 } 399 PlayerList[i]->UpdateFlags &= ~( 1 << PFlag_Animation ); 400 401 //Disabled Frame syncing for now. In most cases it won't be useful. 402 if(0 && DoWeUpdateThis( PlayerList[i]->UpdateFlags, PFlag_FramePing) && PlayerList[i]->Frame != -1 403 //&& !DoWeUpdateThis( PlayerList[i]->UpdateFlags, PFlag_Animation) 404 ) 405 { 406 if( abs(PlayerList[i]->Frame - Active_Player->Frame) > 2 ) 407 { 408 short AnimationLength; 409 AnimationLength = TRrAnimation_GetDuration(Active_Player->Animation); 410 if (PlayerList[i]->Frame >= AnimationLength) 411 { 412 Active_Player->Frame = AnimationLength - 1; 413 //Active_Player->Frame = 0; 414 } 415 else 416 { 417 Active_Player->Frame = PlayerList[i]->Frame; 418 } 419 } 420 421 } 422 PlayerList[i]->UpdateFlags &= ~( 1 << PFlag_FramePing ); 423 424 //Increment frame in case we were waiting 425 PlayerList[i]->Frame++; 426 427 if (DoWeUpdateThis( PlayerList[i]->UpdateFlags, PFlag_Throws) 428 && PlayerList[i]->ThrowData.throwName[0] != 0) 429 { 430 if(PlayerList[PlayerList[i]->ThrowData.throwing]) 431 { 432 short throwTarget = PlayerList[PlayerList[i]->ThrowData.throwing]->spawnnumber; 433 /*if ((throwTarget != Active_Player->throwing) && 434 (PlayerList[i]->ThrowData.throwFrame < 10))*/ 435 { 436 void *throw_animation; 437 ActiveCharacter* Target; 438 // get the animation 439 440 TMrInstance_GetDataPtr( 441 'TRAM', 442 PlayerList[i]->ThrowData.throwName, 443 &throw_animation); 444 //if (error) return; 445 446 // set the throw target 447 Active_Player->ThrowTargetCharacter = &ONgGameState->CharacterStorage[throwTarget]; 448 Target = ONrGetActiveCharacter(Active_Player->ThrowTargetCharacter); 449 //if (/*(Target->Animation != throw_animation) &&*/ 450 // (OldAnimation != Animation) && 451 // !(Active_Player->ThrowTargetCharacter->Flags & ONcCharacterFlag_BeingThrown)) 452 // Target->thrownBy == - 453 { 454 // set the throw variables 455 Active_Player->targetThrow = throw_animation; 456 Active_Player->throwing = throwTarget; 457 458 // run the throw 459 ONrCharacter_NewAnimationHook(Player, Active_Player); 460 461 //if (Active_Player->ThrowTargetCharacter) 462 { 463 // Target->Frame += 2; 464 //DDrConsole_PrintF("Thrown by player %hi", Player->Number ); 465 //DDrStartupMessage("Thrown by player %hi", Player->Number ); 466 Target->thrownBy = Player->Number & 0x00ff; 467 } 468 } 469 } 470 } 471 else 472 { 473 DDrConsole_PrintF("Warning, tried to throw nonexistant player %hi", 474 PlayerList[i]->ThrowData.throwing ); 475 } 476 } 477 478 //Always discard old throw data, even if it isnt applied 479 PlayerList[i]->UpdateFlags &= ~( 1 << PFlag_Throws ); 604 480 } 605 481 … … 607 483 } 608 484 485 if(server_started) 486 { 487 if(ONgGameState->GameTime % 120 == 0) 488 { 489 FLsPingAll(); 490 } 491 492 if(PlayerList[0]) 493 { 494 PlayerList[0]->InputFromClient.Actions1 = ONgGameState->Input.Current.Actions1; 495 PlayerList[0]->InputFromClient.Actions2 = ONgGameState->Input.Current.Actions2; 496 PlayerList[0]->InputFromClient.MouseDeltaX = ONgGameState->Input.MouseDeltaX; 497 PlayerList[0]->InputFromClient.MouseDeltaY = ONgGameState->Input.MouseDeltaY; 498 } 499 FLsSendPlayerData(); 500 } 609 501 MultiplayerStatus.PleaseUpdateAllPlayers = 0; 610 502 return ONgGameState; … … 651 543 const int green = 0x0000FF00; 652 544 const int red = 0x00FF0000; 545 const int blue = 0x000000FF; 653 546 int i; 654 547 char DrawString[255]; 655 548 const int LineHeight = 15; 656 IMtPoint2D DrawLocation = {2 0, 20};549 IMtPoint2D DrawLocation = {25, 20}; 657 550 TSrContext_SetShade(ScoreboardInstance, white); 658 551 TSrContext_DrawText(ScoreboardInstance, "Oni Flatline build " __DATE__ " " __TIME__, 255, 0, &DrawLocation); 552 TSrContext_SetShade(ScoreboardInstance, white); 659 553 DrawLocation.y += LineHeight; 554 DrawLocation.x = 25; 660 555 TSrContext_DrawText(ScoreboardInstance, "Name", 255, 0, &DrawLocation); 661 556 DrawLocation.x += 150; … … 667 562 if(PlayerList[i] == 0 || PlayerList[i]->Chr == 0) continue; 668 563 669 DrawLocation.x = 20;564 DrawLocation.x = 10; 670 565 DrawLocation.y += LineHeight; 566 567 sprintf(DrawString, "%i.", i ); 568 TSrContext_DrawText(ScoreboardInstance, DrawString, 255, 0, &DrawLocation); 569 DrawLocation.x += 15; 671 570 672 571 if(PlayerList[i]->Chr && PlayerList[i]->Chr->Health == 0) -
Daodan/MSVC/Flatline.h
r584 r586 101 101 uint32_t Actions1; 102 102 uint32_t Actions2; 103 unsigned int Time; 103 float DesiredFacing; 104 //unsigned int Time; 104 105 } input_struct; 105 106 … … 182 183 uint32_t ping; 183 184 //player_input all_input[33]; 185 uint32_t integer; //generic integer ;) 184 186 }; 185 187 } flatline_packet; … … 211 213 //PK_ALL_INPUT, 212 214 PK_PLAYER_DATA, 215 PK_MISSING_PLAYER, 213 216 }; 214 217 … … 252 255 253 256 PlayerInput InputFromClient; 257 float FacingFromClient; 254 258 255 259 //////////////////////////// … … 263 267 PlayerScore Score; 264 268 void* Animation; 269 char AnimationString[32]; 265 270 uint16_t Frame; 266 271 PlayerThrowData ThrowData; 267 272 void* Class; 273 char ClassString[32]; 268 274 PlayerInventory Inventory; 269 275 Vector3 Position; … … 272 278 273 279 unsigned int LastInputTime; 274 275 280 276 281 -
Daodan/MSVC/Flatline_BSL.c
r583 r586 216 216 } 217 217 218 218 uint16_t tele(sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], int* dontuse1, int* dontuse2, sl_arg* ret) 219 { 220 ActiveCharacter *AC = ONrGetActiveCharacter(ONgGameState->PlayerCharacter); 221 // AC->PhyContext->Position = AC->AimTarget; 222 AC->PhyContext->Position.X += AC->AimVector.X; 223 AC->PhyContext->Position.Y += AC->AimVector.Y; 224 AC->PhyContext->Position.Z += AC->AimVector.Z; 225 return 0; 226 } 219 227 void SLrFlatline_Initialize() 220 228 { … … 223 231 FLrInput_Update_Keys(); 224 232 SLrGlobalVariable_Register_Int32("skip", "skips", &(((GameState*)ONgGameState)->field_40) ); 233 SLrScript_Command_Register_Void("tele","teleports", "", tele); 225 234 SLrScript_Command_Register_ReturnType("connect","Connects to a server", "ip:string", sl_void, connect_to_server); 226 235 SLrScript_Command_Register_Void("host","Starts a server", "", start_server); -
Daodan/MSVC/Flatline_Client.c
r585 r586 23 23 OBJrConsole_OnActivate( OBJrConsole_GetByID(args[0]), PlayerList[args[1]]->Chr ); 24 24 break; 25 case(EV_RESPAWN): 26 ONrCorpse_Create(PlayerList[args[0]]->Chr); 27 break; 25 28 default: 26 29 break; … … 42 45 //starts the connection 43 46 DDrConsole_PrintF("Connecting to server %s on socket %i", inet_ntoa(address.sin_addr), client_sock); 44 sent_bytes = NetUDPSocket_Send(client_sock, (sockaddr*)&address, (char*)packet, 255);47 sent_bytes = NetUDPSocket_Send(client_sock, (sockaddr*)&address, (char*)packet, FLATLINE_HEADER + sizeof(connect_send) ); 45 48 if(sent_bytes == SOCKET_ERROR) { 46 49 NetCatchError(); … … 73 76 74 77 75 DDrPatch_Byte(0x04ED6FB, 0xEB);78 //DDrPatch_Byte(0x04ED6FB, 0xEB); 76 79 77 80 //DDrConsole_PrintF("Slot %i", ((connect_reply*)packet)->player_slot); -
Daodan/MSVC/Flatline_Hooks.c
r584 r586 32 32 } 33 33 34 int FLrHook_DebugNameTextureInit(short width, short height, int type, int allocated, int flags, char* name, void** output) 35 { 36 //flags = (1 << 10); 37 type = 1; 38 //DDrPatch_Byte( 0x005EB83C + 3, 0xff ); 39 DDrPatch_Int32( 0x005EB83C, 0xFF000000 ); 40 return M3rTextureMap_New(width, height, type, allocated, flags, name, output); 41 } 42 43 short FLrHook_DebugNameShadeHack( Character* Char ) 44 { 45 46 return TSrContext_SetShade(*(void**)0x005EB844, ONrCharacter_GetHealthShade( Char->Health, Char->MaxHealth )); 47 //return TSrContext_SetShade(*(void**)0x005EB844, 0xFFFFFFFF); 48 } 49 /* 50 void FLrHook_Lasers( Character* PlayerChar ) 51 { 52 if(server_started || client_connected) 53 { 54 int i; 55 for(i = 0; i < MAX_PLAYERS; i++) 56 { 57 if(PlayerList[i] && PlayerList[i]->Chr && PlayerList[i]->Chr->Inventory.Weapons[0]) 58 { 59 ONiDrawWeaponSight( PlayerList[i]->Chr ); 60 } 61 } 62 } 63 else 64 { 65 if( 66 ONiDrawWeaponSight( ONgGameState->PlayerCharacter ); 67 } 68 } 69 */ 70 71 void FLrHook_Lasers( Character* Char ) 72 { 73 ONiDrawWeaponSight( Char ); 74 AI2rDisplayDebuggingInfo( Char ); 75 } -
Daodan/MSVC/Flatline_Hooks.h
r584 r586 2 2 char * FLrHook_DoorOpen( DoorObject *Door, Character *Char); 3 3 short FLrHook_ConsoleActivate( void *inObject, Character *inCharacter ); 4 int FLrHook_DebugNameTextureInit(short width, short height, int type, int allocated, int flags, char* name, void** output); 5 short FLrHook_DebugNameShadeHack( Character* Char ); 6 void FLrHook_Lasers( Character* PlayerChar ); -
Daodan/MSVC/Flatline_PacketBuilder.c
r585 r586 4 4 #define FLAG_AND_INCREMENT( FLAG ) PD->UpdateFlags |= (1 << FLAG ); DataPointer += FLpData_PartSize( FLAG ); 5 5 6 void FLsPacketBuild( uint8_t p, PlayerData* PD )6 void FLsPacketBuild( uint8_t p, PlayerData* PD, bool UpdateAll ) 7 7 { 8 8 Character* Player = PlayerList[p]->Chr; … … 38 38 39 39 if( PI->Facings.Facing != Player->Facing || 40 PI->Facings.DesiredFacing != Player->DesiredFacing )40 PI->Facings.DesiredFacing != Player->DesiredFacing || UpdateAll ) 41 41 { 42 42 PlayerFacing* ptr = (void*)DataPointer; … … 50 50 51 51 if(PI->Health.Health != Player->Health || 52 PI->Health.MaxHealth != Player->MaxHealth )52 PI->Health.MaxHealth != Player->MaxHealth || UpdateAll ) 53 53 { 54 54 PlayerHealth* ptr = (void*)DataPointer; … … 89 89 } 90 90 91 if( PI->Class != Player->ONCC )91 if( PI->Class != Player->ONCC || UpdateAll ) 92 92 { 93 93 sprintf_s( DataPointer, 32, "%s", TMrInstance_GetInstanceName( Player->ONCC ) ); 94 sprintf_s( PI->ClassString, 32, "%s", DataPointer ); 94 95 PI->Class = Player->ONCC; 95 96 … … 99 100 if(APlayer) 100 101 { 101 if( (APlayer->PhyContext) && memcmp(&PI->Position, &APlayer->PhyContext->Position, sizeof(Vector3)))102 if( (APlayer->PhyContext) && (memcmp(&PI->Position, &APlayer->PhyContext->Position, sizeof(Vector3)) || UpdateAll )) 102 103 { 103 104 Vector3* ptr = (Vector3*)DataPointer; … … 107 108 } 108 109 109 if(APlayer->Animation != PI->Animation )110 if(APlayer->Animation != PI->Animation || !APlayer->Frame || UpdateAll ) 110 111 { 111 112 sprintf_s( DataPointer, 32, "%s", TMrInstance_GetInstanceName( APlayer->Animation ) ); 113 sprintf_s( PI->AnimationString, 32, "%s", DataPointer ); 112 114 PI->Animation = APlayer->Animation; 115 113 116 114 117 FLAG_AND_INCREMENT( PFlag_Animation ); … … 117 120 if(APlayer->targetThrow) 118 121 { 119 if(!PI->HasAppliedThrow )122 if(!PI->HasAppliedThrow || UpdateAll ) 120 123 { 121 124 PlayerThrowData* ptr = (void*)DataPointer; … … 164 167 if(PlayerList[p] && PlayerList[p]->Chr) 165 168 { 166 FLsPacketBuild(p, &BuildData[p] );169 FLsPacketBuild(p, &BuildData[p], 0); 167 170 168 171 assert( BuildData[p].Size < 255 ); -
Daodan/MSVC/Flatline_PacketReader.c
r584 r586 9 9 //Long winded? 10 10 11 12 11 13 void FLcPacketBufferToPlayerData( PlayerData* PD) 12 14 { … … 14 16 uint8_t * DataPointer = PD->data; 15 17 18 static player_info BufferData[MAX_PLAYERS] = {0}; 19 static bool IsBuffered[32]; 20 21 16 22 if(!PI) 17 23 { 18 24 //TODO: Store this data and then apply it once we have a character that matches! 19 return; 25 flatline_packet pk; 26 pk.id = PK_MISSING_PLAYER; 27 pk.integer = PD->ID; 28 NetUDPSocket_Send(client_sock, (sockaddr*)&address, (char*)&pk, FLATLINE_HEADER + 4 ); 29 30 IsBuffered[PD->ID] = 1; 31 PI = &BufferData[PD->ID]; 32 33 //return; 34 } 35 else if(IsBuffered[PD->ID]) 36 { 37 player_info* Buffer = BufferData + PD->ID; 38 if( DoWeUpdateThis( Buffer->UpdateFlags, PFlag_Input) ) PI->Input = Buffer->Input; 39 if( DoWeUpdateThis( Buffer->UpdateFlags, PFlag_Facing) ) PI->Facings = Buffer->Facings; 40 if( DoWeUpdateThis( Buffer->UpdateFlags, PFlag_Health) ) PI->Health = Buffer->Health; 41 if( DoWeUpdateThis( Buffer->UpdateFlags, PFlag_FramePing) ) { 42 PI->Frame = Buffer->Frame; 43 PI->Ping = Buffer->Ping; 44 } 45 //if( DoWeUpdateThis( Buffer->UpdateFlags, PFlag_Inventory) ) PI->invi= Buffer->Input; 46 if( DoWeUpdateThis( Buffer->UpdateFlags, PFlag_Class) ) 47 { 48 PI->Class = Buffer->Class; 49 sprintf_s( PI->ClassString, 32, "%s", Buffer->ClassString ); 50 } 51 52 if( DoWeUpdateThis( Buffer->UpdateFlags, PFlag_Position) ) PI->Position = Buffer->Position; 53 if( DoWeUpdateThis( Buffer->UpdateFlags, PFlag_Animation) ) 54 { 55 PI->Animation = Buffer->Animation; 56 sprintf_s( PI->AnimationString, 32, "%s", Buffer->AnimationString); 57 } 58 if( DoWeUpdateThis( Buffer->UpdateFlags, PFlag_Throws) ) PI->ThrowData = Buffer->ThrowData; 59 60 PI->UpdateFlags |= Buffer->UpdateFlags; 61 IsBuffered[PD->ID] = 0; 20 62 } 21 63 … … 70 112 if( DoWeUpdateThis( PD->UpdateFlags, PFlag_Class ) ) 71 113 { 72 TMrInstance_GetDataPtr( 'ONCC', (char*)DataPointer, &PI->Class ); 114 sprintf_s( PI->ClassString, 32, "%s", DataPointer ); 115 TMrInstance_GetDataPtr( 'ONCC', (char*)DataPointer, &PI->Class ); 73 116 DataPointer += FLpData_PartSize( PFlag_Class ); 74 117 } … … 82 125 if( DoWeUpdateThis( PD->UpdateFlags, PFlag_Animation ) ) 83 126 { 84 TMrInstance_GetDataPtr( 'TRAM', (char*)DataPointer, &PI->Animation ); 127 sprintf_s( PI->AnimationString, 32, "%s", DataPointer ); 128 TMrInstance_GetDataPtr( 'TRAM', PI->AnimationString, &PI->Animation ); 85 129 DataPointer += FLpData_PartSize( PFlag_Animation ); 86 130 } -
Daodan/MSVC/Flatline_Server.c
r583 r586 172 172 UDPServer_SendToAll(&message, message_size + 2 + FLATLINE_HEADER); 173 173 } 174 void FLsSend_BINACHAR( short j, sockaddr* socket ) 175 { 176 177 ActiveCharacter* AC = ONrGetActiveCharacter( PlayerList[j]->Chr); 178 flatline_packet new_char = {0}; 179 CharacterObject* Char = &new_char.new_player.Character; 180 181 new_char.id = NEW_PLAYER; 182 new_char.new_player.Playernumber = j; 183 184 // memset(Char, 0, sizeof(CharacterObject)); 185 Char->Header.Type = 'CHAR'; 186 Char->OSD.Options = chr_dontaim; 187 188 sprintf(Char->OSD.Name,"%s",PlayerList[j]->name); 189 190 sprintf(Char->OSD.Class, "%s", TMrInstance_GetInstanceName(PlayerList[j]->Chr->ONCC)); 191 192 if(AC) 193 { 194 Char->Header.Position = AC->PhyContext->Position; 195 } 196 else 197 { 198 Char->Header.Position.X = 0; 199 Char->Header.Position.Y = 0; 200 Char->Header.Position.Z = 0; 201 } 202 203 NetTCPServer_Send(socket, (char*)&new_char, sizeof(new_player) + FLATLINE_HEADER ); 204 } 205 bool FLrServer_PacketCallback(char* data, int datalen, int from) 206 { 207 int i, j; 208 bool found_player = 0; 209 flatline_packet * packet = (flatline_packet*)data; 210 static int recieved = 0; 211 sockaddr_in sender; 212 sender.sin_family = AF_INET; 213 sender.sin_port = htons(27777); 214 sender.sin_addr = *((struct in_addr*)(int*)&from); 215 216 217 //packet->data[datalen] = '\0'; 218 219 //DDrConsole_PrintF("Packet \r%d recieved from %i", ++recieved, from); 220 221 222 223 //if data[0] != CONNECT_SEND, search in playerlist for ip address 224 225 226 227 228 switch(packet->id) { 229 flatline_packet connect_recv; 230 player_info * playah; 231 //rewrite this when we get TCP support. 232 //rewrite this before we get TCP support* 233 //the way of seeing if there is room for players sucks. 234 case CONNECT_SEND: 235 ; 236 237 connect_recv.id = CONNECT_REPLY; 238 239 //if(Players[i].ip == sender.sin_addr.S_un.S_addr) break; //needs to send an error message 240 sender.sin_addr.S_un.S_addr = htonl(sender.sin_addr.S_un.S_addr); 241 playah = FLrServer_AddPlayer(from,packet->connect_send.name, 0, 0); 242 DDrConsole_PrintF("%s connected from %s", packet->connect_send.name, inet_ntoa(sender.sin_addr ) ); 243 if(!((int)playah > -5 && (int)playah <= 0)) { 244 245 connect_recv.connect_reply.goodtogo = 1; 246 connect_recv.connect_reply.player_slot = playah->list_slot; 247 //DDrConsole_PrintF("Slot: %i", playah->list_slot); 248 249 //sending this several times to make sure it gets through. Really need to make up some form of packet tracking. 250 NetUDPServer_Send((sockaddr *) &sender, (char*)&connect_recv, sizeof(connect_reply) + FLATLINE_HEADER); 251 NetUDPServer_Send((sockaddr *) &sender, (char*)&connect_recv, sizeof(connect_reply) + FLATLINE_HEADER); 252 NetUDPServer_Send((sockaddr *) &sender, (char*)&connect_recv, sizeof(connect_reply) + FLATLINE_HEADER); 253 NetUDPServer_Send((sockaddr *) &sender, (char*)&connect_recv, sizeof(connect_reply) + FLATLINE_HEADER); 254 NetUDPServer_Send((sockaddr *) &sender, (char*)&connect_recv, sizeof(connect_reply) + FLATLINE_HEADER); 255 Sleep(100); 256 257 258 259 for(j = 0; j < max_connections; j++) { 260 if(PlayerList[j] != 0) { 261 FLsSend_BINACHAR( j, (sockaddr *)&sender); 262 } 263 264 } 265 } 266 else { 267 //fix the error messages... 268 DDrConsole_PrintF("Server is full. :("); 269 connect_recv.connect_reply.goodtogo = 0; 270 sender.sin_addr.S_un.S_addr = htonl(sender.sin_addr.S_un.S_addr); 271 memcpy(&connect_recv.connect_reply.message,"Server is full.", sizeof("Server is full.")); 272 NetTCPServer_Send((sockaddr *) &sender, (char*)&connect_recv, sizeof(bool)*2 + FLATLINE_HEADER + sizeof("Server is full.")); 273 274 } 275 276 277 break; 278 case CONNECT_REPLY: 279 break; //do nothing...a server shouldn't recieve this type of packet. 280 case MESSAGE: 281 for(i = 0; i < MAX_PLAYERS; i++) { 282 //DDrConsole_PrintF("%i : %i | %s : %s", from, Players[i].ip, inet_ntoa(*(struct in_addr*)&from), inet_ntoa(*(struct in_addr*)&(Players[i].ip))); 283 if(Players[i].ip == sender.sin_addr.S_un.S_addr) { 284 found_player = 1; 285 break; 286 } 287 } 288 if(found_player == 0) break; 289 else { 290 char message_buffer[512] = {0}; 291 flatline_packet message; 292 int message_size; 293 data[datalen] = 0; 294 295 DDrConsole_PrintF("%s: %s", Players[i].name, packet->data); 296 sprintf(message_buffer, "%s: %s", Players[i].name, packet->data); 297 298 message.id = MESSAGE; 299 message_size = sprintf(message.data, "%s", message_buffer); 300 COrMessage_Print(message_buffer, "chat", 0); 301 UDPServer_SendToAll(&message, message_size + 1 + FLATLINE_HEADER); 302 break; 303 } 304 case CHANGE_NAME: 305 for(i = 0; i < MAX_PLAYERS; i++) { 306 if(PlayerList[i] && PlayerList[i]->ip == sender.sin_addr.S_un.S_addr) { 307 found_player = 1; 308 break; 309 } 310 } 311 if(found_player == 0) break; 312 else { 313 bool name_exists = 0; 314 for(j = 0; j < MAX_PLAYERS; j++) { 315 if(PlayerList[j] && !strcmp(packet->data, PlayerList[j]->name)) { 316 name_exists = 1; 317 break; 318 } 319 } 320 if(!name_exists) { 321 FLsUpdateName( i, packet->data ); 322 } 323 break; 324 } 325 case PLAYER_INPUT: 326 327 for(i = 0; i < max_connections; i++) { 328 if(PlayerList[i] != 0 && PlayerList[i]->ip == sender.sin_addr.S_un.S_addr) { 329 found_player = 1; 330 break; 331 } 332 } 333 334 if(found_player == 0) break; 335 else { 336 input_struct * packet_input = &packet->input_struct; 337 338 339 PlayerList[i]->InputFromClient.Actions1 = packet_input->Actions1; 340 PlayerList[i]->InputFromClient.Actions2 = packet_input->Actions2; 341 PlayerList[i]->InputFromClient.MouseDeltaX = packet_input->MouseDeltaX; 342 PlayerList[i]->InputFromClient.MouseDeltaY = packet_input->MouseDeltaY; 343 PlayerList[i]->FacingFromClient = packet_input->DesiredFacing; 344 //PlayerList[i]->LastInputTime = packet_input->Time; 345 346 break; 347 } 348 case PK_PONG: 349 for(i = 0; i < max_connections; i++) { 350 if(PlayerList[i] != 0 && PlayerList[i]->ip == sender.sin_addr.S_un.S_addr) { 351 found_player = 1; 352 break; 353 } 354 } 355 356 if(found_player == 0) break; 357 if(packet->ping != lastPingTime) 358 { 359 PlayerList[i]->Ping = 999; 360 } 361 else 362 { 363 PlayerList[i]->Ping = GetTickCount() - packet->ping; 364 } 365 break; 366 case PK_MISSING_PLAYER: 367 if(packet->integer < MAX_PLAYERS) 368 { 369 FLsSend_BINACHAR( packet->integer, &sender); 370 } 371 break; 372 default: 373 DDrConsole_PrintF("Warning, recieved badly formed packet!"); 374 break; 375 } 376 return true; 377 } -
Daodan/MSVC/Oni_GameState.h
r584 r586 1211 1211 __int16 HardPause; 1212 1212 __int16 field_1C8E; 1213 int field_1C90;1214 __int16 field_1C94;1215 __int16 field_1C96;1213 int ForcedAnimationFrames; 1214 __int16 HitStun; 1215 __int16 BlockStun; 1216 1216 __int16 Dizzy; 1217 1217 __int16 field_1C9A; … … 1252 1252 char field_2195; 1253 1253 char gap_2196[2]; 1254 Vector3 field_2198; 1255 int field_21A4; 1256 int field_21A8; 1257 int field_21AC; 1258 Vector3 field_21B0; 1254 Vector3 AimTarget; 1255 Vector3 AimVector; 1256 Vector3 CamVector; 1259 1257 float HeadFacing; 1260 1258 float HeadPitch; -
Daodan/MSVC/Oni_Symbols.h
r582 r586 232 232 DefFunc( short, TMrInstance_GetDataPtr_ByNumber, (int tag, int number, void** out), 0x00423680 ); 233 233 DefFunc( uint32_t, TMrInstance_GetTagCount, (int tag), 0x004236F0); 234 //DefFunc( uint32_t, stdcall M3rTextureMap_New, (int tag), 0x041EB00); 235 //(short width, short height, int type, int allocated, int flags, char* name, void** output) 236 DefFunc( uint32_t, ONrCharacter_GetHealthShade, (uint32_t health, uint32_t maxhealth), 0x004EF450); 237 //DefFunc( short, TSrContext_SetShade, (void* context, int shade ), 0x0042EE50); 238 DefFunc( void, ONiDrawWeaponSight, (Character* Char), 0x004E1900 ); 239 DefFunc( void, AI2rDisplayDebuggingInfo, (Character* Char), 0x0048C5F0 ); 240 static const uint32_t ( * M3rTextureMap_New)(short width, short height, int type, int allocated, int flags, char* name, void** output) 241 = (const uint32_t(*)(short width, short height, int type, int allocated, int flags, char* name, void** output))0x041EB00; 234 242 #endif
Note:
See TracChangeset
for help on using the changeset viewer.