X-Git-Url: http://deadsoftware.ru/gitweb?a=blobdiff_plain;f=src%2Fgame%2Fg_monsters.pas;h=a19fa4b568e5dbab3163ff1eb8d256b8c5234d82;hb=e6a2ca524340877015dc54ec063f925989548a98;hp=83714cbdd0ec333d5f9a581bfd35c78aae655fd5;hpb=8bc91b0c803ac0934ca9e32ca05d9294d7b2a913;p=d2df-sdl.git diff --git a/src/game/g_monsters.pas b/src/game/g_monsters.pas index 83714cb..a19fa4b 100644 --- a/src/game/g_monsters.pas +++ b/src/game/g_monsters.pas @@ -40,6 +40,8 @@ const MONSTATE_REVIVE = 10; MONSTATE_RUNOUT = 11; + MON_BURN_TIME = 100; + { in mapdef now BH_NORMAL = 0; BH_KILLER = 1; @@ -145,7 +147,7 @@ type function AnimIsReverse: Boolean; function shoot(o: PObj; immediately: Boolean): Boolean; function kick(o: PObj): Boolean; - procedure CatchFire(Attacker: Word); + procedure CatchFire(Attacker: Word; Timeout: Integer = MON_BURN_TIME); procedure OnFireFlame(Times: DWORD = 1); procedure positionChanged (); //WARNING! call this after monster position was changed, or coldet will not work right! @@ -2006,6 +2008,15 @@ begin Exit; end; +// Àð÷è íå ãîðÿò, ÷åðåïà óæå ãîðÿò + if (t = HIT_FLAME) and (FMonsterType in [MONSTER_VILE, MONSTER_SOUL]) then + begin + // Ïðîñíóòüñÿ âñå-òàêè ñòîèò + if FState = MONSTATE_SLEEP then + SetState(MONSTATE_GO); + Exit; + end; + // Ëîâóøêà óáèâàåò ñðàçó: if t = HIT_TRAP then FHealth := -100; @@ -2433,6 +2444,8 @@ var o, co: TObj; fall: Boolean; mon: TMonster; + mit: PMonster; + it: TMonsterGrid.Iter; label _end; begin @@ -2469,13 +2482,14 @@ begin st := g_Obj_Move(@FObj, fall, True, True); positionChanged(); // this updates spatial accelerators -// Åñëè ãîðèì - ïîäæèãàåì äðóãèõ ìîíñòðîâ: +// Åñëè ãîðèì - ïîäæèãàåì äðóãèõ ìîíñòðîâ, íî íå íà 100 òèêîâ êàæäûé ðàç: if FFireTime > 0 then - for a := 0 to High(gMonsters) do - if (gMonsters[a] <> nil) and (gMonsters[a].alive) and - (gMonsters[a].FUID <> FUID) and - g_Obj_Collide(@FObj, @gMonsters[a].Obj) then - gMonsters[a].CatchFire(FFireAttacker); + begin + it := monsGrid.forEachInAABB(FObj.X+FObj.Rect.X, FObj.Y+FObj.Rect.Y, FObj.Rect.Width, FObj.Rect.Height); + for mit in it do + if mit.UID <> FUID then + mit.CatchFire(FFireAttacker, FFireTime); + end; // Âûëåòåë çà êàðòó - óäàëÿåì è çàïóñêàåì òðèããåðû: if WordBool(st and MOVE_FALLOUT) or (FObj.X < -1000) or @@ -4644,11 +4658,14 @@ begin SetLength(FDieTriggers, 0); end; -procedure TMonster.CatchFire(Attacker: Word); +procedure TMonster.CatchFire(Attacker: Word; Timeout: Integer = MON_BURN_TIME); begin + if FMonsterType in [MONSTER_SOUL, MONSTER_VILE] then + exit; // àð÷è íå ãîðÿò, ÷åðåïà óæå ãîðÿò + if Timeout <= 0 then exit; if FFireTime <= 0 then g_Sound_PlayExAt('SOUND_IGNITE', FObj.X, FObj.Y); - FFireTime := 100; + FFireTime := Timeout; FFireAttacker := Attacker; if g_Game_IsNet and g_Game_IsServer then MH_SEND_MonsterState(FUID); end;