public void transform(utils.ETransformType _type) { if (m_sel_block_id >= 0) { switch (_type) { case utils.ETransformType.tt_vflip: { int[] vflip_remap = { 2, 3, 0, 1 }; block_transform(_type, vflip_remap); } break; case utils.ETransformType.tt_hflip: { int[] hflip_remap = { 1, 0, 3, 2 }; block_transform(_type, hflip_remap); } break; case utils.ETransformType.tt_rotate: { int[] rotate_remap = { 2, 0, 3, 1 }; block_transform(_type, rotate_remap); } break; } } }
public void transform_selected_CHR(utils.ETransformType _type) { if (m_sel_ind >= 0) { switch (_type) { case utils.ETransformType.tt_vflip: { tiles_data.CHR_bank_vflip(m_data.CHR_bank, m_sel_ind); } break; case utils.ETransformType.tt_hflip: { tiles_data.CHR_bank_hflip(m_data.CHR_bank, m_sel_ind); } break; case utils.ETransformType.tt_rotate: { tiles_data.CHR_bank_rotate_cw(m_data.CHR_bank, m_sel_ind); } break; default: return; } dispatch_event_data_changed(); dispatch_event_need_gfx_update(); // just in case, when the Block editor is inactive update(); } }
public void transform_block(utils.ETransformType _type) { m_block_editor.transform(_type); }
public void transform_selected_CHR(utils.ETransformType _type) { m_CHR_bank_viewer.transform_selected_CHR(_type); }
private void block_transform(utils.ETransformType _type, int[] _remap_arr) { int i; #if DEF_FLIP_BLOCKS_SPR_BY_FLAGS if (m_edit_mode == EMode.bem_CHR_select) { switch (_type) { case utils.ETransformType.tt_vflip: { set_flip_flag(utils.CONST_CHR_ATTR_FLAG_VFLIP, m_sel_block_id, m_sel_quad_ind); } dispatch_event_need_gfx_update(); return; case utils.ETransformType.tt_hflip: { set_flip_flag(utils.CONST_CHR_ATTR_FLAG_HFLIP, m_sel_block_id, m_sel_quad_ind); } dispatch_event_need_gfx_update(); return; } } else { for (i = 0; i < utils.CONST_BLOCK_SIZE; i++) { switch (_type) { case utils.ETransformType.tt_vflip: { set_flip_flag(utils.CONST_CHR_ATTR_FLAG_VFLIP, m_sel_block_id, i); } break; case utils.ETransformType.tt_hflip: { set_flip_flag(utils.CONST_CHR_ATTR_FLAG_HFLIP, m_sel_block_id, i); } break; } } } #endif uint[] blocks_data = { 0, 0, 0, 0 }; for (i = 0; i < utils.CONST_BLOCK_SIZE; i++) { blocks_data[i] = m_data.blocks[(m_sel_block_id << 2) + i]; #if DEF_FLIP_BLOCKS_SPR_BY_FLAGS if (_type == utils.ETransformType.tt_rotate && tiles_data.get_block_flags_flip(blocks_data[i]) != 0) { MainForm.message_box("You can't rotate flipped CHRs!", "Block Transformation Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } #endif } #if DEF_FLIP_BLOCKS_SPR_BY_FLAGS bool flip_by_flags = true; #else bool flip_by_flags = false; #endif //DEF_FLIP_BLOCKS_SPR_BY_FLAGS if (flip_by_flags == false || _type == utils.ETransformType.tt_rotate) { for (i = 0; i < utils.CONST_BLOCK_SIZE; i++) { switch (_type) { case utils.ETransformType.tt_vflip: { tiles_data.CHR_bank_vflip(m_data.CHR_bank, tiles_data.get_block_CHR_id(blocks_data[i])); } break; case utils.ETransformType.tt_hflip: { tiles_data.CHR_bank_hflip(m_data.CHR_bank, tiles_data.get_block_CHR_id(blocks_data[i])); } break; case utils.ETransformType.tt_rotate: { tiles_data.CHR_bank_rotate_cw(m_data.CHR_bank, tiles_data.get_block_CHR_id(blocks_data[i])); } break; } } for (i = 0; i < utils.CONST_BLOCK_SIZE; i++) { blocks_data[i] = m_data.blocks[(m_sel_block_id << 2) + i]; } } for (i = 0; i < utils.CONST_BLOCK_SIZE; i++) { m_data.blocks[(m_sel_block_id << 2) + i] = blocks_data[_remap_arr[i]]; } update_changes(); }