X-Git-Url: http://deadsoftware.ru/gitweb?a=blobdiff_plain;f=src%2Fgame%2Fg_player.pas;h=ca23ce315cc7f2009d858a527d208163a0693b47;hb=c146ab01667396f6b030e131e05cb6ce90aaff04;hp=7d81725f7dddd40549fa18ba20020c4b177af339;hpb=e65704e6e35ebfc43ec635f7a86f95f0b4442fbd;p=d2df-sdl.git diff --git a/src/game/g_player.pas b/src/game/g_player.pas index 7d81725..ca23ce3 100644 --- a/src/game/g_player.pas +++ b/src/game/g_player.pas @@ -231,6 +231,8 @@ type procedure doDamage (v: Integer); + function followCorpse(): Boolean; + public FDamageBuffer: Integer; @@ -463,7 +465,7 @@ type PGib = ^TGib; TGib = record - alive: Boolean; + alive: Boolean; ID: DWORD; MaskID: DWORD; RAngle: Integer; @@ -501,6 +503,7 @@ type FDamage: Byte; FColor: TRGB; FObj: TObj; + FPlayerUID: Word; FAnimation: TAnimation; FAnimationMask: TAnimation; @@ -1539,6 +1542,7 @@ begin gCorpses[find_id].FColor := FModel.Color; gCorpses[find_id].FObj.Vel := FObj.Vel; gCorpses[find_id].FObj.Accel := FObj.Accel; + gCorpses[find_id].FPlayerUID := FUID; end else g_Player_CreateGibs(FObj.X + PLAYER_RECT_CX, @@ -3724,7 +3728,7 @@ begin if not switchAllowed then begin //HACK for weapon cycling - if (FNextWeap and $7000) <> 0 then FNextWeap := 0; + if (FNextWeap and $E000) <> 0 then FNextWeap := 0; exit; end; @@ -4514,6 +4518,13 @@ begin FRulez := []; end; +// Ðàçðûâàåì ñâÿçè ñ òðóïàìè: + if gCorpses <> nil then + for a := 0 to High(gCorpses) do + if gCorpses[a] <> nil then + if gCorpses[a].FPlayerUID = FUID then + gCorpses[a].FPlayerUID := 0; + // Ïîëó÷àåì êîîðäèíàòû òî÷êè âîçðîæäåíèÿ: if not g_Map_GetPoint(c, RespawnPoint) then begin @@ -4831,6 +4842,30 @@ begin Result := 1; end; +function TPlayer.followCorpse(): Boolean; +var + i: Integer; +begin + Result := False; + if FAlive or FSpectator then + Exit; + if (gCorpses = nil) or (Length(gCorpses) = 0) then + Exit; + for i := 0 to High(gCorpses) do + if gCorpses[i] <> nil then + if gCorpses[i].FPlayerUID = FUID then + begin + Result := True; + FObj.X := gCorpses[i].FObj.X; + FObj.Y := gCorpses[i].FObj.Y; + FObj.Vel.X := gCorpses[i].FObj.Vel.X; + FObj.Vel.Y := gCorpses[i].FObj.Vel.Y; + FObj.Accel.X := gCorpses[i].FObj.Accel.X; + FObj.Accel.Y := gCorpses[i].FObj.Accel.Y; + break; + end; +end; + procedure TPlayer.Update(); var b: Byte; @@ -4907,7 +4942,8 @@ begin if FPhysics then begin - g_Obj_Move(@FObj, True, True, True); + if not followCorpse() then + g_Obj_Move(@FObj, True, True, True); positionChanged(); // this updates spatial accelerators end; @@ -5033,7 +5069,8 @@ begin if FPhysics then begin - g_Obj_Move(@FObj, True, True, True); + if not followCorpse() then + g_Obj_Move(@FObj, True, True, True); positionChanged(); // this updates spatial accelerators end else @@ -6383,6 +6420,7 @@ begin utils.writeInt(st, Byte(FColor.B)); // Îáúåêò òðóïà Obj_SaveState(st, @FObj); + utils.writeInt(st, Word(FPlayerUID)); // Åñòü ëè àíèìàöèÿ anim := (FAnimation <> nil); utils.writeBool(st, anim); @@ -6415,6 +6453,7 @@ begin FColor.B := utils.readByte(st); // Îáúåêò òðóïà Obj_LoadState(@FObj, st); + FPlayerUID := utils.readWord(st); // Åñòü ëè àíèìàöèÿ anim := utils.readBool(st); // Åñëè åñòü - çàãðóæàåì