|
|
@ -18,6 +18,13 @@ |
|
|
|
#define TILEMAP_EDITOR_DRAW_MULT 0.4375 |
|
|
|
#define TILEMAP_EDITOR_DRAW_MULT 0.4375 |
|
|
|
#define TILEMAP_EDITOR_TILESIZE (32*TILEMAP_EDITOR_DRAW_MULT) |
|
|
|
#define TILEMAP_EDITOR_TILESIZE (32*TILEMAP_EDITOR_DRAW_MULT) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define AddAsyncCutsceneAction(AsyncClass) \ |
|
|
|
|
|
|
|
if (!((AsyncClass*)CurrentCutscene->GetAction())->InQueue()) { \
|
|
|
|
|
|
|
|
CUTSCENE_QUEUE.push_back(CurrentCutscene->GetAction()); \
|
|
|
|
|
|
|
|
} \
|
|
|
|
|
|
|
|
((AsyncClass*)CurrentCutscene->GetAction())->SetQueued(); \
|
|
|
|
|
|
|
|
CurrentCutscene->AdvanceAction(); \
|
|
|
|
|
|
|
|
|
|
|
|
using namespace olc; |
|
|
|
using namespace olc; |
|
|
|
|
|
|
|
|
|
|
|
namespace layer{ |
|
|
|
namespace layer{ |
|
|
@ -136,6 +143,7 @@ public: |
|
|
|
Cutscene*CurrentCutscene=nullptr; |
|
|
|
Cutscene*CurrentCutscene=nullptr; |
|
|
|
ActionType CurrentAction=ActionType::NONE; |
|
|
|
ActionType CurrentAction=ActionType::NONE; |
|
|
|
double CUTSCENE_FADE_VALUE=0; |
|
|
|
double CUTSCENE_FADE_VALUE=0; |
|
|
|
|
|
|
|
std::vector<CutsceneAction*>CUTSCENE_QUEUE; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool MOUSE_PRESSED_DOWN=false,MOUSE_DOWN=false,MOUSE_RELEASED=false; //TODO Implement Mouse things.
|
|
|
|
bool MOUSE_PRESSED_DOWN=false,MOUSE_DOWN=false,MOUSE_RELEASED=false; //TODO Implement Mouse things.
|
|
|
@ -195,7 +203,6 @@ public: |
|
|
|
(CutsceneAction*)new MoveCutsceneObject(1,{80,64}), |
|
|
|
(CutsceneAction*)new MoveCutsceneObject(1,{80,64}), |
|
|
|
(CutsceneAction*)new DialogBox(R"(Hello! |
|
|
|
(CutsceneAction*)new DialogBox(R"(Hello! |
|
|
|
This is a test message that lets us trigger straight from a cutscene! Cool!)"),}); |
|
|
|
This is a test message that lets us trigger straight from a cutscene! Cool!)"),}); |
|
|
|
|
|
|
|
|
|
|
|
/*DisplayMessageBox(R"(Hello World!
|
|
|
|
/*DisplayMessageBox(R"(Hello World!
|
|
|
|
This is a rather long message, but I hope it reaches you well
|
|
|
|
This is a rather long message, but I hope it reaches you well
|
|
|
|
in some form or capacity or another. Even though it
|
|
|
|
in some form or capacity or another. Even though it
|
|
|
@ -220,7 +227,7 @@ goes on a very long time, I hope you can understand this is only for testing pur |
|
|
|
Clear(MAGENTA); |
|
|
|
Clear(MAGENTA); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
Clear(BLANK); |
|
|
|
Clear(BLANK); |
|
|
|
}
|
|
|
|
} |
|
|
|
SetDrawTarget(layer::HIGH); |
|
|
|
SetDrawTarget(layer::HIGH); |
|
|
|
Clear(BLANK); |
|
|
|
Clear(BLANK); |
|
|
|
SetDrawTarget(layer::DYNAMIC); |
|
|
|
SetDrawTarget(layer::DYNAMIC); |
|
|
@ -277,11 +284,17 @@ goes on a very long time, I hope you can understand this is only for testing pur |
|
|
|
CurrentCutscene->AdvanceAction(); |
|
|
|
CurrentCutscene->AdvanceAction(); |
|
|
|
} |
|
|
|
} |
|
|
|
}break; |
|
|
|
}break; |
|
|
|
|
|
|
|
case ActionType::PAN_CAMERA_ASYNC:{ |
|
|
|
|
|
|
|
AddAsyncCutsceneAction(PanCameraAsync); |
|
|
|
|
|
|
|
}break; |
|
|
|
case ActionType::MOVE_CUTSCENE_OBJ:{ |
|
|
|
case ActionType::MOVE_CUTSCENE_OBJ:{ |
|
|
|
if (MoveObjectTowardsPoint(CurrentCutscene->GetCutsceneObjects()[((MoveCutsceneObject*)CurrentCutscene->GetAction())->GetObjectID()],((MoveCutsceneObject*)CurrentCutscene->GetAction())->GetTargetPos(),((MoveCutsceneObject*)CurrentCutscene->GetAction())->GetMovement(),((MoveCutsceneObject*)CurrentCutscene->GetAction())->GetMoveSpd())) { |
|
|
|
if (MoveObjectTowardsPoint(CurrentCutscene->GetCutsceneObjects()[((MoveCutsceneObject*)CurrentCutscene->GetAction())->GetObjectID()],((MoveCutsceneObject*)CurrentCutscene->GetAction())->GetTargetPos(),((MoveCutsceneObject*)CurrentCutscene->GetAction())->GetMovement(),((MoveCutsceneObject*)CurrentCutscene->GetAction())->GetMoveSpd())) { |
|
|
|
CurrentCutscene->AdvanceAction(); |
|
|
|
CurrentCutscene->AdvanceAction(); |
|
|
|
} |
|
|
|
} |
|
|
|
}break; |
|
|
|
}break; |
|
|
|
|
|
|
|
case ActionType::MOVE_CUTSCENE_OBJ_ASYNC:{ |
|
|
|
|
|
|
|
AddAsyncCutsceneAction(MoveCutsceneObjectAsync); |
|
|
|
|
|
|
|
}break; |
|
|
|
case ActionType::CREATE_OBJECTS:{ |
|
|
|
case ActionType::CREATE_OBJECTS:{ |
|
|
|
for (auto&obj:((CreateObjects*)CurrentCutscene->GetAction())->GetObjects()) { |
|
|
|
for (auto&obj:((CreateObjects*)CurrentCutscene->GetAction())->GetObjects()) { |
|
|
|
obj->temp=true; |
|
|
|
obj->temp=true; |
|
|
@ -290,16 +303,18 @@ goes on a very long time, I hope you can understand this is only for testing pur |
|
|
|
CurrentCutscene->AdvanceAction(); |
|
|
|
CurrentCutscene->AdvanceAction(); |
|
|
|
}break; |
|
|
|
}break; |
|
|
|
case ActionType::CLEANUP:{ |
|
|
|
case ActionType::CLEANUP:{ |
|
|
|
for (int i=0;i<OBJECTS.size();i++) { |
|
|
|
if (CUTSCENE_QUEUE.size()==0) {
|
|
|
|
if (OBJECTS[i]->temp) { |
|
|
|
for (int i=0;i<OBJECTS.size();i++) { |
|
|
|
OBJECTS.erase(OBJECTS.begin()+i--); |
|
|
|
if (OBJECTS[i]->temp) { |
|
|
|
|
|
|
|
OBJECTS.erase(OBJECTS.begin()+i--); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
CurrentCutscene->CleanupCutscene(); |
|
|
|
|
|
|
|
CurrentCutscene->ResetCutscene(); |
|
|
|
|
|
|
|
SetGameFlag(CurrentCutscene->GetEndingCutsceneFlag(),CurrentCutscene->GetEndingCutsceneVal()); |
|
|
|
|
|
|
|
CurrentCutscene=nullptr; |
|
|
|
|
|
|
|
CurrentAction=ActionType::NONE; |
|
|
|
} |
|
|
|
} |
|
|
|
CurrentCutscene->CleanupCutscene(); |
|
|
|
|
|
|
|
CurrentCutscene->ResetCutscene(); |
|
|
|
|
|
|
|
SetGameFlag(CurrentCutscene->GetEndingCutsceneFlag(),CurrentCutscene->GetEndingCutsceneVal()); |
|
|
|
|
|
|
|
CurrentCutscene=nullptr; |
|
|
|
|
|
|
|
CurrentAction=ActionType::NONE; |
|
|
|
|
|
|
|
}break; |
|
|
|
}break; |
|
|
|
case ActionType::FADE:{ |
|
|
|
case ActionType::FADE:{ |
|
|
|
if (((Fade*)CurrentCutscene->GetAction())->FadeIn()&&CUTSCENE_FADE_VALUE>0) { |
|
|
|
if (((Fade*)CurrentCutscene->GetAction())->FadeIn()&&CUTSCENE_FADE_VALUE>0) { |
|
|
@ -315,6 +330,9 @@ goes on a very long time, I hope you can understand this is only for testing pur |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}break; |
|
|
|
}break; |
|
|
|
|
|
|
|
case ActionType::FADE_ASYNC:{ |
|
|
|
|
|
|
|
AddAsyncCutsceneAction(FadeAsync); |
|
|
|
|
|
|
|
}break; |
|
|
|
case ActionType::DIALOG:{ |
|
|
|
case ActionType::DIALOG:{ |
|
|
|
if (!((DialogBox*)CurrentCutscene->GetAction())->MessageHasBeenShown()) { |
|
|
|
if (!((DialogBox*)CurrentCutscene->GetAction())->MessageHasBeenShown()) { |
|
|
|
DisplayMessageBox(((DialogBox*)CurrentCutscene->GetAction())->GetMessage()); |
|
|
|
DisplayMessageBox(((DialogBox*)CurrentCutscene->GetAction())->GetMessage()); |
|
|
@ -324,6 +342,39 @@ goes on a very long time, I hope you can understand this is only for testing pur |
|
|
|
CurrentCutscene->AdvanceAction(); |
|
|
|
CurrentCutscene->AdvanceAction(); |
|
|
|
} |
|
|
|
} |
|
|
|
}break; |
|
|
|
}break; |
|
|
|
|
|
|
|
case ActionType::DIALOG_ASYNC:{ |
|
|
|
|
|
|
|
DisplayMessageBox(((DialogBox*)CurrentCutscene->GetAction())->GetMessage()); |
|
|
|
|
|
|
|
CurrentCutscene->AdvanceAction(); |
|
|
|
|
|
|
|
}break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (int i=0;i<CUTSCENE_QUEUE.size();i++) { |
|
|
|
|
|
|
|
switch (CUTSCENE_QUEUE[i]->GetActionType()) { |
|
|
|
|
|
|
|
case ActionType::PAN_CAMERA_ASYNC:{ |
|
|
|
|
|
|
|
if (MoveCameraTowardsPoint((PanCameraAsync*)CUTSCENE_QUEUE[i])) { |
|
|
|
|
|
|
|
CUTSCENE_QUEUE.erase(CUTSCENE_QUEUE.begin()+i--); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}break; |
|
|
|
|
|
|
|
case ActionType::MOVE_CUTSCENE_OBJ_ASYNC:{ |
|
|
|
|
|
|
|
if (MoveObjectTowardsPoint(CurrentCutscene->GetCutsceneObjects()[((MoveCutsceneObjectAsync*)CUTSCENE_QUEUE[i])->GetObjectID()],((MoveCutsceneObjectAsync*)CUTSCENE_QUEUE[i])->GetTargetPos(),((MoveCutsceneObjectAsync*)CUTSCENE_QUEUE[i])->GetMovement(),((MoveCutsceneObjectAsync*)CUTSCENE_QUEUE[i])->GetMoveSpd())) { |
|
|
|
|
|
|
|
CUTSCENE_QUEUE.erase(CUTSCENE_QUEUE.begin()+i--); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}break; |
|
|
|
|
|
|
|
case ActionType::FADE_ASYNC:{ |
|
|
|
|
|
|
|
if (((FadeAsync*)CUTSCENE_QUEUE[i])->FadeIn()&&CUTSCENE_FADE_VALUE>0) { |
|
|
|
|
|
|
|
CUTSCENE_FADE_VALUE=std::clamp(CUTSCENE_FADE_VALUE-((FadeAsync*)CUTSCENE_QUEUE[i])->GetFadeSpd(),0.0,255.0); |
|
|
|
|
|
|
|
if (CUTSCENE_FADE_VALUE==0) { |
|
|
|
|
|
|
|
CUTSCENE_QUEUE.erase(CUTSCENE_QUEUE.begin()+i--); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else
|
|
|
|
|
|
|
|
if (!((FadeAsync*)CUTSCENE_QUEUE[i])->FadeIn()&&CUTSCENE_FADE_VALUE<255) { |
|
|
|
|
|
|
|
CUTSCENE_FADE_VALUE=std::clamp(CUTSCENE_FADE_VALUE+((FadeAsync*)CUTSCENE_QUEUE[i])->GetFadeSpd(),0.0,255.0); |
|
|
|
|
|
|
|
if (CUTSCENE_FADE_VALUE==255) { |
|
|
|
|
|
|
|
CUTSCENE_QUEUE.erase(CUTSCENE_QUEUE.begin()+i--); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}break; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|