hedgewars/uWorld.pas
changeset 2724 601158aaa201
parent 2716 b9ca1bfca24f
child 2735 f2008d0ce3f8
equal deleted inserted replaced
2723:eaa6ac1e95ea 2724:601158aaa201
   339 var i, t: LongInt;
   339 var i, t: LongInt;
   340     r: TSDL_Rect;
   340     r: TSDL_Rect;
   341     tdx, tdy: Double;
   341     tdx, tdy: Double;
   342     grp: TCapGroup;
   342     grp: TCapGroup;
   343     s: string[15];
   343     s: string[15];
   344 {$IFDEF IPHONEOS}
       
   345     x,y: LongInt;
       
   346 {$ENDIF}
       
   347     offset: LongInt;
   344     offset: LongInt;
       
   345     scale: GLfloat;
   348 begin
   346 begin
   349 if ZoomValue < zoom then
   347 if ZoomValue < zoom then
   350 	begin
   348 	begin
   351 	zoom:= zoom - 0.002 * Lag;
   349 	zoom:= zoom - 0.002 * Lag;
   352 	if ZoomValue > zoom then zoom:= ZoomValue
   350 	if ZoomValue > zoom then zoom:= ZoomValue
   362 glEnable(GL_BLEND);
   360 glEnable(GL_BLEND);
   363 glEnable(GL_TEXTURE_2D);
   361 glEnable(GL_TEXTURE_2D);
   364 //glPushMatrix;
   362 //glPushMatrix;
   365 //glScalef(1.0, 1.0, 1.0);
   363 //glScalef(1.0, 1.0, 1.0);
   366 
   364 
   367 {$IFDEF IPHONEOS}
       
   368 SDL_GetMouseState(@x, @y);
       
   369 //WriteLnToConsole('x; ' + inttostr(x) + ' y: ' + inttostr(y));
       
   370 {$ENDIF}
       
   371 if not isPaused then MoveCamera;
   365 if not isPaused then MoveCamera;
   372 
   366 
   373 if not cReducedQuality then
   367 if not cReducedQuality then
   374     begin
   368     begin
   375     // background
   369     // background
   425 
   419 
   426 
   420 
   427 {$WARNINGS OFF}
   421 {$WARNINGS OFF}
   428 // Target
   422 // Target
   429 if TargetPoint.X <> NoPointX then DrawSprite(sprTargetP, TargetPoint.X + WorldDx - 16, TargetPoint.Y + WorldDy - 16, 0);
   423 if TargetPoint.X <> NoPointX then DrawSprite(sprTargetP, TargetPoint.X + WorldDx - 16, TargetPoint.Y + WorldDy - 16, 0);
   430 
       
   431 {$WARNINGS ON}
   424 {$WARNINGS ON}
   432 SetScale(2.0);
       
   433 
   425 
   434 {$IFDEF IPHONEOS}
   426 {$IFDEF IPHONEOS}
   435 offset:= 465;
   427 scale:= 1.5;
   436 {$ELSE}
   428 {$ELSE}
       
   429 scale:= 2.0;
       
   430 {$ENDIF}
       
   431 SetScale(scale);
       
   432 
       
   433 
       
   434 // Turn time
   437 offset:= 48;
   435 offset:= 48;
   438 {$ENDIF}
       
   439 // Turn time
       
   440 if TurnTimeLeft <> 0 then
   436 if TurnTimeLeft <> 0 then
   441    begin
   437    begin
   442    i:= Succ(Pred(TurnTimeLeft) div 1000);
   438    i:= Succ(Pred(TurnTimeLeft) div 1000);
   443    if i>99 then t:= 112
   439    if i>99 then t:= 112
   444       else if i>9 then t:= 96
   440       else if i>9 then t:= 96
   499 	end;
   495 	end;
   500 {$ENDIF}
   496 {$ENDIF}
   501 
   497 
   502 // Captions
   498 // Captions
   503 {$IFDEF IPHONEOS}
   499 {$IFDEF IPHONEOS}
   504 i:= 53;
   500 offset:= 49;
   505 {$ELSE}
   501 {$ELSE}
   506 if ((TrainingFlags and tfTimeTrial) <> 0) and (TimeTrialStartTime > 0) then i:= 48 else i:= 8;
   502 if ((TrainingFlags and tfTimeTrial) <> 0) and (TimeTrialStartTime > 0) then offset:= 48
       
   503 else offset:= 8;
   507 {$ENDIF}
   504 {$ENDIF}
   508 
   505 
   509 	for grp:= Low(TCapGroup) to High(TCapGroup) do
   506 	for grp:= Low(TCapGroup) to High(TCapGroup) do
   510 		with Captions[grp] do
   507 		with Captions[grp] do
   511 			if Tex <> nil then
   508 			if Tex <> nil then
   512 			begin
   509 			begin
   513 				DrawCentered(0, i, Tex);
   510 				DrawCentered(0, offset, Tex);
   514 				inc(i, Tex^.h + 2);
   511 				inc(offset, Tex^.h + 2);
   515 				if EndTime <= RealTicks then
   512 				if EndTime <= RealTicks then
   516 				begin
   513 				begin
   517 					FreeTexture(Tex);
   514 					FreeTexture(Tex);
   518 					Tex:= nil;
   515 					Tex:= nil;
   519 					EndTime:= 0
   516 					EndTime:= 0
   542 // Lag alert
   539 // Lag alert
   543 if isInLag then DrawSprite(sprLag, 32 - (cScreenWidth shr 1), 32, (RealTicks shr 7) mod 12);
   540 if isInLag then DrawSprite(sprLag, 32 - (cScreenWidth shr 1), 32, (RealTicks shr 7) mod 12);
   544 
   541 
   545 // Wind bar
   542 // Wind bar
   546 {$IFDEF IPHONEOS}
   543 {$IFDEF IPHONEOS}
   547 offset:= 450;
   544 offset:= 305;
   548 {$ELSE}
   545 {$ELSE}
   549 offset:= 30;
   546 offset:= 30;
   550 {$ENDIF}
   547 {$ENDIF}
   551 DrawSprite(sprWindBar, (cScreenWidth shr 1) - 180, cScreenHeight - offset, 0);
   548 DrawSprite(sprWindBar, (cScreenWidth shr 1) - 180, cScreenHeight - offset, 0);
   552 if WindBarWidth > 0 then
   549 if WindBarWidth > 0 then
   575 
   572 
   576 // Cursor
   573 // Cursor
   577 if isCursorVisible and bShowAmmoMenu then
   574 if isCursorVisible and bShowAmmoMenu then
   578    DrawSprite(sprArrow, CursorPoint.X, cScreenHeight - CursorPoint.Y, (RealTicks shr 6) mod 8);
   575    DrawSprite(sprArrow, CursorPoint.X, cScreenHeight - CursorPoint.Y, (RealTicks shr 6) mod 8);
   579 
   576 
   580 {$IFNDEF IPHONEOS}
       
   581 {* do not draw the chat because a) no input b) too little space*}
       
   582 DrawChat;
   577 DrawChat;
   583 {$ENDIF}
       
   584 
   578 
   585 if fastUntilLag then DrawCentered(0, (cScreenHeight shr 1), SyncTexture);
   579 if fastUntilLag then DrawCentered(0, (cScreenHeight shr 1), SyncTexture);
   586 if isPaused then DrawCentered(0, (cScreenHeight shr 1), PauseTexture);
   580 if isPaused then DrawCentered(0, (cScreenHeight shr 1), PauseTexture);
   587 
   581 
       
   582 // fps
       
   583 {$IFDEF IPHONEOS}
       
   584 offset:= 40;
       
   585 {$ELSE}
       
   586 offset:= 10;
       
   587 {$ENDIF}
   588 inc(Frames);
   588 inc(Frames);
   589 if cShowFPS then
   589 if cShowFPS then
   590    begin
   590    begin
   591    inc(CountTicks, Lag);
   591    inc(CountTicks, Lag);
   592    if CountTicks >= 1000 then
   592    if CountTicks >= 1000 then
   600       tmpSurface:= doSurfaceConversion(tmpSurface);
   600       tmpSurface:= doSurfaceConversion(tmpSurface);
   601       fpsTexture:= Surface2Tex(tmpSurface, false);
   601       fpsTexture:= Surface2Tex(tmpSurface, false);
   602       SDL_FreeSurface(tmpSurface)
   602       SDL_FreeSurface(tmpSurface)
   603       end;
   603       end;
   604    if fpsTexture <> nil then
   604    if fpsTexture <> nil then
   605       DrawTexture((cScreenWidth shr 1) - 50, 10, fpsTexture);
   605       DrawTexture((cScreenWidth shr 1) - 50, offset, fpsTexture);
   606    end;
   606    end;
   607 
   607 
       
   608 // lag warning (?)
   608 inc(SoundTimerTicks, Lag);
   609 inc(SoundTimerTicks, Lag);
   609 if SoundTimerTicks >= 50 then
   610 if SoundTimerTicks >= 50 then
   610    begin
   611    begin
   611    SoundTimerTicks:= 0;
   612    SoundTimerTicks:= 0;
   612    if cVolumeDelta <> 0 then
   613    if cVolumeDelta <> 0 then
   614       str(ChangeVolume(cVolumeDelta), s);
   615       str(ChangeVolume(cVolumeDelta), s);
   615       AddCaption(Format(trmsg[sidVolume], s), cWhiteColor, capgrpVolume)
   616       AddCaption(Format(trmsg[sidVolume], s), cWhiteColor, capgrpVolume)
   616       end
   617       end
   617    end;
   618    end;
   618 
   619 
   619 if GameState = gsConfirm then DrawCentered(0, cScreenHeight div 2, ConfirmTexture);
   620 if GameState = gsConfirm then
       
   621 	DrawCentered(0, cScreenHeight div 2, ConfirmTexture);
   620 
   622 
   621 SetScale(zoom);
   623 SetScale(zoom);
   622 
   624 
   623 // Cursor
   625 // Cursor
   624 if isCursorVisible then
   626 if isCursorVisible then