hedgewars/uWorld.pas
changeset 3407 dcc129c4352e
parent 3405 8fdb08497bf1
child 3434 6af73e7f2438
equal deleted inserted replaced
3406:f4bdebced042 3407:dcc129c4352e
    49 procedure ShowMission(caption, subcaption, text: ansistring; icon, time : LongInt);
    49 procedure ShowMission(caption, subcaption, text: ansistring; icon, time : LongInt);
    50 procedure HideMission;
    50 procedure HideMission;
    51 procedure ShakeCamera(amount: LongWord);
    51 procedure ShakeCamera(amount: LongWord);
    52 
    52 
    53 implementation
    53 implementation
    54 uses    uStore, uMisc, uTeams, uIO, uConsole, uKeys, uLocale, uSound, uAmmos, uVisualGears, uChat, uLandTexture, uLand, GLunit;
    54 uses    uStore, uMisc, uTeams, uIO, uKeys, uLocale, uSound, uAmmos, uVisualGears, uChat, uLandTexture, uLand, GLunit;
    55 
    55 
    56 type TCaptionStr = record
    56 type TCaptionStr = record
    57                    Tex: PTexture;
    57                    Tex: PTexture;
    58                    EndTime: LongWord;
    58                    EndTime: LongWord;
    59                    end;
    59                    end;
   378         glDrawArrays(GL_TRIANGLE_FAN, 0, Length(VertexBuffer));
   378         glDrawArrays(GL_TRIANGLE_FAN, 0, Length(VertexBuffer));
   379 
   379 
   380         glDisableClientState(GL_VERTEX_ARRAY);
   380         glDisableClientState(GL_VERTEX_ARRAY);
   381         glDisableClientState(GL_COLOR_ARRAY);
   381         glDisableClientState(GL_COLOR_ARRAY);
   382 
   382 
   383         Tint($FF, $FF, $FF, $FF); // disable coloring
   383         glColor4ub($FF, $FF, $FF, $FF); // must not be Tint() as color array seems to stay active and color reset is required
   384         glEnable(GL_TEXTURE_2D);
   384         glEnable(GL_TEXTURE_2D);
   385     end;
   385     end;
   386 end;
   386 end;
   387 
   387 
   388 procedure DrawWaves(Dir, dX, dY: LongInt; tnt: Byte);
   388 procedure DrawWaves(Dir, dX, dY: LongInt; tnt: Byte);
   390     lw, waves, shift: GLfloat;
   390     lw, waves, shift: GLfloat;
   391 begin
   391 begin
   392 lw:= wScreen / cScaleFactor;
   392 lw:= wScreen / cScaleFactor;
   393 waves:= lw * 2 / cWaveWidth;
   393 waves:= lw * 2 / cWaveWidth;
   394 
   394 
   395 Tint((tnt * WaterColorArray[2].r div 255) + (255-tnt),
   395 Tint(LongInt(tnt) * WaterColorArray[2].r div 255 + 255 - tnt,
   396      (tnt * WaterColorArray[2].g div 255) + (255-tnt),
   396      LongInt(tnt) * WaterColorArray[2].g div 255 + 255 - tnt,
   397      (tnt * WaterColorArray[2].b div 255) + (255-tnt),
   397      LongInt(tnt) * WaterColorArray[2].b div 255 + 255 - tnt,
   398       255
   398      255
   399 );
   399 );
   400 
   400 
   401 glBindTexture(GL_TEXTURE_2D, SpritesData[sprWater].Texture^.id);
   401 glBindTexture(GL_TEXTURE_2D, SpritesData[sprWater].Texture^.id);
   402 
   402 
   403 VertexBuffer[0].X:= -lw;
   403 VertexBuffer[0].X:= -lw;
   765     end
   765     end
   766     else
   766     else
   767         if WindBarWidth < 0 then
   767         if WindBarWidth < 0 then
   768         begin
   768         begin
   769             {$WARNINGS OFF}
   769             {$WARNINGS OFF}
   770             r.x:= (WindBarWidth + RealTicks shr 6) mod 8;
   770             r.x:= (Longword(WindBarWidth) + RealTicks shr 6) mod 8;
   771             {$WARNINGS ON}
   771             {$WARNINGS ON}
   772             r.y:= 0;
   772             r.y:= 0;
   773             r.w:= - WindBarWidth;
   773             r.w:= - WindBarWidth;
   774             r.h:= 13;
   774             r.h:= 13;
   775             DrawSpriteFromRect(sprWindL, r, (cScreenWidth shr 1) - offsetY + 74 + WindBarWidth, cScreenHeight - offsetX + 2, 13, 0);
   775             DrawSpriteFromRect(sprWindL, r, (cScreenWidth shr 1) - offsetY + 74 + WindBarWidth, cScreenHeight - offsetX + 2, 13, 0);
   804 inc(Frames);
   804 inc(Frames);
   805 
   805 
   806 if cShowFPS or (GameType = gmtDemo) then inc(CountTicks, Lag);
   806 if cShowFPS or (GameType = gmtDemo) then inc(CountTicks, Lag);
   807 if (GameType = gmtDemo) and (CountTicks >= 1000) then
   807 if (GameType = gmtDemo) and (CountTicks >= 1000) then
   808    begin
   808    begin
   809    i:=GameTicks div 60000;
   809    i:=GameTicks div 1000;
   810    t:=(GameTicks-(i*60000)) div 1000;
   810    t:= i mod 60;
   811    s:='';
   811    s:= inttostr(t);
   812    if i<10 then s:='0';
   812    if t < 10 then s:= '0' + s;
   813    s:= s+inttostr(i)+':';
   813    i:= i div 60;
   814    if t<10 then s:=s+'0';
   814    t:= i mod 60;
   815    s:= s+inttostr(t);
   815    s:= inttostr(t) + ':' + s;
       
   816    if t < 10 then s:= '0' + s;
       
   817    s:= inttostr(i div 60) + ':' + s;
       
   818    
   816    if timeTexture <> nil then FreeTexture(timeTexture);
   819    if timeTexture <> nil then FreeTexture(timeTexture);
   817    tmpSurface:= TTF_RenderUTF8_Blended(Fontz[fnt16].Handle, Str2PChar(s), cWhiteColorChannels);
   820    tmpSurface:= TTF_RenderUTF8_Blended(Fontz[fnt16].Handle, Str2PChar(s), cWhiteColorChannels);
   818    tmpSurface:= doSurfaceConversion(tmpSurface);
   821    tmpSurface:= doSurfaceConversion(tmpSurface);
   819    timeTexture:= Surface2Tex(tmpSurface, false);
   822    timeTexture:= Surface2Tex(tmpSurface, false);
   820    SDL_FreeSurface(tmpSurface)
   823    SDL_FreeSurface(tmpSurface)