|
|
|
@ -296,8 +296,8 @@ class Encounter{ |
|
|
|
|
std::vector<Entity*>objs; |
|
|
|
|
std::array<vd2d,4> playerPos; |
|
|
|
|
int id; |
|
|
|
|
Encounter(vd2d pos,std::array<vd2d,4> playerPos,std::vector<Entity*>objs,int chance=25) |
|
|
|
|
:pos(pos),objs(objs),chance(chance),playerPos(playerPos){} |
|
|
|
|
Encounter(int id,vd2d pos,std::array<vd2d,4> playerPos,std::vector<Entity*>objs,int chance=25) |
|
|
|
|
:id(id),pos(pos),objs(objs),chance(chance),playerPos(playerPos){} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -880,7 +880,24 @@ goes on a very long time, I hope you can understand this is only for testing pur |
|
|
|
|
GAME_STATE=GameState::OBJ_SELECT; |
|
|
|
|
} |
|
|
|
|
if (EDITING_LAYER==layer::ENCOUNTER&&GetMouse(0).bPressed) { |
|
|
|
|
//LoadEncounter(CURRENT_MAP,HIGHLIGHTED_TILE*32,CURRENT_MAP->encounters) //TODO Make up the encounter reference list and then come back.
|
|
|
|
|
LoadEncounter(CURRENT_MAP,HIGHLIGHTED_TILE*32,ENCOUNTER_LIST[ENCOUNTER_SELECTED]->chance,ENCOUNTER_SELECTED,true); |
|
|
|
|
} else |
|
|
|
|
if (EDITING_LAYER==layer::ENCOUNTER&&GetMouse(1).bPressed) { |
|
|
|
|
for (int i=0;i<CURRENT_MAP->encounters.size();i++) { |
|
|
|
|
if(CURRENT_MAP->encounters[i]->pos==HIGHLIGHTED_TILE*32) { |
|
|
|
|
for (int j=0;j<CURRENT_MAP->encounters[i]->objs.size();j++) { |
|
|
|
|
int index=CURRENT_MAP->encounters[i]->objs[j]->obj->objArrElement; |
|
|
|
|
delete OBJECTS[index]; |
|
|
|
|
OBJECTS.erase(OBJECTS.begin()+index); |
|
|
|
|
for (int k=0;k<OBJECTS.size();k++) { |
|
|
|
|
OBJECTS[k]->objArrElement=k; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
delete CURRENT_MAP->encounters[i]; |
|
|
|
|
CURRENT_MAP->encounters.erase(CURRENT_MAP->encounters.begin()+i--); |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} else |
|
|
|
|
if (EDITING_LAYER==layer::OBJECT&&GetMouse(0).bPressed) { |
|
|
|
|
AddObjectToWorld(CreateObject(SELECTED_OBJ_ID,HIGHLIGHTED_TILE*32)); |
|
|
|
@ -924,6 +941,10 @@ goes on a very long time, I hope you can understand this is only for testing pur |
|
|
|
|
DrawRectDecal((HIGHLIGHTED_TILE)*32-cameraPos,{32,32},YELLOW); |
|
|
|
|
if (EDITING_LAYER==layer::ENCOUNTER) { |
|
|
|
|
DrawStringPropDecal({2,2},"Editing Encounters"); |
|
|
|
|
for (auto&enc:CURRENT_MAP->encounters) { |
|
|
|
|
FillRectDecal(enc->pos-cameraPos,{WIDTH,HEIGHT},Pixel(255,0,0,64)); |
|
|
|
|
DrawRectDecal(enc->pos-cameraPos,{WIDTH,HEIGHT},YELLOW); |
|
|
|
|
} |
|
|
|
|
} else
|
|
|
|
|
if (EDITING_LAYER==layer::OBJECT) { |
|
|
|
|
DrawStringPropDecal({2,2},"Editing Objects"); |
|
|
|
@ -973,7 +994,7 @@ goes on a very long time, I hope you can understand this is only for testing pur |
|
|
|
|
case GameState::ENCOUNTER_SELECT:{ |
|
|
|
|
vd2d drawpos={0,0}; |
|
|
|
|
int counter=0; |
|
|
|
|
for (int i=0;i<CURRENT_MAP->encounters.size();i++){ |
|
|
|
|
for (int i=0;i<ENCOUNTER_LIST.size();i++){ |
|
|
|
|
if (counter<ENCOUNTER_OFFSET) { |
|
|
|
|
counter++; |
|
|
|
|
continue; |
|
|
|
@ -981,7 +1002,7 @@ goes on a very long time, I hope you can understand this is only for testing pur |
|
|
|
|
if (drawpos.y>HEIGHT) { |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
Encounter*enc = CURRENT_MAP->encounters[i]; |
|
|
|
|
Encounter*enc = ENCOUNTER_LIST[i]; |
|
|
|
|
if (GetMouse(0).bHeld&& |
|
|
|
|
GetMousePos().x>=drawpos.x&& |
|
|
|
|
GetMousePos().x<drawpos.x+16&& |
|
|
|
@ -1512,7 +1533,7 @@ goes on a very long time, I hope you can understand this is only for testing pur |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void SetupEncounters() { |
|
|
|
|
ENCOUNTER_LIST.push_back(new Encounter({0,0},std::array<vd2d,4>{vd2d |
|
|
|
|
ENCOUNTER_LIST.push_back(new Encounter(encounter::ENCOUNTER_1,{0,0},std::array<vd2d,4>{vd2d |
|
|
|
|
{+10,+24},{+30,+24},{+50,+24},{+70,+24}}, |
|
|
|
|
std::vector<Entity*>{ |
|
|
|
|
new Entity(new Object( |
|
|
|
@ -1537,7 +1558,7 @@ goes on a very long time, I hope you can understand this is only for testing pur |
|
|
|
|
MOVELIST[BattleMoveName::TESTMOVE3], |
|
|
|
|
}), |
|
|
|
|
}));//ENCOUNTER_1
|
|
|
|
|
ENCOUNTER_LIST.push_back(new Encounter({0,0},std::array<vd2d,4>{vd2d |
|
|
|
|
ENCOUNTER_LIST.push_back(new Encounter(encounter::ENCOUNTER_2,{0,0},std::array<vd2d,4>{vd2d |
|
|
|
|
{10,24},{30,24},{50,24},{70,24}}, |
|
|
|
|
std::vector<Entity*>{ |
|
|
|
|
new Entity(new Object( |
|
|
|
@ -1562,7 +1583,7 @@ goes on a very long time, I hope you can understand this is only for testing pur |
|
|
|
|
MOVELIST[BattleMoveName::TESTMOVE3], |
|
|
|
|
}), |
|
|
|
|
}));//ENCOUNTER_2
|
|
|
|
|
ENCOUNTER_LIST.push_back(new Encounter({0,0},std::array<vd2d,4>{vd2d |
|
|
|
|
ENCOUNTER_LIST.push_back(new Encounter(encounter::ENCOUNTER_3,{0,0},std::array<vd2d,4>{vd2d |
|
|
|
|
{10,24},{30,24},{50,24},{70,24}}, |
|
|
|
|
std::vector<Entity*>{ |
|
|
|
|
new Entity(new Object( |
|
|
|
@ -1797,7 +1818,7 @@ goes on a very long time, I hope you can understand this is only for testing pur |
|
|
|
|
Object*newObj=new Object(ent->obj->id,ent->obj->name,ent->obj->GetPos(),ent->obj->spr,ent->obj->GetScale(),ent->obj->color,ent->obj->animationSpd,ent->obj->temp); |
|
|
|
|
ents.push_back(new Entity(newObj,ent->HP,ent->maxHP,ent->baseAtk,ent->resistances,ent->speed,ent->moveSet,ent->damageReduction,ent->smart,ent->dumb)); |
|
|
|
|
} |
|
|
|
|
Encounter*data=new Encounter(pos,ENCOUNTER_LIST[id]->playerPos,ents,chance); |
|
|
|
|
Encounter*data=new Encounter(id,pos,ENCOUNTER_LIST[id]->playerPos,ents,chance); |
|
|
|
|
data->chance=chance; |
|
|
|
|
data->id=id; |
|
|
|
|
for (int i=0;i<data->objs.size();i++) { |
|
|
|
@ -1808,9 +1829,7 @@ goes on a very long time, I hope you can understand this is only for testing pur |
|
|
|
|
} |
|
|
|
|
map->encounters.push_back(data); |
|
|
|
|
for (int i=0;i<data->objs.size();i++) { |
|
|
|
|
if (successful) { |
|
|
|
|
AddObjectToWorld(data->objs[i]->obj); |
|
|
|
|
} |
|
|
|
|
AddObjectToWorld(data->objs[i]->obj); |
|
|
|
|
data->objs[i]->obj->SetPos(data->objs[i]->obj->GetPos()+pos); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|