generated from sigonasr2/CPlusPlusProjectTemplate
Copy over entire map functions
Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
This commit is contained in:
parent
974b60fd22
commit
f975a30925
Binary file not shown.
@ -33,8 +33,8 @@ class SeasonI:public PixelGameEngine{
|
|||||||
void SetupObjectInfo(); 됐어
|
void SetupObjectInfo(); 됐어
|
||||||
void SetupEncounters(); 됐어
|
void SetupEncounters(); 됐어
|
||||||
void SetupBattleProperties(); 됐어
|
void SetupBattleProperties(); 됐어
|
||||||
void SetupCutscenes();
|
void SetupCutscenes(); 됐어
|
||||||
void SetupMapList();
|
void SetupMapList(); 됐어
|
||||||
void SetGameFlag(Flag flag,bool val); 됐어
|
void SetGameFlag(Flag flag,bool val); 됐어
|
||||||
void LoadMap(Map*map);
|
void LoadMap(Map*map);
|
||||||
void SaveMap(Map*map);
|
void SaveMap(Map*map);
|
||||||
|
@ -44,7 +44,12 @@ extern std::vector<Encounter*>ENCOUNTER_LIST;
|
|||||||
extern std::map<Property,BattleProperty*> BATTLE_PROPERTIES;
|
extern std::map<Property,BattleProperty*> BATTLE_PROPERTIES;
|
||||||
extern std::map<MapName::Map,Map*> MAPS;
|
extern std::map<MapName::Map,Map*> MAPS;
|
||||||
extern std::vector<CutsceneAction*>CUTSCENE_QUEUE;
|
extern std::vector<CutsceneAction*>CUTSCENE_QUEUE;
|
||||||
|
extern std::vector<std::vector<TILE*>> MAP;
|
||||||
|
extern std::vector<std::vector<TILE*>> MAP2;
|
||||||
|
extern std::vector<std::vector<TILE*>> MAP3;
|
||||||
|
extern std::vector<std::vector<TILE*>> MAP4;
|
||||||
extern std::vector<std::vector<TILE*>> MAP5;
|
extern std::vector<std::vector<TILE*>> MAP5;
|
||||||
|
extern std::vector<std::vector<TILE*>> MAP6;
|
||||||
|
|
||||||
int testCount=0;
|
int testCount=0;
|
||||||
int MAX_ITERATIONS=1000;
|
int MAX_ITERATIONS=1000;
|
||||||
@ -95,6 +100,30 @@ namespace key{
|
|||||||
TestKey NP2{Key::NP2,"NP2",KeyIdentifier::DOWN};
|
TestKey NP2{Key::NP2,"NP2",KeyIdentifier::DOWN};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CopyMapContents(std::vector<std::vector<TILE*>>&from,std::vector<std::vector<TILE>>&to) {
|
||||||
|
for (int x=0;x<from.size();x++) {
|
||||||
|
std::vector<TILE> tiles;
|
||||||
|
for (int y=0;y<from[x].size();y++) {
|
||||||
|
tiles.push_back(TILE(from[x][y]->tileX,from[x][y]->tileY,from[x][y]->tileDegree));
|
||||||
|
}
|
||||||
|
to.push_back(tiles);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ValidateEntireMap(std::vector<std::vector<TILE*>>&mapref1,std::vector<std::vector<TILE>>&mapref2) {
|
||||||
|
for (int x=0;x<mapref1.size();x++) {
|
||||||
|
for (int y=0;y<mapref1[x].size();y++) {
|
||||||
|
if (mapref2[x][y]!=mapref1[x][y]) {
|
||||||
|
std::cout<<x<<","<<y<<" failed:"<<std::endl;
|
||||||
|
std::cout<<" "<<mapref2[x][y].tileX<<"|"<<mapref2[x][y].tileY<<"|"<<std::to_string(mapref2[x][y].tileDegree)<<std::endl;
|
||||||
|
std::cout<<" "<<mapref1[x][y]->tileX<<"|"<<mapref1[x][y]->tileY<<"|"<<std::to_string(mapref1[x][y]->tileDegree)<<std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool GetKeyPressed(SeasonI&instance,TestKey&k) {
|
bool GetKeyPressed(SeasonI&instance,TestKey&k) {
|
||||||
if (k==key::UP) {
|
if (k==key::UP) {
|
||||||
return instance.UpPressed();
|
return instance.UpPressed();
|
||||||
@ -681,6 +710,25 @@ bool SeasonI::OnUserCreate(){
|
|||||||
endOfScreenCheck:
|
endOfScreenCheck:
|
||||||
Test("Entire screen should be wiped to magenta before drawing anything",
|
Test("Entire screen should be wiped to magenta before drawing anything",
|
||||||
isAllMagenta);
|
isAllMagenta);
|
||||||
|
std::vector<std::vector<TILE>> TEMPMAP;
|
||||||
|
std::vector<std::vector<TILE>> TEMPMAP2;
|
||||||
|
std::vector<std::vector<TILE>> TEMPMAP3;
|
||||||
|
std::vector<std::vector<TILE>> TEMPMAP4;
|
||||||
|
std::vector<std::vector<TILE>> TEMPMAP5;
|
||||||
|
std::vector<std::vector<TILE>> TEMPMAP6;
|
||||||
|
CopyMapContents(MAP,TEMPMAP);
|
||||||
|
CopyMapContents(MAP2,TEMPMAP2);
|
||||||
|
CopyMapContents(MAP3,TEMPMAP3);
|
||||||
|
CopyMapContents(MAP4,TEMPMAP4);
|
||||||
|
CopyMapContents(MAP5,TEMPMAP5);
|
||||||
|
CopyMapContents(MAP6,TEMPMAP6);
|
||||||
|
Test("Entire map should be copied over properly for testing",
|
||||||
|
ValidateEntireMap(MAP,TEMPMAP)&&
|
||||||
|
ValidateEntireMap(MAP2,TEMPMAP2)&&
|
||||||
|
ValidateEntireMap(MAP3,TEMPMAP3)&&
|
||||||
|
ValidateEntireMap(MAP4,TEMPMAP4)&&
|
||||||
|
ValidateEntireMap(MAP5,TEMPMAP5)&&
|
||||||
|
ValidateEntireMap(MAP6,TEMPMAP6));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user