summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ae5dd5c)
raw | patch | inline | side by side (parent: ae5dd5c)
author | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Mon, 21 Aug 2017 05:18:32 +0000 (08:18 +0300) | ||
committer | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Mon, 21 Aug 2017 05:19:46 +0000 (08:19 +0300) |
diff --git a/src/game/g_game.pas b/src/game/g_game.pas
index c09158d4428909d9041a06e6ea7b2b505f0f56ad..ad2a0f7e1fd54ead47a35dba8880325ffbe9d4d5 100644 (file)
--- a/src/game/g_game.pas
+++ b/src/game/g_game.pas
w: Word;
i, b: Integer;
- function sendMonsPos (monidx: Integer; mon: TMonster): Boolean;
+ function sendMonsPos (mon: TMonster): Boolean;
begin
result := false; // don't stop
if (mon.MonsterType = MONSTER_BARREL) then
var
a, aX, aY, aX2, aY2, Scale, ScaleSz: Integer;
- function monDraw (monidx: Integer; mon: TMonster): Boolean;
+ function monDraw (mon: TMonster): Boolean;
begin
result := false; // don't stop
with mon do
var
i, n, nb, nr: Integer;
- function monRespawn (monidx: Integer; mon: TMonster): Boolean;
+ function monRespawn (mon: TMonster): Boolean;
begin
result := false; // don't stop
if not mon.FNoRespawn then mon.Respawn();
diff --git a/src/game/g_map.pas b/src/game/g_map.pas
index f063f74081e5cf554b813bf9ea1a950283d4cd74..52713fd8785e114aee27e6386f688f3ac52467e9 100644 (file)
--- a/src/game/g_map.pas
+++ b/src/game/g_map.pas
procedure g_Map_ReAdd_DieTriggers();
- function monsDieTrig (monidx: Integer; mon: TMonster): Boolean;
+ function monsDieTrig (mon: TMonster): Boolean;
var
a: Integer;
begin
index 55a02104f4a56e602de638d507b13490936100cf..d577b235b946c5d6ff143ba4c7930c34af7446e0 100644 (file)
--- a/src/game/g_monsters.pas
+++ b/src/game/g_monsters.pas
type
- TEachMonsterCB = function (monidx: Integer; mon: TMonster): Boolean is nested; // return `true` to stop
+ TEachMonsterCB = function (mon: TMonster): Boolean is nested; // return `true` to stop
// throws on invalid uid
function g_Mons_ByIdx (uid: Integer): TMonster; inline;
Result := False;
end;
+
function BehaviourDamage(SpawnerUID: Word; BH, SelfType: Byte): Boolean;
var
m: TMonster;
end;
end;
+
function canShoot(m: Byte): Boolean;
begin
Result := False;
end;
end;
-function isCorpse(o: PObj; immediately: Boolean): Integer;
+
+function isCorpse (o: PObj; immediately: Boolean): Integer;
function monsCollCheck (mon: TMonster; atag: Integer): Boolean;
begin
mon := gMonsters[idx];
if (mon <> nil) then
begin
- result := cb(idx, gMonsters[idx]);
+ result := cb(mon);
if result then exit;
end;
end;
mon := gMonsters[idx];
if (mon <> nil) and mon.Live then
begin
- result := cb(idx, gMonsters[idx]);
+ result := cb(mon);
if result then exit;
end;
end;
@@ -4513,7 +4516,7 @@ function g_Mons_ForEachAt (x, y: Integer; width, height: Integer; cb: TEachMonst
function monsCollCheck (mon: TMonster; atag: Integer): Boolean;
begin
result := false;
- if g_Obj_Collide(x, y, width, height, @mon.Obj) then result := cb(mon.arrIdx, mon);
+ if g_Obj_Collide(x, y, width, height, @mon.Obj) then result := cb(mon);
end;
var
begin
if g_Obj_Collide(x, y, width, height, @mon.Obj) then
begin
- result := cb(idx, mon);
+ result := cb(mon);
if result then exit;
end;
end;
@@ -4549,7 +4552,7 @@ 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.arrIdx, mon);
+ if mon.Live and g_Obj_Collide(x, y, width, height, @mon.Obj) then result := cb(mon);
end;
var
begin
if g_Obj_Collide(x, y, width, height, @mon.Obj) then
begin
- result := cb(idx, mon);
+ result := cb(mon);
if result then exit;
end;
end;
diff --git a/src/game/g_netmsg.pas b/src/game/g_netmsg.pas
index 213669e57aca2a89a5a93814f88e735080dc2264..936141adbc58ee1d33acae7c7708b42ef064dcfe 100644 (file)
--- a/src/game/g_netmsg.pas
+++ b/src/game/g_netmsg.pas
@@ -634,7 +634,7 @@ procedure MH_SEND_Everything(CreatePlayers: Boolean = False; ID: Integer = NET_E
MH_SEND_ItemSpawn(True, it.myid, ID);
end;
- function sendMonSpawn (monidx: Integer; mon: TMonster): Boolean;
+ function sendMonSpawn (mon: TMonster): Boolean;
begin
result := false; // don't stop
MH_SEND_MonsterSpawn(mon.UID, ID);
diff --git a/src/game/g_player.pas b/src/game/g_player.pas
index 612a4fb0aee855f664ae797deb1113959ba59583..2b7fec91097ceb5f23aef7edde48d186ff294ab1 100644 (file)
--- a/src/game/g_player.pas
+++ b/src/game/g_player.pas
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;
index 999db6b3ad32f1dad2dd127da468182a24abcdd6..e39b8c66a3dfdd7b6a2491f85087cae51e119ddb 100644 (file)
--- a/src/game/g_triggers.pas
+++ b/src/game/g_triggers.pas
a, b, c: Integer;
wx, wy, wh, ww: Integer;
- function monsDamage (monidx: Integer; mon: TMonster): Boolean;
+ function monsDamage (mon: TMonster): Boolean;
begin
result := false; // don't stop
if g_Obj_Collide(wx, wy, ww, wh, @mon.Obj) then mon.Damage(TRAP_DAMAGE, 0, 0, 0, HIT_TRAP);
it: PItem;
mon: TMonster;
- function monsShotTarget (monidx: Integer; mon: TMonster): Boolean;
+ function monsShotTarget (mon: TMonster): Boolean;
begin
result := false; // don't stop
if mon.Live and tr_ShotAimCheck(Trigger, @(mon.Obj)) then
end;
end;
- function monsShotTargetMonPlr (monidx: Integer; mon: TMonster): Boolean;
+ function monsShotTargetMonPlr (mon: TMonster): Boolean;
begin
result := false; // don't stop
if mon.Live and tr_ShotAimCheck(Trigger, @(mon.Obj)) then
end;
end;
- function monShotTargetPlrMon (monidx: Integer; mon: TMonster): Boolean;
+ function monShotTargetPlrMon (mon: TMonster): Boolean;
begin
result := false; // don't stop
if mon.Live and tr_ShotAimCheck(Trigger, @(mon.Obj)) then
a, b, i: Integer;
Affected: array of Integer;
- {function monsNear (monidx: Integer; mon: TMonster): Boolean;
+ {function monsNear (mon: TMonster): Boolean;
begin
result := false; // don't stop
if mon.Collide(gTriggers[a].X, gTriggers[a].Y, gTriggers[a].Width, gTriggers[a].Height) then
end;
end;}
- function monsNear (monidx: Integer; mon: TMonster): Boolean;
+ function monsNear (mon: TMonster): Boolean;
begin
result := false; // don't stop
gTriggers[a].ActivateUID := mon.UID;
diff --git a/src/game/g_weapons.pas b/src/game/g_weapons.pas
index 148f87c33966595f8e761c3d3bf56b5d5c73bbbf..d9c20e62c7711a3c7c4faf1a12aac97afabd07a3 100644 (file)
--- a/src/game/g_weapons.pas
+++ b/src/game/g_weapons.pas
frameId: DWord;
{
- function monsWaterCheck (monidx: Integer; mon: TMonster): Boolean;
+ function monsWaterCheck (mon: TMonster): Boolean;
begin
result := false; // don't stop
if mon.Live and mon.Collide(gWater[WaterMap[a][c]]) and (not InWArray(monidx, chkTrap_mn)) and (i2 < 1023) then //FIXME
end;
}
- function monsWaterCheck (monidx: Integer; mon: TMonster): Boolean;
+ function monsWaterCheck (mon: TMonster): Boolean;
begin
result := false; // don't stop
if (mon.trapCheckFrameId <> frameId) then
function GunHit(X, Y: Integer; vx, vy: Integer; dmg: Integer;
SpawnerUID: Word; AllowPush: Boolean): Byte;
- {function monsCheck (monidx: Integer; mon: TMonster): Boolean;
+ {function monsCheck (mon: TMonster): Boolean;
begin
result := false; // don't stop
if mon.Live and mon.Collide(X, Y) then
end;
end;}
- function monsCheck (monidx: Integer; mon: TMonster): Boolean;
+ function monsCheck (mon: TMonster): Boolean;
begin
result := false; // don't stop
if HitMonster(mon, dmg, vx*10, vy*10-3, SpawnerUID, HIT_SOME) then
procedure g_Weapon_BFG9000(X, Y: Integer; SpawnerUID: Word);
- function monsCheck (monidx: Integer; mon: TMonster): Boolean;
+ function monsCheck (mon: TMonster): Boolean;
begin
result := false; // don't stop
if (mon.Live) and (mon.UID <> SpawnerUID) then
end;
//FIXME
- g_Mons_ForEach(monsCheck);
+ g_Mons_ForEachAlive(monsCheck);
end;
function g_Weapon_CreateShot(I: Integer; ShotType: Byte; Spawner, TargetUID: Word; X, Y, XV, YV: Integer): LongWord;
end;
}
- function monsCheckHit (monidx: Integer; mon: TMonster): Boolean;
+ function monsCheckHit (mon: TMonster): Boolean;
begin
result := false; // don't stop
if HitMonster(mon, d, obj.Vel.X, obj.Vel.Y, SpawnerUID, t) then
function MonsterHit(): Boolean;
begin
//result := g_Mons_ForEach(monsCheckHit);
+ //FIXME: accelerate this!
result := g_Mons_ForEachAliveAt(obj.X+obj.Rect.X, obj.Y+obj.Rect.Y, obj.Rect.Width, obj.Rect.Height, monsCheckHit);
end;
@@ -931,7 +932,7 @@ function g_Weapon_Explode(X, Y: Integer; rad: Integer; SpawnerUID: Word): Boolea
var
r: Integer; // squared radius
- function monsExCheck (monidx: Integer; mon: TMonster): Boolean;
+ function monsExCheck (mon: TMonster): Boolean;
var
dx, dy, mm: Integer;
begin