diff --git a/C++ProjectTemplate b/C++ProjectTemplate index b2d945b..c688213 100755 Binary files a/C++ProjectTemplate and b/C++ProjectTemplate differ diff --git a/SeasonI.h b/SeasonI.h index d13e8f6..2f0ea96 100644 --- a/SeasonI.h +++ b/SeasonI.h @@ -27,7 +27,7 @@ class SeasonI:public PixelGameEngine{ SeasonI(){sAppName="Season I: Winters of Loneliness";} bool OnUserCreate()override; void SetupMoveList(); 됐어 - void SetupItemList(); + void SetupItemList(); 됐어 void SetupPartyMemberStats(); 됐어 void SetupAnimations(); 됐어 void SetupObjectInfo(); 됐어 @@ -35,15 +35,15 @@ class SeasonI:public PixelGameEngine{ void SetupBattleProperties(); 됐어 void SetupCutscenes(); void SetupMapList(); - void SetGameFlag(Flag flag,bool val); + void SetGameFlag(Flag flag,bool val); 됐어 void LoadMap(Map*map); void SaveMap(Map*map); void AddItemToPlayerInventory(ItemName item); Decal*CreateSprite(std::string spriteName); Object*CreateObjectInfo(Object*obj,std::string spriteFileName,vi2d size,Flag enableFlag=Flag::NONE,Flag disableFlag=Flag::NONE); 됐어 vi2d grid(int x, int y); - bool GetGameFlag(int flag); - bool GetGameFlag(Flag flag); + bool GetGameFlag(int flag); 됐어 + bool GetGameFlag(Flag flag); 됐어 //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); diff --git a/assets/terrainmap.png b/assets/terrainmap.png index 8fdc84a..351d380 100644 Binary files a/assets/terrainmap.png and b/assets/terrainmap.png differ diff --git a/assets/terrainmap.xcf b/assets/terrainmap.xcf index becd070..4b7e8c7 100644 Binary files a/assets/terrainmap.xcf and b/assets/terrainmap.xcf differ diff --git a/test/test.cpp b/test/test.cpp index 517c205..022bba5 100644 --- a/test/test.cpp +++ b/test/test.cpp @@ -23,6 +23,11 @@ #include "../SeasonI.h" #include "../map.h" +extern int frameCount; +extern double CUTSCENE_FADE_VALUE; +extern Cutscene*CurrentCutscene; +extern ActionType CurrentAction; +extern vd2d cameraPos; extern std::array PARTY_MEMBER_STATS; extern Entity::pstats_t partyMemberDefaultStats; extern std::map SPRITES; @@ -54,7 +59,7 @@ void TestSpriteInitialized(std::vector sprList) { Test("Sprite "+sprList[i]+" should be initialized", SPRITES[sprList[i]]!=nullptr); Test("Sprite "+sprList[i]+" should have a non-zero width and height", - SPRITES[sprList[i]]->sprite->width!=0&&SPRITES["terrainmap.png"]->sprite->height!=0); + SPRITES[sprList[i]]->sprite->width!=0&&SPRITES[sprList[i]]->sprite->height!=0); } } @@ -205,6 +210,133 @@ bool SeasonI::OnUserCreate(){ ITEMLIST[ItemName::FREEZE_PACKET]->description=="Lets out some blistering cold weather."); Test("Freeze Packet drop chance is set properly", ITEMLIST[ItemName::FREEZE_PACKET]->dropChance==256); + Test("No Maps are loaded", + MAPS.size()==0); + SetupMapList(); + Test("Maps are loaded", + MAPS.size()!=0); + Test("No Cutscenes are loaded", + CUTSCENES.size()==0); + SetupCutscenes(); + Test("Calling SetupCutscenes() loads up different cutscenes", + CUTSCENES.size()!=0); + Test("No active cutscene yet", + CurrentCutscene==nullptr); + StartCutscene(CUTSCENES[CutsceneName::TEST_CUTSCENE]); + Test("Starting a cutscene sets the current cutscene", + CurrentCutscene!=nullptr); + Test("Current Action should not be updated yet", + CurrentAction==ActionType::NONE); + updateGame(); + Test("HandleCutscenes should get called in updateGame(), updating the current action", + CurrentAction!=ActionType::NONE); + int startFrame=frameCount; + while (CurrentAction!=ActionType::NONE) { + updateGame(); + } + std::cout<<"Frame Count: "<<(frameCount-startFrame)<previous_fade_value); + Test("There should be no objects in the game", + OBJECTS.size()==0); + while (CurrentAction==ActionType::FADE) { + updateGame(); + } + Test("When faded out, CUTSCENE_FADE_VALUE should be 255", + CUTSCENE_FADE_VALUE==255); + Test("Next cutscene action should be CreateObjects", + CurrentAction==ActionType::CREATE_OBJECTS); + Test("There should be 3 objects in the game", + OBJECTS.size()==3); + Test("Cutscene objects should have the temp flag set", + OBJECTS[0]->temp&&OBJECTS[1]->temp&&OBJECTS[2]->temp); + updateGame(); + Test("Next cutscene action should be Fade back in", + CurrentAction==ActionType::FADE); + previous_fade_value=CUTSCENE_FADE_VALUE; + updateGame(); + Test("Fading in causes CUTSCENE_FADE_VALUE to decrease", + CUTSCENE_FADE_VALUEGetEndingCutsceneFlag()==Flag::TEST_FLAG3&&CurrentCutscene->GetEndingCutsceneVal()); + updateGame(); + Test("Next cutscene action should be setting a flag on the spot", + CurrentAction==ActionType::SET_FLAG); + Test("Test Flag 2 should now be set", + GetGameFlag(Flag::TEST_FLAG2)); + Test("Test Flag 2 should still not be set", + !GetGameFlag(Flag::TEST_FLAG3)); + cameraPos={0,0}; + Test("Camera position should be {0,0}", + cameraPos.x==0&&cameraPos.y==0); + updateGame(); + Test("Next cutscene action should be panning the camera", + CurrentAction==ActionType::PAN_CAMERA); + Test("Camera position should be moving towards {128,128}", + cameraPos.x>0&&cameraPos.y>0); + while (CurrentAction==ActionType::PAN_CAMERA) { + updateGame(); + } + Test("Camera position should be {128,128}", + cameraPos.x==128&&cameraPos.y==128); return true; }