36 end; |
36 end; |
37 |
37 |
38 function AddVisualGear(X, Y: LongInt; Kind: TVisualGearType; dX, dY: hwFloat): PVisualGear; |
38 function AddVisualGear(X, Y: LongInt; Kind: TVisualGearType; dX, dY: hwFloat): PVisualGear; |
39 procedure ProcessVisualGears(Steps: Longword); |
39 procedure ProcessVisualGears(Steps: Longword); |
40 procedure DrawVisualGears(); |
40 procedure DrawVisualGears(); |
41 //procedure AddClouds; |
41 procedure AddClouds; |
42 |
42 |
43 var VisualGearsList: PVisualGear = nil; |
43 var VisualGearsList: PVisualGear = nil; |
44 |
44 |
45 implementation |
45 implementation |
46 uses uWorld, uMisc, uStore, uConsole, uSound, uTeams, uRandom, uCollisions, |
46 uses uWorld, uMisc, uStore, GL; |
47 uLand, uIO, uLandGraphics, uAIMisc, uLocale, uAI, uAmmos, uTriggers, GL; |
|
48 |
47 |
|
48 // ================================================================== |
49 procedure doStepFlake(Gear: PVisualGear; Steps: Longword); |
49 procedure doStepFlake(Gear: PVisualGear; Steps: Longword); |
50 begin |
50 begin |
51 end; |
51 end; |
52 |
52 |
53 // ============= |
53 procedure doStepCloud(Gear: PVisualGear; Steps: Longword); |
|
54 begin |
|
55 Gear^.X:= Gear^.X + (cWindSpeed * 200 + Gear^.dX) * Steps; |
|
56 if hwRound(Gear^.Y) > -160 then Gear^.dY:= Gear^.dY - _1div50000 |
|
57 else Gear^.dY:= Gear^.dY + _1div50000; |
|
58 Gear^.Y:= Gear^.Y + Gear^.dY * Steps; |
|
59 if hwRound(Gear^.X) < -cScreenWidth - 256 then Gear^.X:= int2hwFloat(cScreenWidth + 2048) else |
|
60 if hwRound(Gear^.X) > cScreenWidth + 2048 then Gear^.X:= int2hwFloat(-cScreenWidth - 256) |
|
61 end; |
|
62 |
|
63 // ================================================================== |
54 const doStepHandlers: array[TVisualGearType] of TVGearStepProcedure = |
64 const doStepHandlers: array[TVisualGearType] of TVGearStepProcedure = |
55 ( |
65 ( |
56 @doStepFlake |
66 @doStepFlake, |
|
67 @doStepCloud |
57 ); |
68 ); |
58 |
69 |
59 function AddVisualGear(X, Y: LongInt; Kind: TVisualGearType; dX, dY: hwFloat): PVisualGear; |
70 function AddVisualGear(X, Y: LongInt; Kind: TVisualGearType; dX, dY: hwFloat): PVisualGear; |
60 var Result: PVisualGear; |
71 var Result: PVisualGear; |
61 begin |
72 begin |
65 Result^.Y:= int2hwFloat(Y); |
76 Result^.Y:= int2hwFloat(Y); |
66 Result^.Kind := Kind; |
77 Result^.Kind := Kind; |
67 Result^.dX:= dX; |
78 Result^.dX:= dX; |
68 Result^.dY:= dY; |
79 Result^.dY:= dY; |
69 Result^.doStep:= doStepHandlers[Kind]; |
80 Result^.doStep:= doStepHandlers[Kind]; |
|
81 |
|
82 case Kind of |
|
83 vgtCloud: Result^.State:= random(4); |
|
84 end; |
70 |
85 |
71 if VisualGearsList <> nil then |
86 if VisualGearsList <> nil then |
72 begin |
87 begin |
73 VisualGearsList^.PrevGear:= Result; |
88 VisualGearsList^.PrevGear:= Result; |
74 Result^.NextGear:= VisualGearsList |
89 Result^.NextGear:= VisualGearsList |
96 begin |
113 begin |
97 Gear:= VisualGearsList; |
114 Gear:= VisualGearsList; |
98 while Gear <> nil do |
115 while Gear <> nil do |
99 begin |
116 begin |
100 case Gear^.Kind of |
117 case Gear^.Kind of |
101 // gtCloud: DrawSprite(sprCloud, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.State, nil); |
|
102 vgtFlake: ; |
118 vgtFlake: ; |
|
119 vgtCloud: DrawSprite(sprCloud, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.State, nil); |
103 end; |
120 end; |
104 Gear:= Gear^.NextGear |
121 Gear:= Gear^.NextGear |
105 end; |
122 end; |
106 end; |
123 end; |
107 |
124 |
108 procedure AddClouds; |
125 procedure AddClouds; |
109 var i: LongInt; |
126 var i: LongInt; |
110 dx, dy: hwFloat; |
127 dx, dy: hwFloat; |
111 begin(* |
128 begin |
112 for i:= 0 to cCloudsNumber do |
129 for i:= 0 to cCloudsNumber do |
113 begin |
130 begin |
114 dx.isNegative:= random(2) = 1; |
131 dx.isNegative:= random(2) = 1; |
115 dx.QWordValue:= random(214748364); |
132 dx.QWordValue:= random(214748364); |
116 dy.isNegative:= (i and 1) = 1; |
133 dy.isNegative:= (i and 1) = 1; |
117 dy.QWordValue:= 21474836 + random(64424509); |
134 dy.QWordValue:= 21474836 + random(64424509); |
118 AddVisualGear( - cScreenWidth + i * ((cScreenWidth * 2 + 2304) div cCloudsNumber), -140, |
135 AddVisualGear( - cScreenWidth + i * ((cScreenWidth * 2 + 2304) div cCloudsNumber), -140, |
119 vgtCloud, dx, dy) |
136 vgtCloud, dx, dy) |
120 end*) |
137 end |
121 end; |
138 end; |
122 |
139 |
123 initialization |
140 initialization |
124 |
141 |
125 finalization |
142 finalization |