hedgewars/uWorld.pas
changeset 1911 6283bd8a960b
parent 1906 644f93d8f148
child 1915 c357f5b55320
equal deleted inserted replaced
1910:ae0addb05791 1911:6283bd8a960b
   182 var i, t: LongInt;
   182 var i, t: LongInt;
   183     r: TSDL_Rect;
   183     r: TSDL_Rect;
   184     tdx, tdy: Double;
   184     tdx, tdy: Double;
   185     grp: TCapGroup;
   185     grp: TCapGroup;
   186     s: string[15];
   186     s: string[15];
       
   187     VertexBuffer: array [0..3] of TVertex2f;
   187 
   188 
   188     procedure DrawRepeated(spr: TSprite; Shift: LongInt);
   189     procedure DrawRepeated(spr: TSprite; Shift: LongInt);
   189     var i, w: LongInt;
   190     var i, w: LongInt;
   190     begin
   191     begin
   191     w:= SpritesData[spr].Width;
   192     w:= SpritesData[spr].Width;
   225 
   226 
   226 DrawLand(WorldDx, WorldDy);
   227 DrawLand(WorldDx, WorldDy);
   227 // Water
   228 // Water
   228 r.y:= WorldDy + cWaterLine + 32;
   229 r.y:= WorldDy + cWaterLine + 32;
   229 if r.y < cScreenHeight then
   230 if r.y < cScreenHeight then
   230    begin
   231 	begin
   231    if r.y < 0 then r.y:= 0;
   232 	if r.y < 0 then r.y:= 0;
   232 
   233 
   233    glDisable(GL_TEXTURE_2D);
   234 	glDisable(GL_TEXTURE_2D);
   234    glBegin(GL_QUADS);
   235 	VertexBuffer[0].X:= 0;
   235     glColor3ub(WaterColor.r, WaterColor.g, WaterColor. b); // water color
   236 	VertexBuffer[0].Y:= r.y;
   236     glVertex2i(0, r.y);
   237 	VertexBuffer[1].X:= cScreenWidth;
   237     glVertex2i(cScreenWidth, r.y);
   238 	VertexBuffer[1].Y:= r.y;
   238     glColor3ub(DeepWaterColor.r, DeepWaterColor.g, DeepWaterColor. b); // deep water color
   239 	VertexBuffer[2].X:= cScreenWidth;
   239     glVertex2i(cScreenWidth, cScreenHeight);
   240 	VertexBuffer[2].Y:= cScreenHeight;
   240     glVertex2i(0, cScreenHeight);
   241 	VertexBuffer[3].X:= 0;
   241    glEnd();
   242 	VertexBuffer[3].Y:= cScreenHeight;
   242    glColor4f(1, 1, 1, 1); // disable coloring
   243 
   243    glEnable(GL_TEXTURE_2D)
   244 	glEnableClientState (GL_COLOR_ARRAY);
   244    end;
   245 	glColorPointer(3, GL_UNSIGNED_BYTE, 0, @WaterColorArray[0]);
       
   246 
       
   247 	glEnableClientState(GL_VERTEX_ARRAY);
       
   248 	glVertexPointer(2, GL_FLOAT, 0, @VertexBuffer[0]);
       
   249 	
       
   250 	glDrawArrays(GL_TRIANGLE_FAN, 0, Length(VertexBuffer));
       
   251 
       
   252 	glEnableClientState(GL_COLOR_ARRAY);
       
   253 	glDisableClientState(GL_COLOR_ARRAY);
       
   254 
       
   255 	glColor4f(1, 1, 1, 1); // disable coloring
       
   256 	glEnable(GL_TEXTURE_2D)
       
   257 	end;
   245 
   258 
   246 // Attack bar
   259 // Attack bar
   247 if CurrentTeam <> nil then
   260 if CurrentTeam <> nil then
   248 	case AttackBar of
   261 	case AttackBar of
   249 (*        1: begin
   262 (*        1: begin