hedgewars/uWorld.pas
changeset 3107 1fa539758c10
parent 3104 6cdc45b3b8a6
child 3110 c8d7c852e26a
equal deleted inserted replaced
3106:3610efab8a32 3107:1fa539758c10
   137 
   137 
   138 // modified damage modificator?
   138 // modified damage modificator?
   139 if cDamagePercent <> 100 then
   139 if cDamagePercent <> 100 then
   140     g:= AddGoal(g, gfAny, gidDamageModifier, cDamagePercent);
   140     g:= AddGoal(g, gfAny, gidDamageModifier, cDamagePercent);
   141 
   141 
       
   142 // fade in
       
   143 ScreenFade:= sfFromBlack;
       
   144 ScreenFadeValue:= sfMax;
       
   145 ScreenFadeSpeed:= 1;
       
   146 
   142 // modified mine timers?
   147 // modified mine timers?
   143 if cMinesTime <> 3000 then
   148 if cMinesTime <> 3000 then
   144     begin
   149     begin
   145     if cMinesTime = 0 then
   150     if cMinesTime = 0 then
   146         g:= AddGoal(g, gfMines, gidNoMineTimer)
   151         g:= AddGoal(g, gfMines, gidNoMineTimer)
   161 SDL_WarpMouse(cScreenWidth div 2, cScreenHeight div 2);
   166 SDL_WarpMouse(cScreenWidth div 2, cScreenHeight div 2);
   162 prevPoint.X:= 0;
   167 prevPoint.X:= 0;
   163 prevPoint.Y:= cScreenHeight div 2;
   168 prevPoint.Y:= cScreenHeight div 2;
   164 WorldDx:=  - (LAND_WIDTH div 2) + cScreenWidth div 2;
   169 WorldDx:=  - (LAND_WIDTH div 2) + cScreenWidth div 2;
   165 WorldDy:=  - (LAND_HEIGHT - (playHeight div 2)) + (cScreenHeight div 2);
   170 WorldDy:=  - (LAND_HEIGHT - (playHeight div 2)) + (cScreenHeight div 2);
   166 AMxShift:= 210
   171 AMxShift:= 210;
   167 end;
   172 end;
   168 
   173 
   169 procedure ShowAmmoMenu;
   174 procedure ShowAmmoMenu;
   170 const MENUSPEED = 15;
   175 const MENUSPEED = 15;
   171 var x, y, i, t, l, g: LongInt;
   176 var x, y, i, t, l, g: LongInt;
   523 // Target
   528 // Target
   524 if (TargetPoint.X <> NoPointX) and (CurrentTeam <> nil) and (CurrentHedgehog <> nil) then
   529 if (TargetPoint.X <> NoPointX) and (CurrentTeam <> nil) and (CurrentHedgehog <> nil) then
   525     begin
   530     begin
   526     with PHedgehog(CurrentHedgehog)^ do
   531     with PHedgehog(CurrentHedgehog)^ do
   527         begin
   532         begin
   528         if (Ammo^[CurSlot, CurAmmo].AmmoType = amBee) then
   533 //        if (Ammo^[CurSlot, CurAmmo].AmmoType = amBee) then
   529             DrawRotatedF(sprTargetBee, TargetPoint.X + WorldDx, TargetPoint.Y + WorldDy, 0, 0, (RealTicks shr 3) mod 360)
   534 //            DrawRotatedF(sprTargetBee, TargetPoint.X + WorldDx, TargetPoint.Y + WorldDy, 0, 0, (RealTicks shr 3) mod 360)
   530         else
   535 //        else
   531             DrawRotatedF(sprTargetP, TargetPoint.X + WorldDx, TargetPoint.Y + WorldDy, 0, 0, (RealTicks shr 3) mod 360);
   536             DrawRotatedF(sprTargetP, TargetPoint.X + WorldDx, TargetPoint.Y + WorldDy, 0, 0, (RealTicks shr 3) mod 360);
   532         end;
   537         end;
   533     end;
   538     end;
   534 {$WARNINGS ON}
   539 {$WARNINGS ON}
   535 
   540 
   723 DrawChat;
   728 DrawChat;
   724 
   729 
   725 if fastUntilLag then DrawCentered(0, (cScreenHeight shr 1), SyncTexture);
   730 if fastUntilLag then DrawCentered(0, (cScreenHeight shr 1), SyncTexture);
   726 if isPaused then DrawCentered(0, (cScreenHeight shr 1), PauseTexture);
   731 if isPaused then DrawCentered(0, (cScreenHeight shr 1), PauseTexture);
   727 
   732 
   728 if missionTimer <> 0 then
   733 if not isFirstFrame and (missionTimer <> 0) then
   729     begin
   734     begin
   730     if missionTimer > 0 then dec(missionTimer, Lag);
   735     if missionTimer > 0 then dec(missionTimer, Lag);
   731     if missionTimer < 0 then missionTimer:= 0; // avoid subtracting below 0
   736     if missionTimer < 0 then missionTimer:= 0; // avoid subtracting below 0
   732     if missionTex <> nil then
   737     if missionTex <> nil then
   733         DrawCentered(0, min((cScreenHeight shr 1) + 100, cScreenHeight - 48 - missionTex^.h), missionTex);
   738         DrawCentered(0, min((cScreenHeight shr 1) + 100, cScreenHeight - 48 - missionTex^.h), missionTex);
   813                                     i);
   818                                     i);
   814          end;
   819          end;
   815    DrawSprite(sprArrow, CursorPoint.X, cScreenHeight - CursorPoint.Y, (RealTicks shr 6) mod 8)
   820    DrawSprite(sprArrow, CursorPoint.X, cScreenHeight - CursorPoint.Y, (RealTicks shr 6) mod 8)
   816    end;
   821    end;
   817 
   822 
   818 
       
   819 glDisable(GL_TEXTURE_2D);
   823 glDisable(GL_TEXTURE_2D);
   820 glDisable(GL_BLEND)
   824 
       
   825 if ScreenFade <> sfNone then
       
   826     begin
       
   827     if not isFirstFrame then
       
   828         case ScreenFade of
       
   829             sfToBlack, sfToWhite:     if ScreenFadeValue + Lag * ScreenFadeSpeed < sfMax then
       
   830                                           inc(ScreenFadeValue, Lag * ScreenFadeSpeed)
       
   831                                       else
       
   832                                           ScreenFade:= sfNone;
       
   833             sfFromBlack, sfFromWhite: if ScreenFadeValue - Lag * ScreenFadeSpeed > 0 then
       
   834                                           dec(ScreenFadeValue, Lag * ScreenFadeSpeed)
       
   835                                       else
       
   836                                           ScreenFade:= sfNone;
       
   837             end;
       
   838     if ScreenFade <> sfNone then
       
   839         begin
       
   840         case ScreenFade of
       
   841             sfToBlack, sfFromBlack: glColor4f(0, 0, 0, ScreenFadeValue / 1000);
       
   842             sfToWhite, sfFromWhite: glColor4f(1, 1, 1, ScreenFadeValue / 1000);
       
   843             end;
       
   844         glBegin(GL_TRIANGLE_FAN);
       
   845         glVertex3f(-cScreenWidth, cScreenHeight, 0);
       
   846         glVertex3f(-cScreenWidth, 0, 0);
       
   847         glVertex3f(cScreenWidth, 0, 0);
       
   848         glVertex3f(cScreenWidth, cScreenHeight, 0);
       
   849         glEnd;
       
   850         glColor4f(1, 1, 1, 1)
       
   851         end
       
   852     end;
       
   853 
       
   854 glDisable(GL_BLEND);
       
   855 isFirstFrame:= false
   821 end;
   856 end;
   822 
   857 
   823 procedure AddCaption(s: shortstring; Color: Longword; Group: TCapGroup);
   858 procedure AddCaption(s: shortstring; Color: Longword; Group: TCapGroup);
   824 begin
   859 begin
   825 //if Group in [capgrpGameState] then WriteLnToConsole(s);
   860 //if Group in [capgrpGameState] then WriteLnToConsole(s);