/* BWOverWorld */

#import <Cocoa/Cocoa.h>

struct sArea
{
	unsigned char x;
	unsigned char y;
};

@interface BWOverWorld : NSMatrix
{
    IBOutlet id matrixTools;
	IBOutlet id scrollView;
	
	IBOutlet id fieldPosition;
	IBOutlet id fieldGroups;
	
	IBOutlet id menuRegion;
	IBOutlet id menuArea;
	
	NSMutableData *rom;
	NSMutableArray *tiles;
	
	unsigned char currentTool;
	unsigned char mapScale;
	unsigned char cr;			// Current Region
	
	NSMutableArray *areas;
	
	struct sArea keyAreas[62][3];
	
	int maxAreas;	// Max for current Area/Region (55 - 55 - 62)
	int sel;		// Current selected area (-1 for no selection)
	
	unsigned short offSet;
	unsigned short offSetPalaces;
	unsigned short maxPalaces;
	unsigned short maxGroups;
	
	unsigned short g[3];
	unsigned char b[3][1024];
}

- (void)open:(NSMutableData *)theRom;

- (void)loadTiles;
- (NSImage *)tileWithOffset:(int)os palette:(struct sCol[4])pal;

- (void)loadRegions;
- (IBAction)changeRegion:(id)sender;
- (void)loadAreas;
- (IBAction)changeArea:(id)sender;

- (IBAction)changeTool:(id)sender;
- (void)calc;

- (void)save;
- (void)palacePointers;

- (IBAction)exportRegion:(id)sender;

@end
