index ae4389c98ab48bb4b9c79c15ab9d8607de8967c2..5719ca4ff300322779f697deeb1bbb08510a196b 100644 (file)
--- a/src/game/g_monsters.pas
+++ b/src/game/g_monsters.pas
function findNewPrey(): Boolean;
procedure ActivateTriggers();
+ procedure setGameX (v: Integer); inline;
+ procedure setGameY (v: Integer); inline;
+
public
FNoRespawn: Boolean;
FFireTime: Integer;
function Collide(Panel: TPanel): Boolean; overload;
function Collide(X, Y: Integer): Boolean; overload;
function TeleportTo(X, Y: Integer; silent: Boolean; dir: Byte): Boolean;
- function Live(): Boolean;
+ function alive(): Boolean;
procedure SetHealth(aH: Integer);
procedure Push(vx, vy: Integer);
function Damage(aDamage: Word; VelX, VelY: Integer; SpawnerUID: Word; t: Byte): Boolean;
procedure positionChanged (); //WARNING! call this after monster position was changed, or coldet will not work right!
+ procedure setPosition (ax, ay: Integer; callPosChanged: Boolean=true); inline;
+
procedure getMapBox (out x, y, w, h: Integer); inline;
public
property UID: Word read FUID write FUID;
property SpawnTrigger: Integer read FSpawnTrigger write FSpawnTrigger;
- property GameX: Integer read FObj.X write FObj.X;
- property GameY: Integer read FObj.Y write FObj.Y;
+ property GameX: Integer read FObj.X write setGameX;
+ property GameY: Integer read FObj.Y write setGameY;
property GameVelX: Integer read FObj.Vel.X write FObj.Vel.X;
property GameVelY: Integer read FObj.Vel.Y write FObj.Vel.Y;
property GameAccelX: Integer read FObj.Accel.X write FObj.Accel.X;
g_language, g_netmsg, idpool;
+
// ////////////////////////////////////////////////////////////////////////// //
procedure g_Mons_ProfilersBegin ();
begin
{ T M o n s t e r : }
+procedure TMonster.setGameX (v: Integer); inline; begin FObj.X := v; positionChanged(); end;
+procedure TMonster.setGameY (v: Integer); inline; begin FObj.Y := v; positionChanged(); end;
+procedure TMonster.setPosition (ax, ay: Integer; callPosChanged: Boolean=true); inline; begin FObj.X := ax; FObj.Y := ay; if callPosChanged then positionChanged(); end;
+
+
procedure TMonster.ActionSound();
begin
case FMonsterType of
FObj.Accel.X := 0;
FObj.Accel.Y := 0;
FDirection := FStartDirection;
- GameX := FStartX;
- GameY := FStartY;
+ {GameX}FObj.X := FStartX;
+ {GameY}FObj.Y := FStartY;
FObj.Rect := MONSTERTABLE[FMonsterType].Rect;
FHealth := MONSTERTABLE[FMonsterType].Health;
FAmmo := 0;
Result := False;
if g_Game_IsClient then
Exit;
- if not Live then
+ if not alive then
Exit;
if FHealth < FMaxHealth then
(FObj.X > gMapInfo.Width+1000) or (FObj.Y < -1000) then
begin
FRemoved := True;
- if Live and (gLMSRespawn = LMS_RESPAWN_NONE) then
+ if alive and (gLMSRespawn = LMS_RESPAWN_NONE) then
begin
Inc(gCoopMonstersKilled);
if g_Game_IsNet then
// Åñëè åñòü èãðîê ðÿäîì, ïðîñûïàåìñÿ è èäåì ê íåìó:
if (gPlayers <> nil) then
for a := 0 to High(gPlayers) do
- if (gPlayers[a] <> nil) and (gPlayers[a].Live)
+ if (gPlayers[a] <> nil) and (gPlayers[a].alive)
and (not gPlayers[a].NoTarget) and (gPlayers[a].FMegaRulez[MR_INVIS] < gTime) then
with gPlayers[a] do
if g_Look(@FObj, @Obj, FDirection) then
// Åñëè åñòü ïîäõîäÿùèé ìîíñòð ðÿäîì:
if gMonsters <> nil then
for a := 0 to High(gMonsters) do
- if (gMonsters[a] <> nil) and (gMonsters[a].Live) and
+ if (gMonsters[a] <> nil) and (gMonsters[a].alive) and
(gMonsters[a].FUID <> FUID) then
begin
// Ìàíüÿêè íàïàäàþò íà âñåõ ìîíñòðîâ, êðîìå äðóçåé
if b > 1 then b := b * (Random(8 div b) + 1);
for a := 0 to High(gGibs) do
begin
- if gGibs[a].Live and
+ if gGibs[a].alive and
g_Obj_Collide(FObj.X+FObj.Rect.X, FObj.Y+FObj.Rect.Y+FObj.Rect.Height-4,
FObj.Rect.Width, 8, @gGibs[a].Obj) and (Random(3) = 0) then
begin
if b > 1 then b := b * (Random(8 div b) + 1);
for a := 0 to High(gGibs) do
begin
- if gGibs[a].Live and
+ if gGibs[a].alive and
g_Obj_Collide(FObj.X+FObj.Rect.X, FObj.Y+FObj.Rect.Y+FObj.Rect.Height-4,
FObj.Rect.Width, 8, @gGibs[a].Obj) and (Random(3) = 0) then
begin
if (gPlayers <> nil) and (FBehaviour <> BH_INSANE) and
(FBehaviour <> BH_CANNIBAL) and (FBehaviour <> BH_GOOD) then
for a := 0 to High(gPlayers) do
- if (gPlayers[a] <> nil) and (gPlayers[a].Live)
+ if (gPlayers[a] <> nil) and (gPlayers[a].alive)
and (not gPlayers[a].NoTarget) and (gPlayers[a].FMegaRulez[MR_INVIS] < gTime) then
begin
if g_Look(@FObj, @gPlayers[a].Obj, FDirection) then
// Êèëëåðû è äîáðûå íå òðîãàþò ìîíñòðîâ
if (gMonsters <> nil) and (FBehaviour <> BH_KILLER) and (FBehaviour <> BH_GOOD) then
for a := 0 to High(gMonsters) do
- if (gMonsters[a] <> nil) and (gMonsters[a].Live) and
+ if (gMonsters[a] <> nil) and (gMonsters[a].alive) and
(gMonsters[a].FUID <> FUID) then
begin
if (FBehaviour = BH_CANNIBAL) and (gMonsters[a].FMonsterType <> FMonsterType) then
Result := True;
end;
-function TMonster.Live(): Boolean;
+function TMonster.alive(): Boolean;
begin
Result := (FState <> MONSTATE_DIE) and (FState <> MONSTATE_DEAD) and (FHealth > 0);
end;
for idx := 0 to High(gMonsters) do
begin
mon := gMonsters[idx];
- if (mon <> nil) and mon.Live then
+ if (mon <> nil) and mon.alive then
begin
result := cb(mon);
if result then exit;
@@ -4579,7 +4590,7 @@ function g_Mons_IsAnyAliveAt (x, y: Integer; width, height: Integer): Boolean;
function monsCollCheck (mon: TMonster; atag: Integer): Boolean;
begin
- result := mon.Live;// and g_Obj_Collide(x, y, width, height, @mon.Obj));
+ result := mon.alive;// and g_Obj_Collide(x, y, width, height, @mon.Obj));
end;
var
for idx := 0 to High(gMonsters) do
begin
mon := gMonsters[idx];
- if (mon <> nil) and mon.Live then
+ if (mon <> nil) and mon.alive then
begin
if g_Obj_Collide(x, y, width, height, @mon.Obj) then
begin
for idx := 0 to High(gMonsters) do
begin
mon := gMonsters[idx];
- if (mon <> nil) and mon.Live then
+ if (mon <> nil) and mon.alive then
begin
if g_Obj_Collide(x, y, width, height, @mon.Obj) then
begin
@@ -4650,8 +4661,8 @@ function g_Mons_ForEachAliveAt (x, y: Integer; width, height: Integer; cb: TEach
function monsCollCheck (mon: TMonster; atag: Integer): Boolean;
begin
//result := false;
- //if mon.Live and g_Obj_Collide(x, y, width, height, @mon.Obj) then result := cb(mon);
- if mon.Live then result := cb(mon) else result := false;
+ //if mon.alive and g_Obj_Collide(x, y, width, height, @mon.Obj) then result := cb(mon);
+ if mon.alive then result := cb(mon) else result := false;
end;
var
for idx := 0 to High(gMonsters) do
begin
mon := gMonsters[idx];
- if (mon <> nil) and mon.Live then
+ if (mon <> nil) and mon.alive then
begin
if g_Obj_Collide(x, y, width, height, @mon.Obj) then
begin