170 r.h:= 19; |
171 r.h:= 19; |
171 |
172 |
172 DrawRoundRect(@r, cWhiteColor, cNearBlackColor, texsurf, true); |
173 DrawRoundRect(@r, cWhiteColor, cNearBlackColor, texsurf, true); |
173 |
174 |
174 // overwrite flag for cpu teams and keep players from using it |
175 // overwrite flag for cpu teams and keep players from using it |
175 if (Hedgehogs[0].Gear <> nil) and (Hedgehogs[0].BotLevel > 0) then |
176 foundBot:= false; |
176 if Flag = 'hedgewars' then |
177 maxLevel:= -1; |
177 Flag:= 'cpu' |
178 for i:= 0 to cMaxHHIndex do |
178 else if Flag = 'cpu' then |
179 with Hedgehogs[i] do |
179 Flag:= 'hedgewars'; |
180 if (Gear <> nil) and (BotLevel > 0) then |
|
181 begin |
|
182 foundBot:= true; |
|
183 // initially was going to do the highest botlevel of the team, but for now, just apply if entire team has same bot level |
|
184 if maxLevel = -1 then maxLevel:= BotLevel |
|
185 else if (maxLevel > 0) and (maxLevel <> BotLevel) then maxLevel:= 0; |
|
186 //if (maxLevel > 0) and (BotLevel < maxLevel) then maxLevel:= BotLevel |
|
187 end |
|
188 else if Gear <> nil then maxLevel:= 0; |
|
189 |
|
190 if foundBot then |
|
191 begin |
|
192 // disabled the plain flag - I think it looks ok even w/ full bars obscuring CPU |
|
193 //if (maxLevel > 0) and (maxLevel < 3) then Flag:= 'cpu_plain' else |
|
194 Flag:= 'cpu' |
|
195 end |
|
196 else if (Flag = 'cpu') or (Flag = 'cpu_plain') then |
|
197 Flag:= 'hedgewars'; |
180 |
198 |
181 flagsurf:= LoadImage(UserPathz[ptFlags] + '/' + Flag, ifNone); |
199 flagsurf:= LoadImage(UserPathz[ptFlags] + '/' + Flag, ifNone); |
182 if flagsurf = nil then |
200 if flagsurf = nil then |
183 flagsurf:= LoadImage(Pathz[ptFlags] + '/' + Flag, ifNone); |
201 flagsurf:= LoadImage(Pathz[ptFlags] + '/' + Flag, ifNone); |
184 if flagsurf = nil then |
202 if flagsurf = nil then |
185 flagsurf:= LoadImage(UserPathz[ptFlags] + '/hedgewars', ifNone); |
203 flagsurf:= LoadImage(UserPathz[ptFlags] + '/hedgewars', ifNone); |
186 if flagsurf = nil then |
204 if flagsurf = nil then |
187 flagsurf:= LoadImage(Pathz[ptFlags] + '/hedgewars', ifNone); |
205 flagsurf:= LoadImage(Pathz[ptFlags] + '/hedgewars', ifNone); |
188 TryDo(flagsurf <> nil, 'Failed to load flag "' + Flag + '" as well as the default flag', true); |
206 TryDo(flagsurf <> nil, 'Failed to load flag "' + Flag + '" as well as the default flag', true); |
|
207 |
|
208 case maxLevel of |
|
209 1: copyToXY(SpritesData[sprBotlevels].Surface, flagsurf, 0, 0); |
|
210 2: copyToXYFromRect(SpritesData[sprBotlevels].Surface, flagsurf, 5, 2, 17, 13, 5, 2); |
|
211 3: copyToXYFromRect(SpritesData[sprBotlevels].Surface, flagsurf, 9, 5, 13, 10, 9, 5); |
|
212 4: copyToXYFromRect(SpritesData[sprBotlevels].Surface, flagsurf, 13, 9, 9, 6, 13, 9); |
|
213 5: copyToXYFromRect(SpritesData[sprBotlevels].Surface, flagsurf, 17, 11, 5, 4, 17, 11) |
|
214 end; |
|
215 |
189 copyToXY(flagsurf, texsurf, 2, 2); |
216 copyToXY(flagsurf, texsurf, 2, 2); |
190 SDL_FreeSurface(flagsurf); |
217 SDL_FreeSurface(flagsurf); |
191 flagsurf:= nil; |
218 flagsurf:= nil; |
|
219 |
192 |
220 |
193 // restore black border pixels inside the flag |
221 // restore black border pixels inside the flag |
194 PLongwordArray(texsurf^.pixels)^[32 * 2 + 2]:= cNearBlackColor; |
222 PLongwordArray(texsurf^.pixels)^[32 * 2 + 2]:= cNearBlackColor; |
195 PLongwordArray(texsurf^.pixels)^[32 * 2 + 23]:= cNearBlackColor; |
223 PLongwordArray(texsurf^.pixels)^[32 * 2 + 23]:= cNearBlackColor; |
196 PLongwordArray(texsurf^.pixels)^[32 * 16 + 2]:= cNearBlackColor; |
224 PLongwordArray(texsurf^.pixels)^[32 * 16 + 2]:= cNearBlackColor; |
197 PLongwordArray(texsurf^.pixels)^[32 * 16 + 23]:= cNearBlackColor; |
225 PLongwordArray(texsurf^.pixels)^[32 * 16 + 23]:= cNearBlackColor; |
198 |
226 |
|
227 |
199 FlagTex:= Surface2Tex(texsurf, false); |
228 FlagTex:= Surface2Tex(texsurf, false); |
200 SDL_FreeSurface(texsurf); |
229 SDL_FreeSurface(texsurf); |
201 texsurf:= nil; |
230 texsurf:= nil; |
202 |
231 |
203 AIKillsTex := RenderStringTex(inttostr(stats.AIKills), Clan^.Color, fnt16); |
232 AIKillsTex := RenderStringTex(inttostr(stats.AIKills), Clan^.Color, fnt16); |
204 |
233 |
205 dec(drY, r.h + 2); |
234 dec(drY, r.h + 2); |
206 DrawHealthY:= drY; |
235 DrawHealthY:= drY; |
207 for i:= 0 to 7 do |
236 for i:= 0 to cMaxHHIndex do |
208 with Hedgehogs[i] do |
237 with Hedgehogs[i] do |
209 if Gear <> nil then |
238 if Gear <> nil then |
210 begin |
239 begin |
211 NameTagTex:= RenderStringTexLim(Name, Clan^.Color, fnt16, cTeamHealthWidth); |
240 NameTagTex:= RenderStringTexLim(Name, Clan^.Color, fnt16, cTeamHealthWidth); |
212 if Hat <> 'NoHat' then |
241 if Hat <> 'NoHat' then |