|
|
|
@ -41,6 +41,7 @@ namespace layer{ |
|
|
|
|
GROUND, |
|
|
|
|
BACKGROUND, |
|
|
|
|
OBJECT, //The object layer doesn't actually exist, it's used to tell the editor we are adding an object instead.
|
|
|
|
|
ENCOUNTER, //The encounter layer doesn't actually exist, it's used to tell the editor we are adding encounters instead.
|
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -363,6 +364,8 @@ public: |
|
|
|
|
std::map<BattleMoveName,Battle::Move*>MOVELIST; |
|
|
|
|
std::array<vd2d,PARTY_TRAIL_LENGTH> partyTrail={vd2d{0,0}}; |
|
|
|
|
int PARTY_MEMBER_COUNT = 1; |
|
|
|
|
int ENCOUNTER_SELECTED = 0; |
|
|
|
|
int ENCOUNTER_OFFSET = 0; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool MOUSE_PRESSED_DOWN=false,MOUSE_DOWN=false,MOUSE_RELEASED=false; //TODO Implement Mouse things.
|
|
|
|
@ -630,6 +633,11 @@ goes on a very long time, I hope you can understand this is only for testing pur |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}break; |
|
|
|
|
case GameState::ENCOUNTER_SELECT:{ |
|
|
|
|
if (!GetKey(SHIFT).bHeld) { |
|
|
|
|
GAME_STATE=GameState::EDITOR; |
|
|
|
|
}
|
|
|
|
|
}break; |
|
|
|
|
case GameState::GAME_WORLD:{ |
|
|
|
|
if (PlayerCanMove()) { |
|
|
|
|
if (UpHeld()) { |
|
|
|
@ -658,6 +666,9 @@ goes on a very long time, I hope you can understand this is only for testing pur |
|
|
|
|
if (TabHeld()) { |
|
|
|
|
GAME_STATE=GameState::TILE_SELECT; |
|
|
|
|
} |
|
|
|
|
if (GetKey(SHIFT).bHeld) { |
|
|
|
|
GAME_STATE=GameState::ENCOUNTER_SELECT; |
|
|
|
|
} |
|
|
|
|
if (PlayerCanMove()) { |
|
|
|
|
if (GetKey(I).bHeld) { |
|
|
|
|
if (PARTY_MEMBER_OBJ[0]->SmoothMove({0,-1})) { |
|
|
|
@ -866,6 +877,9 @@ goes on a very long time, I hope you can understand this is only for testing pur |
|
|
|
|
if (GetKey(ESCAPE).bPressed) { |
|
|
|
|
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.
|
|
|
|
|
} else |
|
|
|
|
if (EDITING_LAYER==layer::OBJECT&&GetMouse(0).bPressed) { |
|
|
|
|
AddObjectToWorld(CreateObject(SELECTED_OBJ_ID,HIGHLIGHTED_TILE*32)); |
|
|
|
|
} else |
|
|
|
@ -906,6 +920,9 @@ goes on a very long time, I hope you can understand this is only for testing pur |
|
|
|
|
DrawGameWorld(); |
|
|
|
|
SetDrawTarget(nullptr); |
|
|
|
|
DrawRectDecal((HIGHLIGHTED_TILE)*32-cameraPos,{32,32},YELLOW); |
|
|
|
|
if (EDITING_LAYER==layer::ENCOUNTER) { |
|
|
|
|
DrawStringPropDecal({2,2},"Editing Encounters"); |
|
|
|
|
} else
|
|
|
|
|
if (EDITING_LAYER==layer::OBJECT) { |
|
|
|
|
DrawStringPropDecal({2,2},"Editing Objects"); |
|
|
|
|
} else { |
|
|
|
@ -951,6 +968,45 @@ goes on a very long time, I hope you can understand this is only for testing pur |
|
|
|
|
counter++; |
|
|
|
|
} |
|
|
|
|
}break; |
|
|
|
|
case GameState::ENCOUNTER_SELECT:{ |
|
|
|
|
vd2d drawpos={0,0}; |
|
|
|
|
int counter=0; |
|
|
|
|
for (int i=0;i<CURRENT_MAP->encounters.size();i++){ |
|
|
|
|
if (counter<ENCOUNTER_OFFSET) { |
|
|
|
|
counter++; |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
if (drawpos.y>HEIGHT) { |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
Encounter*enc = CURRENT_MAP->encounters[i]; |
|
|
|
|
if (GetMouse(0).bHeld&& |
|
|
|
|
GetMousePos().x>=drawpos.x&& |
|
|
|
|
GetMousePos().x<drawpos.x+16&& |
|
|
|
|
GetMousePos().y>=drawpos.y&& |
|
|
|
|
GetMousePos().y<drawpos.y+24) { |
|
|
|
|
ENCOUNTER_SELECTED=enc->id; |
|
|
|
|
EDITING_LAYER=layer::ENCOUNTER; |
|
|
|
|
} |
|
|
|
|
FillRectDecal(drawpos,{16,24},VERY_DARK_GREY); |
|
|
|
|
for (int i=0;i<enc->objs.size();i+=2) { |
|
|
|
|
DrawPartialDecal({drawpos.x+((double)8/(enc->objs.size()))*i-4,drawpos.y},{16,16},enc->objs[i]->obj->spr->spr,{(enc->objs[i]->obj->frameIndex%enc->objs[i]->obj->spr->frames)*enc->objs[i]->obj->spr->width,0},{enc->objs[i]->obj->spr->width,enc->objs[i]->obj->spr->spr->sprite->height},enc->objs[i]->obj->color); |
|
|
|
|
} |
|
|
|
|
for (int i=1;i<enc->objs.size();i+=2) { |
|
|
|
|
DrawPartialDecal({drawpos.x+((double)8/(enc->objs.size()))*i-4,drawpos.y+6},{16,16},enc->objs[i]->obj->spr->spr,{(enc->objs[i]->obj->frameIndex%enc->objs[i]->obj->spr->frames)*enc->objs[i]->obj->spr->width,0},{enc->objs[i]->obj->spr->width,enc->objs[i]->obj->spr->spr->sprite->height},enc->objs[i]->obj->color); |
|
|
|
|
} |
|
|
|
|
if (ENCOUNTER_SELECTED==enc->id) { |
|
|
|
|
DrawRectDecal(drawpos,{16,24},YELLOW); |
|
|
|
|
} |
|
|
|
|
DrawStringDecal({drawpos.x+2,drawpos.y+24-GetTextSize(std::to_string(enc->id)).y},std::to_string(enc->id),WHITE,{12.0/GetTextSize(std::to_string(enc->id)).x,1.0}); |
|
|
|
|
drawpos.x+=16; |
|
|
|
|
if (drawpos.x>=WIDTH) { |
|
|
|
|
drawpos.x=0; |
|
|
|
|
drawpos.y+=24; |
|
|
|
|
} |
|
|
|
|
counter++; |
|
|
|
|
} |
|
|
|
|
}break; |
|
|
|
|
} |
|
|
|
|
if (messageBoxVisible) { |
|
|
|
|
SetDrawTarget(layer::INTERFACE); |
|
|
|
|