changeset 15583 | e1078c72ad60 |
parent 15239 | de53425ebc39 |
child 15585 | f8c1492601fe |
15582:6a38a30e772a | 15583:e1078c72ad60 |
---|---|
78 uses uCollisions, uVariables, Math, uConsts, uVisualGearsList, uFloat, uSound, uRenderUtils, uWorld, uUtils; |
78 uses uCollisions, uVariables, Math, uConsts, uVisualGearsList, uFloat, uSound, uRenderUtils, uWorld, uUtils; |
79 |
79 |
80 procedure doStepFlake(Gear: PVisualGear; Steps: Longword); |
80 procedure doStepFlake(Gear: PVisualGear; Steps: Longword); |
81 var sign: real; |
81 var sign: real; |
82 moved, rising, outside: boolean; |
82 moved, rising, outside: boolean; |
83 vfc, vft: LongWord; |
83 vfc, vft, diff: LongWord; |
84 spawnMargin: LongInt; |
84 spawnMargin: LongInt; |
85 const |
85 const |
86 randMargin = 50; |
86 randMargin = 50; |
87 begin |
87 begin |
88 if SuddenDeathDmg then |
88 if SuddenDeathDmg then |
178 spawnMargin:= 200; |
178 spawnMargin:= 200; |
179 |
179 |
180 // flake fell far below map? |
180 // flake fell far below map? |
181 outside:= (not rising) and (round(Y) - spawnMargin + randMargin > LAND_HEIGHT); |
181 outside:= (not rising) and (round(Y) - spawnMargin + randMargin > LAND_HEIGHT); |
182 // if not, did it rise far above map? |
182 // if not, did it rise far above map? |
183 outside:= outside or (rising and (round(Y) < LAND_HEIGHT - 1024 - spawnMargin - randMargin)); |
183 outside:= outside or (rising and (round(Y) < LAND_HEIGHT - 1024 - randMargin)); |
184 |
184 |
185 // if flake left acceptable vertical area, respawn it opposite side |
185 // if flake left acceptable vertical area, respawn it opposite side |
186 if outside then |
186 if outside then |
187 begin |
187 begin |
188 X:= cLeftScreenBorder + random(cScreenSpace); |
|
189 if rising then |
188 if rising then |
190 Y:= Y + (1024 + spawnMargin + random(50)) |
189 begin |
190 if State = 0 then |
|
191 begin |
|
192 // fade out rising flake |
|
193 diff:= (LAND_HEIGHT - 1024 - randMargin) - round(Y); |
|
194 diff:= Min(diff*2, $FF); |
|
195 if diff >= $FF then |
|
196 begin |
|
197 diff:= $FF; |
|
198 State:= 1; |
|
199 end; |
|
200 Tint:= (Tint and $FFFFFF00) or ($FF - diff); |
|
201 end |
|
202 else |
|
203 begin |
|
204 Y:= LAND_HEIGHT + spawnMargin + random(50); |
|
205 moved:= true; |
|
206 State:= 0; |
|
207 Tint:= Tint or $FF; |
|
208 end; |
|
209 end |
|
191 else |
210 else |
211 begin |
|
192 Y:= Y - (1024 + spawnMargin + random(50)); |
212 Y:= Y - (1024 + spawnMargin + random(50)); |
193 moved:= true; |
213 moved:= true; |
214 end; |
|
215 if moved then |
|
216 X:= cLeftScreenBorder + random(cScreenSpace); |
|
194 end; |
217 end; |
195 |
218 |
196 if moved then |
219 if moved then |
197 begin |
220 begin |
198 Angle:= random(360); |
221 Angle:= random(360); |