Rev 18 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 18 | Rev 20 | ||
|---|---|---|---|
| Line 1... | Line 1... | ||
| 1 | #include "network.h" |
1 | #include "network.h" |
| 2 | #include "brender.h" |
2 | #include "brender/brender.h" |
| 3 | #include "car.h" |
3 | #include "car.h" |
| 4 | #include "controls.h" |
4 | #include "controls.h" |
| 5 | #include "displays.h" |
5 | #include "displays.h" |
| 6 | #include "errors.h" |
6 | #include "errors.h" |
| 7 | #include "globvars.h" |
7 | #include "globvars.h" |
| Line 17... | Line 17... | ||
| 17 | #include "pd/net.h" |
17 | #include "pd/net.h" |
| 18 | #include "pd/sys.h" |
18 | #include "pd/sys.h" |
| 19 | #include "pedestrn.h" |
19 | #include "pedestrn.h" |
| 20 | #include "piping.h" |
20 | #include "piping.h" |
| 21 | #include "powerup.h" |
21 | #include "powerup.h" |
| 22 | #include "pratcam.h" |
- | |
| 23 | #include "replay.h" |
22 | #include "replay.h" |
| 24 | #include "spark.h" |
23 | #include "spark.h" |
| 25 | #include "structur.h" |
24 | #include "structur.h" |
| 26 | #include "utility.h" |
25 | #include "utility.h" |
| 27 | #include "world.h" |
26 | #include "world.h" |
| Line 159... | Line 158... | ||
| 159 | } |
158 | } |
| 160 | 159 | ||
| 161 | // IDA: void __cdecl HaltNetServiceReentrancy() |
160 | // IDA: void __cdecl HaltNetServiceReentrancy() |
| 162 | void HaltNetServiceReentrancy(void) { |
161 | void HaltNetServiceReentrancy(void) { |
| 163 | LOG_TRACE("()"); |
162 | LOG_TRACE("()"); |
| 164 | - | ||
| 165 |
|
163 | NOT_IMPLEMENTED(); |
| 166 | } |
164 | } |
| 167 | 165 | ||
| 168 | // IDA: void __usercall NetSendHeadupToAllPlayers(char *pMessage@<EAX>) |
166 | // IDA: void __usercall NetSendHeadupToAllPlayers(char *pMessage@<EAX>) |
| 169 | void NetSendHeadupToAllPlayers(char* pMessage) { |
167 | void NetSendHeadupToAllPlayers(char* pMessage) { |
| 170 | tNet_contents* the_contents; |
168 | tNet_contents* the_contents; |
| Line 176... | Line 174... | ||
| 176 | } |
174 | } |
| 177 | } |
175 | } |
| 178 | 176 | ||
| 179 | // IDA: void __usercall NetSendHeadupToEverybody(char *pMessage@<EAX>) |
177 | // IDA: void __usercall NetSendHeadupToEverybody(char *pMessage@<EAX>) |
| 180 | void NetSendHeadupToEverybody(char* pMessage) { |
178 | void NetSendHeadupToEverybody(char* pMessage) { |
| 181 | tNet_contents |
179 | //tNet_contents* the_contents; // Pierre-Marie Baty -- unused variable |
| 182 | LOG_TRACE("(\"%s\")", pMessage); |
180 | LOG_TRACE("(\"%s\")", pMessage); |
| 183 | - | ||
| 184 | if (gNet_mode == eNet_mode_none) { |
- | |
| 185 |
|
181 | NOT_IMPLEMENTED(); |
| 186 | } |
- | |
| 187 | if (gProgram_state.racing) { |
- | |
| 188 | NewTextHeadupSlot(4, 0, 3000, -4, pMessage); |
- | |
| 189 | } |
- | |
| 190 | the_contents = NetGetBroadcastContents(NETMSGID_HEADUP, 0); |
- | |
| 191 | strcpy(the_contents->data.headup.text, pMessage); |
- | |
| 192 | } |
182 | } |
| 193 | 183 | ||
| 194 | // IDA: void __usercall NetSendHeadupToPlayer(char *pMessage@<EAX>, tPlayer_ID pPlayer@<EDX>) |
184 | // IDA: void __usercall NetSendHeadupToPlayer(char *pMessage@<EAX>, tPlayer_ID pPlayer@<EDX>) |
| 195 | void NetSendHeadupToPlayer(char* pMessage, tPlayer_ID pPlayer) { |
185 | void NetSendHeadupToPlayer(char* pMessage, tPlayer_ID pPlayer) { |
| 196 | tNet_message |
186 | //tNet_message* message; // Pierre-Marie Baty -- unused variable |
| 197 | LOG_TRACE("(\"%s\", %d)", pMessage, pPlayer); |
187 | LOG_TRACE("(\"%s\", %d)", pMessage, pPlayer); |
| 198 | - | ||
| 199 | if (gNet_mode == eNet_mode_none) { |
- | |
| 200 |
|
188 | NOT_IMPLEMENTED(); |
| 201 | } |
- | |
| 202 | if (gLocal_net_ID == pPlayer) { |
- | |
| 203 | if (gProgram_state.racing) { |
- | |
| 204 | NewTextHeadupSlot(4, 0, 3000, -4, pMessage); |
- | |
| 205 | } |
- | |
| 206 | } else { |
- | |
| 207 | message = NetBuildMessage(NETMSGID_HEADUP, 0); |
- | |
| 208 | strcpy(message->contents.data.headup.text, pMessage); |
- | |
| 209 | NetGuaranteedSendMessageToPlayer(gCurrent_net_game, message, pPlayer, 0); |
- | |
| 210 | } |
- | |
| 211 | } |
189 | } |
| 212 | 190 | ||
| 213 | // IDA: void __cdecl InitialisePlayerStati() |
191 | // IDA: void __cdecl InitialisePlayerStati() |
| 214 | void InitialisePlayerStati(void) { |
192 | void InitialisePlayerStati(void) { |
| 215 | int i; |
193 | int i; |
| Line 398... | Line 376... | ||
| 398 | } |
376 | } |
| 399 | 377 | ||
| 400 | // IDA: void __usercall NetDisposePlayer(tNet_game_player_info *pPlayer@<EAX>) |
378 | // IDA: void __usercall NetDisposePlayer(tNet_game_player_info *pPlayer@<EAX>) |
| 401 | void NetDisposePlayer(tNet_game_player_info* pPlayer) { |
379 | void NetDisposePlayer(tNet_game_player_info* pPlayer) { |
| 402 | LOG_TRACE("(%p)", pPlayer); |
380 | LOG_TRACE("(%p)", pPlayer); |
| 403 | - | ||
| 404 |
|
381 | NOT_IMPLEMENTED(); |
| 405 | } |
382 | } |
| 406 | 383 | ||
| 407 | // IDA: void __usercall FillInThisPlayer(tNet_game_details *pGame@<EAX>, tNet_game_player_info *pPlayer@<EDX>, int pCar_index@<EBX>, int pHost@<ECX>) |
384 | // IDA: void __usercall FillInThisPlayer(tNet_game_details *pGame@<EAX>, tNet_game_player_info *pPlayer@<EDX>, int pCar_index@<EBX>, int pHost@<ECX>) |
| 408 | void FillInThisPlayer(tNet_game_details* pGame, tNet_game_player_info* pPlayer, int pCar_index, int pHost) { |
385 | void FillInThisPlayer(tNet_game_details* pGame, tNet_game_player_info* pPlayer, int pCar_index, int pHost) { |
| 409 | LOG_TRACE("(%p, %p, %d, %d)", pGame, pPlayer, pCar_index, pHost); |
386 | LOG_TRACE("(%p, %p, %d, %d)", pGame, pPlayer, pCar_index, pHost); |
| Line 481... | Line 458... | ||
| 481 | } |
458 | } |
| 482 | 459 | ||
| 483 | // IDA: void __usercall PlayerHasLeft(int pIndex@<EAX>) |
460 | // IDA: void __usercall PlayerHasLeft(int pIndex@<EAX>) |
| 484 | void PlayerHasLeft(int pIndex) { |
461 | void PlayerHasLeft(int pIndex) { |
| 485 | LOG_TRACE("(%d)", pIndex); |
462 | LOG_TRACE("(%d)", pIndex); |
| 486 | - | ||
| 487 | if (gCurrent_net_game->options.random_car_choice && (gCurrent_net_game->options.car_choice == eNet_car_all || gCurrent_net_game->options.car_choice == eNet_car_both)) { |
- | |
| 488 | if (gNet_players[pIndex].car_index >= 0) { |
- | |
| 489 | gCar_details[gNet_players[pIndex].car_index].ownership = eCar_owner_none; |
- | |
| 490 | } |
- | |
| 491 | if (gNet_players[pIndex].next_car_index >= 0) { |
- | |
| 492 | gCar_details[gNet_players[pIndex].next_car_index].ownership = eCar_owner_none; |
- | |
| 493 |
|
463 | NOT_IMPLEMENTED(); |
| 494 | } |
- | |
| 495 | } |
464 | } |
| 496 | 465 | ||
| 497 | // IDA: void __usercall NetPlayersChanged(int pNew_count@<EAX>, tNet_game_player_info *pNew_players@<EDX>) |
466 | // IDA: void __usercall NetPlayersChanged(int pNew_count@<EAX>, tNet_game_player_info *pNew_players@<EDX>) |
| 498 | void NetPlayersChanged(int pNew_count, tNet_game_player_info* pNew_players) { |
467 | void NetPlayersChanged(int pNew_count, tNet_game_player_info* pNew_players) { |
| 499 | int i; |
468 | int i; |
| Line 504... | Line 473... | ||
| 504 | int player_still_there; |
473 | int player_still_there; |
| 505 | tPlayer_ID old_fox_it; |
474 | tPlayer_ID old_fox_it; |
| 506 | LOG_TRACE("(%d, %p)", pNew_count, pNew_players); |
475 | LOG_TRACE("(%d, %p)", pNew_count, pNew_players); |
| 507 | 476 | ||
| 508 | if (gCurrent_net_game->type == eNet_game_type_tag || gCurrent_net_game->type == eNet_game_type_foxy) { |
477 | if (gCurrent_net_game->type == eNet_game_type_tag || gCurrent_net_game->type == eNet_game_type_foxy) { |
| 509 | #ifdef DETHRACE_FIX_BUGS |
- | |
| 510 | old_fox_it = -1; |
- | |
| 511 | if (gIt_or_fox >= 0) { |
- | |
| 512 | #endif |
- | |
| 513 |
|
478 | old_fox_it = gNet_players[gIt_or_fox].ID; |
| 514 | #ifdef DETHRACE_FIX_BUGS |
- | |
| 515 | } |
- | |
| 516 | #endif |
- | |
| 517 | } |
479 | } |
| 518 | for (i = 0; i < pNew_count; i++) { |
480 | for (i = 0; i < pNew_count; i++) { |
| 519 | new_player = 1; |
481 | new_player = 1; |
| 520 | for (j = 0; j < gNumber_of_net_players; j++) { |
482 | for (j = 0; j < gNumber_of_net_players; j++) { |
| 521 | if (pNew_players[i].ID == gNet_players[j].ID) { |
483 | if (pNew_players[i].ID == gNet_players[j].ID) { |
| Line 648... | Line 610... | ||
| 648 | } |
610 | } |
| 649 | 611 | ||
| 650 | // IDA: int __usercall NetInitClient@<EAX>(tNet_game_details *pDetails@<EAX>) |
612 | // IDA: int __usercall NetInitClient@<EAX>(tNet_game_details *pDetails@<EAX>) |
| 651 | int NetInitClient(tNet_game_details* pDetails) { |
613 | int NetInitClient(tNet_game_details* pDetails) { |
| 652 | LOG_TRACE("(%p)", pDetails); |
614 | LOG_TRACE("(%p)", pDetails); |
| 653 | - | ||
| 654 |
|
615 | NOT_IMPLEMENTED(); |
| 655 | } |
616 | } |
| 656 | 617 | ||
| 657 | // IDA: int __usercall NetJoinGameLowLevel@<EAX>(tNet_game_details *pDetails@<EAX>, char *pPlayer_name@<EDX>) |
618 | // IDA: int __usercall NetJoinGameLowLevel@<EAX>(tNet_game_details *pDetails@<EAX>, char *pPlayer_name@<EDX>) |
| 658 | int NetJoinGameLowLevel(tNet_game_details* pDetails, char* pPlayer_name) { |
619 | int NetJoinGameLowLevel(tNet_game_details* pDetails, char* pPlayer_name) { |
| 659 | LOG_TRACE("(%p, \"%s\")", pDetails, pPlayer_name); |
620 | LOG_TRACE("(%p, \"%s\")", pDetails, pPlayer_name); |
| 660 | 621 | ||
| 661 | return PDNetJoinGame(pDetails, pPlayer_name); |
622 | return PDNetJoinGame(pDetails, pPlayer_name); |
| 662 | } |
623 | } |
| 663 | - | ||
| 664 | DR_STATIC_ASSERT(offsetof(tNet_message_join, player_info) == 4); |
- | |
| 665 | DR_STATIC_ASSERT(offsetof(tNet_game_player_info, this_players_time_stamp) == 0x10); |
- | |
| 666 | DR_STATIC_ASSERT(offsetof(tNet_game_player_info, wasted) == 0x68); |
- | |
| 667 | DR_STATIC_ASSERT(offsetof(tNet_game_player_info, initial_position) == 0x8c); |
- | |
| 668 | DR_STATIC_ASSERT(offsetof(tNet_game_player_info, car) == 0xbc); |
- | |
| 669 | 624 | ||
| 670 | // IDA: int __usercall NetJoinGame@<EAX>(tNet_game_details *pDetails@<EAX>, char *pPlayer_name@<EDX>, int pCar_index@<EBX>) |
625 | // IDA: int __usercall NetJoinGame@<EAX>(tNet_game_details *pDetails@<EAX>, char *pPlayer_name@<EDX>, int pCar_index@<EBX>) |
| 671 | int NetJoinGame(tNet_game_details* pDetails, char* pPlayer_name, int pCar_index) { |
626 | int NetJoinGame(tNet_game_details* pDetails, char* pPlayer_name, int pCar_index) { |
| 672 | int result; |
627 | int result; |
| 673 | tNet_message* the_message; |
628 | tNet_message* the_message; |
| Line 759... | Line 714... | ||
| 759 | return PDNetSendMessageToAddress(pDetails, pMessage, pAddress); |
714 | return PDNetSendMessageToAddress(pDetails, pMessage, pAddress); |
| 760 | } |
715 | } |
| 761 | 716 | ||
| 762 | // IDA: int __usercall NetSendMessageToPlayer@<EAX>(tNet_game_details *pDetails@<EAX>, tNet_message *pMessage@<EDX>, tPlayer_ID pPlayer@<EBX>) |
717 | // IDA: int __usercall NetSendMessageToPlayer@<EAX>(tNet_game_details *pDetails@<EAX>, tNet_message *pMessage@<EDX>, tPlayer_ID pPlayer@<EBX>) |
| 763 | int NetSendMessageToPlayer(tNet_game_details* pDetails, tNet_message* pMessage, tPlayer_ID pPlayer) { |
718 | int NetSendMessageToPlayer(tNet_game_details* pDetails, tNet_message* pMessage, tPlayer_ID pPlayer) { |
| 764 |
|
719 | //int i; // Pierre-Marie Baty -- unused variable |
| 765 | LOG_TRACE("(%p, %p, %d)", pDetails, pMessage, pPlayer); |
720 | LOG_TRACE("(%p, %p, %d)", pDetails, pMessage, pPlayer); |
| 766 | - | ||
| 767 | if (gNet_mode == eNet_mode_none) { |
- | |
| 768 |
|
721 | NOT_IMPLEMENTED(); |
| 769 | } |
- | |
| 770 | pMessage->sender = gLocal_net_ID; |
- | |
| 771 | pMessage->senders_time_stamp = PDGetTotalTime(); |
- | |
| 772 | for (i = 0; i < gNumber_of_net_players; i++) { |
- | |
| 773 | if (gNet_players[i].ID == pPlayer) { |
- | |
| 774 | GetCheckSum(pMessage); |
- | |
| 775 | return PDNetSendMessageToAddress(pDetails, pMessage, &gNet_players[i]); |
- | |
| 776 | } |
- | |
| 777 | } |
- | |
| 778 | return -3; |
- | |
| 779 | } |
722 | } |
| 780 | 723 | ||
| 781 | // IDA: int __usercall NetSendMessageToHost@<EAX>(tNet_game_details *pDetails@<EAX>, tNet_message *pMessage@<EDX>) |
724 | // IDA: int __usercall NetSendMessageToHost@<EAX>(tNet_game_details *pDetails@<EAX>, tNet_message *pMessage@<EDX>) |
| 782 | int NetSendMessageToHost(tNet_game_details* pDetails, tNet_message* pMessage) { |
725 | int NetSendMessageToHost(tNet_game_details* pDetails, tNet_message* pMessage) { |
| 783 | LOG_TRACE("(%p, %p)", pDetails, pMessage); |
726 | LOG_TRACE("(%p, %p)", pDetails, pMessage); |
| 784 | - | ||
| 785 | if (gNet_mode == eNet_mode_none) { |
- | |
| 786 | return -3; |
- | |
| 787 | } |
- | |
| 788 | pMessage->sender = gLocal_net_ID; |
- | |
| 789 | pMessage->senders_time_stamp = PDGetTotalTime(); |
- | |
| 790 |
|
727 | NOT_IMPLEMENTED(); |
| 791 | return PDNetSendMessageToAddress(pDetails, pMessage, &pDetails->pd_net_info); |
- | |
| 792 | } |
728 | } |
| 793 | 729 | ||
| 794 | // IDA: int __usercall NetReplyToMessage@<EAX>(tNet_game_details *pDetails@<EAX>, tNet_message *pIncoming_message@<EDX>, tNet_message *pReply_message@<EBX>) |
730 | // IDA: int __usercall NetReplyToMessage@<EAX>(tNet_game_details *pDetails@<EAX>, tNet_message *pIncoming_message@<EDX>, tNet_message *pReply_message@<EBX>) |
| 795 | int NetReplyToMessage(tNet_game_details* pDetails, tNet_message* pIncoming_message, tNet_message* pReply_message) { |
731 | int NetReplyToMessage(tNet_game_details* pDetails, tNet_message* pIncoming_message, tNet_message* pReply_message) { |
| 796 | LOG_TRACE("(%p, %p, %p)", pDetails, pIncoming_message, pReply_message); |
732 | LOG_TRACE("(%p, %p, %p)", pDetails, pIncoming_message, pReply_message); |
| 797 | - | ||
| 798 |
|
733 | NOT_IMPLEMENTED(); |
| 799 | } |
734 | } |
| 800 | 735 | ||
| 801 | // IDA: int __usercall NetSendMessageToAllPlayers@<EAX>(tNet_game_details *pDetails@<EAX>, tNet_message *pMessage@<EDX>) |
736 | // IDA: int __usercall NetSendMessageToAllPlayers@<EAX>(tNet_game_details *pDetails@<EAX>, tNet_message *pMessage@<EDX>) |
| 802 | int NetSendMessageToAllPlayers(tNet_game_details* pDetails, tNet_message* pMessage) { |
737 | int NetSendMessageToAllPlayers(tNet_game_details* pDetails, tNet_message* pMessage) { |
| 803 | LOG_TRACE("(%p, %p)", pDetails, pMessage); |
738 | LOG_TRACE("(%p, %p)", pDetails, pMessage); |
| Line 906... | Line 841... | ||
| 906 | 841 | ||
| 907 | // IDA: tS32 __usercall NetCalcSizeDecider@<EAX>(tNet_contents *pContents@<EAX>) |
842 | // IDA: tS32 __usercall NetCalcSizeDecider@<EAX>(tNet_contents *pContents@<EAX>) |
| 908 | tS32 NetCalcSizeDecider(tNet_contents* pContents) { |
843 | tS32 NetCalcSizeDecider(tNet_contents* pContents) { |
| 909 | //tS32 the_decider; // Pierre-Marie Baty -- unused variable |
844 | //tS32 the_decider; // Pierre-Marie Baty -- unused variable |
| 910 | LOG_TRACE("(%p)", pContents); |
845 | LOG_TRACE("(%p)", pContents); |
| 911 | - | ||
| 912 |
|
846 | NOT_IMPLEMENTED(); |
| 913 | } |
847 | } |
| 914 | 848 | ||
| 915 | // IDA: tNet_message* __usercall NetBuildMessage@<EAX>(tNet_message_type pType@<EAX>, tS32 pSize_decider@<EDX>) |
849 | // IDA: tNet_message* __usercall NetBuildMessage@<EAX>(tNet_message_type pType@<EAX>, tS32 pSize_decider@<EDX>) |
| 916 | tNet_message* NetBuildMessage(tNet_message_type pType, tS32 pSize_decider) { |
850 | tNet_message* NetBuildMessage(tNet_message_type pType, tS32 pSize_decider) { |
| 917 | tNet_message* the_message; |
851 | tNet_message* the_message; |
| Line 928... | Line 862... | ||
| 928 | return the_message; |
862 | return the_message; |
| 929 | } |
863 | } |
| 930 | 864 | ||
| 931 | // IDA: tNet_contents* __usercall NetGetToHostContents@<EAX>(tNet_message_type pType@<EAX>, tS32 pSize_decider@<EDX>) |
865 | // IDA: tNet_contents* __usercall NetGetToHostContents@<EAX>(tNet_message_type pType@<EAX>, tS32 pSize_decider@<EDX>) |
| 932 | tNet_contents* NetGetToHostContents(tNet_message_type pType, tS32 pSize_decider) { |
866 | tNet_contents* NetGetToHostContents(tNet_message_type pType, tS32 pSize_decider) { |
| 933 | tU32 the_size |
867 | //tU32 the_size; // Pierre-Marie Baty -- unused variable |
| 934 | tNet_contents |
868 | //tNet_contents* contents; // Pierre-Marie Baty -- unused variable |
| 935 | LOG_TRACE("(%d, %d)", pType, pSize_decider); |
869 | LOG_TRACE("(%d, %d)", pType, pSize_decider); |
| 936 | - | ||
| 937 | the_size = NetGetContentsSize(pType, pSize_decider); |
- | |
| 938 | if (gTo_host_stack && the_size + gTo_host_stack->overall_size > MAX_MESAGE_STACK_SIZE) { |
- | |
| 939 | NetSendMessageToHost(gCurrent_net_game, gTo_host_stack); |
- | |
| 940 | gTo_host_stack = 0; |
- | |
| 941 | } |
- | |
| 942 | if (!gTo_host_stack) { |
- | |
| 943 | gTo_host_stack = NetAllocateMessage(MAX_MESAGE_STACK_SIZE); |
- | |
| 944 | gTo_host_stack->overall_size = offsetof(tNet_message, contents); |
- | |
| 945 | gTo_host_stack->num_contents = 0; |
- | |
| 946 | } |
- | |
| 947 | contents = (tNet_contents*)((char*)gTo_host_stack + gTo_host_stack->overall_size); |
- | |
| 948 | gTo_host_stack->overall_size += the_size; |
- | |
| 949 | contents->header.type = pType; |
- | |
| 950 | contents->header.contents_size = the_size; |
- | |
| 951 | gTo_host_stack->num_contents++; |
- | |
| 952 |
|
870 | NOT_IMPLEMENTED(); |
| 953 | } |
871 | } |
| 954 | 872 | ||
| 955 | // IDA: tNet_contents* __usercall NetGetBroadcastContents@<EAX>(tNet_message_type pType@<EAX>, tS32 pSize_decider@<EDX>) |
873 | // IDA: tNet_contents* __usercall NetGetBroadcastContents@<EAX>(tNet_message_type pType@<EAX>, tS32 pSize_decider@<EDX>) |
| 956 | tNet_contents* NetGetBroadcastContents(tNet_message_type pType, tS32 pSize_decider) { |
874 | tNet_contents* NetGetBroadcastContents(tNet_message_type pType, tS32 pSize_decider) { |
| 957 | tU32 the_size; |
875 | tU32 the_size; |
| Line 1049... | Line 967... | ||
| 1049 | } |
967 | } |
| 1050 | *(void**)last_message = pointer; |
968 | *(void**)last_message = pointer; |
| 1051 | } else { |
969 | } else { |
| 1052 | gMessage_to_free = pointer; |
970 | gMessage_to_free = pointer; |
| 1053 | } |
971 | } |
| 1054 | pointer = ( |
972 | pointer = ((void**)pointer)[1]; |
| 1055 | } |
973 | } |
| 1056 | } |
974 | } |
| 1057 | if (pointer == NULL) { |
975 | if (pointer == NULL) { |
| 1058 | LOG_PANIC("null pointer!"); |
976 | LOG_PANIC("null pointer!"); |
| 1059 | message = NULL; |
977 | message = NULL; |
| Line 1155... | Line 1073... | ||
| 1155 | tNet_message* message; |
1073 | tNet_message* message; |
| 1156 | tNet_game_player_info* new_players; |
1074 | tNet_game_player_info* new_players; |
| 1157 | LOG_TRACE("(%p, %p)", pContents, pSender_address); |
1075 | LOG_TRACE("(%p, %p)", pContents, pSender_address); |
| 1158 | 1076 | ||
| 1159 | new_player_count = gNumber_of_net_players; |
1077 | new_player_count = gNumber_of_net_players; |
| 1160 | new_players = BrMemAllocate |
1078 | new_players = BrMemAllocate(new_player_count + 1 * sizeof(tNet_game_player_info), kMem_player_list_join); |
| 1161 | memcpy(new_players, gNet_players, gNumber_of_net_players * sizeof(tNet_game_player_info)); |
1079 | memcpy(new_players, gNet_players, gNumber_of_net_players * sizeof(tNet_game_player_info)); |
| 1162 | 1080 | ||
| 1163 | if ((!gCurrent_net_game->options.open_game && gProgram_state.racing) || gCurrent_net_game->num_players > 5 || gDont_allow_joiners) { |
1081 | if ((!gCurrent_net_game->options.open_game && gProgram_state.racing) || gCurrent_net_game->num_players > 5 || gDont_allow_joiners) { |
| 1164 | message = NetBuildMessage(NETMSGID_NEWPLAYERLIST, 0); |
1082 | message = NetBuildMessage(NETMSGID_NEWPLAYERLIST, 0); |
| 1165 | // Send player count = 0 when race has already begun or is full |
1083 | // Send player count = 0 when race has already begun or is full |
| Line 1203... | Line 1121... | ||
| 1203 | } |
1121 | } |
| 1204 | } |
1122 | } |
| 1205 | 1123 | ||
| 1206 | // IDA: void __usercall KickPlayerOut(tPlayer_ID pID@<EAX>) |
1124 | // IDA: void __usercall KickPlayerOut(tPlayer_ID pID@<EAX>) |
| 1207 | void KickPlayerOut(tPlayer_ID pID) { |
1125 | void KickPlayerOut(tPlayer_ID pID) { |
| 1208 |
|
1126 | //int i; // Pierre-Marie Baty -- unused variable |
| 1209 |
|
1127 | //int j; // Pierre-Marie Baty -- unused variable |
| 1210 |
|
1128 | //int new_player_count; // Pierre-Marie Baty -- unused variable |
| 1211 | tNet_game_player_info |
1129 | //tNet_game_player_info* new_players; // Pierre-Marie Baty -- unused variable |
| 1212 | LOG_TRACE("(%d)", pID); |
1130 | LOG_TRACE("(%d)", pID); |
| 1213 | - | ||
| 1214 | new_player_count = gNumber_of_net_players; |
- | |
| 1215 | new_players = (tNet_game_player_info*)BrMemAllocate(sizeof(tNet_game_player_info) * gNumber_of_net_players, kMem_player_list_leave); |
- | |
| 1216 | memcpy(new_players, gNet_players, sizeof(tNet_game_player_info) * new_player_count); |
- | |
| 1217 | for (i = 0; i < new_player_count; i++) { |
- | |
| 1218 | if (new_players[i].ID == pID) { |
- | |
| 1219 | if (new_players[i].car_index >= 0) { |
- | |
| 1220 | gCar_details[new_players[i].car_index].ownership = eCar_owner_none; |
- | |
| 1221 | } |
- | |
| 1222 | if (new_players[i].next_car_index >= 0 && gCurrent_net_game->options.random_car_choice && (gCurrent_net_game->options.car_choice == eNet_car_all || gCurrent_net_game->options.car_choice == eNet_car_both)) { |
- | |
| 1223 | gCar_details[new_players[i].next_car_index].ownership = eCar_owner_none; |
- | |
| 1224 | } |
- | |
| 1225 | #ifdef DETHRACE_FIX_BUGS |
- | |
| 1226 | for (j = i; j < new_player_count - 1; j++) { |
- | |
| 1227 | #else |
- | |
| 1228 | for (j = i; j < new_player_count; j++) { |
- | |
| 1229 | #endif |
- | |
| 1230 | memcpy(&new_players[j], &new_players[j + 1], sizeof(tNet_game_player_info)); |
- | |
| 1231 | } |
- | |
| 1232 | new_player_count--; |
- | |
| 1233 | break; |
- | |
| 1234 | } |
- | |
| 1235 | } |
- | |
| 1236 | NetPlayersChanged(new_player_count, new_players); |
- | |
| 1237 | BrMemFree(new_players); |
- | |
| 1238 |
|
1131 | NOT_IMPLEMENTED(); |
| 1239 | } |
1132 | } |
| 1240 | 1133 | ||
| 1241 | // IDA: void __usercall ReceivedLeave(tNet_contents *pContents@<EAX>, tNet_message *pMessage@<EDX>) |
1134 | // IDA: void __usercall ReceivedLeave(tNet_contents *pContents@<EAX>, tNet_message *pMessage@<EDX>) |
| 1242 | void ReceivedLeave(tNet_contents* pContents, tNet_message* pMessage) { |
1135 | void ReceivedLeave(tNet_contents* pContents, tNet_message* pMessage) { |
| 1243 | LOG_TRACE("(%p, %p)", pContents, pMessage); |
1136 | LOG_TRACE("(%p, %p)", pContents, pMessage); |
| 1244 | - | ||
| 1245 |
|
1137 | NOT_IMPLEMENTED(); |
| 1246 | } |
1138 | } |
| 1247 | 1139 | ||
| 1248 | // IDA: void __usercall NetFullScreenMessage(int pStr_index@<EAX>, int pLeave_it_up_there@<EDX>) |
1140 | // IDA: void __usercall NetFullScreenMessage(int pStr_index@<EAX>, int pLeave_it_up_there@<EDX>) |
| 1249 | void NetFullScreenMessage(int pStr_index, int pLeave_it_up_there) { |
1141 | void NetFullScreenMessage(int pStr_index, int pLeave_it_up_there) { |
| 1250 | tU32 start_time; |
1142 | tU32 start_time; |
| Line 1319... | Line 1211... | ||
| 1319 | 1211 | ||
| 1320 | // IDA: void __usercall ReceivedHosticide(tNet_contents *pContents@<EAX>) |
1212 | // IDA: void __usercall ReceivedHosticide(tNet_contents *pContents@<EAX>) |
| 1321 | void ReceivedHosticide(tNet_contents* pContents) { |
1213 | void ReceivedHosticide(tNet_contents* pContents) { |
| 1322 | LOG_TRACE("(%p)", pContents); |
1214 | LOG_TRACE("(%p)", pContents); |
| 1323 | 1215 | ||
| 1324 | HostHasBittenTheDust( |
1216 | HostHasBittenTheDust(73); |
| 1325 | } |
1217 | } |
| 1326 | 1218 | ||
| 1327 | // IDA: void __cdecl ConfirmReceipt() |
1219 | // IDA: void __cdecl ConfirmReceipt() |
| 1328 | void ConfirmReceipt(void) { |
1220 | void ConfirmReceipt(void) { |
| 1329 | //tNet_message* the_message; // Pierre-Marie Baty -- unused variable |
1221 | //tNet_message* the_message; // Pierre-Marie Baty -- unused variable |
| Line 1419... | Line 1311... | ||
| 1419 | } |
1311 | } |
| 1420 | } |
1312 | } |
| 1421 | 1313 | ||
| 1422 | // IDA: void __usercall ReceivedStartRace(tNet_contents *pContents@<EAX>) |
1314 | // IDA: void __usercall ReceivedStartRace(tNet_contents *pContents@<EAX>) |
| 1423 | void ReceivedStartRace(tNet_contents* pContents) { |
1315 | void ReceivedStartRace(tNet_contents* pContents) { |
| 1424 |
|
1316 | //int i; // Pierre-Marie Baty -- unused variable |
| 1425 |
|
1317 | //int index; // Pierre-Marie Baty -- unused variable |
| 1426 | LOG_TRACE("(%p)", pContents); |
1318 | LOG_TRACE("(%p)", pContents); |
| 1427 | - | ||
| 1428 | if (pContents->data.player_list.number_of_players == -1) { |
- | |
| 1429 | if (gProgram_state.racing) { |
- | |
| 1430 | index = pContents->data.start_race.car_list[0].index; |
- | |
| 1431 | BrMatrix34Copy(&gNet_players[index].car->car_master_actor->t.t.mat, &pContents->data.start_race.car_list[0].mat); |
- | |
| 1432 | ReinitialiseCar(gNet_players[index].car); |
- | |
| 1433 | if (gThis_net_player_index == index) { |
- | |
| 1434 | if (!gInterface_within_race_mode) { |
- | |
| 1435 | FadePaletteDown(); |
- | |
| 1436 |
|
1319 | NOT_IMPLEMENTED(); |
| 1437 | CancelPendingCunningStunt(); |
- | |
| 1438 | gProgram_state.credits_earned = gInitial_net_credits[gCurrent_net_game->options.starting_money_index]; |
- | |
| 1439 | gProgram_state.credits_lost = 0; |
- | |
| 1440 | InitialiseExternalCamera(); |
- | |
| 1441 | } |
- | |
| 1442 | gNet_players[index].last_waste_message = 0; |
- | |
| 1443 | gNet_players[index].wasteage_attributed = 0; |
- | |
| 1444 | } |
- | |
| 1445 | } else if (gSynch_race_start) { |
- | |
| 1446 | for (i = 0; i < pContents->data.start_race.car_count; i++) { |
- | |
| 1447 | gNet_players[pContents->data.start_race.car_list[i].index].next_car_index = pContents->data.start_race.car_list[i].next_car_index; |
- | |
| 1448 | } |
- | |
| 1449 | } else { |
- | |
| 1450 | for (i = 0; i < pContents->data.player_list.number_of_players; i++) { |
- | |
| 1451 | gCurrent_race.number_of_racers = i + 1; |
- | |
| 1452 | gCurrent_race.opponent_list[i].index = -1; |
- | |
| 1453 | gCurrent_race.opponent_list[i].ranking = -1; |
- | |
| 1454 | gCurrent_race.opponent_list[i].car_spec = gNet_players[pContents->data.start_race.car_list[i].index].car; |
- | |
| 1455 | gCurrent_race.opponent_list[i].net_player_index = pContents->data.start_race.car_list[i].index; |
- | |
| 1456 | gNet_players[gCurrent_race.opponent_list[i].net_player_index].last_waste_message = 0; |
- | |
| 1457 | gNet_players[gCurrent_race.opponent_list[i].net_player_index].wasteage_attributed = 0; |
- | |
| 1458 | if (!gProgram_state.racing || gCurrent_race.opponent_list[i].car_spec->driver != eDriver_local_human) { |
- | |
| 1459 | BrMatrix34Copy(&gCurrent_race.opponent_list[i].car_spec->car_master_actor->t.t.mat, &pContents->data.start_race.car_list[i].mat); |
- | |
| 1460 | InitialiseCar(gCurrent_race.opponent_list[i].car_spec); |
- | |
| 1461 | } |
- | |
| 1462 | gNet_players[pContents->data.start_race.car_list[i].index].next_car_index = pContents->data.start_race.car_list[i].next_car_index; |
- | |
| 1463 | } |
- | |
| 1464 | gPending_race = pContents->data.player_list.batch_number; |
- | |
| 1465 | gCurrent_race.number_of_racers = pContents->data.player_list.number_of_players; |
- | |
| 1466 | gSynch_race_start = 1; |
- | |
| 1467 | if (!pContents->data.player_list.this_index || gProgram_state.racing) { |
- | |
| 1468 | gWait_for_it = 0; |
- | |
| 1469 | } |
- | |
| 1470 | } |
- | |
| 1471 | } |
1320 | } |
| 1472 | 1321 | ||
| 1473 | // IDA: void __usercall ReceivedGuaranteeReply(tNet_contents *pContents@<EAX>) |
1322 | // IDA: void __usercall ReceivedGuaranteeReply(tNet_contents *pContents@<EAX>) |
| 1474 | void ReceivedGuaranteeReply(tNet_contents* pContents) { |
1323 | void ReceivedGuaranteeReply(tNet_contents* pContents) { |
| 1475 | int i; |
1324 | int i; |
| Line 1512... | Line 1361... | ||
| 1512 | //tNet_message* message; // Pierre-Marie Baty -- unused variable |
1361 | //tNet_message* message; // Pierre-Marie Baty -- unused variable |
| 1513 | LOG_TRACE("(%p)", pContents); |
1362 | LOG_TRACE("(%p)", pContents); |
| 1514 | 1363 | ||
| 1515 | if (pContents->data.heres_where_we_at.race_index != gProgram_state.current_race_index) { |
1364 | if (pContents->data.heres_where_we_at.race_index != gProgram_state.current_race_index) { |
| 1516 | NetLeaveGame(gCurrent_net_game); |
1365 | NetLeaveGame(gCurrent_net_game); |
| 1517 | NetFullScreenMessage( |
1366 | NetFullScreenMessage(128, 0); |
| 1518 | gProgram_state.prog_status = eProg_idling; |
1367 | gProgram_state.prog_status = eProg_idling; |
| 1519 | } |
1368 | } |
| 1520 | if (pContents->data.heres_where_we_at.race_has_started) { |
1369 | if (pContents->data.heres_where_we_at.race_has_started) { |
| 1521 | if (gCurrent_net_game->options.open_game) { |
1370 | if (gCurrent_net_game->options.open_game) { |
| 1522 | gPending_race = pContents->data.heres_where_we_at.pending_race; |
1371 | gPending_race = pContents->data.heres_where_we_at.pending_race; |
| 1523 | } else { |
1372 | } else { |
| 1524 | NetFullScreenMessage( |
1373 | NetFullScreenMessage(89, 0); |
| 1525 | gProgram_state.prog_status = eProg_idling; |
1374 | gProgram_state.prog_status = eProg_idling; |
| 1526 | } |
1375 | } |
| 1527 | } |
1376 | } |
| 1528 | } |
1377 | } |
| 1529 | 1378 | ||
| Line 1553... | Line 1402... | ||
| 1553 | } |
1402 | } |
| 1554 | 1403 | ||
| 1555 | // IDA: void __usercall ReceivedTimeSync(tNet_contents *pContents@<EAX>, tNet_message *pMessage@<EDX>, tU32 pReceive_time@<EBX>) |
1404 | // IDA: void __usercall ReceivedTimeSync(tNet_contents *pContents@<EAX>, tNet_message *pMessage@<EDX>, tU32 pReceive_time@<EBX>) |
| 1556 | void ReceivedTimeSync(tNet_contents* pContents, tNet_message* pMessage, tU32 pReceive_time) { |
1405 | void ReceivedTimeSync(tNet_contents* pContents, tNet_message* pMessage, tU32 pReceive_time) { |
| 1557 | LOG_TRACE("(%p, %p, %d)", pContents, pMessage, pReceive_time); |
1406 | LOG_TRACE("(%p, %p, %d)", pContents, pMessage, pReceive_time); |
| 1558 | - | ||
| 1559 | if (pMessage->senders_time_stamp - pContents->data.time_sync.race_start_time > pReceive_time + 10) { |
- | |
| 1560 | gRace_start -= pMessage->senders_time_stamp - pContents->data.time_sync.race_start_time - pReceive_time; |
- | |
| 1561 | |
1407 | NOT_IMPLEMENTED(); |
| 1562 | } |
1408 | } |
| 1563 | 1409 | ||
| 1564 | // IDA: void __usercall ReceivedConfirm(tNet_contents *pContents@<EAX>) |
1410 | // IDA: void __usercall ReceivedConfirm(tNet_contents *pContents@<EAX>) |
| 1565 | void ReceivedConfirm(tNet_contents* pContents) { |
1411 | void ReceivedConfirm(tNet_contents* pContents) { |
| 1566 |
|
1412 | //int i; // Pierre-Marie Baty -- unused variable |
| 1567 | LOG_TRACE("(%p)", pContents); |
1413 | LOG_TRACE("(%p)", pContents); |
| 1568 | - | ||
| 1569 | for (i = 0; i < gNumber_of_net_players; i++) { |
- | |
| 1570 | if (gNet_players[i].ID == pContents->data.confirm.player) { |
- | |
| 1571 | gNet_players[i].awaiting_confirmation = 0; |
- | |
| 1572 |
|
1414 | NOT_IMPLEMENTED(); |
| 1573 | } |
- | |
| 1574 | } |
- | |
| 1575 | } |
1415 | } |
| 1576 | 1416 | ||
| 1577 | // IDA: void __usercall ReceivedDisableCar(tNet_contents *pContents@<EAX>) |
1417 | // IDA: void __usercall ReceivedDisableCar(tNet_contents *pContents@<EAX>) |
| 1578 | void ReceivedDisableCar(tNet_contents* pContents) { |
1418 | void ReceivedDisableCar(tNet_contents* pContents) { |
| 1579 | LOG_TRACE("(%p)", pContents); |
1419 | LOG_TRACE("(%p)", pContents); |
| 1580 | - | ||
| - | 1420 | NOT_IMPLEMENTED(); |
|
| 1581 | } |
1421 | } |
| 1582 | 1422 | ||
| 1583 | // IDA: void __usercall ReceivedEnableCar(tNet_contents *pContents@<EAX>) |
1423 | // IDA: void __usercall ReceivedEnableCar(tNet_contents *pContents@<EAX>) |
| 1584 | void ReceivedEnableCar(tNet_contents* pContents) { |
1424 | void ReceivedEnableCar(tNet_contents* pContents) { |
| 1585 | LOG_TRACE("(%p)", pContents); |
1425 | LOG_TRACE("(%p)", pContents); |
| 1586 | - | ||
| - | 1426 | NOT_IMPLEMENTED(); |
|
| 1587 | } |
1427 | } |
| 1588 | 1428 | ||
| 1589 | // IDA: void __usercall ReceivedScores(tNet_contents *pContents@<EAX>) |
1429 | // IDA: void __usercall ReceivedScores(tNet_contents *pContents@<EAX>) |
| 1590 | void ReceivedScores(tNet_contents* pContents) { |
1430 | void ReceivedScores(tNet_contents* pContents) { |
| 1591 |
|
1431 | //int i; // Pierre-Marie Baty -- unused variable |
| 1592 | LOG_TRACE("(%p)", pContents); |
1432 | LOG_TRACE("(%p)", pContents); |
| 1593 | - | ||
| 1594 | UseGeneralScore(pContents->data.scores.general_score); |
- | |
| 1595 |
|
1433 | NOT_IMPLEMENTED(); |
| 1596 | gNet_players[i].score = pContents->data.scores.scores[i]; |
- | |
| 1597 | } |
- | |
| 1598 | } |
1434 | } |
| 1599 | 1435 | ||
| 1600 | // IDA: void __usercall ReceivedWasted(tNet_contents *pContents@<EAX>) |
1436 | // IDA: void __usercall ReceivedWasted(tNet_contents *pContents@<EAX>) |
| 1601 | void ReceivedWasted(tNet_contents* pContents) { |
1437 | void ReceivedWasted(tNet_contents* pContents) { |
| 1602 | tNet_game_player_info |
1438 | //tNet_game_player_info* victim; // Pierre-Marie Baty -- unused variable |
| 1603 | tNet_game_player_info |
1439 | //tNet_game_player_info* culprit; // Pierre-Marie Baty -- unused variable |
| 1604 |
|
1440 | //char s[256]; // Pierre-Marie Baty -- unused variable |
| 1605 | tCar_spec |
1441 | //tCar_spec* car; // Pierre-Marie Baty -- unused variable |
| 1606 |
|
1442 | //static tS32 last_got_wasted_time; // Pierre-Marie Baty -- unused variable |
| 1607 |
|
1443 | //static tS32 last_wasted_em_time; // Pierre-Marie Baty -- unused variable |
| 1608 |
|
1444 | //static tS32 last_wasty_message_time; // Pierre-Marie Baty -- unused variable |
| 1609 |
|
1445 | //static tNet_game_player_info* last_culprit; // Pierre-Marie Baty -- unused variable |
| 1610 |
|
1446 | //static tNet_game_player_info* last_victim; // Pierre-Marie Baty -- unused variable |
| 1611 | LOG_TRACE("(%p)", pContents); |
1447 | LOG_TRACE("(%p)", pContents); |
| 1612 | - | ||
| 1613 | victim = NetPlayerFromID(pContents->data.wasted.victim); |
- | |
| 1614 | if (victim == NULL) { |
- | |
| 1615 | return; |
- | |
| 1616 | } |
- | |
| 1617 | victim->car->knackered = 1; |
- | |
| 1618 | if (pContents->data.wasted.victim == gLocal_net_ID) { |
- | |
| 1619 | if (gCurrent_net_game->type == eNet_game_type_fight_to_death) { |
- | |
| 1620 | DoFancyHeadup(kFancyHeadupYouLost); |
- | |
| 1621 | gRace_finished = 1; |
- | |
| 1622 | } else { |
- | |
| 1623 | last_got_wasted_time = PDGetTotalTime(); |
- | |
| 1624 | if (last_got_wasted_time - last_wasted_em_time > 1000) { |
- | |
| 1625 | DoFancyHeadup(kFancyHeadupYouAreWasted); |
- | |
| 1626 | } else { |
- | |
| 1627 | DoFancyHeadup(kFancyHeadupYouAreBothWasted); |
- | |
| 1628 | } |
- | |
| 1629 | } |
- | |
| 1630 | } |
- | |
| 1631 | if (pContents->data.wasted.culprit == -1) { |
- | |
| 1632 | if (victim->last_waste_message == 0) { |
- | |
| 1633 | victim->last_waste_message = GetTotalTime(); |
- | |
| 1634 | } |
- | |
| 1635 | } else if (!victim->wasteage_attributed) { |
- | |
| 1636 | if (pContents->data.wasted.culprit == -2) { |
- | |
| 1637 | culprit = NULL; |
- | |
| 1638 | } else { |
- | |
| 1639 | culprit = NetPlayerFromID(pContents->data.wasted.culprit); |
- | |
| 1640 | } |
- | |
| 1641 | if (culprit != NULL && gNet_mode == eNet_mode_host && gCurrent_net_game->type == eNet_game_type_car_crusher) { |
- | |
| 1642 | culprit->score++; |
- | |
| 1643 | if (culprit->score >= gCurrent_net_game->options.race_end_target) { |
- | |
| 1644 | DeclareWinner(culprit - gNet_players); |
- | |
| 1645 | } |
- | |
| 1646 | } |
- | |
| 1647 | victim->last_waste_message = GetTotalTime(); |
- | |
| 1648 | victim->wasteage_attributed = 1; |
- | |
| 1649 | if (victim == last_culprit && culprit == last_victim && victim != NULL && culprit != NULL && PDGetTotalTime() - last_wasty_message_time < 1000) { |
- | |
| 1650 | sprintf(s, "%s %s %s %s", victim->player_name, GetMiscString(kMiscString_AND), culprit->player_name, GetMiscString(kMiscString_WASTED_EACH_OTHER)); |
- | |
| 1651 | } else { |
- | |
| 1652 | sprintf(s, "%s %s %s", victim->player_name, GetMiscString(kMiscString_WastedBy), culprit ? culprit->player_name : GetMiscString(kMiscString_COP)); |
- | |
| 1653 | } |
- | |
| 1654 | NewTextHeadupSlot2(4, 0, 3000, -4, s, 0); |
- | |
| 1655 | last_wasty_message_time = PDGetTotalTime(); |
- | |
| 1656 | last_culprit = culprit; |
- | |
| 1657 | last_victim = victim; |
- | |
| 1658 | if (pContents->data.wasted.culprit == gLocal_net_ID) { |
- | |
| 1659 |
|
1448 | NOT_IMPLEMENTED(); |
| 1660 | last_wasted_em_time = PDGetTotalTime(); |
- | |
| 1661 | if (last_wasted_em_time - last_got_wasted_time > 1000) { |
- | |
| 1662 | DoFancyHeadup(kFancyHeadupYouWastedEm); |
- | |
| 1663 | } else { |
- | |
| 1664 | DoFancyHeadup(kFancyHeadupYouAreBothWasted); |
- | |
| 1665 | } |
- | |
| 1666 | } |
- | |
| 1667 | } |
- | |
| 1668 | } |
1449 | } |
| 1669 | 1450 | ||
| 1670 | // IDA: void __usercall ReceivedCarDetailsReq(tNet_contents *pContents@<EAX>, void *pSender_address@<EDX>) |
1451 | // IDA: void __usercall ReceivedCarDetailsReq(tNet_contents *pContents@<EAX>, void *pSender_address@<EDX>) |
| 1671 | void ReceivedCarDetailsReq(tNet_contents* pContents, void* pSender_address) { |
1452 | void ReceivedCarDetailsReq(tNet_contents* pContents, void* pSender_address) { |
| 1672 | tNet_message* message; |
1453 | tNet_message* message; |
| Line 1702... | Line 1483... | ||
| 1702 | gReceived_car_details = 1; |
1483 | gReceived_car_details = 1; |
| 1703 | } |
1484 | } |
| 1704 | 1485 | ||
| 1705 | // IDA: void __usercall ReceivedGameScores(tNet_contents *pContents@<EAX>) |
1486 | // IDA: void __usercall ReceivedGameScores(tNet_contents *pContents@<EAX>) |
| 1706 | void ReceivedGameScores(tNet_contents* pContents) { |
1487 | void ReceivedGameScores(tNet_contents* pContents) { |
| 1707 |
|
1488 | //int i; // Pierre-Marie Baty -- unused variable |
| 1708 | LOG_TRACE("(%p)", pContents); |
1489 | LOG_TRACE("(%p)", pContents); |
| 1709 | - | ||
| 1710 |
|
1490 | NOT_IMPLEMENTED(); |
| 1711 | for (i = 0; i < gNumber_of_net_players; i++) { |
- | |
| 1712 | gNet_players[i].played = pContents->data.game_scores.scores[i].played; |
- | |
| 1713 | gNet_players[i].won = pContents->data.game_scores.scores[i].won; |
- | |
| 1714 | gNet_players[i].games_score = pContents->data.game_scores.scores[i].score; |
- | |
| 1715 | } |
- | |
| 1716 | } |
1491 | } |
| 1717 | 1492 | ||
| 1718 | // IDA: void __usercall ReceivedMessage(tNet_message *pMessage@<EAX>, void *pSender_address@<EDX>, tU32 pReceive_time@<EBX>) |
1493 | // IDA: void __usercall ReceivedMessage(tNet_message *pMessage@<EAX>, void *pSender_address@<EDX>, tU32 pReceive_time@<EBX>) |
| 1719 | void ReceivedMessage(tNet_message* pMessage, void* pSender_address, tU32 pReceive_time) { |
1494 | void ReceivedMessage(tNet_message* pMessage, void* pSender_address, tU32 pReceive_time) { |
| 1720 | tNet_contents* contents; |
1495 | tNet_contents* contents; |
| Line 1894... | Line 1669... | ||
| 1894 | NewTextHeadupSlot(4, 0, 3000, -4, s); |
1669 | NewTextHeadupSlot(4, 0, 3000, -4, s); |
| 1895 | } |
1670 | } |
| 1896 | } |
1671 | } |
| 1897 | } |
1672 | } |
| 1898 | } else if (!gHost_died && gNumber_of_net_players != 0 && gNet_players[0].last_heard_from_him != 0 && the_time - gNet_players[0].last_heard_from_him >= 20000) { |
1673 | } else if (!gHost_died && gNumber_of_net_players != 0 && gNet_players[0].last_heard_from_him != 0 && the_time - gNet_players[0].last_heard_from_him >= 20000) { |
| 1899 | HostHasBittenTheDust( |
1674 | HostHasBittenTheDust(91); |
| 1900 | } |
1675 | } |
| 1901 | } |
1676 | } |
| 1902 | 1677 | ||
| 1903 | // IDA: void __cdecl CheckForPendingStartRace() |
1678 | // IDA: void __cdecl CheckForPendingStartRace() |
| 1904 | void CheckForPendingStartRace(void) { |
1679 | void CheckForPendingStartRace(void) { |
| Line 2007... | Line 1782... | ||
| 2007 | } |
1782 | } |
| 2008 | 1783 | ||
| 2009 | // IDA: int __usercall NetGuaranteedSendMessageToEverybody@<EAX>(tNet_game_details *pDetails@<EAX>, tNet_message *pMessage@<EDX>, int (*pNotifyFail)(tU32, tNet_message*)@<EBX>) |
1784 | // IDA: int __usercall NetGuaranteedSendMessageToEverybody@<EAX>(tNet_game_details *pDetails@<EAX>, tNet_message *pMessage@<EDX>, int (*pNotifyFail)(tU32, tNet_message*)@<EBX>) |
| 2010 | int NetGuaranteedSendMessageToEverybody(tNet_game_details* pDetails, tNet_message* pMessage, int (*pNotifyFail)(tU32, tNet_message*)) { |
1785 | int NetGuaranteedSendMessageToEverybody(tNet_game_details* pDetails, tNet_message* pMessage, int (*pNotifyFail)(tU32, tNet_message*)) { |
| 2011 | LOG_TRACE("(%p, %p, %p)", pDetails, pMessage, pNotifyFail); |
1786 | LOG_TRACE("(%p, %p, %p)", pDetails, pMessage, pNotifyFail); |
| 2012 | - | ||
| 2013 | pMessage->sender = gLocal_net_ID; |
- | |
| 2014 | pMessage->senders_time_stamp = PDGetTotalTime(); |
- | |
| 2015 |
|
1787 | NOT_IMPLEMENTED(); |
| 2016 | pMessage->guarantee_number = 0; |
- | |
| 2017 | ReceivedMessage(pMessage, &gNet_players[gThis_net_player_index], GetRaceTime()); |
- | |
| 2018 | return NetGuaranteedSendMessageToAllPlayers(pDetails, pMessage, pNotifyFail); |
- | |
| 2019 | } |
1788 | } |
| 2020 | 1789 | ||
| 2021 | // IDA: int __usercall NetGuaranteedSendMessageToHost@<EAX>(tNet_game_details *pDetails@<EAX>, tNet_message *pMessage@<EDX>, int (*pNotifyFail)(tU32, tNet_message*)@<EBX>) |
1790 | // IDA: int __usercall NetGuaranteedSendMessageToHost@<EAX>(tNet_game_details *pDetails@<EAX>, tNet_message *pMessage@<EDX>, int (*pNotifyFail)(tU32, tNet_message*)@<EBX>) |
| 2022 | int NetGuaranteedSendMessageToHost(tNet_game_details* pDetails, tNet_message* pMessage, int (*pNotifyFail)(tU32, tNet_message*)) { |
1791 | int NetGuaranteedSendMessageToHost(tNet_game_details* pDetails, tNet_message* pMessage, int (*pNotifyFail)(tU32, tNet_message*)) { |
| 2023 | LOG_TRACE("(%p, %p, %p)", pDetails, pMessage, pNotifyFail); |
1792 | LOG_TRACE("(%p, %p, %p)", pDetails, pMessage, pNotifyFail); |
| Line 2122... | Line 1891... | ||
| 2122 | } |
1891 | } |
| 2123 | 1892 | ||
| 2124 | // IDA: int __usercall SampleFailNotifier@<EAX>(tU32 pAge@<EAX>, tNet_message *pMessage@<EDX>) |
1893 | // IDA: int __usercall SampleFailNotifier@<EAX>(tU32 pAge@<EAX>, tNet_message *pMessage@<EDX>) |
| 2125 | int SampleFailNotifier(tU32 pAge, tNet_message* pMessage) { |
1894 | int SampleFailNotifier(tU32 pAge, tNet_message* pMessage) { |
| 2126 | LOG_TRACE("(%d, %p)", pAge, pMessage); |
1895 | LOG_TRACE("(%d, %p)", pAge, pMessage); |
| 2127 | - | ||
| 2128 |
|
1896 | NOT_IMPLEMENTED(); |
| 2129 | } |
1897 | } |
| 2130 | 1898 | ||
| 2131 | // IDA: void __cdecl NetWaitForGuaranteeReplies() |
1899 | // IDA: void __cdecl NetWaitForGuaranteeReplies() |
| 2132 | void NetWaitForGuaranteeReplies(void) { |
1900 | void NetWaitForGuaranteeReplies(void) { |
| 2133 | tU32 start_time; |
1901 | tU32 start_time; |
| Line 2142... | Line 1910... | ||
| 2142 | } |
1910 | } |
| 2143 | } |
1911 | } |
| 2144 | 1912 | ||
| 2145 | // IDA: tNet_game_player_info* __usercall NetPlayerFromID@<EAX>(tPlayer_ID pPlayer@<EAX>) |
1913 | // IDA: tNet_game_player_info* __usercall NetPlayerFromID@<EAX>(tPlayer_ID pPlayer@<EAX>) |
| 2146 | tNet_game_player_info* NetPlayerFromID(tPlayer_ID pPlayer) { |
1914 | tNet_game_player_info* NetPlayerFromID(tPlayer_ID pPlayer) { |
| 2147 |
|
1915 | //int i; // Pierre-Marie Baty -- unused variable |
| 2148 | LOG_TRACE("(%d)", pPlayer); |
1916 | LOG_TRACE("(%d)", pPlayer); |
| 2149 | - | ||
| 2150 | for (i = 0; i < gNumber_of_net_players; i++) { |
- | |
| 2151 | if (gNet_players[i].ID == pPlayer) { |
- | |
| 2152 | return &gNet_players[i]; |
- | |
| 2153 | } |
- | |
| 2154 | } |
- | |
| 2155 |
|
1917 | NOT_IMPLEMENTED(); |
| 2156 | } |
1918 | } |
| 2157 | 1919 | ||
| 2158 | // IDA: tCar_spec* __usercall NetCarFromPlayerID@<EAX>(tPlayer_ID pPlayer@<EAX>) |
1920 | // IDA: tCar_spec* __usercall NetCarFromPlayerID@<EAX>(tPlayer_ID pPlayer@<EAX>) |
| 2159 | tCar_spec* NetCarFromPlayerID(tPlayer_ID pPlayer) { |
1921 | tCar_spec* NetCarFromPlayerID(tPlayer_ID pPlayer) { |
| 2160 |
|
1922 | //int i; // Pierre-Marie Baty -- unused variable |
| 2161 | tNet_game_player_info |
1923 | //tNet_game_player_info* player; // Pierre-Marie Baty -- unused variable |
| 2162 | LOG_TRACE("(%d)", pPlayer); |
1924 | LOG_TRACE("(%d)", pPlayer); |
| 2163 | - | ||
| 2164 | player = NetPlayerFromID(pPlayer); |
- | |
| 2165 | if (player) { |
- | |
| 2166 | return player->car; |
- | |
| 2167 | } |
- | |
| 2168 |
|
1925 | NOT_IMPLEMENTED(); |
| 2169 | } |
1926 | } |
| 2170 | 1927 | ||
| 2171 | // IDA: tNet_game_player_info* __usercall NetPlayerFromCar@<EAX>(tCar_spec *pCar@<EAX>) |
1928 | // IDA: tNet_game_player_info* __usercall NetPlayerFromCar@<EAX>(tCar_spec *pCar@<EAX>) |
| 2172 | tNet_game_player_info* NetPlayerFromCar(tCar_spec* pCar) { |
1929 | tNet_game_player_info* NetPlayerFromCar(tCar_spec* pCar) { |
| 2173 |
|
1930 | //int i; // Pierre-Marie Baty -- unused variable |
| 2174 | LOG_TRACE("(%p)", pCar); |
1931 | LOG_TRACE("(%p)", pCar); |
| 2175 | - | ||
| 2176 | for (i = 0; i < gNumber_of_net_players; i++) { |
- | |
| 2177 | if (gNet_players[i].car == pCar) { |
- | |
| 2178 | return &gNet_players[i]; |
- | |
| 2179 | } |
- | |
| 2180 | } |
- | |
| 2181 |
|
1932 | NOT_IMPLEMENTED(); |
| 2182 | } |
1933 | } |
| 2183 | 1934 | ||
| 2184 | // IDA: tU32 __usercall DoCheckSum@<EAX>(tNet_message *pMessage@<EAX>) |
1935 | // IDA: tU32 __usercall DoCheckSum@<EAX>(tNet_message *pMessage@<EAX>) |
| 2185 | tU32 DoCheckSum(tNet_message* pMessage) { |
1936 | tU32 DoCheckSum(tNet_message* pMessage) { |
| 2186 | //int i; // Pierre-Marie Baty -- unused variable |
1937 | //int i; // Pierre-Marie Baty -- unused variable |