Results 1 to 7 of 7

Thread: My solution to the overlapping issue in isometric worlds.

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #3
    Code:
    Procedure AddItem(y : LongWord; Data : tItem);
    Var
      b : longword;
    
    Begin
      OrderHeap[y]^[Items[y]] := data;
    //  writeln(y);
      Inc(Items[y]);
    End;
    This is pretty self explanatory. Items[y] always contains the next empty spot in the array.


    Code:
    Function ReadItem(y,x : LongWord) : tItem;
    Begin
      ReadItem := OrderHeap[y]^[x];
    End;

    Code:
    Procedure MoveItem(y : LongWord; Src,Dest : Word);
    Begin
    
      OrderHeap[y]^[Dest] := OrderHeap[y]^[Src];
      OrderHeap[y]^[Src] := OrderHeap[y]^[Items[y]-1];
      Dec(Items[y]);
    End;
    Okay now what's the point of this ? ^_^
    It's never used. There is none.
    I just keep it as a reference.

    The actually important one is the next one.

    Code:
    Procedure MoveItemToY(y1 : word; Src : byte; y2 : word);
    Var
      xxx : LongWord;
    
    Begin
      OrderHeap[y2]^[Items[y2]] := OrderHeap[y1]^[Src];
      OrderHeap[y1]^[Src] := OrderHeap[y1]^[Items[y1]-1];
      Dec(Items[y1]);
      Inc(Items[y2]);
    End;
    This part deals with moving entities that change Y.

    The part i like most about this approach is that whenever an item
    needs to move to different Y, the empty spot it left can get filled instantly by the last in line.

    No holes, no need for management.



    I am fairly certain that i have missed something and owe you explanations.
    Sadly, it's 0241, but i'll check back at it tomorrow and hopefully
    there are questions you want to have answered !

    Or, you know, just flame me.
    Last edited by Solstice Project; 01-11-2013 at 01:45 AM.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •