Add "Clone" function. Fix first entry of sprite palette to 0xff

This commit is contained in:
mkwong98 2020-11-13 00:22:40 +08:00
parent 6770a94557
commit e06fa8acf8
13 changed files with 323 additions and 193 deletions

View file

@ -175,3 +175,20 @@ string condition::writeLine(){
}
return stream.str();
}
condition condition::clone(){
condition c = condition();
c.id = id.clone();
c.conditionType = conditionType;
c.name = name;
c.objCoordX = objCoordX;
c.objCoordY = objCoordY;
c.hFlip = hFlip;
c.vFlip = vFlip;
c.address = address;
c.op = op;
c.value = value;
c.frame1 = frame1;
c.frame2 = frame2;
return c;
}

View file

@ -38,6 +38,7 @@ class condition
void save(fstream& file);
bool isMatch(gameTile& owner, gameTile& conditionTile);
int getType();
condition clone();
protected:

View file

@ -37,6 +37,9 @@ gameObjNode::~gameObjNode()
}
void gameObjNode::addTile(gameTile g){
if(isSprite){
g.id.palette[0] = 0xff;
}
tiles.push_back(g);
addToObjectSize(tiles.size() - 1);
}
@ -251,6 +254,42 @@ void gameObjNode::updatePalettes(){
}
}
gameObjNode* gameObjNode::clone(){
gameObjNode* n = new gameObjNode();
n->nodeType = nodeType;
n->nodeName = nodeName;
n->brightness = brightness;
for(int i = 0; i < conditions.size(); ++i){
n->conditions.push_back(conditions[i].clone());
}
for(int i = 0; i < conSigns.size(); ++i){
n->conSigns.push_back(conSigns[i]);
}
n->frameRanges.clear();
for(int i = 0; i < frameRanges.size(); ++i){
n->frameRanges.push_back(frameRanges[i]);
}
n->bgColour = bgColour;
n->isSprite = isSprite;
n->isDefault = isDefault;
for(int i = 0; i < tiles.size(); ++i){
n->addTile(tiles[i].clone());
}
for(int i = 0; i < swaps.size(); ++i){
n->swaps.push_back(swaps[i].clone());
}
n->fileName = fileName;
n->hScrollRate = hScrollRate;
n->vScrollRate = vScrollRate;
n->updatePalettes();
return n;
}
string gameObjNode::writeConditionNames(){
stringstream stream;
for(int i = 0; i < conditions.size(); ++i){

View file

@ -18,6 +18,7 @@
#define GAME_OBJ_NODE_MENU_MOVE_DOWN 6
#define GAME_OBJ_NODE_MENU_MOVE_TO_FOLDER 7
#define GAME_OBJ_NODE_MENU_MOVE_HERE 8
#define GAME_OBJ_NODE_MENU_CLONE_OBJECT 9
struct frameRange{
int frameID;
@ -67,6 +68,7 @@ class gameObjNode : public wxTreeItemData
void load(fstream& file, wxTreeItemId newItm);
void save(fstream& file, wxTreeItemId newItm);
void updatePalettes();
gameObjNode* clone();
string writeLine();
string writeConditionNames();
protected:

View file

@ -171,6 +171,25 @@ void gameTile::save(fstream& file){
file << "<endGameTile>\n";
}
gameTile gameTile::clone(){
gameTile c = gameTile();
c.id = id.clone();
c.objCoordX = objCoordX;
c.objCoordY = objCoordY;
c.hFlip = hFlip;
c.vFlip = vFlip;
for(int i = 0; i < aniFrames.size(); i++){
c.aniFrames.push_back(aniFrames[i]);
}
for(int i = 0; i < conditions.size(); i++){
c.conditions.push_back(conditions[i].clone());
}
for(int i = 0; i < conSigns.size(); i++){
c.conSigns.push_back(conSigns[i]);
}
return c;
}
string gameTile::writeConditionNames(){
stringstream stream;
for(int i = 0; i < conditions.size(); ++i){

View file

@ -45,6 +45,7 @@ class gameTile
bool compareEqual(gameTile& t);
void load(fstream& file);
void save(fstream& file);
gameTile clone();
protected:
private:

View file

@ -3951,13 +3951,13 @@
"coreData.h"
"main.h"
1564552673 source:d:\work\hdnes\trunk\hdnespackeditor\condition.cpp
1605194635 source:d:\work\hdnes\trunk\hdnespackeditor\condition.cpp
"condition.h"
"coreData.h"
"gameTile.h"
"main.h"
1561782682 d:\work\hdnes\trunk\hdnespackeditor\condition.h
1604751097 d:\work\hdnes\trunk\hdnespackeditor\condition.h
"common.h"
"classList.h"
"tileReference.h"
@ -5485,7 +5485,7 @@
1561782682 d:\work\hdnes\trunk\hdnespackeditor\classlist.h
1561782682 d:\work\hdnes\trunk\hdnespackeditor\tilereference.h
1605194127 d:\work\hdnes\trunk\hdnespackeditor\tilereference.h
"common.h"
1561782682 d:\work\hdnes\trunk\hdnespackeditor\coredata.h
@ -7222,7 +7222,7 @@
1520441738 d:\work\include\wx\cocoa\mdi.h
"wx/frame.h"
1561808887 d:\work\hdnes\trunk\hdnespackeditor\gametile.h
1604752180 d:\work\hdnes\trunk\hdnespackeditor\gametile.h
"common.h"
"classList.h"
"condition.h"
@ -7510,7 +7510,7 @@
1561782682 d:\work\hdnes\trunk\hdnespackeditor\colourdialogclient.h
1585990253 d:\work\hdnes\trunk\hdnespackeditor\gameobjnode.h
1604750244 d:\work\hdnes\trunk\hdnespackeditor\gameobjnode.h
"common.h"
"gameTile.h"
<wx/treebase.h>
@ -7518,17 +7518,17 @@
1561782682 d:\work\hdnes\trunk\hdnespackeditor\hdnespackeditornewprojectdialog.h
"mainForm.h"
1585990968 source:d:\work\hdnes\trunk\hdnespackeditor\gameobjnode.cpp
1605196382 source:d:\work\hdnes\trunk\hdnespackeditor\gameobjnode.cpp
"gameObjNode.h"
"gameTile.h"
"paletteSwap.h"
"main.h"
"hdnesPackEditormainForm.h"
1561782682 d:\work\hdnes\trunk\hdnespackeditor\paletteswap.h
1604752360 d:\work\hdnes\trunk\hdnespackeditor\paletteswap.h
"common.h"
1561808996 source:d:\work\hdnes\trunk\hdnespackeditor\gametile.cpp
1605195154 source:d:\work\hdnes\trunk\hdnespackeditor\gametile.cpp
"common.h"
"coreData.h"
"gameObjNode.h"
@ -7572,7 +7572,7 @@
"wx/gdicmn.h"
"wx/dialog.h"
1588481832 source:d:\work\hdnes\trunk\hdnespackeditor\hdnespackeditormainform.cpp
1605196382 source:d:\work\hdnes\trunk\hdnespackeditor\hdnespackeditormainform.cpp
"hdnesPackEditormainForm.h"
"hdnesPackEditornewProjectDialog.h"
"hdnesPackEditorcolourSelectDialog.h"
@ -7664,11 +7664,11 @@
1585989500 source:d:\work\hdnes\trunk\hdnespackeditor\mainform.cpp
"mainForm.h"
1561782682 source:d:\work\hdnes\trunk\hdnespackeditor\paletteswap.cpp
1604761296 source:d:\work\hdnes\trunk\hdnespackeditor\paletteswap.cpp
"paletteSwap.h"
"main.h"
1561782682 source:d:\work\hdnes\trunk\hdnespackeditor\tilereference.cpp
1605194493 source:d:\work\hdnes\trunk\hdnespackeditor\tilereference.cpp
"tileReference.h"
"coreData.h"
"main.h"

View file

@ -2,64 +2,216 @@
<CodeBlocks_layout_file>
<FileVersion major="1" minor="0" />
<ActiveTarget name="Release" />
<File name="hdnesPackEditormainForm.h" open="0" top="0" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="image.h" open="1" top="0" tabpos="15" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1133" topLine="0" />
</Cursor>
<Folding>
<Collapse line="47" />
</Folding>
</File>
<File name="hdnesPackEditorcolourSelectDialog.h" open="0" top="0" tabpos="20" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="382" topLine="0" />
<Cursor1 position="189" topLine="0" />
</Cursor>
</File>
<File name="hdnesPackEditorreplacementDialog.cpp" open="0" top="0" tabpos="14" split="0" active="1" splitpos="0" zoom_1="-1" zoom_2="0">
<Cursor>
<Cursor1 position="2646" topLine="0" />
</Cursor>
<Folding>
<Collapse line="35" />
<Collapse line="47" />
</Folding>
</File>
<File name="mainForm.h" open="0" top="0" tabpos="12" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="mainForm.h" open="1" top="0" tabpos="17" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="76" topLine="0" />
</Cursor>
<Folding>
<Collapse line="331" />
<Collapse line="357" />
<Collapse line="444" />
</Folding>
</File>
<File name="paletteSwap.cpp" open="1" top="0" tabpos="8" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="2412" topLine="4" />
</Cursor>
<Folding>
<Collapse line="15" />
<Collapse line="66" />
</Folding>
</File>
<File name="paletteSwap.h" open="1" top="0" tabpos="7" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="436" topLine="0" />
</Cursor>
</File>
<File name="hdnesPackEditormainForm.h" open="1" top="0" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="7617" topLine="21" />
</Cursor>
<Folding>
<Collapse line="47" />
</Folding>
</File>
<File name="image.h" open="0" top="0" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="hdnesPackEditorreplacementDialog.h" open="0" top="0" tabpos="18" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="189" topLine="0" />
<Cursor1 position="1177" topLine="0" />
</Cursor>
</File>
<File name="mainForm.cpp" open="0" top="0" tabpos="16" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="888" topLine="356" />
</Cursor>
</File>
<File name="gameTile.cpp" open="1" top="0" tabpos="12" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="5995" topLine="0" />
</Cursor>
<Folding>
<Collapse line="7" />
<Collapse line="22" />
<Collapse line="26" />
<Collapse line="42" />
<Collapse line="46" />
<Collapse line="56" />
<Collapse line="65" />
<Collapse line="192" />
</Folding>
</File>
<File name="gameObjNode.h" open="1" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1054" topLine="24" />
</Cursor>
<Folding>
<Collapse line="22" />
</Folding>
</File>
<File name="main.h" open="0" top="0" tabpos="17" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="380" topLine="0" />
</Cursor>
</File>
<File name="paletteSwap.h" open="0" top="0" tabpos="6" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="tileReference.cpp" open="1" top="0" tabpos="16" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="293" topLine="0" />
<Cursor1 position="2617" topLine="9" />
</Cursor>
<Folding>
<Collapse line="6" />
<Collapse line="5" />
<Collapse line="10" />
<Collapse line="14" />
<Collapse line="29" />
<Collapse line="73" />
</Folding>
</File>
<File name="coreData.cpp" open="1" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="2901" topLine="23" />
</Cursor>
<Folding>
<Collapse line="11" />
<Collapse line="22" />
<Collapse line="24" />
<Collapse line="28" />
<Collapse line="32" />
<Collapse line="81" />
<Collapse line="412" />
</Folding>
</File>
<File name="classList.h" open="0" top="0" tabpos="22" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="256" topLine="0" />
</Cursor>
</File>
<File name="hdnesPackEditorcolourSelectDialog.cpp" open="0" top="0" tabpos="15" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="3921" topLine="0" />
</Cursor>
</File>
<File name="gameObjNode.cpp" open="1" top="1" tabpos="9" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="755" topLine="3" />
</Cursor>
<Folding>
<Collapse line="7" />
<Collapse line="34" />
</Folding>
</File>
<File name="image.cpp" open="1" top="0" tabpos="18" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="359" topLine="0" />
</Cursor>
<Folding>
<Collapse line="4" />
<Collapse line="9" />
<Collapse line="12" />
<Collapse line="17" />
</Folding>
</File>
<File name="main.cpp" open="1" top="0" tabpos="19" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="565" topLine="25" />
</Cursor>
<Folding>
<Collapse line="10" />
<Collapse line="30" />
<Collapse line="50" />
<Collapse line="60" />
<Collapse line="66" />
<Collapse line="78" />
<Collapse line="95" />
<Collapse line="108" />
<Collapse line="112" />
<Collapse line="118" />
</Folding>
</File>
<File name="tileReference.h" open="1" top="0" tabpos="14" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="234" topLine="2" />
</Cursor>
</File>
<File name="hdnesPackEditormainForm.cpp" open="1" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="65669" topLine="0" />
</Cursor>
<Folding>
<Collapse line="31" />
<Collapse line="32" />
<Collapse line="34" />
<Collapse line="85" />
<Collapse line="88" />
<Collapse line="91" />
<Collapse line="103" />
<Collapse line="766" />
</Folding>
</File>
<File name="coreData.h" open="1" top="0" tabpos="10" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="776" topLine="39" />
</Cursor>
</File>
<File name="condition.h" open="1" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="311" topLine="0" />
</Cursor>
</File>
<File name="gameTile.h" open="1" top="0" tabpos="6" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="960" topLine="25" />
</Cursor>
</File>
<File name="hdnesPackEditorcolourSelectDialog.h" open="0" top="0" tabpos="20" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="382" topLine="0" />
</Cursor>
</File>
<File name="hdnesPackEditornewProjectDialog.cpp" open="0" top="0" tabpos="13" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="742" topLine="0" />
</Cursor>
</File>
<File name="image.cpp" open="0" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="common.h" open="1" top="0" tabpos="11" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="359" topLine="0" />
<Cursor1 position="171" topLine="0" />
</Cursor>
</File>
<File name="condition.cpp" open="1" top="0" tabpos="13" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="5867" topLine="103" />
</Cursor>
<Folding>
<Collapse line="6" />
<Collapse line="11" />
<Collapse line="29" />
<Collapse line="138" />
<Collapse line="161" />
</Folding>
</File>
<File name="hdnesPackEditornewProjectDialog.h" open="0" top="0" tabpos="19" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="229" topLine="0" />
@ -70,162 +222,13 @@
<Cursor1 position="235" topLine="0" />
</Cursor>
</File>
<File name="main.cpp" open="0" top="0" tabpos="11" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="hdnesPackEditorreplacementDialog.cpp" open="0" top="0" tabpos="14" split="0" active="1" splitpos="0" zoom_1="-1" zoom_2="0">
<Cursor>
<Cursor1 position="565" topLine="2" />
</Cursor>
</File>
<File name="condition.h" open="0" top="0" tabpos="6" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="229" topLine="0" />
<Cursor1 position="2646" topLine="0" />
</Cursor>
<Folding>
<Collapse line="8" />
</Folding>
</File>
<File name="common.h" open="0" top="0" tabpos="24" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="171" topLine="0" />
</Cursor>
</File>
<File name="gameObjNode.h" open="0" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1479" topLine="1" />
</Cursor>
</File>
<File name="coreData.cpp" open="1" top="0" tabpos="7" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="2901" topLine="51" />
</Cursor>
<Folding>
<Collapse line="24" />
<Collapse line="28" />
<Collapse line="32" />
<Collapse line="38" />
<Collapse line="53" />
<Collapse line="198" />
<Collapse line="238" />
<Collapse line="258" />
<Collapse line="287" />
<Collapse line="325" />
<Collapse line="361" />
<Collapse line="366" />
<Collapse line="371" />
<Collapse line="385" />
<Collapse line="392" />
<Collapse line="475" />
<Collapse line="481" />
</Folding>
</File>
<File name="hdnesPackEditorcolourSelectDialog.cpp" open="0" top="0" tabpos="15" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="3921" topLine="0" />
</Cursor>
</File>
<File name="coreData.h" open="0" top="0" tabpos="25" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="776" topLine="0" />
</Cursor>
</File>
<File name="classList.h" open="0" top="0" tabpos="22" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="256" topLine="0" />
</Cursor>
</File>
<File name="gameObjNode.cpp" open="1" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="490" topLine="10" />
</Cursor>
<Folding>
<Collapse line="34" />
<Collapse line="38" />
<Collapse line="43" />
<Collapse line="35" />
<Collapse line="47" />
<Collapse line="52" />
<Collapse line="61" />
<Collapse line="232" />
<Collapse line="253" />
<Collapse line="263" />
</Folding>
</File>
<File name="hdnesPackEditorreplacementDialog.h" open="0" top="0" tabpos="18" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1177" topLine="0" />
</Cursor>
</File>
<File name="gameTile.cpp" open="1" top="0" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1137" topLine="4" />
</Cursor>
<Folding>
<Collapse line="7" />
<Collapse line="22" />
<Collapse line="26" />
<Collapse line="56" />
<Collapse line="65" />
<Collapse line="135" />
<Collapse line="173" />
</Folding>
</File>
<File name="gameTile.h" open="0" top="0" tabpos="21" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="40" topLine="0" />
</Cursor>
</File>
<File name="condition.cpp" open="1" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="4788" topLine="46" />
</Cursor>
<Folding>
<Collapse line="15" />
<Collapse line="53" />
<Collapse line="108" />
<Collapse line="126" />
</Folding>
</File>
<File name="tileReference.cpp" open="1" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1065" topLine="36" />
</Cursor>
<Folding>
<Collapse line="65" />
</Folding>
</File>
<File name="hdnesPackEditormainForm.cpp" open="1" top="1" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="91137" topLine="1713" />
</Cursor>
<Folding>
<Collapse line="31" />
<Collapse line="32" />
<Collapse line="34" />
<Collapse line="47" />
<Collapse line="85" />
<Collapse line="88" />
<Collapse line="91" />
<Collapse line="103" />
<Collapse line="924" />
<Collapse line="1017" />
<Collapse line="1926" />
<Collapse line="1934" />
<Collapse line="1945" />
<Collapse line="1977" />
<Collapse line="1989" />
</Folding>
</File>
<File name="tileReference.h" open="1" top="0" tabpos="6" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="412" topLine="0" />
</Cursor>
</File>
<File name="paletteSwap.cpp" open="0" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="279" topLine="0" />
</Cursor>
</File>
<File name="mainForm.cpp" open="0" top="0" tabpos="16" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="888" topLine="356" />
</Cursor>
</File>
</CodeBlocks_layout_file>

View file

@ -807,7 +807,9 @@ void hdnesPackEditormainForm::gameObjTItemOpenMenu( wxTreeEvent& event ){
}
menu.Append(GAME_OBJ_NODE_MENU_MOVE_TO_FOLDER, wxT("Move to folder"));
}
if(data->nodeType == GAME_OBJ_NODE_TYPE_OBJECT){
menu.Append(GAME_OBJ_NODE_MENU_CLONE_OBJECT, wxT("Clone"));
}
menu.Connect( wxEVT_MENU, wxCommandEventHandler(hdnesPackEditormainForm::gameObjsTreeMenu), NULL, this );
treeGameObjs->PopupMenu(&menu, event.GetPoint());
}
@ -881,6 +883,20 @@ void hdnesPackEditormainForm::gameObjsTreeMenu( wxCommandEvent& event ){
gameObjectTreeWillMove = false;
gameObjsMoveTreeItem(tItmGameObjMove, tItmGameObjMenu, treeGameObjs->GetLastChild(tItmGameObjMenu));
gameObjsCancelWillMove(tItmGameObjRoot);
coreData::cData->dataChanged();
break;
case GAME_OBJ_NODE_MENU_CLONE_OBJECT:
gameObjNode* data = (gameObjNode*)(treeGameObjs->GetItemData(tItmGameObjMenu));
node = data->clone();
newItm = treeGameObjs->AppendItem(treeGameObjs->GetItemParent(tItmGameObjMenu), wxString(node->nodeName), -1, -1, node);
treeGameObjs->Expand(tItmGameObjMenu);
treeGameObjs->EditLabel(newItm);
treeGameObjs->SetFocusedItem(newItm);
tItmGameObjMenu = newItm;
gameObjSelectedTiles.clear();
refreshNode();
coreData::cData->dataChanged();
break;
}
@ -1398,16 +1414,19 @@ void hdnesPackEditormainForm::refreshNode(){
nbkGameObject->AddPage(pnlBGImage, wxString("Background"), false);
pnlConditions->Show(true);
nbkGameObject->AddPage(pnlConditions, wxString("Conditions"), false);
}
}
loadingTab = false;
nbkGameObject->Refresh();
nbkGameObject->Update();
if(ndata->nodeType == GAME_OBJ_NODE_TYPE_OBJECT){
refreshGameObj();
}
else{
refreshBGImage();
}
}
void hdnesPackEditormainForm::refreshBGImage(){
@ -1483,11 +1502,13 @@ void hdnesPackEditormainForm::refreshGameObj(){
loadFrameRanges();
drawGameObj();
adjustGameObjSize();
drawGameObjEdits();
loadSwaps();
loadConditions();
}
void hdnesPackEditormainForm::refreshCboFrameRange(gameObjNode* ndata){

View file

@ -72,3 +72,18 @@ void paletteSwap::save(fstream& file){
file << "<change>" << brightness << "," << hueRotation << "," << saturation << "\n";
file << "<endPaletteSwap>\n";
}
paletteSwap paletteSwap::clone(){
paletteSwap p = paletteSwap();
p.brightness = brightness;
p.hueRotation = hueRotation;
p.name = name;
for(int i = 0; i < newPalettes.size(); i++){
p.newPalettes.push_back(newPalettes[i]);
}
for(int i = 0; i < orgPalettes.size(); i++){
p.orgPalettes.push_back(orgPalettes[i]);
}
p.saturation = saturation;
return p;
}

View file

@ -18,7 +18,7 @@ class paletteSwap
void load(fstream& file);
void save(fstream& file);
paletteSwap clone();
protected:
private:

View file

@ -101,3 +101,14 @@ void tileReference::save(fstream& file){
file << "<endTileReference>\n";
}
tileReference tileReference::clone(){
tileReference t;
t.id = id;
for(int i = 0; i < 4; i++){
t.palette[i] = palette[i];
}
for(int i = 0; i < 16; i++){
t.rawData[i] = rawData[i];
}
return t;
}

View file

@ -21,6 +21,7 @@ class tileReference
string writeID(bool useHex);
void readPalette(string s);
string writePalette();
tileReference clone();
protected: