X-Git-Url: http://deadsoftware.ru/gitweb?a=blobdiff_plain;f=src%2Fgame%2Fg_monsters.pas;h=12488d6e1c69aedad84bdaf0207800bf6a479347;hb=d9ca0efe35fd9b4bb8430cbd5ca348fd459955c7;hp=4cba5acb10b21bd2487e25d577e7a4611455449a;hpb=4eec31fb4339e1eedd7380506e344a69af9976f5;p=d2df-sdl.git diff --git a/src/game/g_monsters.pas b/src/game/g_monsters.pas index 4cba5ac..12488d6 100644 --- a/src/game/g_monsters.pas +++ b/src/game/g_monsters.pas @@ -322,8 +322,8 @@ uses procedure g_Mons_ProfilersBegin (); begin if (profMonsLOS = nil) then profMonsLOS := TProfiler.Create('LOS CALC', g_profile_history_size); - profMonsLOS.mainBegin(g_profile_los); - if g_profile_los then + if (profMonsLOS <> nil) then profMonsLOS.mainBegin(g_profile_los); + if g_profile_los and (profMonsLOS <> nil) then begin profMonsLOS.sectionBegin('loscalc'); profMonsLOS.sectionEnd(); @@ -332,17 +332,17 @@ end; procedure g_Mons_ProfilersEnd (); begin - if (profMonsLOS <> nil) and (g_profile_los) then profMapCollision.mainEnd(); + if (profMonsLOS <> nil) and (g_profile_los) then profMonsLOS.mainEnd(); end; procedure g_Mons_LOS_Start (); inline; begin - profMonsLOS.sectionBeginAccum('loscalc'); + if (profMonsLOS <> nil) then profMonsLOS.sectionBeginAccum('loscalc'); end; procedure g_Mons_LOS_End (); inline; begin - profMonsLOS.sectionEnd(); + if (profMonsLOS <> nil) then profMonsLOS.sectionEnd(); end; @@ -2825,7 +2825,7 @@ begin // Ðûáà ïëûâåò ââåðõ: if FObj.Vel.Y < 0 then - if not g_Obj_CollideWater(@FObj, 0, -16) then + if not g_Obj_CollideLiquid(@FObj, 0, -16) then begin // Âñïëûëè äî ïîâåðõíîñòè - ñòîï: FObj.Vel.Y := 0; @@ -3243,6 +3243,19 @@ _end: wx := FObj.X + wx; wy := FObj.Y + MONSTER_ANIMTABLE[FMonsterType].wY; + // Ìîíñòð íå ìîæåò öåëèòüñÿ â îáúåêò çà ñïèíîé, ñòðåëÿÿ âëåâî: + if (FDirection = TDirection.D_LEFT) and (tx > wx) then + begin + tx := wx - 32; + ty := wy + Random(11) - 5; + end; + // È àíàëîãè÷íî, ñòðåëÿÿ âïðàâî: + if (FDirection = TDirection.D_RIGHT) and (tx < wx) then + begin + tx := wx + 32; + ty := wy + Random(11) - 5; + end; + // Äåëàåì âûñòðåë íóæíûì îðóæèåì: case FMonsterType of MONSTER_IMP: @@ -3661,7 +3674,7 @@ begin // Ðûáà ïëûâåò ââåðõ: if FObj.Vel.Y < 0 then - if not g_Obj_CollideWater(@FObj, 0, -16) then + if not g_Obj_CollideLiquid(@FObj, 0, -16) then begin // Âñïëûëè äî ïîâåðõíîñòè - ñòîï: FObj.Vel.Y := 0;