@@ -494,44 +494,68 @@ void SetInitialPosition(tRace_info* pThe_race, int pCar_index, int pGrid_index)
494
494
car = pThe_race -> opponent_list [pCar_index ].car_spec ;
495
495
BrMatrix34Identity (& car_actor -> t .t .mat );
496
496
place_on_grid = 1 ;
497
- if (gNet_mode && !gCurrent_net_game -> options .grid_start && pThe_race -> number_of_net_start_points ) {
498
- TELL_ME_IF_WE_PASS_THIS_WAY ();
497
+ if (gNet_mode != eNet_mode_none && !gCurrent_net_game -> options .grid_start && pThe_race -> number_of_net_start_points != 0 ) {
498
+ start_i = i = IRandomBetween (0 , pThe_race -> number_of_net_start_points - 1 );
499
+ do {
500
+ PossibleService ();
501
+ for (j = 0 ; j < gNumber_of_net_players ; j ++ ) {
502
+ if (j != pCar_index ) {
503
+ BrVector3Copy (& real_pos , & pThe_race -> opponent_list [j ].car_spec -> car_master_actor -> t .t .translate .t );
504
+ if (real_pos .v [0 ] > 500.f ) {
505
+ real_pos .v [0 ] -= 1000.f ;
506
+ real_pos .v [1 ] -= 1000.f ;
507
+ real_pos .v [2 ] -= 1000.f ;
508
+ }
509
+ BrVector3Sub (& dist , & real_pos , & pThe_race -> net_starts [i ].pos );
510
+ if (BrVector3LengthSquared (& dist ) < 16.f ) {
511
+ break ;
512
+ }
513
+ }
514
+ }
515
+ if (j == gNumber_of_net_players ) {
516
+ BrVector3Copy (& car_actor -> t .t .translate .t , & pThe_race -> net_starts [i ].pos );
517
+ initial_yaw = BrDegreeToAngle (pThe_race -> net_starts [i ].yaw );
518
+ place_on_grid = 0 ;
519
+ }
520
+ i ++ ;
521
+ if (i == pThe_race -> number_of_net_start_points ) {
522
+ i = 0 ;
523
+ }
524
+ } while (start_i != i );
499
525
}
500
526
if (place_on_grid ) {
501
- initial_yaw = (pThe_race -> initial_yaw * 182.0444444444445 );
527
+ initial_yaw = BrDegreeToAngle (pThe_race -> initial_yaw );
502
528
BrMatrix34RotateY (& initial_yaw_matrix , initial_yaw );
503
- grid_offset .v [0 ] = 0.0 - pGrid_index % 2 ;
504
- grid_offset .v [1 ] = 0.0 ;
505
- grid_offset .v [2 ] = (double )(pGrid_index / 2 ) * 2.0 + (double )(pGrid_index % 2 ) * 0.40000001 ;
529
+ grid_offset .v [0 ] = 0.0f - pGrid_index % 2 ;
530
+ grid_offset .v [1 ] = 0.0f ;
531
+ grid_offset .v [2 ] = (br_scalar )(pGrid_index / 2 ) * 2.0f + (br_scalar )(pGrid_index % 2 ) * 0.4f ;
506
532
BrMatrix34ApplyV (& car_actor -> t .t .translate .t , & grid_offset , & initial_yaw_matrix );
507
533
BrVector3Accumulate (& car_actor -> t .t .translate .t , & pThe_race -> initial_position );
508
534
}
509
535
FindBestY (
510
536
& car_actor -> t .t .translate .t ,
511
537
gTrack_actor ,
512
- 10.0 ,
538
+ 10.0f ,
513
539
& nearest_y_above ,
514
540
& nearest_y_below ,
515
541
& above_model ,
516
542
& below_model ,
517
543
& above_face_index ,
518
544
& below_face_index );
519
- if (nearest_y_above == 30000.0 ) {
520
- if (nearest_y_below == -30000.0 ) {
521
- car_actor -> t .t .translate .t .v [1 ] = 0.0 ;
522
- } else {
523
- car_actor -> t .t .translate .t .v [1 ] = nearest_y_below ;
524
- }
525
- } else {
545
+ if (nearest_y_above != 30000.0f ) {
526
546
car_actor -> t .t .translate .t .v [1 ] = nearest_y_above ;
547
+ } else if (nearest_y_below != -30000.0f ) {
548
+ car_actor -> t .t .translate .t .v [1 ] = nearest_y_below ;
549
+ } else {
550
+ car_actor -> t .t .translate .t .v [1 ] = 0.0f ;
527
551
}
528
552
BrMatrix34PreRotateY (& car_actor -> t .t .mat , initial_yaw );
529
553
if (gNet_mode ) {
530
554
BrMatrix34Copy (
531
555
& gNet_players [pThe_race -> opponent_list [pCar_index ].net_player_index ].initial_position ,
532
556
& car -> car_master_actor -> t .t .mat );
533
557
}
534
- if (gNet_mode && car -> disabled && car_actor -> t .t .translate .t .v [0 ] < 500.0 ) {
558
+ if (gNet_mode != eNet_mode_none && car -> disabled && car_actor -> t .t .translate .t .v [0 ] < 500.0f ) {
535
559
DisableCar (car );
536
560
}
537
561
// Enable to start all opponent cars upside down ;)
0 commit comments