|
3268 | 3268 | Else Begin |
3269 | 3269 | // Der Server hat die Datei schon, dann ist eh alles I.O. :-) |
3270 | 3270 | End; |
3271 | | - cbBE(self, true); |
| 3271 | + If assigned(cbBE) Then |
| 3272 | + cbBE(self, true); |
3272 | 3273 | End; |
3273 | 3274 | miFilesToTransmitCount: Begin |
3274 | 3275 | m := TMemorystream.create; |
|
3358 | 3359 | fmap.CreateDamageClassTextures; |
3359 | 3360 | fmap.EditTerrain := false; |
3360 | 3361 | If GetValue('Global', 'ShowOppoentsPathOnWaveStart', '1') = '1' Then Begin |
3361 | | - fmap.CreateWavePreviewPath(PlayerIndex); |
| 3362 | + fmap.CreateWavePreviewPath(fAktualWave, PlayerIndex); |
| 3363 | + fmap.CreateAirWavePreviewPath(fAktualWave, PlayerIndex); |
| 3364 | + fmap.CalculateWavePreviewOffsets; |
3362 | 3365 | End |
3363 | 3366 | Else Begin |
3364 | | - setlength(fmap.WaypointPreviewDirections, 0); |
| 3367 | + setlength(fmap.WaypointPreview.Points, 0); |
| 3368 | + setlength(fmap.AirWaypointPreview.Points, 0); |
3365 | 3369 | End; |
3366 | 3370 | For i := 0 To high(fPlayerInfos) Do Begin |
3367 | 3371 | fPlayerInfos[i].KillsOnWaveStart := fPlayerInfos[i].Kills + fPlayerInfos[i].BonusFinisher; |
|
3893 | 3897 | Begin |
3894 | 3898 | result := 0; |
3895 | 3899 | // Die Hauptrichtungen |
3896 | | - If wpdLeftToRight In directions Then result := 0; |
3897 | | - If wpdRightToLeft In directions Then result := 2; |
3898 | | - If wpdTopToBottom In directions Then result := 3; |
3899 | | - If wpdBottomToTop In directions Then result := 1; |
| 3900 | + If wpdRightToLeft In directions Then result := 0; |
| 3901 | + If wpdLeftToRight In directions Then result := 1; |
| 3902 | + If wpdTopToBottom In directions Then result := 2; |
| 3903 | + If wpdBottomToTop In directions Then result := 3; |
3900 | 3904 | // Nun Kommen die Diagonalen |
3901 | | - If (wpdLeftToRight In directions) And (wpdTopToBottom In directions) Then result := 7; |
3902 | | - If (wpdLeftToRight In directions) And (wpdBottomToTop In directions) Then result := 4; |
| 3905 | + If (wpdRightToLeft In directions) And (wpdBottomToTop In directions) Then result := 4; |
| 3906 | + If (wpdLeftToRight In directions) And (wpdBottomToTop In directions) Then result := 5; |
3903 | 3907 | If (wpdRightToLeft In directions) And (wpdTopToBottom In directions) Then result := 6; |
3904 | | - If (wpdRightToLeft In directions) And (wpdBottomToTop In directions) Then result := 5; |
| 3908 | + If (wpdLeftToRight In directions) And (wpdTopToBottom In directions) Then result := 7; |
| 3909 | + End; |
| 3910 | + |
| 3911 | + Procedure RenderWayPointPreview(Const WayPointPreview: TWaypointPreview; Offset: integer); |
| 3912 | + Const |
| 3913 | + DirectionsRotated: Array[0..7] Of Tpoint = (// Alle Einträge von Directions gedreht um 90° gegen den Uhrzeigersinn |
| 3914 | + (x: 0; y: - 1), |
| 3915 | + (x: 0; y: + 1), |
| 3916 | + (x: + 1; y: 0), |
| 3917 | + (x: - 1; y: 0), |
| 3918 | + (x: + 1; y: - 1), |
| 3919 | + (x: + 1; y: + 1), |
| 3920 | + (x: - 1; y: - 1), |
| 3921 | + (x: - 1; y: + 1) |
| 3922 | + ); |
| 3923 | + Var |
| 3924 | + c, x, y, i, DirectionIndex: integer; |
| 3925 | + gi: TGraphikItem; |
| 3926 | + OffsetP: TPoint; |
| 3927 | + Begin |
| 3928 | + c := 0; |
| 3929 | + For i := 0 To high(WaypointPreview.Points) Do Begin |
| 3930 | + DirectionIndex := WaypointDirectionsToIndex(WaypointPreview.Points[i].Directions); |
| 3931 | + glPushMatrix; |
| 3932 | + x := WaypointPreview.Points[i].Location.x; |
| 3933 | + y := WaypointPreview.Points[i].Location.y; |
| 3934 | + OffsetP := point(0, 0); |
| 3935 | + If WaypointPreview.Points[i].Offsetted Then Begin |
| 3936 | + OffsetP := DirectionsRotated[DirectionIndex] * Offset; |
| 3937 | + End; |
| 3938 | + glTranslatef(x * MapBlockSize - fsx + fMapL, y * MapBlockSize - fsy + fMapT, ctd_Buy_Preview_Layer); |
| 3939 | + glTranslatef(0, 0, ctd_EPSILON); |
| 3940 | + glScalef(MapBlockSize / 10, MapBlockSize / 10, 1); |
| 3941 | + glTranslatef(OffsetP.x, OffsetP.Y, 0); |
| 3942 | + glColor4f(1, 1, 1, 1); |
| 3943 | + If i Mod 2 = 0 Then Begin // Nur jeden 2. Rendern, sieht gleich viel besser aus ;) |
| 3944 | + // Die Pfeile sind kleiner |
| 3945 | + glTranslatef(2.5, 2.5, 0); |
| 3946 | + glScalef(0.5, 0.5, 1); |
| 3947 | + RenderAlphaTiledQuad(0, 0, DirectionIndex, 8, 1, fWaypointDirectionTexs); |
| 3948 | + End |
| 3949 | + Else Begin |
| 3950 | + // Die Klassen genau eine Kachel Groß |
| 3951 | + glTranslatef(0, 0, ctd_EPSILON); |
| 3952 | + c := c Mod length(WayPointPreview.DamageClasses); |
| 3953 | + gi := fMap.OpenGLArrowDamageClassTex[WayPointPreview.DamageClasses[c]]; |
| 3954 | + glScalef(10 / gi.OrigWidth, 10 / gi.OrigHeight, 1); |
| 3955 | + If gi.IsAlphaImage Then Begin |
| 3956 | + RenderAlphaQuad(0, 0, gi); |
| 3957 | + End |
| 3958 | + Else Begin |
| 3959 | + RenderQuad(0, 0, gi); |
| 3960 | + End; |
| 3961 | + inc(c); |
| 3962 | + End; |
| 3963 | + glPopMatrix; |
| 3964 | + End; |
3905 | 3965 | End; |
3906 | 3966 |
|
3907 | 3967 | Var |
|
3933 | 3993 | fkeyRepeatTimeStamp := t; |
3934 | 3994 | FOnKeyPress(); |
3935 | 3995 | End; |
3936 | | - |
3937 | 3996 | Case fgameState Of |
3938 | 3997 | gs_WaitForJoin: Begin |
3939 | 3998 | glColor4f(1, 1, 1, 1); |
|
3970 | 4029 | CenterTextOut(w, h, 'The game has been paused.'); |
3971 | 4030 | End; |
3972 | 4031 | // Anzeigen des Weg Previews |
3973 | | - For i := 0 To high(fMap.WaypointPreviewDirections) Do Begin |
3974 | | - If i Mod 2 = 1 Then Begin // Nur jeden 2. Rendern, sieht gleich viel besser aus ;) |
3975 | | - glPushMatrix; |
3976 | | - x := fMap.WaypointPreviewDirections[i].Location.x; |
3977 | | - y := fMap.WaypointPreviewDirections[i].Location.y; |
3978 | | - glTranslatef(x * MapBlockSize - fsx + fMapL, y * MapBlockSize - fsy + fMapT, ctd_Buy_Preview_Layer); |
3979 | | - glTranslatef(0, 0, ctd_EPSILON); |
3980 | | - glScalef(MapBlockSize / 10, MapBlockSize / 10, 1); |
3981 | | - glColor4f(1, 1, 1, 1); |
3982 | | - RenderAlphaTiledQuad(0, 0, WaypointDirectionsToIndex(fMap.WaypointPreviewDirections[i].Directions), 8, 1, fWaypointDirectionTexs); |
3983 | | - glPopMatrix; |
3984 | | - End; |
3985 | | - End; |
| 4032 | + RenderWayPointPreview(fMap.WaypointPreview, -5); |
| 4033 | + RenderWayPointPreview(fMap.AirWaypointPreview, 5); |
3986 | 4034 | // Anzeigen des zu kaufenden Objekts |
3987 | 4035 | If assigned(FBuyingObject) Then Begin |
3988 | 4036 | x := (fsx + fCursorPos.x - fMapL) Div MapBlockSize; |
|
4614 | 4662 | b := TBuilding.create(); |
4615 | 4663 | b.LoadFromFile(MapFolder + MapName + PathDelim + Name); |
4616 | 4664 | b.Owner := Owner; |
4617 | | - If Not fMap.AddBuilding(x, y, b) Then Begin |
| 4665 | + If fMap.AddBuilding(x, y, b) Then Begin |
| 4666 | + // Neu Berechnen der Wegpunkt Previes, diese könnten sich ja geändert haben ;) |
| 4667 | + If Assigned(fMap.WaypointPreview.Points) Then Begin |
| 4668 | + fmap.CreateWavePreviewPath(fAktualWave, PlayerIndex); |
| 4669 | + fmap.CalculateWavePreviewOffsets; |
| 4670 | + End; |
| 4671 | + End |
| 4672 | + Else Begin |
4618 | 4673 | (* |
4619 | 4674 | * Eigentlich hat der Server alles Geprüft, das Gebäude muss hier immer Akzeptiert werden |
4620 | 4675 | * Wenn aber doch nicht, dann geben wir es wenigstens frei ... |
|
4918 | 4973 | End |
4919 | 4974 | Else Begin |
4920 | 4975 | // Wir sollen eine Datei senden die es gar nicht gibt -> Fehler |
4921 | | - Callback(self, false); |
| 4976 | + If assigned(Callback) Then |
| 4977 | + Callback(self, false); |
4922 | 4978 | End; |
4923 | 4979 | LogLeave; |
4924 | 4980 | End; |
|
0 commit comments