public static Bitmap selectedtobmp(byte[] sheets, int p = 4, bool sprite = false) { byte[] blocks = new byte[24]; byte[] data = new byte[blocks.Length * 0x1000]; int gfxanimatedPointer = (ROM.DATA[Constants.gfx_animated_pointer + 2] << 16) + (ROM.DATA[Constants.gfx_animated_pointer + 1] << 8) + (ROM.DATA[Constants.gfx_animated_pointer]); gfxanimatedPointer = Addresses.snestopc(gfxanimatedPointer); for (int i = 0; i < blocks.Length; i++) { if (i < sheets.Length) { byte[] d = GFX.bpp3snestoindexed(GFX.gfxdata, sheets[i]); byte[] dd = new byte[0]; if (i == 6) { dd = GFX.bpp3snestoindexed(GFX.gfxdata, ROM.DATA[gfxanimatedPointer + 0]); //static animated gfx1 } if (i == 7) { dd = GFX.bpp3snestoindexed(GFX.gfxdata, 92); //static animated gfx1 } for (int j = 0; j < d.Length; j++) { data[(i * 0x1000) + j] = d[j]; if (i == 6) { if (j >= 0xC00) { data[(i * 0x1000) + j] = dd[j - 0xC00]; } } if (i == 7) { if (j < 0x400) { data[(i * 0x1000) + j] = dd[j]; } } } } } Bitmap b = new Bitmap(128, 256); begin_draw(b, 128, 256); unsafe { for (int x = 0; x < 128; x++) { for (int y = 0; y < 32 * sheets.Length; y++) { int dest = (x + (y * 128)) * 4; if (sprite == true) { GFX.currentData[dest] = (GFX.spritesPalettes[data[(dest / 4)], p].B); GFX.currentData[dest + 1] = (GFX.spritesPalettes[data[(dest / 4)], p].G); GFX.currentData[dest + 2] = (GFX.spritesPalettes[data[(dest / 4)], p].R); GFX.currentData[dest + 3] = 255; } else { GFX.currentData[dest] = (GFX.loadedPalettes[data[(dest / 4)], p].B); GFX.currentData[dest + 1] = (GFX.loadedPalettes[data[(dest / 4)], p].G); GFX.currentData[dest + 2] = (GFX.loadedPalettes[data[(dest / 4)], p].R); GFX.currentData[dest + 3] = 255; } } } } end_draw(b); return(b); }
public void GetSelectedMapGfx() { updateOverworldPalettes(); byte[] staticgfx = new byte[] { 58, 59, 60, 61, 0, 0, 89, 0, 0, 0, 0, 0, 0, 0, 0 }; //89 DM Animated byte animatedGfxPart2 = 91; //Should be 8 total not 9 //TODO Find why there's 9 probably because of animated tiles if (blockset >= 48) { staticgfx = new byte[] { 66, 67, 68, 69, 0, 0, 63, 89, 0, 0, 0, 0, 0, 0, 0, 0 }; } else if (blockset < 48) { staticgfx = new byte[] { 58, 59, 60, 61, 0, 0, 62, 89, 0, 0, 0, 0, 0, 0, 0, 0 }; } staticgfx[4] = ROM.DATA[(int)(Constants.overworldgfxGroups + (blockset * 4) + 1)]; staticgfx[5] = ROM.DATA[(int)(Constants.overworldgfxGroups + (blockset * 4) + 2)]; if (index >= 128) { staticgfx[4] = 71; staticgfx[5] = 72; } if (index >= 136) { staticgfx = new byte[] { 0, 70, 66, 65, 66, 65, 66, 65, 66, 0, 0, 0, 0, 0, 0, 0, 0 }; } //TODO : Need to find the position of these values for now they are hardcoded if (index >= 3 && index < 8) { staticgfx[7] = 89; } else if (index >= 11 && index < 15) { staticgfx[7] = 89; } else if (index >= 64 + 3 && index < 64 + 8) { staticgfx[7] = 89; } else if (index >= 64 + 11 && index < 64 + 15) { staticgfx[7] = 89; } else { staticgfx[7] = 91; } staticgfx[8] = 115 + 0; staticgfx[9] = 115 + 10; staticgfx[10] = 115 + 6; staticgfx[11] = 115 + 7; //Static Sprites Blocksets (fairy,pot,ect...) for (int i = 0; i < 4; i++) { staticgfx[12 + i] = (byte)(ROM.DATA[Constants.sprite_blockset_pointer + ((spriteset) * 4) + i] + 115); } GFX.singledata = new byte[staticgfx.Length * 0x1000]; for (int i = 0; i < staticgfx.Length; i++) { byte[] d = GFX.bpp3snestoindexed(GFX.gfxdata, staticgfx[i]); byte[] dd = new byte[0]; if (i == 7) { dd = GFX.bpp3snestoindexed(GFX.gfxdata, animatedGfxPart2); } for (int j = 0; j < d.Length; j++) { int pp = 0; if (i == 0) { pp = 8; } else if (i == 1) { pp = 0; } else if (i == 2) { pp = 0; } else if (i == 3) { pp = 8; } else if (i == 4) { pp = 8; } else if (i == 5) { pp = 8; } else if (i == 6) { pp = 0; } else if (i == 7) { pp = 0; } GFX.singledata[(i * 0x1000) + j] = (byte)(d[j] + pp); if (i == 7) { if (j > d.Length / 2) { GFX.singledata[(i * 0x1000) + j] = (byte)(dd[j] + pp); } } } } }