Rev 11 | Rev 20 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 11 | Rev 18 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | #include "network.h" |
1 | #include "network.h" |
2 | #include " |
2 | #include "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" |
|
22 | #include "replay.h" |
23 | #include "replay.h" |
23 | #include "spark.h" |
24 | #include "spark.h" |
24 | #include "structur.h" |
25 | #include "structur.h" |
25 | #include "utility.h" |
26 | #include "utility.h" |
26 | #include "world.h" |
27 | #include "world.h" |
Line 158... | Line 159... | ||
158 | } |
159 | } |
159 | 160 | ||
160 | // IDA: void __cdecl HaltNetServiceReentrancy() |
161 | // IDA: void __cdecl HaltNetServiceReentrancy() |
161 | void HaltNetServiceReentrancy(void) { |
162 | void HaltNetServiceReentrancy(void) { |
162 | LOG_TRACE("()"); |
163 | LOG_TRACE("()"); |
- | 164 | ||
163 |
|
165 | gIn_net_service = 1; |
164 | } |
166 | } |
165 | 167 | ||
166 | // IDA: void __usercall NetSendHeadupToAllPlayers(char *pMessage@<EAX>) |
168 | // IDA: void __usercall NetSendHeadupToAllPlayers(char *pMessage@<EAX>) |
167 | void NetSendHeadupToAllPlayers(char* pMessage) { |
169 | void NetSendHeadupToAllPlayers(char* pMessage) { |
168 | tNet_contents* the_contents; |
170 | tNet_contents* the_contents; |
Line 174... | Line 176... | ||
174 | } |
176 | } |
175 | } |
177 | } |
176 | 178 | ||
177 | // IDA: void __usercall NetSendHeadupToEverybody(char *pMessage@<EAX>) |
179 | // IDA: void __usercall NetSendHeadupToEverybody(char *pMessage@<EAX>) |
178 | void NetSendHeadupToEverybody(char* pMessage) { |
180 | void NetSendHeadupToEverybody(char* pMessage) { |
179 |
|
181 | tNet_contents* the_contents; |
180 | LOG_TRACE("(\"%s\")", pMessage); |
182 | LOG_TRACE("(\"%s\")", pMessage); |
- | 183 | ||
- | 184 | if (gNet_mode == eNet_mode_none) { |
|
181 |
|
185 | return; |
- | 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); |
|
182 | } |
192 | } |
183 | 193 | ||
184 | // IDA: void __usercall NetSendHeadupToPlayer(char *pMessage@<EAX>, tPlayer_ID pPlayer@<EDX>) |
194 | // IDA: void __usercall NetSendHeadupToPlayer(char *pMessage@<EAX>, tPlayer_ID pPlayer@<EDX>) |
185 | void NetSendHeadupToPlayer(char* pMessage, tPlayer_ID pPlayer) { |
195 | void NetSendHeadupToPlayer(char* pMessage, tPlayer_ID pPlayer) { |
186 |
|
196 | tNet_message* message; |
187 | LOG_TRACE("(\"%s\", %d)", pMessage, pPlayer); |
197 | LOG_TRACE("(\"%s\", %d)", pMessage, pPlayer); |
- | 198 | ||
- | 199 | if (gNet_mode == eNet_mode_none) { |
|
188 |
|
200 | return; |
- | 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 | } |
|
189 | } |
211 | } |
190 | 212 | ||
191 | // IDA: void __cdecl InitialisePlayerStati() |
213 | // IDA: void __cdecl InitialisePlayerStati() |
192 | void InitialisePlayerStati(void) { |
214 | void InitialisePlayerStati(void) { |
193 | int i; |
215 | int i; |
Line 376... | Line 398... | ||
376 | } |
398 | } |
377 | 399 | ||
378 | // IDA: void __usercall NetDisposePlayer(tNet_game_player_info *pPlayer@<EAX>) |
400 | // IDA: void __usercall NetDisposePlayer(tNet_game_player_info *pPlayer@<EAX>) |
379 | void NetDisposePlayer(tNet_game_player_info* pPlayer) { |
401 | void NetDisposePlayer(tNet_game_player_info* pPlayer) { |
380 | LOG_TRACE("(%p)", pPlayer); |
402 | LOG_TRACE("(%p)", pPlayer); |
- | 403 | ||
381 |
|
404 | PDNetDisposePlayer(pPlayer); |
382 | } |
405 | } |
383 | 406 | ||
384 | // IDA: void __usercall FillInThisPlayer(tNet_game_details *pGame@<EAX>, tNet_game_player_info *pPlayer@<EDX>, int pCar_index@<EBX>, int pHost@<ECX>) |
407 | // IDA: void __usercall FillInThisPlayer(tNet_game_details *pGame@<EAX>, tNet_game_player_info *pPlayer@<EDX>, int pCar_index@<EBX>, int pHost@<ECX>) |
385 | void FillInThisPlayer(tNet_game_details* pGame, tNet_game_player_info* pPlayer, int pCar_index, int pHost) { |
408 | void FillInThisPlayer(tNet_game_details* pGame, tNet_game_player_info* pPlayer, int pCar_index, int pHost) { |
386 | LOG_TRACE("(%p, %p, %d, %d)", pGame, pPlayer, pCar_index, pHost); |
409 | LOG_TRACE("(%p, %p, %d, %d)", pGame, pPlayer, pCar_index, pHost); |
Line 458... | Line 481... | ||
458 | } |
481 | } |
459 | 482 | ||
460 | // IDA: void __usercall PlayerHasLeft(int pIndex@<EAX>) |
483 | // IDA: void __usercall PlayerHasLeft(int pIndex@<EAX>) |
461 | void PlayerHasLeft(int pIndex) { |
484 | void PlayerHasLeft(int pIndex) { |
462 | LOG_TRACE("(%d)", pIndex); |
485 | 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; |
|
463 |
|
493 | } |
- | 494 | } |
|
464 | } |
495 | } |
465 | 496 | ||
466 | // IDA: void __usercall NetPlayersChanged(int pNew_count@<EAX>, tNet_game_player_info *pNew_players@<EDX>) |
497 | // IDA: void __usercall NetPlayersChanged(int pNew_count@<EAX>, tNet_game_player_info *pNew_players@<EDX>) |
467 | void NetPlayersChanged(int pNew_count, tNet_game_player_info* pNew_players) { |
498 | void NetPlayersChanged(int pNew_count, tNet_game_player_info* pNew_players) { |
468 | int i; |
499 | int i; |
Line 473... | Line 504... | ||
473 | int player_still_there; |
504 | int player_still_there; |
474 | tPlayer_ID old_fox_it; |
505 | tPlayer_ID old_fox_it; |
475 | LOG_TRACE("(%d, %p)", pNew_count, pNew_players); |
506 | LOG_TRACE("(%d, %p)", pNew_count, pNew_players); |
476 | 507 | ||
477 | if (gCurrent_net_game->type == eNet_game_type_tag || gCurrent_net_game->type == eNet_game_type_foxy) { |
508 | 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 |
|
478 | old_fox_it = gNet_players[gIt_or_fox].ID; |
513 | old_fox_it = gNet_players[gIt_or_fox].ID; |
- | 514 | #ifdef DETHRACE_FIX_BUGS |
|
- | 515 | } |
|
- | 516 | #endif |
|
479 | } |
517 | } |
480 | for (i = 0; i < pNew_count; i++) { |
518 | for (i = 0; i < pNew_count; i++) { |
481 | new_player = 1; |
519 | new_player = 1; |
482 | for (j = 0; j < gNumber_of_net_players; j++) { |
520 | for (j = 0; j < gNumber_of_net_players; j++) { |
483 | if (pNew_players[i].ID == gNet_players[j].ID) { |
521 | if (pNew_players[i].ID == gNet_players[j].ID) { |
Line 610... | Line 648... | ||
610 | } |
648 | } |
611 | 649 | ||
612 | // IDA: int __usercall NetInitClient@<EAX>(tNet_game_details *pDetails@<EAX>) |
650 | // IDA: int __usercall NetInitClient@<EAX>(tNet_game_details *pDetails@<EAX>) |
613 | int NetInitClient(tNet_game_details* pDetails) { |
651 | int NetInitClient(tNet_game_details* pDetails) { |
614 | LOG_TRACE("(%p)", pDetails); |
652 | LOG_TRACE("(%p)", pDetails); |
- | 653 | ||
615 |
|
654 | return PDNetInitClient(pDetails); |
616 | } |
655 | } |
617 | 656 | ||
618 | // IDA: int __usercall NetJoinGameLowLevel@<EAX>(tNet_game_details *pDetails@<EAX>, char *pPlayer_name@<EDX>) |
657 | // IDA: int __usercall NetJoinGameLowLevel@<EAX>(tNet_game_details *pDetails@<EAX>, char *pPlayer_name@<EDX>) |
619 | int NetJoinGameLowLevel(tNet_game_details* pDetails, char* pPlayer_name) { |
658 | int NetJoinGameLowLevel(tNet_game_details* pDetails, char* pPlayer_name) { |
620 | LOG_TRACE("(%p, \"%s\")", pDetails, pPlayer_name); |
659 | LOG_TRACE("(%p, \"%s\")", pDetails, pPlayer_name); |
621 | 660 | ||
622 | return PDNetJoinGame(pDetails, pPlayer_name); |
661 | return PDNetJoinGame(pDetails, pPlayer_name); |
623 | } |
662 | } |
- | 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); |
|
624 | 669 | ||
625 | // IDA: int __usercall NetJoinGame@<EAX>(tNet_game_details *pDetails@<EAX>, char *pPlayer_name@<EDX>, int pCar_index@<EBX>) |
670 | // IDA: int __usercall NetJoinGame@<EAX>(tNet_game_details *pDetails@<EAX>, char *pPlayer_name@<EDX>, int pCar_index@<EBX>) |
626 | int NetJoinGame(tNet_game_details* pDetails, char* pPlayer_name, int pCar_index) { |
671 | int NetJoinGame(tNet_game_details* pDetails, char* pPlayer_name, int pCar_index) { |
627 | int result; |
672 | int result; |
628 | tNet_message* the_message; |
673 | tNet_message* the_message; |
Line 714... | Line 759... | ||
714 | return PDNetSendMessageToAddress(pDetails, pMessage, pAddress); |
759 | return PDNetSendMessageToAddress(pDetails, pMessage, pAddress); |
715 | } |
760 | } |
716 | 761 | ||
717 | // IDA: int __usercall NetSendMessageToPlayer@<EAX>(tNet_game_details *pDetails@<EAX>, tNet_message *pMessage@<EDX>, tPlayer_ID pPlayer@<EBX>) |
762 | // IDA: int __usercall NetSendMessageToPlayer@<EAX>(tNet_game_details *pDetails@<EAX>, tNet_message *pMessage@<EDX>, tPlayer_ID pPlayer@<EBX>) |
718 | int NetSendMessageToPlayer(tNet_game_details* pDetails, tNet_message* pMessage, tPlayer_ID pPlayer) { |
763 | int NetSendMessageToPlayer(tNet_game_details* pDetails, tNet_message* pMessage, tPlayer_ID pPlayer) { |
719 |
|
764 | int i; |
720 | LOG_TRACE("(%p, %p, %d)", pDetails, pMessage, pPlayer); |
765 | LOG_TRACE("(%p, %p, %d)", pDetails, pMessage, pPlayer); |
- | 766 | ||
- | 767 | if (gNet_mode == eNet_mode_none) { |
|
721 |
|
768 | return -3; |
- | 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; |
|
722 | } |
779 | } |
723 | 780 | ||
724 | // IDA: int __usercall NetSendMessageToHost@<EAX>(tNet_game_details *pDetails@<EAX>, tNet_message *pMessage@<EDX>) |
781 | // IDA: int __usercall NetSendMessageToHost@<EAX>(tNet_game_details *pDetails@<EAX>, tNet_message *pMessage@<EDX>) |
725 | int NetSendMessageToHost(tNet_game_details* pDetails, tNet_message* pMessage) { |
782 | int NetSendMessageToHost(tNet_game_details* pDetails, tNet_message* pMessage) { |
726 | LOG_TRACE("(%p, %p)", pDetails, pMessage); |
783 | 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(); |
|
727 |
|
790 | DoCheckSum(pMessage); |
- | 791 | return PDNetSendMessageToAddress(pDetails, pMessage, &pDetails->pd_net_info); |
|
728 | } |
792 | } |
729 | 793 | ||
730 | // IDA: int __usercall NetReplyToMessage@<EAX>(tNet_game_details *pDetails@<EAX>, tNet_message *pIncoming_message@<EDX>, tNet_message *pReply_message@<EBX>) |
794 | // IDA: int __usercall NetReplyToMessage@<EAX>(tNet_game_details *pDetails@<EAX>, tNet_message *pIncoming_message@<EDX>, tNet_message *pReply_message@<EBX>) |
731 | int NetReplyToMessage(tNet_game_details* pDetails, tNet_message* pIncoming_message, tNet_message* pReply_message) { |
795 | int NetReplyToMessage(tNet_game_details* pDetails, tNet_message* pIncoming_message, tNet_message* pReply_message) { |
732 | LOG_TRACE("(%p, %p, %p)", pDetails, pIncoming_message, pReply_message); |
796 | LOG_TRACE("(%p, %p, %p)", pDetails, pIncoming_message, pReply_message); |
- | 797 | ||
733 |
|
798 | return NetSendMessageToPlayer(pDetails, pReply_message, pIncoming_message->sender); |
734 | } |
799 | } |
735 | 800 | ||
736 | // IDA: int __usercall NetSendMessageToAllPlayers@<EAX>(tNet_game_details *pDetails@<EAX>, tNet_message *pMessage@<EDX>) |
801 | // IDA: int __usercall NetSendMessageToAllPlayers@<EAX>(tNet_game_details *pDetails@<EAX>, tNet_message *pMessage@<EDX>) |
737 | int NetSendMessageToAllPlayers(tNet_game_details* pDetails, tNet_message* pMessage) { |
802 | int NetSendMessageToAllPlayers(tNet_game_details* pDetails, tNet_message* pMessage) { |
738 | LOG_TRACE("(%p, %p)", pDetails, pMessage); |
803 | LOG_TRACE("(%p, %p)", pDetails, pMessage); |
Line 841... | Line 906... | ||
841 | 906 | ||
842 | // IDA: tS32 __usercall NetCalcSizeDecider@<EAX>(tNet_contents *pContents@<EAX>) |
907 | // IDA: tS32 __usercall NetCalcSizeDecider@<EAX>(tNet_contents *pContents@<EAX>) |
843 | tS32 NetCalcSizeDecider(tNet_contents* pContents) { |
908 | tS32 NetCalcSizeDecider(tNet_contents* pContents) { |
844 | //tS32 the_decider; // Pierre-Marie Baty -- unused variable |
909 | //tS32 the_decider; // Pierre-Marie Baty -- unused variable |
845 | LOG_TRACE("(%p)", pContents); |
910 | LOG_TRACE("(%p)", pContents); |
- | 911 | ||
846 |
|
912 | return 0; |
847 | } |
913 | } |
848 | 914 | ||
849 | // IDA: tNet_message* __usercall NetBuildMessage@<EAX>(tNet_message_type pType@<EAX>, tS32 pSize_decider@<EDX>) |
915 | // IDA: tNet_message* __usercall NetBuildMessage@<EAX>(tNet_message_type pType@<EAX>, tS32 pSize_decider@<EDX>) |
850 | tNet_message* NetBuildMessage(tNet_message_type pType, tS32 pSize_decider) { |
916 | tNet_message* NetBuildMessage(tNet_message_type pType, tS32 pSize_decider) { |
851 | tNet_message* the_message; |
917 | tNet_message* the_message; |
Line 862... | Line 928... | ||
862 | return the_message; |
928 | return the_message; |
863 | } |
929 | } |
864 | 930 | ||
865 | // IDA: tNet_contents* __usercall NetGetToHostContents@<EAX>(tNet_message_type pType@<EAX>, tS32 pSize_decider@<EDX>) |
931 | // IDA: tNet_contents* __usercall NetGetToHostContents@<EAX>(tNet_message_type pType@<EAX>, tS32 pSize_decider@<EDX>) |
866 | tNet_contents* NetGetToHostContents(tNet_message_type pType, tS32 pSize_decider) { |
932 | tNet_contents* NetGetToHostContents(tNet_message_type pType, tS32 pSize_decider) { |
867 |
|
933 | tU32 the_size; |
868 |
|
934 | tNet_contents* contents; |
869 | LOG_TRACE("(%d, %d)", pType, pSize_decider); |
935 | 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++; |
|
870 |
|
952 | return contents; |
871 | } |
953 | } |
872 | 954 | ||
873 | // IDA: tNet_contents* __usercall NetGetBroadcastContents@<EAX>(tNet_message_type pType@<EAX>, tS32 pSize_decider@<EDX>) |
955 | // IDA: tNet_contents* __usercall NetGetBroadcastContents@<EAX>(tNet_message_type pType@<EAX>, tS32 pSize_decider@<EDX>) |
874 | tNet_contents* NetGetBroadcastContents(tNet_message_type pType, tS32 pSize_decider) { |
956 | tNet_contents* NetGetBroadcastContents(tNet_message_type pType, tS32 pSize_decider) { |
875 | tU32 the_size; |
957 | tU32 the_size; |
Line 967... | Line 1049... | ||
967 | } |
1049 | } |
968 | *(void**)last_message = pointer; |
1050 | *(void**)last_message = pointer; |
969 | } else { |
1051 | } else { |
970 | gMessage_to_free = pointer; |
1052 | gMessage_to_free = pointer; |
971 | } |
1053 | } |
972 | pointer = ( |
1054 | pointer = (char*)pointer + sizeof(void*); |
973 | } |
1055 | } |
974 | } |
1056 | } |
975 | if (pointer == NULL) { |
1057 | if (pointer == NULL) { |
976 | LOG_PANIC("null pointer!"); |
1058 | LOG_PANIC("null pointer!"); |
977 | message = NULL; |
1059 | message = NULL; |
Line 1073... | Line 1155... | ||
1073 | tNet_message* message; |
1155 | tNet_message* message; |
1074 | tNet_game_player_info* new_players; |
1156 | tNet_game_player_info* new_players; |
1075 | LOG_TRACE("(%p, %p)", pContents, pSender_address); |
1157 | LOG_TRACE("(%p, %p)", pContents, pSender_address); |
1076 | 1158 | ||
1077 | new_player_count = gNumber_of_net_players; |
1159 | new_player_count = gNumber_of_net_players; |
1078 | new_players = BrMemAllocate(new_player_count + 1 * sizeof(tNet_game_player_info), kMem_player_list_join); |
1160 | new_players = BrMemAllocate((new_player_count + 1) * sizeof(tNet_game_player_info), kMem_player_list_join); |
1079 | memcpy(new_players, gNet_players, gNumber_of_net_players * sizeof(tNet_game_player_info)); |
1161 | memcpy(new_players, gNet_players, gNumber_of_net_players * sizeof(tNet_game_player_info)); |
1080 | 1162 | ||
1081 | if ((!gCurrent_net_game->options.open_game && gProgram_state.racing) || gCurrent_net_game->num_players > 5 || gDont_allow_joiners) { |
1163 | if ((!gCurrent_net_game->options.open_game && gProgram_state.racing) || gCurrent_net_game->num_players > 5 || gDont_allow_joiners) { |
1082 | message = NetBuildMessage(NETMSGID_NEWPLAYERLIST, 0); |
1164 | message = NetBuildMessage(NETMSGID_NEWPLAYERLIST, 0); |
1083 | // Send player count = 0 when race has already begun or is full |
1165 | // Send player count = 0 when race has already begun or is full |
Line 1121... | Line 1203... | ||
1121 | } |
1203 | } |
1122 | } |
1204 | } |
1123 | 1205 | ||
1124 | // IDA: void __usercall KickPlayerOut(tPlayer_ID pID@<EAX>) |
1206 | // IDA: void __usercall KickPlayerOut(tPlayer_ID pID@<EAX>) |
1125 | void KickPlayerOut(tPlayer_ID pID) { |
1207 | void KickPlayerOut(tPlayer_ID pID) { |
1126 |
|
1208 | int i; |
1127 |
|
1209 | int j; |
1128 |
|
1210 | int new_player_count; |
1129 |
|
1211 | tNet_game_player_info* new_players; |
1130 | LOG_TRACE("(%d)", pID); |
1212 | 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); |
|
1131 |
|
1238 | SendOutPlayerList(); |
1132 | } |
1239 | } |
1133 | 1240 | ||
1134 | // IDA: void __usercall ReceivedLeave(tNet_contents *pContents@<EAX>, tNet_message *pMessage@<EDX>) |
1241 | // IDA: void __usercall ReceivedLeave(tNet_contents *pContents@<EAX>, tNet_message *pMessage@<EDX>) |
1135 | void ReceivedLeave(tNet_contents* pContents, tNet_message* pMessage) { |
1242 | void ReceivedLeave(tNet_contents* pContents, tNet_message* pMessage) { |
1136 | LOG_TRACE("(%p, %p)", pContents, pMessage); |
1243 | LOG_TRACE("(%p, %p)", pContents, pMessage); |
- | 1244 | ||
1137 |
|
1245 | KickPlayerOut(pMessage->sender); |
1138 | } |
1246 | } |
1139 | 1247 | ||
1140 | // IDA: void __usercall NetFullScreenMessage(int pStr_index@<EAX>, int pLeave_it_up_there@<EDX>) |
1248 | // IDA: void __usercall NetFullScreenMessage(int pStr_index@<EAX>, int pLeave_it_up_there@<EDX>) |
1141 | void NetFullScreenMessage(int pStr_index, int pLeave_it_up_there) { |
1249 | void NetFullScreenMessage(int pStr_index, int pLeave_it_up_there) { |
1142 | tU32 start_time; |
1250 | tU32 start_time; |
Line 1211... | Line 1319... | ||
1211 | 1319 | ||
1212 | // IDA: void __usercall ReceivedHosticide(tNet_contents *pContents@<EAX>) |
1320 | // IDA: void __usercall ReceivedHosticide(tNet_contents *pContents@<EAX>) |
1213 | void ReceivedHosticide(tNet_contents* pContents) { |
1321 | void ReceivedHosticide(tNet_contents* pContents) { |
1214 | LOG_TRACE("(%p)", pContents); |
1322 | LOG_TRACE("(%p)", pContents); |
1215 | 1323 | ||
1216 | HostHasBittenTheDust( |
1324 | HostHasBittenTheDust(kMiscString_GAME_TERMINATED_BY_HOST); |
1217 | } |
1325 | } |
1218 | 1326 | ||
1219 | // IDA: void __cdecl ConfirmReceipt() |
1327 | // IDA: void __cdecl ConfirmReceipt() |
1220 | void ConfirmReceipt(void) { |
1328 | void ConfirmReceipt(void) { |
1221 | //tNet_message* the_message; // Pierre-Marie Baty -- unused variable |
1329 | //tNet_message* the_message; // Pierre-Marie Baty -- unused variable |
Line 1311... | Line 1419... | ||
1311 | } |
1419 | } |
1312 | } |
1420 | } |
1313 | 1421 | ||
1314 | // IDA: void __usercall ReceivedStartRace(tNet_contents *pContents@<EAX>) |
1422 | // IDA: void __usercall ReceivedStartRace(tNet_contents *pContents@<EAX>) |
1315 | void ReceivedStartRace(tNet_contents* pContents) { |
1423 | void ReceivedStartRace(tNet_contents* pContents) { |
1316 |
|
1424 | int i; |
1317 |
|
1425 | int index; |
1318 | LOG_TRACE("(%p)", pContents); |
1426 | 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(); |
|
1319 |
|
1436 | } |
- | 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 | } |
|
1320 | } |
1471 | } |
1321 | 1472 | ||
1322 | // IDA: void __usercall ReceivedGuaranteeReply(tNet_contents *pContents@<EAX>) |
1473 | // IDA: void __usercall ReceivedGuaranteeReply(tNet_contents *pContents@<EAX>) |
1323 | void ReceivedGuaranteeReply(tNet_contents* pContents) { |
1474 | void ReceivedGuaranteeReply(tNet_contents* pContents) { |
1324 | int i; |
1475 | int i; |
Line 1361... | Line 1512... | ||
1361 | //tNet_message* message; // Pierre-Marie Baty -- unused variable |
1512 | //tNet_message* message; // Pierre-Marie Baty -- unused variable |
1362 | LOG_TRACE("(%p)", pContents); |
1513 | LOG_TRACE("(%p)", pContents); |
1363 | 1514 | ||
1364 | if (pContents->data.heres_where_we_at.race_index != gProgram_state.current_race_index) { |
1515 | if (pContents->data.heres_where_we_at.race_index != gProgram_state.current_race_index) { |
1365 | NetLeaveGame(gCurrent_net_game); |
1516 | NetLeaveGame(gCurrent_net_game); |
1366 | NetFullScreenMessage( |
1517 | NetFullScreenMessage(kMiscString_RACE_CHANGED_DURING_LOADING, 0); |
1367 | gProgram_state.prog_status = eProg_idling; |
1518 | gProgram_state.prog_status = eProg_idling; |
1368 | } |
1519 | } |
1369 | if (pContents->data.heres_where_we_at.race_has_started) { |
1520 | if (pContents->data.heres_where_we_at.race_has_started) { |
1370 | if (gCurrent_net_game->options.open_game) { |
1521 | if (gCurrent_net_game->options.open_game) { |
1371 | gPending_race = pContents->data.heres_where_we_at.pending_race; |
1522 | gPending_race = pContents->data.heres_where_we_at.pending_race; |
1372 | } else { |
1523 | } else { |
1373 | NetFullScreenMessage( |
1524 | NetFullScreenMessage(kMiscString_SORRY_YOU_RE_TOO_LATE, 0); |
1374 | gProgram_state.prog_status = eProg_idling; |
1525 | gProgram_state.prog_status = eProg_idling; |
1375 | } |
1526 | } |
1376 | } |
1527 | } |
1377 | } |
1528 | } |
1378 | 1529 | ||
Line 1402... | Line 1553... | ||
1402 | } |
1553 | } |
1403 | 1554 | ||
1404 | // IDA: void __usercall ReceivedTimeSync(tNet_contents *pContents@<EAX>, tNet_message *pMessage@<EDX>, tU32 pReceive_time@<EBX>) |
1555 | // IDA: void __usercall ReceivedTimeSync(tNet_contents *pContents@<EAX>, tNet_message *pMessage@<EDX>, tU32 pReceive_time@<EBX>) |
1405 | void ReceivedTimeSync(tNet_contents* pContents, tNet_message* pMessage, tU32 pReceive_time) { |
1556 | void ReceivedTimeSync(tNet_contents* pContents, tNet_message* pMessage, tU32 pReceive_time) { |
1406 | LOG_TRACE("(%p, %p, %d)", pContents, pMessage, pReceive_time); |
1557 | 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; |
|
1407 |
|
1561 | } |
1408 | } |
1562 | } |
1409 | 1563 | ||
1410 | // IDA: void __usercall ReceivedConfirm(tNet_contents *pContents@<EAX>) |
1564 | // IDA: void __usercall ReceivedConfirm(tNet_contents *pContents@<EAX>) |
1411 | void ReceivedConfirm(tNet_contents* pContents) { |
1565 | void ReceivedConfirm(tNet_contents* pContents) { |
1412 |
|
1566 | int i; |
1413 | LOG_TRACE("(%p)", pContents); |
1567 | 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; |
|
1414 |
|
1572 | return; |
- | 1573 | } |
|
- | 1574 | } |
|
1415 | } |
1575 | } |
1416 | 1576 | ||
1417 | // IDA: void __usercall ReceivedDisableCar(tNet_contents *pContents@<EAX>) |
1577 | // IDA: void __usercall ReceivedDisableCar(tNet_contents *pContents@<EAX>) |
1418 | void ReceivedDisableCar(tNet_contents* pContents) { |
1578 | void ReceivedDisableCar(tNet_contents* pContents) { |
1419 | LOG_TRACE("(%p)", pContents); |
1579 | LOG_TRACE("(%p)", pContents); |
1420 | NOT_IMPLEMENTED(); |
- | |
- | 1580 | ||
1421 | } |
1581 | } |
1422 | 1582 | ||
1423 | // IDA: void __usercall ReceivedEnableCar(tNet_contents *pContents@<EAX>) |
1583 | // IDA: void __usercall ReceivedEnableCar(tNet_contents *pContents@<EAX>) |
1424 | void ReceivedEnableCar(tNet_contents* pContents) { |
1584 | void ReceivedEnableCar(tNet_contents* pContents) { |
1425 | LOG_TRACE("(%p)", pContents); |
1585 | LOG_TRACE("(%p)", pContents); |
1426 | NOT_IMPLEMENTED(); |
- | |
- | 1586 | ||
1427 | } |
1587 | } |
1428 | 1588 | ||
1429 | // IDA: void __usercall ReceivedScores(tNet_contents *pContents@<EAX>) |
1589 | // IDA: void __usercall ReceivedScores(tNet_contents *pContents@<EAX>) |
1430 | void ReceivedScores(tNet_contents* pContents) { |
1590 | void ReceivedScores(tNet_contents* pContents) { |
1431 |
|
1591 | int i; |
1432 | LOG_TRACE("(%p)", pContents); |
1592 | LOG_TRACE("(%p)", pContents); |
- | 1593 | ||
- | 1594 | UseGeneralScore(pContents->data.scores.general_score); |
|
1433 |
|
1595 | for (i = 0; i < gNumber_of_net_players; i++) { |
- | 1596 | gNet_players[i].score = pContents->data.scores.scores[i]; |
|
- | 1597 | } |
|
1434 | } |
1598 | } |
1435 | 1599 | ||
1436 | // IDA: void __usercall ReceivedWasted(tNet_contents *pContents@<EAX>) |
1600 | // IDA: void __usercall ReceivedWasted(tNet_contents *pContents@<EAX>) |
1437 | void ReceivedWasted(tNet_contents* pContents) { |
1601 | void ReceivedWasted(tNet_contents* pContents) { |
1438 |
|
1602 | tNet_game_player_info* victim; |
1439 |
|
1603 | tNet_game_player_info* culprit; |
1440 |
|
1604 | char s[256]; |
1441 |
|
1605 | tCar_spec* car; |
1442 |
|
1606 | static tS32 last_got_wasted_time; |
1443 |
|
1607 | static tS32 last_wasted_em_time; |
1444 |
|
1608 | static tS32 last_wasty_message_time; |
1445 |
|
1609 | static tNet_game_player_info* last_culprit; |
1446 |
|
1610 | static tNet_game_player_info* last_victim; |
1447 | LOG_TRACE("(%p)", pContents); |
1611 | 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) { |
|
1448 |
|
1659 | PratcamEvent(32); |
- | 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 | } |
|
1449 | } |
1668 | } |
1450 | 1669 | ||
1451 | // IDA: void __usercall ReceivedCarDetailsReq(tNet_contents *pContents@<EAX>, void *pSender_address@<EDX>) |
1670 | // IDA: void __usercall ReceivedCarDetailsReq(tNet_contents *pContents@<EAX>, void *pSender_address@<EDX>) |
1452 | void ReceivedCarDetailsReq(tNet_contents* pContents, void* pSender_address) { |
1671 | void ReceivedCarDetailsReq(tNet_contents* pContents, void* pSender_address) { |
1453 | tNet_message* message; |
1672 | tNet_message* message; |
Line 1483... | Line 1702... | ||
1483 | gReceived_car_details = 1; |
1702 | gReceived_car_details = 1; |
1484 | } |
1703 | } |
1485 | 1704 | ||
1486 | // IDA: void __usercall ReceivedGameScores(tNet_contents *pContents@<EAX>) |
1705 | // IDA: void __usercall ReceivedGameScores(tNet_contents *pContents@<EAX>) |
1487 | void ReceivedGameScores(tNet_contents* pContents) { |
1706 | void ReceivedGameScores(tNet_contents* pContents) { |
1488 |
|
1707 | int i; |
1489 | LOG_TRACE("(%p)", pContents); |
1708 | LOG_TRACE("(%p)", pContents); |
- | 1709 | ||
1490 |
|
1710 | gReceived_game_scores = 1; |
- | 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 | } |
|
1491 | } |
1716 | } |
1492 | 1717 | ||
1493 | // IDA: void __usercall ReceivedMessage(tNet_message *pMessage@<EAX>, void *pSender_address@<EDX>, tU32 pReceive_time@<EBX>) |
1718 | // IDA: void __usercall ReceivedMessage(tNet_message *pMessage@<EAX>, void *pSender_address@<EDX>, tU32 pReceive_time@<EBX>) |
1494 | void ReceivedMessage(tNet_message* pMessage, void* pSender_address, tU32 pReceive_time) { |
1719 | void ReceivedMessage(tNet_message* pMessage, void* pSender_address, tU32 pReceive_time) { |
1495 | tNet_contents* contents; |
1720 | tNet_contents* contents; |
Line 1669... | Line 1894... | ||
1669 | NewTextHeadupSlot(4, 0, 3000, -4, s); |
1894 | NewTextHeadupSlot(4, 0, 3000, -4, s); |
1670 | } |
1895 | } |
1671 | } |
1896 | } |
1672 | } |
1897 | } |
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) { |
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) { |
1674 | HostHasBittenTheDust( |
1899 | HostHasBittenTheDust(kMiscString_PANIC_HOST_HAS_DISAPPEARED); |
1675 | } |
1900 | } |
1676 | } |
1901 | } |
1677 | 1902 | ||
1678 | // IDA: void __cdecl CheckForPendingStartRace() |
1903 | // IDA: void __cdecl CheckForPendingStartRace() |
1679 | void CheckForPendingStartRace(void) { |
1904 | void CheckForPendingStartRace(void) { |
Line 1782... | Line 2007... | ||
1782 | } |
2007 | } |
1783 | 2008 | ||
1784 | // IDA: int __usercall NetGuaranteedSendMessageToEverybody@<EAX>(tNet_game_details *pDetails@<EAX>, tNet_message *pMessage@<EDX>, int (*pNotifyFail)(tU32, tNet_message*)@<EBX>) |
2009 | // IDA: int __usercall NetGuaranteedSendMessageToEverybody@<EAX>(tNet_game_details *pDetails@<EAX>, tNet_message *pMessage@<EDX>, int (*pNotifyFail)(tU32, tNet_message*)@<EBX>) |
1785 | int NetGuaranteedSendMessageToEverybody(tNet_game_details* pDetails, tNet_message* pMessage, int (*pNotifyFail)(tU32, tNet_message*)) { |
2010 | int NetGuaranteedSendMessageToEverybody(tNet_game_details* pDetails, tNet_message* pMessage, int (*pNotifyFail)(tU32, tNet_message*)) { |
1786 | LOG_TRACE("(%p, %p, %p)", pDetails, pMessage, pNotifyFail); |
2011 | LOG_TRACE("(%p, %p, %p)", pDetails, pMessage, pNotifyFail); |
- | 2012 | ||
- | 2013 | pMessage->sender = gLocal_net_ID; |
|
- | 2014 | pMessage->senders_time_stamp = PDGetTotalTime(); |
|
1787 |
|
2015 | pMessage->num_contents = 1; |
- | 2016 | pMessage->guarantee_number = 0; |
|
- | 2017 | ReceivedMessage(pMessage, &gNet_players[gThis_net_player_index], GetRaceTime()); |
|
- | 2018 | return NetGuaranteedSendMessageToAllPlayers(pDetails, pMessage, pNotifyFail); |
|
1788 | } |
2019 | } |
1789 | 2020 | ||
1790 | // IDA: int __usercall NetGuaranteedSendMessageToHost@<EAX>(tNet_game_details *pDetails@<EAX>, tNet_message *pMessage@<EDX>, int (*pNotifyFail)(tU32, tNet_message*)@<EBX>) |
2021 | // IDA: int __usercall NetGuaranteedSendMessageToHost@<EAX>(tNet_game_details *pDetails@<EAX>, tNet_message *pMessage@<EDX>, int (*pNotifyFail)(tU32, tNet_message*)@<EBX>) |
1791 | int NetGuaranteedSendMessageToHost(tNet_game_details* pDetails, tNet_message* pMessage, int (*pNotifyFail)(tU32, tNet_message*)) { |
2022 | int NetGuaranteedSendMessageToHost(tNet_game_details* pDetails, tNet_message* pMessage, int (*pNotifyFail)(tU32, tNet_message*)) { |
1792 | LOG_TRACE("(%p, %p, %p)", pDetails, pMessage, pNotifyFail); |
2023 | LOG_TRACE("(%p, %p, %p)", pDetails, pMessage, pNotifyFail); |
Line 1891... | Line 2122... | ||
1891 | } |
2122 | } |
1892 | 2123 | ||
1893 | // IDA: int __usercall SampleFailNotifier@<EAX>(tU32 pAge@<EAX>, tNet_message *pMessage@<EDX>) |
2124 | // IDA: int __usercall SampleFailNotifier@<EAX>(tU32 pAge@<EAX>, tNet_message *pMessage@<EDX>) |
1894 | int SampleFailNotifier(tU32 pAge, tNet_message* pMessage) { |
2125 | int SampleFailNotifier(tU32 pAge, tNet_message* pMessage) { |
1895 | LOG_TRACE("(%d, %p)", pAge, pMessage); |
2126 | LOG_TRACE("(%d, %p)", pAge, pMessage); |
- | 2127 | ||
1896 |
|
2128 | return pAge > 9999; |
1897 | } |
2129 | } |
1898 | 2130 | ||
1899 | // IDA: void __cdecl NetWaitForGuaranteeReplies() |
2131 | // IDA: void __cdecl NetWaitForGuaranteeReplies() |
1900 | void NetWaitForGuaranteeReplies(void) { |
2132 | void NetWaitForGuaranteeReplies(void) { |
1901 | tU32 start_time; |
2133 | tU32 start_time; |
Line 1910... | Line 2142... | ||
1910 | } |
2142 | } |
1911 | } |
2143 | } |
1912 | 2144 | ||
1913 | // IDA: tNet_game_player_info* __usercall NetPlayerFromID@<EAX>(tPlayer_ID pPlayer@<EAX>) |
2145 | // IDA: tNet_game_player_info* __usercall NetPlayerFromID@<EAX>(tPlayer_ID pPlayer@<EAX>) |
1914 | tNet_game_player_info* NetPlayerFromID(tPlayer_ID pPlayer) { |
2146 | tNet_game_player_info* NetPlayerFromID(tPlayer_ID pPlayer) { |
1915 |
|
2147 | int i; |
1916 | LOG_TRACE("(%d)", pPlayer); |
2148 | 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 | } |
|
1917 |
|
2155 | return 0; |
1918 | } |
2156 | } |
1919 | 2157 | ||
1920 | // IDA: tCar_spec* __usercall NetCarFromPlayerID@<EAX>(tPlayer_ID pPlayer@<EAX>) |
2158 | // IDA: tCar_spec* __usercall NetCarFromPlayerID@<EAX>(tPlayer_ID pPlayer@<EAX>) |
1921 | tCar_spec* NetCarFromPlayerID(tPlayer_ID pPlayer) { |
2159 | tCar_spec* NetCarFromPlayerID(tPlayer_ID pPlayer) { |
1922 |
|
2160 | int i; |
1923 |
|
2161 | tNet_game_player_info* player; |
1924 | LOG_TRACE("(%d)", pPlayer); |
2162 | LOG_TRACE("(%d)", pPlayer); |
- | 2163 | ||
- | 2164 | player = NetPlayerFromID(pPlayer); |
|
- | 2165 | if (player) { |
|
- | 2166 | return player->car; |
|
- | 2167 | } |
|
1925 |
|
2168 | return NULL; |
1926 | } |
2169 | } |
1927 | 2170 | ||
1928 | // IDA: tNet_game_player_info* __usercall NetPlayerFromCar@<EAX>(tCar_spec *pCar@<EAX>) |
2171 | // IDA: tNet_game_player_info* __usercall NetPlayerFromCar@<EAX>(tCar_spec *pCar@<EAX>) |
1929 | tNet_game_player_info* NetPlayerFromCar(tCar_spec* pCar) { |
2172 | tNet_game_player_info* NetPlayerFromCar(tCar_spec* pCar) { |
1930 |
|
2173 | int i; |
1931 | LOG_TRACE("(%p)", pCar); |
2174 | 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 | } |
|
1932 |
|
2181 | return 0; |
1933 | } |
2182 | } |
1934 | 2183 | ||
1935 | // IDA: tU32 __usercall DoCheckSum@<EAX>(tNet_message *pMessage@<EAX>) |
2184 | // IDA: tU32 __usercall DoCheckSum@<EAX>(tNet_message *pMessage@<EAX>) |
1936 | tU32 DoCheckSum(tNet_message* pMessage) { |
2185 | tU32 DoCheckSum(tNet_message* pMessage) { |
1937 | //int i; // Pierre-Marie Baty -- unused variable |
2186 | //int i; // Pierre-Marie Baty -- unused variable |