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