130 fi: THWFont; |
130 fi: THWFont; |
131 s: string; |
131 s: string; |
132 tmpsurf: PSDL_Surface; |
132 tmpsurf: PSDL_Surface; |
133 |
133 |
134 procedure WriteNames(Font: THWFont); |
134 procedure WriteNames(Font: THWFont); |
135 var Team: PTeam; |
135 var t: LongInt; |
136 i: LongInt; |
136 i: LongInt; |
137 r, rr: TSDL_Rect; |
137 r, rr: TSDL_Rect; |
138 drY: LongInt; |
138 drY: LongInt; |
139 begin |
139 begin |
140 r.x:= 0; |
140 r.x:= 0; |
141 r.y:= 272; |
141 r.y:= 272; |
142 drY:= cScreenHeight - 4; |
142 drY:= cScreenHeight - 4; |
143 Team:= TeamsList; |
143 for t:= 0 to Pred(TeamsCount) do |
144 while Team<>nil do |
144 with TeamsArray[t]^ do |
145 begin |
145 begin |
146 r.w:= 104; |
146 r.w:= 104; |
147 Team^.NameTag:= RenderString(Team^.TeamName, Team^.Color, Font); |
147 NameTag:= RenderString(TeamName, Color, Font); |
148 r.w:= cTeamHealthWidth + 5; |
148 r.w:= cTeamHealthWidth + 5; |
149 r.h:= Team^.NameTag^.h; |
149 r.h:= NameTag^.h; |
150 DrawRoundRect(@r, cWhiteColor, cColorNearBlack, StoreSurface, true); |
150 DrawRoundRect(@r, cWhiteColor, cColorNearBlack, StoreSurface, true); |
151 Team^.HealthRect:= r; |
151 HealthRect:= r; |
152 rr:= r; |
152 rr:= r; |
153 inc(rr.x, 2); dec(rr.w, 4); inc(rr.y, 2); dec(rr.h, 4); |
153 inc(rr.x, 2); dec(rr.w, 4); inc(rr.y, 2); dec(rr.h, 4); |
154 DrawRoundRect(@rr, Team^.AdjColor, Team^.AdjColor, StoreSurface, false); |
154 DrawRoundRect(@rr, AdjColor, AdjColor, StoreSurface, false); |
155 inc(r.y, r.h); |
155 inc(r.y, r.h); |
156 dec(drY, r.h + 2); |
156 dec(drY, r.h + 2); |
157 Team^.DrawHealthY:= drY; |
157 DrawHealthY:= drY; |
158 for i:= 0 to 7 do |
158 for i:= 0 to 7 do |
159 with Team^.Hedgehogs[i] do |
159 with Hedgehogs[i] do |
160 if Gear <> nil then |
160 if Gear <> nil then |
161 NameTag:= RenderString(Name, Team^.Color, fnt16); |
161 NameTag:= RenderString(Name, Color, fnt16); |
162 Team:= Team^.Next |
|
163 end; |
162 end; |
164 end; |
163 end; |
165 |
164 |
166 procedure MakeCrossHairs; |
165 procedure MakeCrossHairs; |
167 var Team: PTeam; |
166 var t: LongInt; |
168 tmpsurf: PSDL_Surface; |
167 tmpsurf: PSDL_Surface; |
169 s: string; |
168 s: string; |
170 begin |
169 begin |
171 s:= Pathz[ptGraphics] + '/' + cCHFileName; |
170 s:= Pathz[ptGraphics] + '/' + cCHFileName; |
172 tmpsurf:= LoadImage(s, true, true, false); |
171 tmpsurf:= LoadImage(s, true, true, false); |
173 |
172 |
174 Team:= TeamsList; |
173 for t:= 0 to Pred(TeamsCount) do |
175 while Team<>nil do |
174 with TeamsArray[t]^ do |
176 begin |
175 begin |
177 Team^.CrosshairSurf:= SDL_CreateRGBSurface(SDL_HWSURFACE, tmpsurf^.w, tmpsurf^.h, cBits, PixelFormat^.RMask, PixelFormat^.GMask, PixelFormat^.BMask, PixelFormat^.AMask); |
176 CrosshairSurf:= SDL_CreateRGBSurface(SDL_HWSURFACE, tmpsurf^.w, tmpsurf^.h, cBits, PixelFormat^.RMask, PixelFormat^.GMask, PixelFormat^.BMask, PixelFormat^.AMask); |
178 TryDo(Team^.CrosshairSurf <> nil, errmsgCreateSurface, true); |
177 TryDo(CrosshairSurf <> nil, errmsgCreateSurface, true); |
179 SDL_FillRect(Team^.CrosshairSurf, nil, Team^.AdjColor); |
178 SDL_FillRect(CrosshairSurf, nil, AdjColor); |
180 SDL_UpperBlit(tmpsurf, nil, Team^.CrosshairSurf, nil); |
179 SDL_UpperBlit(tmpsurf, nil, CrosshairSurf, nil); |
181 TryDo(SDL_SetColorKey(Team^.CrosshairSurf, SDL_SRCCOLORKEY or SDL_RLEACCEL, 0) = 0, errmsgTransparentSet, true); |
180 TryDo(SDL_SetColorKey(CrosshairSurf, SDL_SRCCOLORKEY or SDL_RLEACCEL, 0) = 0, errmsgTransparentSet, true); |
182 Team:= Team^.Next |
|
183 end; |
181 end; |
184 |
182 |
185 SDL_FreeSurface(tmpsurf) |
183 SDL_FreeSurface(tmpsurf) |
186 end; |
184 end; |
187 |
185 |
188 procedure InitHealth; |
186 procedure InitHealth; |
189 var p: PTeam; |
187 var i, t: LongInt; |
190 i: LongInt; |
|
191 begin |
188 begin |
192 p:= TeamsList; |
189 for t:= 0 to Pred(TeamsCount) do |
193 while p <> nil do |
190 if TeamsArray[t] <> nil then |
|
191 with TeamsArray[t]^ do |
194 begin |
192 begin |
195 for i:= 0 to cMaxHHIndex do |
193 for i:= 0 to cMaxHHIndex do |
196 if p^.Hedgehogs[i].Gear <> nil then |
194 if Hedgehogs[i].Gear <> nil then |
197 RenderHealth(p^.Hedgehogs[i]); |
195 RenderHealth(Hedgehogs[i]); |
198 p:= p^.Next |
|
199 end |
196 end |
200 end; |
197 end; |
201 |
198 |
202 procedure LoadGraves; |
199 procedure LoadGraves; |
203 var p: PTeam; |
200 var t, l: LongInt; |
204 l: LongInt; |
|
205 begin |
201 begin |
206 p:= TeamsList; |
|
207 l:= 512; |
202 l:= 512; |
208 while p <> nil do |
203 for t:= 0 to Pred(TeamsCount) do |
|
204 if TeamsArray[t] <> nil then |
|
205 with TeamsArray[t]^ do |
209 begin |
206 begin |
210 dec(l, 32); |
207 dec(l, 32); |
211 if p^.GraveName = '' then p^.GraveName:= 'Simple'; |
208 if GraveName = '' then GraveName:= 'Simple'; |
212 LoadToSurface(Pathz[ptGraves] + '/' + p^.GraveName, StoreSurface, l, 512); |
209 LoadToSurface(Pathz[ptGraves] + '/' + GraveName, StoreSurface, l, 512); |
213 p^.GraveRect.x:= l; |
210 GraveRect.x:= l; |
214 p^.GraveRect.y:= 512; |
211 GraveRect.y:= 512; |
215 p^.GraveRect.w:= 32; |
212 GraveRect.w:= 32; |
216 p^.GraveRect.h:= 256; |
213 GraveRect.h:= 256; |
217 p:= p^.Next |
|
218 end |
214 end |
219 end; |
215 end; |
220 |
216 |
221 procedure GetSkyColor; |
217 procedure GetSkyColor; |
222 var p: PByteArray; |
218 var p: PByteArray; |