summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f1e5041)
raw | patch | inline | side by side (parent: f1e5041)
author | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Sun, 20 Aug 2017 02:03:00 +0000 (05:03 +0300) | ||
committer | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Sun, 20 Aug 2017 05:33:44 +0000 (08:33 +0300) |
src/game/g_items.pas | patch | blob | history |
diff --git a/src/game/g_items.pas b/src/game/g_items.pas
index 4950e4c4b9a1412599f1b3e098f65d8f1f13b0e9..95ea919ca31007ae9c90257f1e49cc1b555e2c85 100644 (file)
--- a/src/game/g_items.pas
+++ b/src/game/g_items.pas
// ////////////////////////////////////////////////////////////////////////// //
+{
type
TDynAABBTreeItemBase = specialize TDynAABBTreeBase<Integer>;
if not aabb.valid then raise Exception.Create('wutafuuuuuuu?!');
result := true;
end;
-
+}
// ////////////////////////////////////////////////////////////////////////// //
var
- itemTree: TDynAABBTreeItem = nil;
+ //itemTree: TDynAABBTreeItem = nil;
freeIds: TBinaryHeapInt = nil; // free item ids
// ////////////////////////////////////////////////////////////////////////// //
procedure TItem.positionChanged ();
-var
- x, y: Integer;
+//var
+// x, y: Integer;
begin
+ (*
if (treeNode = -1) then
begin
treeNode := itemTree.insertObject(arrIdx, 0, true); // static object
+ {$IF DEFINED(D2F_DEBUG)}
itemTree.getNodeXY(treeNode, x, y);
- {$IF DEFINED(D2F_DEBUG)}e_WriteLog(Format('item #%d: inserted into the tree; nodeid=%d; x=%d; y=%d', [arrIdx, treeNode, x, y]), MSG_NOTIFY);{$ENDIF}
+ e_WriteLog(Format('item #%d: inserted into the tree; nodeid=%d; x=%d; y=%d', [arrIdx, treeNode, x, y]), MSG_NOTIFY);
+ {$ENDIF}
end
else
begin
treeNode := itemTree.insertObject(arrIdx, 0, true); // static object
{$ENDIF}
+ {$IF DEFINED(D2F_DEBUG)}
itemTree.getNodeXY(treeNode, x, y);
- {$IF DEFINED(D2F_DEBUG)}e_WriteLog(Format('item #%d: updated tree; nodeid=%d; x=%d; y=%d', [arrIdx, treeNode, x, y]), MSG_NOTIFY);{$ENDIF}
+ e_WriteLog(Format('item #%d: updated tree; nodeid=%d; x=%d; y=%d', [arrIdx, treeNode, x, y]), MSG_NOTIFY);
+ {$ENDIF}
end;
+ *)
end;
InitTextures();
- itemTree := TDynAABBTreeItem.Create();
+ //itemTree := TDynAABBTreeItem.Create();
freeIds := binHeapNewIntLess();
end;
g_Texture_Delete('ITEM_MEDKIT_BLACK');
g_Texture_Delete('ITEM_JETPACK');
- itemTree.Free();
+ //itemTree.Free();
freeIds.Free();
end;
it := @ggItems[idx];
if (it.treeNode = -1) then raise Exception.Create('releaseItem: trying to release unallocated item');
if (it.arrIdx <> idx) then raise Exception.Create('releaseItem: arrIdx inconsistency');
- itemTree.removeObject(it.treeNode);
+ //itemTree.removeObject(it.treeNode);
it.treeNode := -1;
if (it.Animation <> nil) then
begin
else
begin
// it will be readded
- itemTree.removeObject(it.treeNode);
+ //itemTree.removeObject(it.treeNode);
it.treeNode := -1;
end;
for i := 0 to High(ggItems) do ggItems[i].Animation.Free();
ggItems := nil;
end;
- if (itemTree <> nil) then itemTree.reset();
+ //if (itemTree <> nil) then itemTree.reset();
freeIds.clear();
end;
var
it: PItem;
trig: Integer;
- x, y: Integer;
+{$IF DEFINED(D2F_DEBUG)}
+ //x, y: Integer;
+{$ENDIF}
begin
if not g_ItemValidId(ID) then raise Exception.Create('g_Items_Remove: invalid item id');
it := @ggItems[ID];
if (it.arrIdx <> ID) then raise Exception.Create('g_Items_Remove: arrIdx desync');
- itemTree.getNodeXY(it.treeNode, x, y);
- {$IF DEFINED(D2F_DEBUG)}e_WriteLog(Format('removing item #%d: updating tree; nodeid=%d; x=%d; y=%d (%d,%d)', [it.arrIdx, it.treeNode, x, y, it.Obj.X, it.Obj.Y]), MSG_NOTIFY);{$ENDIF}
+ {$IF DEFINED(D2F_DEBUG)}
+ //itemTree.getNodeXY(it.treeNode, x, y);
+ //e_WriteLog(Format('removing item #%d: updating tree; nodeid=%d; x=%d; y=%d (%d,%d)', [it.arrIdx, it.treeNode, x, y, it.Obj.X, it.Obj.Y]), MSG_NOTIFY);
+ {$ENDIF}
trig := it.SpawnTrigger;