X-Git-Url: http://deadsoftware.ru/gitweb?a=blobdiff_plain;f=src%2Fgame%2Fg_map.pas;h=570d5e2413c66732c51084fdc17e37e62fc50708;hb=9ba8ea50592447e5c5874f94338e7dd75f5a35ed;hp=e99d47b19186dd65974751d9a2dd3e90539e3439;hpb=93f620df25ad634372657a64d609dcaf44e718bd;p=d2df-sdl.git diff --git a/src/game/g_map.pas b/src/game/g_map.pas index e99d47b..570d5e2 100644 --- a/src/game/g_map.pas +++ b/src/game/g_map.pas @@ -54,6 +54,7 @@ type CaptureTime: LongWord; Animation: TAnimation; Direction: TDirection; + NeedSend: Boolean; end; function g_Map_Load(Res: String): Boolean; @@ -89,6 +90,7 @@ function g_Map_IsSpecialTexture(Texture: String): Boolean; function g_Map_GetPoint(PointType: Byte; var RespawnPoint: TRespawnPoint): Boolean; function g_Map_GetPointCount(PointType: Byte): Word; +function g_Map_GetRandomPointType(): Byte; function g_Map_HaveFlagPoints(): Boolean; @@ -2566,8 +2568,13 @@ begin begin if gFlags[a].Animation <> nil then gFlags[a].Animation.Update(); + Obj.oldX := Obj.X; + Obj.oldY := Obj.Y; + m := g_Obj_Move(@Obj, True, True); + NeedSend := NeedSend or (Obj.X <> Obj.oldX) or (Obj.Y <> Obj.oldY); + if gTime mod (GAME_TICK*2) <> 0 then Continue; // Ñîïðîòèâëåíèå âîçäóõà @@ -3122,6 +3129,14 @@ begin Result := Result + 1; end; +function g_Map_GetRandomPointType(): Byte; +begin + if RespawnPoints = nil then + Result := 255 + else + Result := RespawnPoints[Random(Length(RespawnPoints))].PointType; +end; + function g_Map_HaveFlagPoints(): Boolean; begin Result := (FlagPoints[FLAG_RED] <> nil) and (FlagPoints[FLAG_BLUE] <> nil); @@ -3144,6 +3159,9 @@ begin Direction := FlagPoints[Flag]^.Direction; State := FLAG_STATE_NORMAL; end; + Obj.oldX := Obj.X; + Obj.oldY := Obj.Y; + NeedSend := False; // the event will take care of this Count := -1; end; end; @@ -3151,6 +3169,7 @@ end; procedure g_Map_DrawFlags(); var i, dx: Integer; + tx, ty: Integer; Mirror: TMirrorType; begin if gGameSettings.GameMode <> GM_CTF then @@ -3163,6 +3182,8 @@ begin if State = FLAG_STATE_NONE then continue; + Obj.lerp(gLerpFactor, tx, ty); + if Direction = TDirection.D_LEFT then begin Mirror := TMirrorType.Horizontal; @@ -3174,7 +3195,7 @@ begin dx := 1; end; - Animation.Draw(Obj.X+dx, Obj.Y+1, Mirror); + Animation.Draw(tx+dx, ty+1, Mirror); if g_debug_Frames then begin