|
|
|
@ -132,6 +132,8 @@ public: |
|
|
|
|
bool messageBoxLoad=false; //Set to true when ready to load a message in.
|
|
|
|
|
std::map<int,vi2d> additionalChars; |
|
|
|
|
Cutscene*TestCutscene; |
|
|
|
|
Cutscene*CurrentCutscene=nullptr; |
|
|
|
|
ActionType CurrentAction=ActionType::NONE; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool MOUSE_PRESSED_DOWN=false,MOUSE_DOWN=false,MOUSE_RELEASED=false; //TODO Implement Mouse things.
|
|
|
|
@ -179,9 +181,11 @@ public: |
|
|
|
|
|
|
|
|
|
TestCutscene=new Cutscene({ |
|
|
|
|
(CutsceneAction*)new PanCamera({128,128},BOTH), |
|
|
|
|
(CutsceneAction*)new PanCamera({128,128},BOTH), |
|
|
|
|
(CutsceneAction*)new PanCamera({128,0},BOTH), |
|
|
|
|
(CutsceneAction*)new CreateObjects({ |
|
|
|
|
new Object(PLAYER,"player",{64,64},ANIMATIONS["player.png"],{1,1},MAGENTA) |
|
|
|
|
new Object(PLAYER,"player",{64,64},ANIMATIONS["player.png"],{1,1},MAGENTA), |
|
|
|
|
new Object(PLAYER,"player",{136,136},ANIMATIONS["player.png"],{1,1},RED), |
|
|
|
|
new Object(PLAYER,"player",{96,96},ANIMATIONS["player.png"],{1,1},DARK_GREEN), |
|
|
|
|
}),}); |
|
|
|
|
|
|
|
|
|
/*DisplayMessageBox(R"(Hello World!
|
|
|
|
@ -190,6 +194,8 @@ in some form or capacity or another. Even though it |
|
|
|
|
goes on a very long time, I hope you can understand this is only for testing purposes! |
|
|
|
|
)");*/ |
|
|
|
|
|
|
|
|
|
StartCutscene(TestCutscene); |
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -246,6 +252,26 @@ goes on a very long time, I hope you can understand this is only for testing pur |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (GetCurrentCutsceneAction()!=ActionType::NONE) { |
|
|
|
|
CurrentAction=GetCurrentCutsceneAction(); |
|
|
|
|
CurrentCutscene->LockAction(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
switch (CurrentAction) { |
|
|
|
|
case ActionType::PAN_CAMERA:{ |
|
|
|
|
if (MoveCameraTowardsPoint((PanCamera*)CurrentCutscene->GetAction())) { |
|
|
|
|
CurrentCutscene->AdvanceAction(); |
|
|
|
|
} |
|
|
|
|
}break; |
|
|
|
|
case ActionType::CREATE_OBJECTS:{ |
|
|
|
|
for (auto&obj:((CreateObjects*)CurrentCutscene->GetAction())->GetObjects()) { |
|
|
|
|
obj->temp=true; |
|
|
|
|
AddObjectToWorld(obj); |
|
|
|
|
} |
|
|
|
|
CurrentCutscene->AdvanceAction(); |
|
|
|
|
}break; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
switch (GAME_STATE) { |
|
|
|
|
case GameState::TILE_SELECT:{ |
|
|
|
|
if (!TabHeld()) { |
|
|
|
@ -792,6 +818,8 @@ goes on a very long time, I hope you can understand this is only for testing pur |
|
|
|
|
return SPRITES[spriteName]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//You're probably trying to add an object to the world. Use this function inside of AddObjectToWorld(CreateObject(...))
|
|
|
|
|
//You only need to use this function if you want to create an object from pre-defined OBJ_INFO variables.
|
|
|
|
|
Object*CreateObject(int id,vd2d pos) { |
|
|
|
|
return new Object(id,OBJ_INFO[id]->name,pos,OBJ_INFO[id]->spr,OBJ_INFO[id]->scale,OBJ_INFO[id]->color,OBJ_INFO[id]->animationSpd); |
|
|
|
|
} |
|
|
|
@ -1082,7 +1110,7 @@ goes on a very long time, I hope you can understand this is only for testing pur |
|
|
|
|
|
|
|
|
|
void AddObjectToWorld(Object*obj) { |
|
|
|
|
std::vector<Object*>::const_iterator it = OBJECTS.begin(); |
|
|
|
|
if (obj->id==PLAYER) { |
|
|
|
|
if (obj->id==PLAYER&&!obj->temp) { |
|
|
|
|
PLAYER_OBJ=obj; |
|
|
|
|
} |
|
|
|
|
bool inserted=false; |
|
|
|
@ -1187,13 +1215,63 @@ goes on a very long time, I hope you can understand this is only for testing pur |
|
|
|
|
}break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void StartCutscene(Cutscene*cutscene) { |
|
|
|
|
CurrentCutscene=cutscene; |
|
|
|
|
} |
|
|
|
|
ActionType GetCurrentCutsceneAction() { |
|
|
|
|
return (CurrentCutscene==nullptr)?ActionType::NONE:CurrentCutscene->CurrentAction(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
bool MoveCameraTowardsPoint(PanCamera*pan,bool secondRun=false) { |
|
|
|
|
bool reachedPosition=true; |
|
|
|
|
if (pan->GetPriorityDirection()==HORZ_FIRST||pan->GetPriorityDirection()==BOTH) { |
|
|
|
|
if (cameraPos.x!=pan->GetCameraTargetPos().x) { |
|
|
|
|
if (cameraPos.x<pan->GetCameraTargetPos().x) { |
|
|
|
|
cameraPos.x+=pan->GetCameraSpeed(); |
|
|
|
|
if (cameraPos.x>pan->GetCameraTargetPos().x) { |
|
|
|
|
cameraPos.x=pan->GetCameraTargetPos().x; |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
cameraPos.x-=pan->GetCameraSpeed(); |
|
|
|
|
if (cameraPos.x<pan->GetCameraTargetPos().x) { |
|
|
|
|
cameraPos.x=pan->GetCameraTargetPos().x; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
reachedPosition=false; |
|
|
|
|
} else
|
|
|
|
|
if (!secondRun&&pan->GetPriorityDirection()!=BOTH) { |
|
|
|
|
MoveCameraTowardsPoint(pan,true); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (pan->GetPriorityDirection()==VERT_FIRST||pan->GetPriorityDirection()==BOTH) { |
|
|
|
|
if (cameraPos.y!=pan->GetCameraTargetPos().y) { |
|
|
|
|
if (cameraPos.y<pan->GetCameraTargetPos().y) { |
|
|
|
|
cameraPos.y+=pan->GetCameraSpeed(); |
|
|
|
|
if (cameraPos.y>pan->GetCameraTargetPos().y) { |
|
|
|
|
cameraPos.y=pan->GetCameraTargetPos().y; |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
cameraPos.y-=pan->GetCameraSpeed(); |
|
|
|
|
if (cameraPos.y<pan->GetCameraTargetPos().y) { |
|
|
|
|
cameraPos.y=pan->GetCameraTargetPos().y; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
reachedPosition=false; |
|
|
|
|
} else
|
|
|
|
|
if (!secondRun&&pan->GetPriorityDirection()!=BOTH) { |
|
|
|
|
MoveCameraTowardsPoint(pan,true); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return reachedPosition; |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int main() |
|
|
|
|
{ |
|
|
|
|
SeasonI demo; |
|
|
|
|
if (demo.Construct(WIDTH, HEIGHT, 4, 4)) |
|
|
|
|
if (demo.Construct(WIDTH, HEIGHT, 4, 4,false,false,true)) |
|
|
|
|
demo.Start(); |
|
|
|
|
|
|
|
|
|
return 0; |
|
|
|
|