index 13ab23ee0ccdf57421a7af06f9b0caf8b0f5637f..eabd05d7dff7ef4670fb23cf1f44536201a75933 100644 (file)
--- a/src/game/g_monsters.pas
+++ b/src/game/g_monsters.pas
SysUtils, Classes,
mempool,
MAPDEF,
- g_basic, r_graphics, g_phys, g_textures, g_grid,
+ g_base, g_basic, g_phys, g_textures, g_grid,
g_saveload, g_panel, xprofiler;
const
implementation
uses
- e_log, e_texture, g_main, g_sound, g_gfx, g_player, g_game,
+ e_log, g_sound, g_gfx, g_player, g_game, r_textures, r_animations, r_gfx,
g_weapons, g_triggers, g_items, g_options,
g_console, g_map, Math, g_menu, wadreader,
g_language, g_netmsg, idpool, utils, xstreams;
+function g_Look(a, b: PObj; d: TDirection): Boolean;
+begin
+ if not gmon_dbg_los_enabled then begin result := false; exit; end; // always "wall hit"
+
+ if ((b^.X > a^.X) and (d = TDirection.D_LEFT)) or
+ ((b^.X < a^.X) and (d = TDirection.D_RIGHT)) then
+ begin
+ Result := False;
+ Exit;
+ end;
+
+ Result := g_TraceVector(a^.X+a^.Rect.X+(a^.Rect.Width div 2),
+ a^.Y+a^.Rect.Y+(a^.Rect.Height div 2),
+ b^.X+b^.Rect.X+(b^.Rect.Width div 2),
+ b^.Y+b^.Rect.Y+(b^.Rect.Height div 2));
+end;
// ////////////////////////////////////////////////////////////////////////// //
procedure g_Mons_ProfilersBegin ();
end;
function TMonster.TeleportTo(X, Y: Integer; silent: Boolean; dir: Byte): Boolean;
-var
- TA: TAnimation;
- FramesID: DWORD;
begin
Result := False;
Exit;
end;
- TA := nil;
-
// Эффект телепорта в позиции монстра:
if not silent then
begin
- if g_Frames_Get(FramesID, 'FRAMES_TELEPORT') then
- TA := TAnimation.Create(FramesID, False, 6);
g_Sound_PlayExAt('SOUND_GAME_TELEPORT', Obj.X, Obj.Y);
- g_GFX_OnceAnim(FObj.X+FObj.Rect.X+(FObj.Rect.Width div 2)-32,
- FObj.Y+FObj.Rect.Y+(FObj.Rect.Height div 2)-32, TA);
+ r_GFX_OnceAnim(
+ R_GFX_TELEPORT,
+ FObj.X+FObj.Rect.X+(FObj.Rect.Width div 2)-32,
+ FObj.Y+FObj.Rect.Y+(FObj.Rect.Height div 2)-32
+ );
if g_Game_IsServer and g_Game_IsNet then
MH_SEND_Effect(FObj.X+FObj.Rect.X+(FObj.Rect.Width div 2)-32,
end;
// Эффект телепорта в точке назначения:
- if not silent and (TA <> nil) then
+ if not silent then
begin
- g_GFX_OnceAnim(FObj.X+FObj.Rect.X+(FObj.Rect.Width div 2)-32,
- FObj.Y+FObj.Rect.Y+(FObj.Rect.Height div 2)-32, TA);
- TA.Free();
+ r_GFX_OnceAnim(
+ R_GFX_TELEPORT,
+ FObj.X+FObj.Rect.X+(FObj.Rect.Width div 2)-32,
+ FObj.Y+FObj.Rect.Y+(FObj.Rect.Height div 2)-32
+ );
if g_Game_IsServer and g_Game_IsNet then
MH_SEND_Effect(FObj.X+FObj.Rect.X+(FObj.Rect.Width div 2)-32,
end;
procedure TMonster.OnFireFlame(Times: DWORD = 1);
-var
- id, i: DWORD;
- Anim: TAnimation;
+ var i: DWORD; x, y: Integer;
begin
if (Random(10) = 1) and (Times = 1) then
Exit;
- if g_Frames_Get(id, 'FRAMES_FLAME') then
+ for i := 1 to Times do
begin
- for i := 1 to Times do
- begin
- Anim := TAnimation.Create(id, False, 3);
- Anim.Alpha := 0;
- g_GFX_OnceAnim(Obj.X+Obj.Rect.X+Random(Obj.Rect.Width+Times*2)-(Anim.Width div 2),
- Obj.Y+8+Random(8+Times*2)+IfThen(FState = MONSTATE_DEAD, 16, 0), Anim, ONCEANIM_SMOKE);
- Anim.Free();
- end;
+ x := Obj.X + Obj.Rect.X + Random(Obj.Rect.Width + Times * 2) - (R_GFX_FLAME_WIDTH div 2);
+ y := Obj.Y + 8 + Random(8 + Times * 2) + IfThen(FState = MONSTATE_DEAD, 16, 0);
+ r_GFX_OnceAnim(R_GFX_FLAME, x, y);
end;
end;