Changeset 581 for Daodan/MSVC
- Timestamp:
- Jan 14, 2011, 9:36:34 AM (14 years ago)
- Location:
- Daodan/MSVC
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
Daodan/MSVC/Flatline.c
r580 r581 425 425 //PlayerList[i]->Chr = ((GameState *)ONgGameState)->CharacterStorage; 426 426 427 PlayerList[i]->Actions1 = pd->Inputs.Actions1;427 /* PlayerList[i]->Actions1 = pd->Inputs.Actions1; 428 428 PlayerList[i]->Actions2 = pd->Inputs.Actions2; 429 429 PlayerList[i]->MouseDeltaX = pd->Inputs.MouseDeltaX; 430 PlayerList[i]->MouseDeltaY = pd->Inputs.MouseDeltaY; 430 PlayerList[i]->MouseDeltaY = pd->Inputs.MouseDeltaY;*/ 431 431 memcpy( &(PlayerList[i]->player_data), pd, sizeof(player_data) ); 432 432 … … 484 484 case PK_PING: 485 485 packet.id = PK_PONG; 486 487 486 NetUDPSocket_Send(client_sock, (sockaddr *) &address, (char*)&packet, FLATLINE_HEADER + 4); 487 break; 488 case PK_ALL_INPUT: 489 if(1) 490 { 491 int Player; 492 for(Player = 0; Player < MAX_CONNECTIONS; Player++) 493 { 494 if(PlayerList[Player]) 495 { 496 PlayerList[Player]->Actions1 = packet.all_input[Player].Actions1; 497 PlayerList[Player]->Actions2 = packet.all_input[Player].Actions2; 498 PlayerList[Player]->MouseDeltaX = packet.all_input[Player].MouseDeltaX; 499 PlayerList[Player]->MouseDeltaY = packet.all_input[Player].MouseDeltaY; 500 } 501 } 502 } 488 503 break; 489 504 default: … … 532 547 { 533 548 uint16_t i; 534 549 flatline_packet all_input = {0}; 535 550 ActiveCharacter * Active_Player = ONgGameState->ActiveCharacters; 536 551 Active_Player->PhyContext->Rotation; … … 557 572 if(!(server_started || client_connected)) return ONgGameState; 558 573 574 all_input.id = PK_ALL_INPUT; 575 559 576 if(server_started && ONgGameState->GameTime % 120 == 0) 560 577 { … … 568 585 if(PlayerList[i] == 0) continue; 569 586 587 588 if(i == 0) { 589 all_input.all_input[i].Actions1 = ((GameState*)(ONgGameState))->Input.Current.Actions1; 590 all_input.all_input[i].Actions2 = ((GameState*)(ONgGameState))->Input.Current.Actions2; 591 all_input.all_input[i].MouseDeltaX = ONgGameState->Input.MouseDeltaX; 592 all_input.all_input[i].MouseDeltaY = ONgGameState->Input.MouseDeltaY; 593 } 594 else{ 595 all_input.all_input[i].Actions1 = PlayerList[i]->Actions1; 596 all_input.all_input[i].Actions2 = PlayerList[i]->Actions2; 597 all_input.all_input[i].MouseDeltaX = PlayerList[i]->MouseDeltaX; 598 all_input.all_input[i].MouseDeltaY = PlayerList[i]->MouseDeltaY; 599 } 570 600 571 601 Player = PlayerList[i]->Chr; … … 614 644 if(Active_Player == 0) continue; 615 645 Active_Input = &(Active_Player->Input); 616 if(server_started) { 646 647 if(server_started && strcmp(PlayerList[i]->player_data.Animation, TMrInstance_GetInstanceName(Active_Player->Animation))) 648 { 617 649 player_data * data; 618 650 flatline_packet data_out = {0}; 619 651 620 if(!strcmp(PlayerList[i]->player_data.Animation, TMrInstance_GetInstanceName(Active_Player->Animation))) 621 continue; 622 652 623 653 data_out.id = PLAYER_DATA; 624 654 data = (void*)&(data_out.data); … … 652 682 653 683 654 if(i == 0) {655 data->Inputs.Actions1 = ((GameState*)(ONgGameState))->Input.Current.Actions1;656 data->Inputs.Actions2 = ((GameState*)(ONgGameState))->Input.Current.Actions2;657 data->Inputs.MouseDeltaX = ONgGameState->Input.MouseDeltaX;658 data->Inputs.MouseDeltaY = ONgGameState->Input.MouseDeltaY;659 }660 else{661 data->Inputs.Actions1 = PlayerList[i]->Actions1;662 data->Inputs.Actions2 = PlayerList[i]->Actions2;663 data->Inputs.MouseDeltaX = PlayerList[i]->MouseDeltaX;664 data->Inputs.MouseDeltaY = PlayerList[i]->MouseDeltaY;665 }666 684 data->Ping = PlayerList[i]->Ping; 667 685 memcpy( &(PlayerList[i]->player_data), data, sizeof(player_data) ); … … 690 708 player_data* pd = &PlayerList[i]->player_data; 691 709 692 if(PlayerList[i]->DataApplied) continue; 693 710 711 //Note to self: sort out which needs to be applied the first time and which the second. 712 switch(PlayerList[i]->DataApplied) 713 { 714 case 1: 715 PlayerList[i]->DataApplied = 2; 716 break; 717 case 0: 718 PlayerList[i]->DataApplied = 1; 719 case 2: 720 continue; 721 } 722 694 723 Player->Health = PlayerList[i]->player_data.Health; 695 724 PlayerList[i]->Chr->MaxHealth = PlayerList[i]->player_data.MaxHealth; … … 698 727 PlayerList[i]->Chr->DesiredFacing = PlayerList[i]->player_data.DesiredFacing; 699 728 700 PlayerList[i]->Actions1 = PlayerList[i]->player_data.Inputs.Actions1;729 /* PlayerList[i]->Actions1 = PlayerList[i]->player_data.Inputs.Actions1; 701 730 PlayerList[i]->Actions2 = PlayerList[i]->player_data.Inputs.Actions2; 702 731 PlayerList[i]->MouseDeltaX = PlayerList[i]->player_data.Inputs.MouseDeltaX; 703 PlayerList[i]->MouseDeltaY = PlayerList[i]->player_data.Inputs.MouseDeltaY; 732 PlayerList[i]->MouseDeltaY = PlayerList[i]->player_data.Inputs.MouseDeltaY;*/ 704 733 Active_Player->PhyContext->Position = PlayerList[i]->player_data.Position; 705 734 OldAnimation = Active_Player->Animation; … … 757 786 //Player->Flags |= 0x00000010; 758 787 ONrCharacter_SetAnimationExternal(Player, TRrAnimation_GetFrom(Animation), Animation, 0); 788 //ONrCharacter_NewAnimationHook(Player, Active_Player); 759 789 } 760 790 … … 811 841 } 812 842 } 813 PlayerList[i]->DataApplied = 1; 814 815 } 816 } 843 844 } 845 } 846 847 } 848 if(server_started) 849 { 850 UDPServer_SendToAll(&all_input, FLATLINE_HEADER + sizeof(player_input) * 32); 817 851 } 818 852 -
Daodan/MSVC/Flatline.h
r580 r581 121 121 uint32_t Health; 122 122 uint32_t MaxHealth; 123 input_struct Inputs;123 //input_struct Inputs; 124 124 int rare_sync_index; 125 125 char Animation[32]; … … 144 144 int intArray[]; 145 145 } flatline_event; 146 147 typedef struct { 148 float MouseDeltaX; 149 float MouseDeltaY; 150 uint32_t Actions1; 151 uint32_t Actions2; 152 } player_input; 146 153 147 154 //used for storing data about each player … … 163 170 flatline_event flatline_event; 164 171 uint32_t ping; 172 player_input all_input[32]; 165 173 }; 166 174 } flatline_packet; … … 190 198 PK_PING, 191 199 PK_PONG, 200 PK_ALL_INPUT, 192 201 }; 193 202
Note:
See TracChangeset
for help on using the changeset viewer.