20 interface |
20 interface |
21 uses SDLh; |
21 uses SDLh; |
22 {$include options.inc} |
22 {$include options.inc} |
23 |
23 |
24 procedure AddObjects(InSurface, Surface: PSDL_Surface); |
24 procedure AddObjects(InSurface, Surface: PSDL_Surface); |
|
25 procedure LoadThemeConfig; |
25 procedure BlitImageAndGenerateCollisionInfo(cpX, cpY: Longword; Image, Surface: PSDL_Surface); |
26 procedure BlitImageAndGenerateCollisionInfo(cpX, cpY: Longword; Image, Surface: PSDL_Surface); |
26 |
27 |
27 implementation |
28 implementation |
28 uses uLand, uStore, uConsts, uMisc, uConsole, uRandom, uVisualGears, uFloat; |
29 uses uLand, uStore, uConsts, uMisc, uConsole, uRandom, uVisualGears, uFloat, GL; |
29 const MaxRects = 256; |
30 const MaxRects = 256; |
30 MAXOBJECTRECTS = 16; |
31 MAXOBJECTRECTS = 16; |
31 MAXTHEMEOBJECTS = 32; |
32 MAXTHEMEOBJECTS = 32; |
32 |
33 |
33 type PRectArray = ^TRectsArray; |
34 type PRectArray = ^TRectsArray; |
54 objs: array[0..Pred(MAXTHEMEOBJECTS)] of TSprayObject |
55 objs: array[0..Pred(MAXTHEMEOBJECTS)] of TSprayObject |
55 end; |
56 end; |
56 |
57 |
57 var Rects: PRectArray; |
58 var Rects: PRectArray; |
58 RectCount: Longword; |
59 RectCount: Longword; |
|
60 ThemeObjects: TThemeObjects; |
|
61 SprayObjects: TSprayObjects; |
|
62 |
59 |
63 |
60 procedure BlitImageAndGenerateCollisionInfo(cpX, cpY: Longword; Image, Surface: PSDL_Surface); |
64 procedure BlitImageAndGenerateCollisionInfo(cpX, cpY: Longword; Image, Surface: PSDL_Surface); |
61 var p: PByteArray; |
65 var p: PByteArray; |
62 x, y: Longword; |
66 x, y: Longword; |
63 bpp: LongInt; |
67 bpp: LongInt; |
352 procedure ReadThemeInfo(var ThemeObjects: TThemeObjects; var SprayObjects: TSprayObjects); |
356 procedure ReadThemeInfo(var ThemeObjects: TThemeObjects; var SprayObjects: TSprayObjects); |
353 var s: string; |
357 var s: string; |
354 f: textfile; |
358 f: textfile; |
355 i, ii: LongInt; |
359 i, ii: LongInt; |
356 vobcount: Longword; |
360 vobcount: Longword; |
|
361 c1, c2: TSDL_Color; |
357 begin |
362 begin |
358 s:= Pathz[ptCurrTheme] + '/' + cThemeCFGFilename; |
363 s:= Pathz[ptCurrTheme] + '/' + cThemeCFGFilename; |
359 WriteLnToConsole('Reading objects info...'); |
364 WriteLnToConsole('Reading objects info...'); |
360 Assign(f, s); |
365 Assign(f, s); |
361 {$I-} |
366 {$I-} |
362 Reset(f); |
367 Reset(f); |
363 Readln(f, s); // skip sky color |
368 |
364 Readln(f, s); // skip border color |
369 // read sky and explosion border colors |
|
370 Readln(f, c1.r, c1.g, c1. b); |
|
371 Readln(f, c2.r, c2.g, c2. b); |
|
372 |
|
373 glClearColor(c1.r / 255, c1.g / 255, c1.b / 255, 0.99); // sky color |
|
374 cExplosionBorderColor:= c2.value or $FF000000; |
|
375 |
365 Readln(f, ThemeObjects.Count); |
376 Readln(f, ThemeObjects.Count); |
366 for i:= 0 to Pred(ThemeObjects.Count) do |
377 for i:= 0 to Pred(ThemeObjects.Count) do |
367 begin |
378 begin |
368 Readln(f, s); // filename |
379 Readln(f, s); // filename |
369 with ThemeObjects.objs[i] do |
380 with ThemeObjects.objs[i] do |
445 inc(i) |
456 inc(i) |
446 until (i > MaxCount) or not b; |
457 until (i > MaxCount) or not b; |
447 end; |
458 end; |
448 |
459 |
449 procedure AddObjects(InSurface, Surface: PSDL_Surface); |
460 procedure AddObjects(InSurface, Surface: PSDL_Surface); |
450 var ThemeObjects: TThemeObjects; |
|
451 SprayObjects: TSprayObjects; |
|
452 begin |
461 begin |
453 InitRects; |
462 InitRects; |
454 AddGirder(256, Surface); |
463 AddGirder(256, Surface); |
455 AddGirder(512, Surface); |
464 AddGirder(512, Surface); |
456 AddGirder(768, Surface); |
465 AddGirder(768, Surface); |
457 AddGirder(1024, Surface); |
466 AddGirder(1024, Surface); |
458 AddGirder(1280, Surface); |
467 AddGirder(1280, Surface); |
459 AddGirder(1536, Surface); |
468 AddGirder(1536, Surface); |
460 AddGirder(1792, Surface); |
469 AddGirder(1792, Surface); |
461 ReadThemeInfo(ThemeObjects, SprayObjects); |
|
462 AddThemeObjects(Surface, ThemeObjects, 8); |
470 AddThemeObjects(Surface, ThemeObjects, 8); |
463 AddProgress; |
471 AddProgress; |
464 SDL_UpperBlit(InSurface, nil, Surface, nil); |
472 SDL_UpperBlit(InSurface, nil, Surface, nil); |
465 AddSprayObjects(Surface, SprayObjects, 10); |
473 AddSprayObjects(Surface, SprayObjects, 10); |
466 FreeRects |
474 FreeRects |
467 end; |
475 end; |
468 |
476 |
|
477 procedure LoadThemeConfig; |
|
478 begin |
|
479 ReadThemeInfo(ThemeObjects, SprayObjects) |
|
480 end; |
|
481 |
469 end. |
482 end. |