@@ -144,48 +144,48 @@ void HandleThrownBombs(void)
144144 int dx , dz ;
145145 VECTOR velocity ;
146146
147- if (gBombTargetVehicle == NULL )
148- return ;
149-
150- ThrownBombDelay -- ;
151-
152- if (ThrownBombDelay == -1 )
147+ // throw bombs if we have vehicle
148+ if (gBombTargetVehicle )
153149 {
154- ThrownBombDelay = Random2 ( 0 ) % 45 + 8 ;
150+ ThrownBombDelay -- ;
155151
156- bomb = & ThrownBombs [CurrentBomb ++ ];
157- CurrentBomb = CurrentBomb % MAX_THROWN_BOMBS ;
152+ if (ThrownBombDelay == -1 )
153+ {
154+ ThrownBombDelay = Random2 (0 ) % 45 + 8 ;
158155
159- bomb -> flags = 1 ;
160- bomb -> active = 1 ;
156+ bomb = & ThrownBombs [ CurrentBomb ++ ] ;
157+ CurrentBomb = CurrentBomb % MAX_THROWN_BOMBS ;
161158
162- bomb -> position .vx = gBombTargetVehicle -> hd .where .t [0 ];
163- bomb -> position .vy = gBombTargetVehicle -> hd .where .t [1 ] - 200 ;
164- bomb -> position .vz = gBombTargetVehicle -> hd .where .t [2 ];
159+ bomb -> flags = 1 ;
160+ bomb -> active = 1 ;
165161
166- velocity .vx = FIXEDH ( gBombTargetVehicle -> st . n . linearVelocity [0 ]) ;
167- velocity .vy = 0 ;
168- velocity .vz = FIXEDH ( gBombTargetVehicle -> st . n . linearVelocity [2 ]) ;
162+ bomb -> position .vx = gBombTargetVehicle -> hd . where . t [0 ];
163+ bomb -> position .vy = gBombTargetVehicle -> hd . where . t [ 1 ] - 200 ;
164+ bomb -> position .vz = gBombTargetVehicle -> hd . where . t [2 ];
169165
170- bomb -> velocity .vx = velocity .vx >> 10 ;
171- bomb -> velocity .vz = velocity .vz >> 10 ;
172- bomb -> velocity .vy = - (Long2DDistance (& bomb -> position , (VECTOR * )player [0 ].pos ) >> 7 );
166+ velocity .vx = FIXEDH (gBombTargetVehicle -> st .n .linearVelocity [0 ]);
167+ velocity .vz = FIXEDH (gBombTargetVehicle -> st .n .linearVelocity [2 ]);
173168
174- if ((rand () & 1 ) == 0 )
175- bomb -> rot_speed = - bomb -> velocity .vy ;
176- else
177- bomb -> rot_speed = bomb -> velocity .vy ;
169+ bomb -> velocity .vx = velocity .vx >> 10 ;
170+ bomb -> velocity .vz = velocity .vz >> 10 ;
171+ bomb -> velocity .vy = - (Long2DDistance (& bomb -> position , (VECTOR * )player [0 ].pos ) >> 7 );
178172
179- if (bomb -> velocity .vy < -100 )
180- bomb -> velocity .vy = -100 ;
173+ if ((rand () & 1 ) == 0 )
174+ bomb -> rot_speed = - bomb -> velocity .vy ;
175+ else
176+ bomb -> rot_speed = bomb -> velocity .vy ;
177+
178+ if (bomb -> velocity .vy < -100 )
179+ bomb -> velocity .vy = -100 ;
180+ }
181181 }
182182
183183 bomb = ThrownBombs ;
184184
185185 i = 0 ;
186186 while (i < MAX_THROWN_BOMBS )
187187 {
188- if (( bomb -> flags & 1 ) != 0 )
188+ if (bomb -> flags & 1 )
189189 {
190190 bomb -> position .vx += bomb -> velocity .vx ;
191191 bomb -> position .vy += bomb -> velocity .vy ;
@@ -237,7 +237,7 @@ void HandleThrownBombs(void)
237237 }
238238 bomb ++ ;
239239 i ++ ;
240- };
240+ }
241241}
242242
243243
0 commit comments