362 end; |
362 end; |
363 |
363 |
364 procedure ReadThemeInfo(var ThemeObjects: TThemeObjects; var SprayObjects: TSprayObjects); |
364 procedure ReadThemeInfo(var ThemeObjects: TThemeObjects; var SprayObjects: TSprayObjects); |
365 var s: shortstring; |
365 var s: shortstring; |
366 f: textfile; |
366 f: textfile; |
367 i, ii: LongInt; |
367 i, ii, numFlakes: LongInt; |
368 c1, c2: TSDL_Color; |
368 c1, c2: TSDL_Color; |
369 |
369 |
370 procedure CheckRect(Width, Height, x, y, w, h: LongWord); |
370 procedure CheckRect(Width, Height, x, y, w, h: LongWord); |
371 begin |
371 begin |
372 if (x + w > Width) then OutError('Object''s rectangle exceeds image: x + w (' + inttostr(x) + ' + ' + inttostr(w) + ') > Width (' + inttostr(Width) + ')', true); |
372 if (x + w > Width) then OutError('Object''s rectangle exceeds image: x + w (' + inttostr(x) + ' + ' + inttostr(w) + ') > Width (' + inttostr(Width) + ')', true); |
454 Readln(f, vobCount); |
454 Readln(f, vobCount); |
455 if vobCount > 0 then |
455 if vobCount > 0 then |
456 Readln(f, vobFramesCount, vobFrameTicks, vobVelocity, vobFallSpeed); |
456 Readln(f, vobFramesCount, vobFrameTicks, vobVelocity, vobFallSpeed); |
457 |
457 |
458 // adjust amount of flakes scaled by screen space |
458 // adjust amount of flakes scaled by screen space |
459 vobCount:= longint(vobCount) * cScreenSpace div LAND_WIDTH; |
459 vobCount:= longint(vobCount); |
|
460 numFlakes:= vobCount * cScreenSpace div LAND_WIDTH; |
460 |
461 |
461 if (cReducedQuality and rqKillFlakes) <> 0 then |
462 if (cReducedQuality and rqKillFlakes) <> 0 then |
462 vobCount:= 0; |
463 numFlakes:= 0; |
463 |
464 |
464 if Theme <> 'Snow' then |
465 if Theme <> 'Snow' then |
465 for i:= 0 to Pred(vobCount) do |
466 for i:= 0 to Pred(numFlakes) do |
466 AddVisualGear(cLeftScreenBorder + random(cScreenSpace), random(1024+200) - 100 + LAND_HEIGHT, vgtFlake) |
467 AddVisualGear(cLeftScreenBorder + random(cScreenSpace), random(1024+200) - 100 + LAND_HEIGHT, vgtFlake) |
467 else |
468 else |
468 for i:= 0 to Pred(vobCount div 3) do |
469 for i:= 0 to Pred(numFlakes div 3) do |
469 AddVisualGear(cLeftScreenBorder + random(cScreenSpace), random(1024+200) - 100 + LAND_HEIGHT, vgtFlake); |
470 AddVisualGear(cLeftScreenBorder + random(cScreenSpace), random(1024+200) - 100 + LAND_HEIGHT, vgtFlake); |
470 |
471 |
471 Close(f); |
472 Close(f); |
472 {$I+} |
473 {$I+} |
473 TryDo(IOResult = 0, 'Bad data or cannot access file ' + cThemeCFGFilename, true); |
474 TryDo(IOResult = 0, 'Bad data or cannot access file ' + cThemeCFGFilename, true); |