442 |
445 |
443 |
446 |
444 AmmoRect.w:= (BORDERSIZE*2) + (SlotsNumX * AMSlotSize) + (SlotsNumX-1); |
447 AmmoRect.w:= (BORDERSIZE*2) + (SlotsNumX * AMSlotSize) + (SlotsNumX-1); |
445 AmmoRect.h:= (BORDERSIZE*2) + (SlotsNumY * AMSlotSize) + (SlotsNumY-1); |
448 AmmoRect.h:= (BORDERSIZE*2) + (SlotsNumY * AMSlotSize) + (SlotsNumY-1); |
446 amSurface := SDL_CreateRGBSurface(SDL_SWSURFACE, AmmoRect.w, AmmoRect.h, 32, RMask, GMask, BMask, AMask); |
449 amSurface := SDL_CreateRGBSurface(SDL_SWSURFACE, AmmoRect.w, AmmoRect.h, 32, RMask, GMask, BMask, AMask); |
447 |
450 |
448 AMRect.x:= BORDERSIZE; |
451 AMRect.x:= BORDERSIZE; |
449 AMRect.y:= BORDERSIZE; |
452 AMRect.y:= BORDERSIZE; |
450 AMRect.w:= AmmoRect.w - (BORDERSIZE*2); |
453 AMRect.w:= AmmoRect.w - (BORDERSIZE*2); |
451 AMRect.h:= AmmoRect.h - (BORDERSIZE*2); |
454 AMRect.h:= AmmoRect.h - (BORDERSIZE*2); |
452 |
455 |
453 SDL_FillRect(amSurface, @AMRect, SDL_MapRGB(amSurface^.format, 0,0,0)); |
456 SDL_FillRect(amSurface, @AMRect, SDL_MapRGB(amSurface^.format, 0,0,0)); |
454 |
457 |
455 x:= AMRect.x; |
458 x:= AMRect.x; |
456 y:= AMRect.y; |
459 y:= AMRect.y; |
457 for i:= 0 to cMaxSlotIndex do |
460 for i:= 0 to cMaxSlotIndex do |
458 if ((i = 0) and (Ammo^[i, 1].Count > 0)) or ((i <> 0) and (Ammo^[i, 0].Count > 0)) then |
461 if ((i = 0) and (Ammo^[i, 1].Count > 0)) or ((i <> 0) and (Ammo^[i, 0].Count > 0)) then |
459 begin |
462 begin |
483 begin |
486 begin |
484 STurns:= Ammoz[Ammo^[i, t].AmmoType].SkipTurns - CurrentTeam^.Clan^.TurnNumber; |
487 STurns:= Ammoz[Ammo^[i, t].AmmoType].SkipTurns - CurrentTeam^.Clan^.TurnNumber; |
485 AMFrame:= LongInt(Ammo^[i,t].AmmoType) - 1; |
488 AMFrame:= LongInt(Ammo^[i,t].AmmoType) - 1; |
486 if STurns >= 0 then //weapon not usable yet, draw grayed out with turns remaining |
489 if STurns >= 0 then //weapon not usable yet, draw grayed out with turns remaining |
487 begin |
490 begin |
488 DrawSpriteFrame2Surf(sprAMAmmosBW, amSurface, x + AMSlotPadding, |
491 DrawSpriteFrame2Surf(sprAMAmmosBW, amSurface, x + AMSlotPadding, |
489 y + AMSlotPadding, AMFrame); |
492 y + AMSlotPadding, AMFrame); |
490 if STurns < 100 then |
493 if STurns < 100 then |
491 DrawSpriteFrame2Surf(sprTurnsLeft, amSurface, |
494 DrawSpriteFrame2Surf(sprTurnsLeft, amSurface, |
492 x + AMSlotSize-16, |
495 x + AMSlotSize-16, |
493 y + AMSlotSize + 1 - 16, STurns); |
496 y + AMSlotSize + 1 - 16, STurns); |
494 end |
497 end |
495 else //draw colored version |
498 else //draw colored version |
496 begin |
499 begin |
497 DrawSpriteFrame2Surf(sprAMAmmos, amSurface, x + AMSlotPadding, |
500 DrawSpriteFrame2Surf(sprAMAmmos, amSurface, x + AMSlotPadding, |
498 y + AMSlotPadding, AMFrame); |
501 y + AMSlotPadding, AMFrame); |
499 end; |
502 end; |
500 {$IFDEF USE_LANDSCAPE_AMMOMENU} |
503 {$IFDEF USE_LANDSCAPE_AMMOMENU} |
501 inc(y, AMSlotSize + 1); //the plus one is for the border |
504 inc(y, AMSlotSize + 1); //the plus one is for the border |
502 {$ELSE} |
505 {$ELSE} |
503 inc(x, AMSlotSize + 1); |
506 inc(x, AMSlotSize + 1); |
504 {$ENDIF} |
507 {$ENDIF} |
505 end; |
508 end; |
506 end; |
509 end; |
507 {$IFDEF USE_LANDSCAPE_AMMOMENU} |
510 {$IFDEF USE_LANDSCAPE_AMMOMENU} |
508 inc(x, AMSlotSize + 1); |
511 inc(x, AMSlotSize + 1); |
509 {$ELSE} |
512 {$ELSE} |
510 inc(y, AMSlotSize + 1); |
513 inc(y, AMSlotSize + 1); |
511 {$ENDIF} |
514 {$ENDIF} |
512 end; |
515 end; |
513 |
516 |
514 for i:= 1 to SlotsNumX -1 do |
517 for i:= 1 to SlotsNumX -1 do |
515 DrawLine2Surf(amSurface, i * (AMSlotSize+1)+1, BORDERSIZE, i * (AMSlotSize+1)+1, AMRect.h + BORDERSIZE - AMSlotSize - 2,160,160,160); |
518 DrawLine2Surf(amSurface, i * (AMSlotSize+1)+1, BORDERSIZE, i * (AMSlotSize+1)+1, AMRect.h + BORDERSIZE - AMSlotSize - 2,160,160,160); |
516 for i:= 1 to SlotsNumY -1 do |
519 for i:= 1 to SlotsNumY -1 do |
517 DrawLine2Surf(amSurface, BORDERSIZE, i * (AMSlotSize+1)+1, AMRect.w + BORDERSIZE, i * (AMSlotSize+1)+1,160,160,160); |
520 DrawLine2Surf(amSurface, BORDERSIZE, i * (AMSlotSize+1)+1, AMRect.w + BORDERSIZE, i * (AMSlotSize+1)+1,160,160,160); |
518 |
521 |
519 //draw outer border |
522 //draw outer border |
520 DrawSpriteFrame2Surf(sprAMCorners, amSurface, 0 , 0 , 0); |
523 DrawSpriteFrame2Surf(sprAMCorners, amSurface, 0 , 0 , 0); |
637 else |
640 else |
638 if AMAnimState < 1 then |
641 if AMAnimState < 1 then |
639 begin |
642 begin |
640 AMShiftX:= Round(AMShiftTargetX * AMAnimState); |
643 AMShiftX:= Round(AMShiftTargetX * AMAnimState); |
641 AMShiftY:= Round(AMShiftTargetY * AMAnimState); |
644 AMShiftY:= Round(AMShiftTargetY * AMAnimState); |
642 if (AMAnimType and AMTypeMaskAlpha) <> 0 then |
645 if (AMAnimType and AMTypeMaskAlpha) <> 0 then |
643 Tint($FF, $ff, $ff, Round($ff * (1-AMAnimState))); |
646 Tint($FF, $ff, $ff, Round($ff * (1-AMAnimState))); |
644 end |
647 end |
645 else |
648 else |
646 begin |
649 begin |
647 AMShiftX:= AMShiftTargetX; |
650 AMShiftX:= AMShiftTargetX; |
648 AMShiftY:= AMShiftTargetY; |
651 AMShiftY:= AMShiftTargetY; |
649 prevPoint:= CursorPoint; |
652 prevPoint:= CursorPoint; |
650 //prevTargetPoint:= TargetCursorPoint; |
653 //prevTargetPoint:= TargetCursorPoint; |
651 AMState:= AMHidden; |
654 AMState:= AMHidden; |
652 end; |
655 end; |
653 end; |
656 end; |
654 |
657 |
655 DrawTexture(AmmoRect.x + AMShiftX, AmmoRect.y + AMShiftY, AmmoMenuTex); |
658 DrawTexture(AmmoRect.x + AMShiftX, AmmoRect.y + AMShiftY, AmmoMenuTex); |
656 |
659 |
657 if ((AMState = AMHiding) or (AMState = AMShowingUp)) and ((AMAnimType and AMTypeMaskAlpha) <> 0 )then |
660 if ((AMState = AMHiding) or (AMState = AMShowingUp)) and ((AMAnimType and AMTypeMaskAlpha) <> 0 )then |
658 Tint($FF, $ff, $ff, $ff); |
661 Tint($FF, $ff, $ff, $ff); |
659 |
662 |
660 Pos:= -1; |
663 Pos:= -1; |
661 Slot:= -1; |
664 Slot:= -1; |
662 {$IFDEF USE_LANDSCAPE_AMMOMENU} |
665 {$IFDEF USE_LANDSCAPE_AMMOMENU} |
673 for t:=0 to cMaxSlotAmmoIndex do |
676 for t:=0 to cMaxSlotAmmoIndex do |
674 if (Ammo^[i, t].Count > 0) and (Ammo^[i, t].AmmoType <> amNothing) then |
677 if (Ammo^[i, t].Count > 0) and (Ammo^[i, t].AmmoType <> amNothing) then |
675 begin |
678 begin |
676 if (CursorPoint.Y <= (cScreenHeight - AmmoRect.y) - ( g * (AMSlotSize+1))) and |
679 if (CursorPoint.Y <= (cScreenHeight - AmmoRect.y) - ( g * (AMSlotSize+1))) and |
677 (CursorPoint.Y > (cScreenHeight - AmmoRect.y) - ((g+1) * (AMSlotSize+1))) and |
680 (CursorPoint.Y > (cScreenHeight - AmmoRect.y) - ((g+1) * (AMSlotSize+1))) and |
678 (CursorPoint.X > AmmoRect.x + ( c * (AMSlotSize+1))) and |
681 (CursorPoint.X > AmmoRect.x + ( c * (AMSlotSize+1))) and |
679 (CursorPoint.X <= AmmoRect.x + ((c+1) * (AMSlotSize+1))) then |
682 (CursorPoint.X <= AmmoRect.x + ((c+1) * (AMSlotSize+1))) then |
680 begin |
683 begin |
681 Slot:= i; |
684 Slot:= i; |
682 Pos:= t; |
685 Pos:= t; |
683 STurns:= Ammoz[Ammo^[i, t].AmmoType].SkipTurns - CurrentTeam^.Clan^.TurnNumber; |
686 STurns:= Ammoz[Ammo^[i, t].AmmoType].SkipTurns - CurrentTeam^.Clan^.TurnNumber; |
684 if (STurns < 0) and (AMShiftX = 0) and (AMShiftY = 0) then |
687 if (STurns < 0) and (AMShiftX = 0) and (AMShiftY = 0) then |
685 DrawSprite(sprAMSlot, |
688 DrawSprite(sprAMSlot, |
686 AmmoRect.x + BORDERSIZE + (c * (AMSlotSize+1)) + AMSlotPadding, |
689 AmmoRect.x + BORDERSIZE + (c * (AMSlotSize+1)) + AMSlotPadding, |
687 AmmoRect.y + BORDERSIZE + (g * (AMSlotSize+1)) + AMSlotPadding -1, 0); |
690 AmmoRect.y + BORDERSIZE + (g * (AMSlotSize+1)) + AMSlotPadding -1, 0); |
688 end; |
691 end; |
689 inc(g); |
692 inc(g); |
690 end; |
693 end; |
691 end; |
694 end; |
703 for t:=0 to cMaxSlotAmmoIndex do |
706 for t:=0 to cMaxSlotAmmoIndex do |
704 if (Ammo^[i, t].Count > 0) and (Ammo^[i, t].AmmoType <> amNothing) then |
707 if (Ammo^[i, t].Count > 0) and (Ammo^[i, t].AmmoType <> amNothing) then |
705 begin |
708 begin |
706 if (CursorPoint.Y <= (cScreenHeight - AmmoRect.y) - ( c * (AMSlotSize+1))) and |
709 if (CursorPoint.Y <= (cScreenHeight - AmmoRect.y) - ( c * (AMSlotSize+1))) and |
707 (CursorPoint.Y > (cScreenHeight - AmmoRect.y) - ((c+1) * (AMSlotSize+1))) and |
710 (CursorPoint.Y > (cScreenHeight - AmmoRect.y) - ((c+1) * (AMSlotSize+1))) and |
708 (CursorPoint.X > AmmoRect.x + ( g * (AMSlotSize+1))) and |
711 (CursorPoint.X > AmmoRect.x + ( g * (AMSlotSize+1))) and |
709 (CursorPoint.X <= AmmoRect.x + ((g+1) * (AMSlotSize+1))) then |
712 (CursorPoint.X <= AmmoRect.x + ((g+1) * (AMSlotSize+1))) then |
710 begin |
713 begin |
711 Slot:= i; |
714 Slot:= i; |
712 Pos:= t; |
715 Pos:= t; |
713 STurns:= Ammoz[Ammo^[i, t].AmmoType].SkipTurns - CurrentTeam^.Clan^.TurnNumber; |
716 STurns:= Ammoz[Ammo^[i, t].AmmoType].SkipTurns - CurrentTeam^.Clan^.TurnNumber; |
714 if (STurns < 0) and (AMShiftX = 0) and (AMShiftY = 0) then |
717 if (STurns < 0) and (AMShiftX = 0) and (AMShiftY = 0) then |
715 DrawSprite(sprAMSlot, |
718 DrawSprite(sprAMSlot, |
716 AmmoRect.x + BORDERSIZE + (g * (AMSlotSize+1)) + AMSlotPadding, |
719 AmmoRect.x + BORDERSIZE + (g * (AMSlotSize+1)) + AMSlotPadding, |
717 AmmoRect.y + BORDERSIZE + (c * (AMSlotSize+1)) + AMSlotPadding -1, 0); |
720 AmmoRect.y + BORDERSIZE + (c * (AMSlotSize+1)) + AMSlotPadding -1, 0); |
718 end; |
721 end; |
719 inc(g); |
722 inc(g); |
720 end; |
723 end; |
721 end; |
724 end; |
822 VertexBuffer[2].X:= lw; |
825 VertexBuffer[2].X:= lw; |
823 VertexBuffer[2].Y:= lh; |
826 VertexBuffer[2].Y:= lh; |
824 VertexBuffer[3].X:= -lw; |
827 VertexBuffer[3].X:= -lw; |
825 VertexBuffer[3].Y:= lh; |
828 VertexBuffer[3].Y:= lh; |
826 |
829 |
|
830 {$IFNDEF GL2} |
827 glDisableClientState(GL_TEXTURE_COORD_ARRAY); |
831 glDisableClientState(GL_TEXTURE_COORD_ARRAY); |
828 glEnableClientState(GL_COLOR_ARRAY); |
832 glEnableClientState(GL_COLOR_ARRAY); |
829 if SuddenDeathDmg then |
833 if SuddenDeathDmg then |
830 glColorPointer(4, GL_UNSIGNED_BYTE, 0, @SDWaterColorArray[0]) |
834 glColorPointer(4, GL_UNSIGNED_BYTE, 0, @SDWaterColorArray[0]) |
831 else |
835 else |
835 |
839 |
836 glDrawArrays(GL_TRIANGLE_FAN, 0, Length(VertexBuffer)); |
840 glDrawArrays(GL_TRIANGLE_FAN, 0, Length(VertexBuffer)); |
837 |
841 |
838 glDisableClientState(GL_COLOR_ARRAY); |
842 glDisableClientState(GL_COLOR_ARRAY); |
839 glEnableClientState(GL_TEXTURE_COORD_ARRAY); |
843 glEnableClientState(GL_TEXTURE_COORD_ARRAY); |
840 glColor4ub($FF, $FF, $FF, $FF); // must not be Tint() as color array seems to stay active and color reset is required |
844 |
|
845 {$ELSE} |
|
846 UpdateModelviewProjection; |
|
847 |
|
848 BeginWater; |
|
849 if SuddenDeathDmg then |
|
850 SetColorPointer(@SDWaterColorArray[0], 4) |
|
851 else |
|
852 SetColorPointer(@WaterColorArray[0], 4); |
|
853 |
|
854 SetVertexPointer(@VertexBuffer[0], 4); |
|
855 |
|
856 glDrawArrays(GL_TRIANGLE_FAN, 0, 4); |
|
857 |
|
858 EndWater; |
|
859 {$ENDIF} |
|
860 |
|
861 {$IFNDEF GL2} |
|
862 // must not be Tint() as color array seems to stay active and color reset is required |
|
863 glColor4ub($FF, $FF, $FF, $FF); |
|
864 {$ENDIF} |
841 glEnable(GL_TEXTURE_2D); |
865 glEnable(GL_TEXTURE_2D); |
842 end; |
866 end; |
843 end; |
867 end; |
844 |
868 |
845 procedure DrawWaves(Dir, dX, dY: LongInt; tnt: Byte); |
869 procedure DrawWaves(Dir, dX, dY: LongInt; tnt: Byte); |
890 TextureBuffer[2].Y:= SpritesData[sprite].Texture^.ry; |
914 TextureBuffer[2].Y:= SpritesData[sprite].Texture^.ry; |
891 TextureBuffer[3].X:= TextureBuffer[0].X; |
915 TextureBuffer[3].X:= TextureBuffer[0].X; |
892 TextureBuffer[3].Y:= TextureBuffer[2].Y; |
916 TextureBuffer[3].Y:= TextureBuffer[2].Y; |
893 |
917 |
894 |
918 |
895 glVertexPointer(2, GL_FLOAT, 0, @VertexBuffer[0]); |
919 SetVertexPointer(@VertexBuffer[0], Length(VertexBuffer)); |
896 glTexCoordPointer(2, GL_FLOAT, 0, @TextureBuffer[0]); |
920 SetTexCoordPointer(@TextureBuffer[0], Length(VertexBuffer)); |
|
921 |
|
922 {$IFDEF GL2} |
|
923 UpdateModelviewProjection; |
|
924 {$ENDIF} |
|
925 |
897 glDrawArrays(GL_TRIANGLE_FAN, 0, Length(VertexBuffer)); |
926 glDrawArrays(GL_TRIANGLE_FAN, 0, Length(VertexBuffer)); |
898 |
927 |
899 untint; |
928 untint; |
900 |
929 |
901 {for i:= -1 to cWaterSprCount do |
930 {for i:= -1 to cWaterSprCount do |
1103 if rm = rmDefault then |
1132 if rm = rmDefault then |
1104 exit |
1133 exit |
1105 else if rm = rmLeftEye then |
1134 else if rm = rmLeftEye then |
1106 d:= -d; |
1135 d:= -d; |
1107 stereoDepth:= stereoDepth + d; |
1136 stereoDepth:= stereoDepth + d; |
|
1137 |
|
1138 {$IFDEF GL2} |
|
1139 hglMatrixMode(MATRIX_PROJECTION); |
|
1140 hglTranslatef(d, 0, 0); |
|
1141 hglMatrixMode(MATRIX_MODELVIEW); |
|
1142 {$ELSE} |
1108 glMatrixMode(GL_PROJECTION); |
1143 glMatrixMode(GL_PROJECTION); |
1109 glTranslatef(d, 0, 0); |
1144 glTranslatef(d, 0, 0); |
1110 glMatrixMode(GL_MODELVIEW); |
1145 glMatrixMode(GL_MODELVIEW); |
1111 {$ENDIF} |
1146 {$ENDIF} |
1112 end; |
1147 {$ENDIF} |
1113 |
1148 end; |
|
1149 |
1114 procedure ResetDepth(rm: TRenderMode); |
1150 procedure ResetDepth(rm: TRenderMode); |
1115 begin |
1151 begin |
1116 {$IFNDEF USE_S3D_RENDERING} |
1152 {$IFNDEF USE_S3D_RENDERING} |
1117 rm:= rm; // avoid hint |
1153 rm:= rm; // avoid hint |
1118 exit; |
1154 exit; |
1119 {$ELSE} |
1155 {$ELSE} |
1120 if rm = rmDefault then |
1156 if rm = rmDefault then |
1121 exit; |
1157 exit; |
|
1158 {$IFDEF GL2} |
|
1159 hglMatrixMode(MATRIX_PROJECTION); |
|
1160 hglTranslatef(-stereoDepth, 0, 0); |
|
1161 hglMatrixMode(MATRIX_MODELVIEW); |
|
1162 {$ELSE} |
1122 glMatrixMode(GL_PROJECTION); |
1163 glMatrixMode(GL_PROJECTION); |
1123 glTranslatef(-stereoDepth, 0, 0); |
1164 glTranslatef(-stereoDepth, 0, 0); |
1124 glMatrixMode(GL_MODELVIEW); |
1165 glMatrixMode(GL_MODELVIEW); |
1125 stereoDepth:= 0; |
1166 {$ENDIF} |
1126 {$ENDIF} |
1167 cStereoDepth:= 0; |
1127 end; |
1168 {$ENDIF} |
1128 |
1169 end; |
1129 |
1170 |
1130 procedure RenderWorldEdge(Lag: Longword); |
1171 procedure RenderWorldEdge(Lag: Longword); |
1131 var |
1172 var |
1132 VertexBuffer: array [0..3] of TVertex2f; |
1173 VertexBuffer: array [0..3] of TVertex2f; |
1133 c1, c2: LongWord; // couple of colours for edges |
1174 c1, c2: LongWord; // couple of colours for edges |
1187 glEnableClientState(GL_TEXTURE_COORD_ARRAY); |
1228 glEnableClientState(GL_TEXTURE_COORD_ARRAY); |
1188 |
1229 |
1189 glColor4ub($FF, $FF, $FF, $FF); // must not be Tint() as color array seems to stay active and color reset is required |
1230 glColor4ub($FF, $FF, $FF, $FF); // must not be Tint() as color array seems to stay active and color reset is required |
1190 glEnable(GL_TEXTURE_2D); |
1231 glEnable(GL_TEXTURE_2D); |
1191 |
1232 |
1192 // I'd still like to have things happen to the border when a wrap or bounce just occurred, based on a timer |
1233 // I'd still like to have things happen to the border when a wrap or bounce just occurred, based on a timer |
1193 if WorldEdge = weBounce then |
1234 if WorldEdge = weBounce then |
1194 begin |
1235 begin |
1195 // could maybe alternate order of these on a bounce, or maybe drop the outer ones. |
1236 // could maybe alternate order of these on a bounce, or maybe drop the outer ones. |
1196 if LeftImpactTimer mod 2 = 0 then |
1237 if LeftImpactTimer mod 2 = 0 then |
1197 begin |
1238 begin |
1289 h:= 0; |
1330 h:= 0; |
1290 if not hasGone then |
1331 if not hasGone then |
1291 for i:= 0 to cMaxHHIndex do |
1332 for i:= 0 to cMaxHHIndex do |
1292 begin |
1333 begin |
1293 inc(h, Hedgehogs[i].HealthBarHealth); |
1334 inc(h, Hedgehogs[i].HealthBarHealth); |
1294 if (h < TeamHealthBarHealth) and (Hedgehogs[i].HealthBarHealth > 0) then |
1335 if (h < TeamHealthBarHealth) and (Hedgehogs[i].HealthBarHealth > 0) then |
1295 DrawTexture(15 + h * TeamHealthBarWidth div TeamHealthBarHealth, cScreenHeight + DrawHealthY + smallScreenOffset + 1, SpritesData[sprSlider].Texture); |
1336 DrawTexture(15 + h * TeamHealthBarWidth div TeamHealthBarHealth, cScreenHeight + DrawHealthY + smallScreenOffset + 1, SpritesData[sprSlider].Texture); |
1296 end; |
1337 end; |
1297 |
1338 |
1298 // draw ai kill counter for gfAISurvival |
1339 // draw ai kill counter for gfAISurvival |
1299 if (GameFlags and gfAISurvival) <> 0 then |
1340 if (GameFlags and gfAISurvival) <> 0 then |
1372 DrawVisualGears(4); |
1413 DrawVisualGears(4); |
1373 |
1414 |
1374 if (cReducedQuality and rq2DWater) = 0 then |
1415 if (cReducedQuality and rq2DWater) = 0 then |
1375 begin |
1416 begin |
1376 // Waves |
1417 // Waves |
1377 DrawWater(255, SkyOffset); |
1418 DrawWater(255, SkyOffset); |
1378 ChangeDepth(RM, -cStereo_Water_distant); |
1419 ChangeDepth(RM, -cStereo_Water_distant); |
1379 DrawWaves( 1, 0 - WorldDx div 32, - cWaveHeight + offsetY div 35, 64); |
1420 DrawWaves( 1, 0 - WorldDx div 32, - cWaveHeight + offsetY div 35, 64); |
1380 ChangeDepth(RM, -cStereo_Water_distant); |
1421 ChangeDepth(RM, -cStereo_Water_distant); |
1381 DrawWaves( -1, 25 + WorldDx div 25, - cWaveHeight + offsetY div 38, 48); |
1422 DrawWaves( -1, 25 + WorldDx div 25, - cWaveHeight + offsetY div 38, 48); |
1382 ChangeDepth(RM, -cStereo_Water_distant); |
1423 ChangeDepth(RM, -cStereo_Water_distant); |
1390 changeDepth(RM, cStereo_Land); |
1431 changeDepth(RM, cStereo_Land); |
1391 DrawVisualGears(5); |
1432 DrawVisualGears(5); |
1392 DrawLand(WorldDx, WorldDy); |
1433 DrawLand(WorldDx, WorldDy); |
1393 |
1434 |
1394 DrawWater(255, 0); |
1435 DrawWater(255, 0); |
|
1436 |
|
1437 (* |
|
1438 // Attack bar |
|
1439 if CurrentTeam <> nil then |
|
1440 case AttackBar of |
|
1441 //1: begin |
|
1442 //r:= StuffPoz[sPowerBar]; |
|
1443 //{$WARNINGS OFF} |
|
1444 //r.w:= (CurrentHedgehog^.Gear^.Power * 256) div cPowerDivisor; |
|
1445 //{$WARNINGS ON} |
|
1446 //DrawSpriteFromRect(r, cScreenWidth - 272, cScreenHeight - 48, 16, 0, Surface); |
|
1447 //end; |
|
1448 2: with CurrentHedgehog^ do |
|
1449 begin |
|
1450 tdx:= hwSign(Gear^.dX) * Sin(Gear^.Angle * Pi / cMaxAngle); |
|
1451 tdy:= - Cos(Gear^.Angle * Pi / cMaxAngle); |
|
1452 for i:= (Gear^.Power * 24) div cPowerDivisor downto 0 do |
|
1453 DrawSprite(sprPower, |
|
1454 hwRound(Gear^.X) + GetLaunchX(CurAmmoType, hwSign(Gear^.dX), Gear^.Angle) + LongInt(round(WorldDx + tdx * (24 + i * 2))) - 16, |
|
1455 hwRound(Gear^.Y) + GetLaunchY(CurAmmoType, Gear^.Angle) + LongInt(round(WorldDy + tdy * (24 + i * 2))) - 16, |
|
1456 i) |
|
1457 end |
|
1458 end; |
|
1459 *) |
1395 |
1460 |
1396 DrawVisualGears(1); |
1461 DrawVisualGears(1); |
1397 DrawGears; |
1462 DrawGears; |
1398 DrawVisualGears(6); |
1463 DrawVisualGears(6); |
1399 |
1464 |
1554 AMAnimStartTime:= RealTicks |
1619 AMAnimStartTime:= RealTicks |
1555 else |
1620 else |
1556 AMAnimStartTime:= RealTicks - (AMAnimDuration - (RealTicks - AMAnimStartTime)); |
1621 AMAnimStartTime:= RealTicks - (AMAnimDuration - (RealTicks - AMAnimStartTime)); |
1557 AMState:= AMShowingUp; |
1622 AMState:= AMShowingUp; |
1558 end; |
1623 end; |
1559 if not(bShowAmmoMenu) and ((AMstate = AMShowing) or (AMState = AMShowingUp)) then |
1624 if (not bShowAmmoMenu) and ((AMstate = AMShowing) or (AMState = AMShowingUp)) then |
1560 begin |
1625 begin |
1561 if (AMState = AMShowing) then |
1626 if (AMState = AMShowing) then |
1562 AMAnimStartTime:= RealTicks |
1627 AMAnimStartTime:= RealTicks |
1563 else |
1628 else |
1564 AMAnimStartTime:= RealTicks - (AMAnimDuration - (RealTicks - AMAnimStartTime)); |
1629 AMAnimStartTime:= RealTicks - (AMAnimDuration - (RealTicks - AMAnimStartTime)); |
1565 AMState:= AMHiding; |
1630 AMState:= AMHiding; |
1566 end; |
1631 end; |
1567 |
1632 |
1568 if bShowAmmoMenu or (AMState = AMHiding) then |
1633 if bShowAmmoMenu or (AMState = AMHiding) then |
1569 ShowAmmoMenu; |
1634 ShowAmmoMenu; |
1570 |
1635 |
1571 // Cursor |
1636 // Cursor |
1572 if isCursorVisible and bShowAmmoMenu then |
1637 if isCursorVisible and bShowAmmoMenu then |
1573 DrawSprite(sprArrow, CursorPoint.X, cScreenHeight - CursorPoint.Y, (RealTicks shr 6) mod 8); |
1638 DrawSprite(sprArrow, CursorPoint.X, cScreenHeight - CursorPoint.Y, (RealTicks shr 6) mod 8); |
1574 |
1639 |
1575 // Chat |
1640 // Chat |
1576 DrawChat; |
1641 DrawChat; |
|
1642 |
1577 |
1643 |
1578 // various captions |
1644 // various captions |
1579 if fastUntilLag then |
1645 if fastUntilLag then |
1580 DrawTextureCentered(0, (cScreenHeight shr 1), SyncTexture); |
1646 DrawTextureCentered(0, (cScreenHeight shr 1), SyncTexture); |
1581 if isPaused then |
1647 if isPaused then |
1616 t:= i mod 60; |
1682 t:= i mod 60; |
1617 s:= inttostr(t) + ':' + s; |
1683 s:= inttostr(t) + ':' + s; |
1618 if t < 10 then |
1684 if t < 10 then |
1619 s:= '0' + s; |
1685 s:= '0' + s; |
1620 s:= inttostr(i div 60) + ':' + s; |
1686 s:= inttostr(i div 60) + ':' + s; |
1621 |
1687 |
1622 |
1688 |
1623 tmpSurface:= TTF_RenderUTF8_Blended(Fontz[fnt16].Handle, Str2PChar(s), cWhiteColorChannels); |
1689 tmpSurface:= TTF_RenderUTF8_Blended(Fontz[fnt16].Handle, Str2PChar(s), cWhiteColorChannels); |
1624 tmpSurface:= doSurfaceConversion(tmpSurface); |
1690 tmpSurface:= doSurfaceConversion(tmpSurface); |
1625 FreeTexture(timeTexture); |
1691 FreeTexture(timeTexture); |
1626 timeTexture:= Surface2Tex(tmpSurface, false); |
1692 timeTexture:= Surface2Tex(tmpSurface, false); |
1627 SDL_FreeSurface(tmpSurface) |
1693 SDL_FreeSurface(tmpSurface) |
1653 if GameState = gsConfirm then |
1719 if GameState = gsConfirm then |
1654 DrawTextureCentered(0, (cScreenHeight shr 1)-40, ConfirmTexture); |
1720 DrawTextureCentered(0, (cScreenHeight shr 1)-40, ConfirmTexture); |
1655 |
1721 |
1656 if ScreenFade <> sfNone then |
1722 if ScreenFade <> sfNone then |
1657 begin |
1723 begin |
1658 if not isFirstFrame then |
1724 if (not isFirstFrame) then |
1659 case ScreenFade of |
1725 case ScreenFade of |
1660 sfToBlack, sfToWhite: if ScreenFadeValue + Lag * ScreenFadeSpeed < sfMax then |
1726 sfToBlack, sfToWhite: if ScreenFadeValue + Lag * ScreenFadeSpeed < sfMax then |
1661 inc(ScreenFadeValue, Lag * ScreenFadeSpeed) |
1727 inc(ScreenFadeValue, Lag * ScreenFadeSpeed) |
1662 else |
1728 else |
1663 ScreenFadeValue:= sfMax; |
1729 ScreenFadeValue:= sfMax; |
1683 VertexBuffer[3].Y:= cScreenHeight; |
1749 VertexBuffer[3].Y:= cScreenHeight; |
1684 |
1750 |
1685 glDisable(GL_TEXTURE_2D); |
1751 glDisable(GL_TEXTURE_2D); |
1686 |
1752 |
1687 glVertexPointer(2, GL_FLOAT, 0, @VertexBuffer[0]); |
1753 glVertexPointer(2, GL_FLOAT, 0, @VertexBuffer[0]); |
1688 glDrawArrays(GL_TRIANGLE_FAN, 0, Length(VertexBuffer)); |
1754 glDrawArrays(GL_TRIANGLE_FAN, 0, High(VertexBuffer) - Low(VertexBuffer) + 1); |
1689 |
1755 |
1690 glEnable(GL_TEXTURE_2D); |
1756 glEnable(GL_TEXTURE_2D); |
1691 untint; |
1757 untint; |
1692 if not isFirstFrame and ((ScreenFadeValue = 0) or (ScreenFadeValue = sfMax)) then |
1758 if not isFirstFrame and ((ScreenFadeValue = 0) or (ScreenFadeValue = sfMax)) then |
1693 ScreenFade:= sfNone |
1759 ScreenFade:= sfNone |
1708 SDL_FreeSurface(tmpSurface) |
1774 SDL_FreeSurface(tmpSurface) |
1709 end; |
1775 end; |
1710 DrawTexture( -(cScreenWidth shr 1) + 50, 20, recTexture); |
1776 DrawTexture( -(cScreenWidth shr 1) + 50, 20, recTexture); |
1711 |
1777 |
1712 // draw red circle |
1778 // draw red circle |
1713 glDisable(GL_TEXTURE_2D); |
1779 glDisable(GL_TEXTURE_2D); |
1714 Tint($FF, $00, $00, Byte(Round(127*(1 + sin(SDL_GetTicks()*0.007))))); |
1780 Tint($FF, $00, $00, Byte(Round(127*(1 + sin(SDL_GetTicks()*0.007))))); |
1715 glBegin(GL_POLYGON); |
1781 glBegin(GL_POLYGON); |
1716 for i:= 0 to 20 do |
1782 for i:= 0 to 20 do |
1717 glVertex2f(-(cScreenWidth shr 1) + 30 + sin(i*2*Pi/20)*10, 35 + cos(i*2*Pi/20)*10); |
1783 glVertex2f(-(cScreenWidth shr 1) + 30 + sin(i*2*Pi/20)*10, 35 + cos(i*2*Pi/20)*10); |
1718 glEnd(); |
1784 glEnd(); |
1763 DrawSprite(PosSprite, TargetCursorPoint.X - (SpritesData[PosSprite].Width shr 1), cScreenHeight - TargetCursorPoint.Y - (SpritesData[PosSprite].Height shr 1),i); |
1829 DrawSprite(PosSprite, TargetCursorPoint.X - (SpritesData[PosSprite].Width shr 1), cScreenHeight - TargetCursorPoint.Y - (SpritesData[PosSprite].Height shr 1),i); |
1764 end; |
1830 end; |
1765 DrawSprite(sprArrow, TargetCursorPoint.X, cScreenHeight - TargetCursorPoint.Y, (RealTicks shr 6) mod 8) |
1831 DrawSprite(sprArrow, TargetCursorPoint.X, cScreenHeight - TargetCursorPoint.Y, (RealTicks shr 6) mod 8) |
1766 end |
1832 end |
1767 end; |
1833 end; |
1768 isFirstFrame:= false; |
1834 |
|
1835 isFirstFrame:= false |
1769 end; |
1836 end; |
1770 |
1837 |
1771 var PrevSentPointTime: LongWord = 0; |
1838 var PrevSentPointTime: LongWord = 0; |
1772 |
1839 |
1773 procedure MoveCamera; |
1840 procedure MoveCamera; |
1778 if (not (CurrentTeam^.ExtDriven and isCursorVisible and (not bShowAmmoMenu) and autoCameraOn)) and cHasFocus and (GameState <> gsConfirm) then |
1845 if (not (CurrentTeam^.ExtDriven and isCursorVisible and (not bShowAmmoMenu) and autoCameraOn)) and cHasFocus and (GameState <> gsConfirm) then |
1779 uCursor.updatePosition(); |
1846 uCursor.updatePosition(); |
1780 {$ENDIF} |
1847 {$ENDIF} |
1781 z:= round(200/zoom); |
1848 z:= round(200/zoom); |
1782 inbtwnTrgtAttks := (CurrentHedgehog <> nil) and ((Ammoz[CurrentHedgehog^.CurAmmoType].Ammo.Propz and ammoprop_NeedTarget) <> 0) and ((GameFlags and gfInfAttack) <> 0); |
1849 inbtwnTrgtAttks := (CurrentHedgehog <> nil) and ((Ammoz[CurrentHedgehog^.CurAmmoType].Ammo.Propz and ammoprop_NeedTarget) <> 0) and ((GameFlags and gfInfAttack) <> 0); |
1783 if autoCameraOn and not PlacingHogs and (FollowGear <> nil) and (not isCursorVisible) and (not bShowAmmoMenu) and (not fastUntilLag) and not inbtwnTrgtAttks then |
1850 if autoCameraOn and (not PlacingHogs) and (FollowGear <> nil) and (not isCursorVisible) and (not bShowAmmoMenu) and (not fastUntilLag) and (not inbtwnTrgtAttks) then |
1784 if ((abs(CursorPoint.X - prevPoint.X) + abs(CursorPoint.Y - prevpoint.Y)) > 4) then |
1851 if ((abs(CursorPoint.X - prevPoint.X) + abs(CursorPoint.Y - prevpoint.Y)) > 4) then |
1785 begin |
1852 begin |
1786 FollowGear:= nil; |
1853 FollowGear:= nil; |
1787 prevPoint:= CursorPoint; |
1854 prevPoint:= CursorPoint; |
1788 exit |
1855 exit |
1967 if(CurrentHedgehog <> nil)then |
2034 if(CurrentHedgehog <> nil)then |
1968 if (Ammoz[ammoType].Ammo.Propz and ammoprop_Timerable) <> 0 then |
2035 if (Ammoz[ammoType].Ammo.Propz and ammoprop_Timerable) <> 0 then |
1969 begin |
2036 begin |
1970 utilityWidget.sprite:= sprTimerButton; |
2037 utilityWidget.sprite:= sprTimerButton; |
1971 animateWidget(@utilityWidget, true, true); |
2038 animateWidget(@utilityWidget, true, true); |
1972 end |
2039 end |
1973 else if (Ammoz[ammoType].Ammo.Propz and ammoprop_NeedTarget) <> 0 then |
2040 else if (Ammoz[ammoType].Ammo.Propz and ammoprop_NeedTarget) <> 0 then |
1974 begin |
2041 begin |
1975 utilityWidget.sprite:= sprTargetButton; |
2042 utilityWidget.sprite:= sprTargetButton; |
1976 animateWidget(@utilityWidget, true, true); |
2043 animateWidget(@utilityWidget, true, true); |
1977 end |
2044 end |