private void loadAnimData() { int ANIM_COUNT = AnimConfig.ANIM_COUNT; int animAddrHi = AnimConfig.animAddrHi; int animAddrLo = AnimConfig.animAddrLo; int FRAME_COUNT = AnimConfig.FRAME_COUNT; int frameAddr1Hi = AnimConfig.frameAddrHi; int frameAddr1Lo = AnimConfig.frameAddrLo; int COORD_COUNT = AnimConfig.COORD_COUNT; int coordAddrHi = AnimConfig.coordAddrHi; int coordAddrLo = AnimConfig.coordAddrLo; animList = new AnimData[ANIM_COUNT]; frameList = new FrameData[FRAME_COUNT]; coordList = new CoordData[COORD_COUNT]; for (int i = 0; i < ANIM_COUNT; i++) { byte hiAddrByte = Globals.romdata[animAddrHi + i]; byte loAddrByte = Globals.romdata[animAddrLo + i]; int addr = Utils.makeAddrPtr(hiAddrByte, loAddrByte); int addrRom = Utils.getRomAddr(AnimConfig.animBankNo, addr); int frameCountAndShift = Globals.romdata[addrRom] + 1; int framesCount = frameCountAndShift % 128; int frameShift = frameCountAndShift < 128 ? 0 : 256; int timer = Globals.romdata[addrRom+1]; int[] frameIndexes = null; { frameIndexes = new int[framesCount]; for (int frame = 0; frame < framesCount; frame++) { int frameNo = Globals.romdata[addrRom + 2 + frame]; frameIndexes[frame] = frameNo + frameShift; } } animList[i] = new AnimData(i, addr, framesCount, timer, frameIndexes, frameShift); } for (int frame = 0; frame < FRAME_COUNT; frame++) { byte frameAddrHi = Globals.romdata[frameAddr1Hi + frame]; byte frameAddrLo = Globals.romdata[frameAddr1Lo + frame]; int frameAddr = Utils.makeAddrPtr(frameAddrHi, frameAddrLo); int frameAddrRom = Utils.getRomAddr(AnimConfig.animBankNo, frameAddr); int tileCount = Globals.romdata[frameAddrRom]+1; int coordsIndex = Globals.romdata[frameAddrRom+1]; var tiles = new TileInfo[tileCount]; for (int tile = 0; tile < tileCount; tile++) { tiles[tile].index = Globals.romdata[frameAddrRom + 2 + tile*2]; tiles[tile].property = Globals.romdata[frameAddrRom + 2 + tile*2+1]; } FrameData frameData = new FrameData(frame, frameAddr, tileCount, coordsIndex, tiles); frameList[frame] = frameData; } for (int coord = 0; coord < COORD_COUNT; coord++) { byte coordAddrHiByte = Globals.romdata[coordAddrHi + coord]; byte coordAddrLoByte = Globals.romdata[coordAddrLo + coord]; int coordAddr = Utils.makeAddrPtr(coordAddrHiByte, coordAddrLoByte); CoordData coordData = new CoordData(coordAddr); coordList[coord] = coordData; } mapAnimToTreeView(); }
private void loadAnimData() { int ANIM_COUNT = AnimConfig.ANIM_COUNT; int animAddrHi = AnimConfig.animAddrHi; int animAddrLo = AnimConfig.animAddrLo; int FRAME_COUNT = AnimConfig.FRAME_COUNT; int frameAddr1Hi = AnimConfig.frameAddrHi; int frameAddr1Lo = AnimConfig.frameAddrLo; int COORD_COUNT = AnimConfig.COORD_COUNT; int coordAddrHi = AnimConfig.coordAddrHi; int coordAddrLo = AnimConfig.coordAddrLo; animList = new AnimData[ANIM_COUNT]; frameList = new FrameData[FRAME_COUNT]; coordList = new CoordData[COORD_COUNT]; for (int i = 0; i < ANIM_COUNT; i++) { byte hiAddrByte = Globals.romdata[animAddrHi + i]; byte loAddrByte = Globals.romdata[animAddrLo + i]; int addr = Utils.makeAddrPtr(hiAddrByte, loAddrByte); int addrRom = Utils.getRomAddr(AnimConfig.animBankNo, addr); int frameCountAndShift = Globals.romdata[addrRom] + 1; int framesCount = frameCountAndShift % 128; int frameShift = frameCountAndShift < 128 ? 0 : 256; int timer = Globals.romdata[addrRom + 1]; int[] frameIndexes = null; { frameIndexes = new int[framesCount]; for (int frame = 0; frame < framesCount; frame++) { int frameNo = Globals.romdata[addrRom + 2 + frame]; frameIndexes[frame] = frameNo + frameShift; } } animList[i] = new AnimData(i, addr, framesCount, timer, frameIndexes, frameShift); } for (int frame = 0; frame < FRAME_COUNT; frame++) { byte frameAddrHi = Globals.romdata[frameAddr1Hi + frame]; byte frameAddrLo = Globals.romdata[frameAddr1Lo + frame]; int frameAddr = Utils.makeAddrPtr(frameAddrHi, frameAddrLo); int frameAddrRom = Utils.getRomAddr(AnimConfig.animBankNo, frameAddr); int tileCount = Globals.romdata[frameAddrRom] + 1; int coordsIndex = Globals.romdata[frameAddrRom + 1]; var tiles = new TileInfo[tileCount]; for (int tile = 0; tile < tileCount; tile++) { tiles[tile].index = Globals.romdata[frameAddrRom + 2 + tile * 2]; tiles[tile].property = Globals.romdata[frameAddrRom + 2 + tile * 2 + 1]; } FrameData frameData = new FrameData(frame, frameAddr, tileCount, coordsIndex, tiles); frameList[frame] = frameData; } for (int coord = 0; coord < COORD_COUNT; coord++) { byte coordAddrHiByte = Globals.romdata[coordAddrHi + coord]; byte coordAddrLoByte = Globals.romdata[coordAddrLo + coord]; int coordAddr = Utils.makeAddrPtr(coordAddrHiByte, coordAddrLoByte); CoordData coordData = new CoordData(coordAddr); coordList[coord] = coordData; } mapAnimToTreeView(); }