diff --git a/C++ProjectTemplate b/C++ProjectTemplate index b27df68..d1ad5eb 100755 Binary files a/C++ProjectTemplate and b/C++ProjectTemplate differ diff --git a/SeasonI.h b/SeasonI.h index 3afe510..90fda09 100644 --- a/SeasonI.h +++ b/SeasonI.h @@ -32,6 +32,7 @@ class SeasonI:public PixelGameEngine{ void SetupObjectInfo(); 됐어 void SetupEncounters(); 됐어 void SetupBattleProperties(); 됐어 + void SetupCutscenes(); void SetGameFlag(Flag flag,bool val); void LoadMap(Map*map); void SaveMap(Map*map); @@ -125,6 +126,7 @@ class SeasonI:public PixelGameEngine{ bool Collision(vd2d pos); void DrawInventory(); void ChoiceMade(int choice); + void StartCutscene(Cutscene*cutscene); }; extern SeasonI*GAME; #endif \ No newline at end of file diff --git a/assets/maps/map0 b/assets/maps/map0 index 2e13a6f..40b3670 100644 --- a/assets/maps/map0 +++ b/assets/maps/map0 @@ -94,4 +94,5 @@ ENCOUNTER480.000000;160.000000;100;3 TRIGGER32;288;1;32;32 TRIGGER96;352;1;32;32 TRIGGER32;384;1;32;32 -TRIGGER32;288;1;32;32 \ No newline at end of file +TRIGGER32;288;1;32;32 +TRIGGER416;256;2;32;32 \ No newline at end of file diff --git a/assets/maps/map0_5 b/assets/maps/map0_5 index e53cfe7..52043b2 100644 --- a/assets/maps/map0_5 +++ b/assets/maps/map0_5 @@ -7,7 +7,7 @@ ??????????0717?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? -????????????????????????93:3;3?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? +????????????????????????93??;3?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ????????????????????????????????15?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ??????????????????????065656565616?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ??????????????????????9256?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? diff --git a/assets/maps/newmap b/assets/maps/newmap index 094142a..21425ce 100644 --- a/assets/maps/newmap +++ b/assets/maps/newmap @@ -68,4 +68,5 @@ TRIGGER64;352;1;32;32 TRIGGER96;352;1;32;32 TRIGGER96;384;1;32;32 TRIGGER64;384;1;32;32 -TRIGGER32;384;1;32;32 \ No newline at end of file +TRIGGER32;384;1;32;32 +TRIGGER416;256;3;32;32 \ No newline at end of file diff --git a/assets/maps/newmap_5 b/assets/maps/newmap_5 index e53cfe7..52043b2 100644 --- a/assets/maps/newmap_5 +++ b/assets/maps/newmap_5 @@ -7,7 +7,7 @@ ??????????0717?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? -????????????????????????93:3;3?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? +????????????????????????93??;3?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ????????????????????????????????15?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ??????????????????????065656565616?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ??????????????????????9256?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? diff --git a/cutscene.h b/cutscene.h index 201bc55..feaef7b 100644 --- a/cutscene.h +++ b/cutscene.h @@ -1,6 +1,7 @@ #ifndef CUTSCENE_H #define CUTSCENE_H #include "pixelGameEngine.h" +#include "defines.h" #include "flags.h" #define CAMERA_MOVESPD 5 @@ -14,6 +15,14 @@ enum PriorityDirection{ BOTH }; +namespace CutsceneName{ + enum Cutscene{ + TEST_CUTSCENE, + TRANSFER_MAP_TWOSON_CUTSCENE, + TRANSFER_MAP_ONETT_CUTSCENE, + }; +} + enum class ActionType{ NONE, PAN_CAMERA, @@ -28,6 +37,7 @@ enum class ActionType{ DIALOG_ASYNC, MOVE_CUTSCENE_OBJ_ASYNC, MODIFY_OBJECT, + LOAD_MAP, }; class CutsceneAction{ @@ -49,6 +59,7 @@ class Cleanup:public CutsceneAction{ class Object; class Animation; +class Map; class CreateObjects:public CutsceneAction{ protected: @@ -249,6 +260,18 @@ class ModifyObject:public CutsceneAction{ } }; +class LoadMap:public CutsceneAction{ + protected: + Map*map; + public: + LoadMap(Map*newMap) + :map(newMap) {} + ActionType GetActionType() override{return ActionType::LOAD_MAP;} + Map*GetTargetMap(){ + return map; + } +}; + /* To use this class, specify multiple actions back-to-back, filling their appropriate arguments. @@ -270,7 +293,7 @@ class Cutscene{ AddAction(actions); }; template - void AddAction( std::initializer_list actions ) + void AddAction(std::initializer_list actions ) { for( auto elem : actions ) { @@ -327,4 +350,14 @@ class Cutscene{ return storedVal; } }; + +class MapTransitionCutscene:public Cutscene{ + public: + MapTransitionCutscene(Map*newmap) + :Cutscene({ + 액션 Fade(), + 액션 LoadMap(newmap), + 액션 Fade(true), + }){} +}; #endif \ No newline at end of file diff --git a/main.cpp b/main.cpp index 7aa9940..ad76b28 100644 --- a/main.cpp +++ b/main.cpp @@ -75,7 +75,6 @@ int messageBoxStopMarker=0; //End of text display for current printout. int messageBoxFrameWaitTime=1; bool messageBoxLoad=false; //Set to true when ready to load a message in. std::map additionalChars={}; -Cutscene*TestCutscene=nullptr; Cutscene*CurrentCutscene=nullptr; ActionType CurrentAction=ActionType::NONE; double CUTSCENE_FADE_VALUE=0; @@ -203,6 +202,7 @@ std::vector PARTICLES={}; std::vector DAMAGE_NUMBERS={}; std::map,vd2d> MOVEMENT_GRID={}; std::mapITEMLIST={}; +std::map CUTSCENES={}; vi2d SELECTED_MOVE_SQUARE={}; FountainEffect*FOUNTAIN_EFFECT=nullptr; @@ -234,6 +234,7 @@ bool SeasonI::OnUserCreate(){ SetupObjectInfo(); SetupEncounters(); SetupBattleProperties(); + SetupCutscenes(); SetGameFlag(Flag::TEST_FLAG1,false); SetGameFlag(Flag::TEST_FLAG2,false); SetGameFlag(Flag::TEST_FLAG3,false); @@ -252,23 +253,6 @@ bool SeasonI::OnUserCreate(){ //OBJ_INFO["PLAYER"]=PLAYER_ANIMATION; LoadMap(CURRENT_MAP); - TestCutscene=new Cutscene({ - 액션 Fade(), - 액션 CreateObjects({ - new Standard_Obj(PLAYER,"player",{64,64},ANIMATIONS["player.png"],{1,1},MAGENTA), - new Standard_Obj(PLAYER,"player",{136,136},ANIMATIONS["player.png"],{1,1},RED), - new Standard_Obj(PLAYER,"player",{96,96},ANIMATIONS["player.png"],{1,1},DARK_GREEN), - }), - 액션 Fade(true), - 액션 SetFlagWhenCutsceneEnds(Flag::TEST_FLAG1), - 액션 PanCamera({128,128},BOTH,1), - 액션 MoveCutsceneObjectAsync(1,{80,64},5), - 액션 PanCamera({64,0},BOTH), - 액션 DialogBoxAsync(R"(Hello! -This is a test message that lets us trigger straight from a cutscene! Cool!)"), - 액션 ModifyObject(0,ANIMATIONS["player.png"],{5,5},MAGENTA), - 액션 MoveCutsceneObject(1,{320,64},1),}); - AddItemToPlayerInventory(ItemName::LIGHT_JACKET); AddItemToPlayerInventory(ItemName::LIGHT_JACKET); AddItemToPlayerInventory(ItemName::HEAVY_JACKET); @@ -3770,6 +3754,12 @@ void SeasonI::HandleCutscenes() { obj->animationSpd=action->GetAnimationSpeed(); CurrentCutscene->AdvanceAction(); }break; + case ActionType::LOAD_MAP:{ + class LoadMap*action=(class LoadMap*)CurrentCutscene->GetAction(); + Map*map=action->GetTargetMap(); + LoadMap(map); + CurrentCutscene->AdvanceAction(); + }break; } for (int i=0;i TRIGGERS={ {(TriggerName::Trigger)TRIGGER_ENUM_COUNT++,"START_CUTSCENE_1"}, + {(TriggerName::Trigger)TRIGGER_ENUM_COUNT++,"Goto Twoson"}, + {(TriggerName::Trigger)TRIGGER_ENUM_COUNT++,"Goto Onett"}, }; \ No newline at end of file diff --git a/trigger.h b/trigger.h index b8324dc..a198982 100644 --- a/trigger.h +++ b/trigger.h @@ -1,5 +1,6 @@ #ifndef TRIGGER_H #define TRIGGER_H +#include "cutscene.h" #include "pixelGameEngine.h" #include "flags.h" #include "SeasonI.h" @@ -10,20 +11,24 @@ namespace TriggerName{ //When adding new triggers to the list, you will have to add a new line to trigger.cpp to get it to appear in the editor. enum Trigger{ NONE, - START_CUTSCENE_1 + START_CUTSCENE_1, + GOTO_TWOSON_MAP, + GOTO_ONETT_MAP }; } extern void DisplayMessageBox(std::string targetT); extern SeasonI*GAME; +extern std::map CUTSCENES; class Trigger{ vi2d pos; vi2d size; TriggerName::Trigger id; + vi2d extraCoords; public: - Trigger(vi2d pos,vi2d size,TriggerName::Trigger id) - :pos(pos),size(size),id(id){} + Trigger(vi2d pos,vi2d size,TriggerName::Trigger id,vi2d extraCoords={0,0}) + :pos(pos),size(size),id(id),extraCoords(extraCoords){} bool IsInside(vd2d point) { return point.x>pos.x&&point.xpos.y&&point.ySetGameFlag(Flag::TEST_FLAG1,true); } }break; + case TriggerName::GOTO_TWOSON_MAP:{ + GAME->StartCutscene(CUTSCENES[CutsceneName::TRANSFER_MAP_TWOSON_CUTSCENE]); + }break; + case TriggerName::GOTO_ONETT_MAP:{ + GAME->StartCutscene(CUTSCENES[CutsceneName::TRANSFER_MAP_ONETT_CUTSCENE]); + }break; } } vi2d GetPos() {