X-Git-Url: https://deadsoftware.ru/gitweb?a=blobdiff_plain;ds=sidebyside;f=src%2Fgame%2Fg_player.pas;h=f277a4e8ab74fa5ce9992b49c8af0b215c4e5e27;hb=4c4a0406b07cdfd5051e388e8b00f02e008ed140;hp=75366d34590e693d5c82b50f235ee20adcc27f04;hpb=e0ef894b62b50d6a7bd7e1dfa42ee3f1a839403a;p=d2df-sdl.git diff --git a/src/game/g_player.pas b/src/game/g_player.pas index 75366d3..f277a4e 100644 --- a/src/game/g_player.pas +++ b/src/game/g_player.pas @@ -21,7 +21,7 @@ interface uses e_graphics, g_playermodel, g_basic, g_textures, g_weapons, g_phys, g_sound, g_saveload, MAPSTRUCT, - BinEditor, g_panel; + BinEditor, g_panel, z_aabbtree; const KEY_LEFT = 1; @@ -222,6 +222,8 @@ type procedure resetWeaponQueue (); function hasAmmoForWeapon (weapon: Byte): Boolean; + function getMapAABB (): AABB2D; + public FDamageBuffer: Integer; @@ -346,6 +348,8 @@ type property UID: Word read FUID write FUID; property JustTeleported: Boolean read FJustTeleported write FJustTeleported; property NetTime: LongWord read FNetTime write FNetTime; + + property mapAABB: AABB2D read getMapAABB; end; TDifficult = record @@ -2980,7 +2984,7 @@ var id: DWORD; begin id := g_Items_Create(FObj.X, FObj.Y, t, True, False); - it := g_ItemByIdx(id); + it := g_Items_ByIdx(id); if KillType = K_EXTRAHARDKILL then // -7..+7; -8..0 begin g_Obj_Push(@it.Obj, (FObj.Vel.X div 2)-7+Random(15), @@ -3121,7 +3125,7 @@ begin end else if g_GetUIDType(SpawnerUID) = UID_MONSTER then begin // Óáèò ìîíñòðîì - mon := g_Monsters_Get(SpawnerUID); + mon := g_Monsters_ByUID(SpawnerUID); if mon = nil then s := '?' else @@ -4998,6 +5002,11 @@ begin if FKeys[b].Time = 0 then FKeys[b].Pressed := False else Dec(FKeys[b].Time); end; +function TPlayer.getMapAABB (): AABB2D; inline; +begin + result := AABB2D.CreateWH(FObj.X+PLAYER_RECT.X, FObj.Y+PLAYER_RECT.Y, PLAYER_RECT.Width, PLAYER_RECT.Height); +end; + function TPlayer.Collide(X, Y: Integer; Width, Height: Word): Boolean; begin Result := g_Collide(FObj.X+PLAYER_RECT.X, @@ -6304,10 +6313,10 @@ var vsPlayer, vsMonster, ok: Boolean; - function monsUpdate (monidx: Integer; mon: TMonster): Boolean; + function monsUpdate (mon: TMonster): Boolean; begin result := false; // don't stop - if (mon <> nil) and (mon.Live) and (mon.MonsterType <> MONSTER_BARREL) then + if mon.Live and (mon.MonsterType <> MONSTER_BARREL) then begin if not TargetOnScreen(mon.Obj.X+mon.Obj.Rect.X, mon.Obj.Y+mon.Obj.Rect.Y) then exit; @@ -6393,7 +6402,7 @@ begin if (g_GetUIDType(Target.UID) = UID_MONSTER) and vsMonster then begin // Ìîíñòð - mon := g_Monsters_Get(Target.UID); + mon := g_Monsters_ByUID(Target.UID); if mon <> nil then begin Target.X := mon.Obj.X; @@ -6626,7 +6635,7 @@ begin end else begin // Öåëü - ìîíñòð - mon := g_Monsters_Get(Target.UID); + mon := g_Monsters_ByUID(Target.UID); if (mon = nil) or (not mon.Live) then Target.UID := 0; // òî çàáûòü öåëü end; @@ -7378,7 +7387,7 @@ begin if (g_GetUIDType(FLastSpawnerUID) = UID_MONSTER) and LongBool(gGameSettings.Options and GAME_OPTION_BOTVSMONSTER) then begin // Ìîíñòð - mon := g_Monsters_Get(FLastSpawnerUID); + mon := g_Monsters_ByUID(FLastSpawnerUID); ok := not TargetOnScreen(mon.Obj.X + mon.Obj.Rect.X, mon.Obj.Y + mon.Obj.Rect.Y); end;