#ifndef HEAP_H
#define HEAP_H

struct N64Event
{
	__int64 Time;
	void (_cdecl *Action)(void);
};

#define EVENT_HEAP_SIZE 55

extern N64Event N64EventArray[EVENT_HEAP_SIZE];

//Insert Item onto Heap
void EventHeapInsert(__int64 TheEventTime, void (_cdecl *TheEventAction)(void));
__int64 EventHeapFindMinTime();			//Return Smallest Item (Leave on heap)
void * EventHeapFindMinAction();		//Return the action for top of heap
void EventHeapDeleteMin();				//Remove Smallest
void EventHeapDeleteTime(__int64 TheEventTime);      //Remove Event with a certain time
void EventHeapDeleteAction(void (_cdecl *TheEventAction)(void));      //Remove Event with a certain action
int EventHeapIsEmpty();					//Check If Empty
int EventHeapIsFull();					//Check If full
void EventHeapMakeEmpty();				//Remove all Items
void EventHeapToss(N64Event X);			//Insert Lazily
void EventHeapPercolateDown(int Hole);	// Move entry 1 to its proper location
void EventHeapFixHeap(void);			//heapify
void InitEventHeap();

#endif
