|
|
@ -23,6 +23,11 @@ |
|
|
|
#include "../SeasonI.h" |
|
|
|
#include "../SeasonI.h" |
|
|
|
#include "../map.h" |
|
|
|
#include "../map.h" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
extern int frameCount; |
|
|
|
|
|
|
|
extern double CUTSCENE_FADE_VALUE; |
|
|
|
|
|
|
|
extern Cutscene*CurrentCutscene; |
|
|
|
|
|
|
|
extern ActionType CurrentAction; |
|
|
|
|
|
|
|
extern vd2d cameraPos; |
|
|
|
extern std::array<Entity*,7> PARTY_MEMBER_STATS; |
|
|
|
extern std::array<Entity*,7> PARTY_MEMBER_STATS; |
|
|
|
extern Entity::pstats_t partyMemberDefaultStats; |
|
|
|
extern Entity::pstats_t partyMemberDefaultStats; |
|
|
|
extern std::map<std::string,Decal*> SPRITES; |
|
|
|
extern std::map<std::string,Decal*> SPRITES; |
|
|
@ -54,7 +59,7 @@ void TestSpriteInitialized(std::vector<std::string> sprList) { |
|
|
|
Test("Sprite "+sprList[i]+" should be initialized", |
|
|
|
Test("Sprite "+sprList[i]+" should be initialized", |
|
|
|
SPRITES[sprList[i]]!=nullptr); |
|
|
|
SPRITES[sprList[i]]!=nullptr); |
|
|
|
Test("Sprite "+sprList[i]+" should have a non-zero width and height", |
|
|
|
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."); |
|
|
|
ITEMLIST[ItemName::FREEZE_PACKET]->description=="Lets out some blistering cold weather."); |
|
|
|
Test("Freeze Packet drop chance is set properly", |
|
|
|
Test("Freeze Packet drop chance is set properly", |
|
|
|
ITEMLIST[ItemName::FREEZE_PACKET]->dropChance==256); |
|
|
|
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)<<std::endl; |
|
|
|
|
|
|
|
Test("Cutscene is now finished", |
|
|
|
|
|
|
|
CurrentAction==ActionType::NONE); |
|
|
|
|
|
|
|
Test("Test Flag 1 is set", |
|
|
|
|
|
|
|
GetGameFlag(Flag::TEST_FLAG1)); |
|
|
|
|
|
|
|
Test("Test Flag 2 is not set", |
|
|
|
|
|
|
|
!GetGameFlag(Flag::TEST_FLAG2)); |
|
|
|
|
|
|
|
Test("Test Flag 1 (int cast) is still set", |
|
|
|
|
|
|
|
GetGameFlag((int)Flag::TEST_FLAG1)); |
|
|
|
|
|
|
|
Test("Test Flag 2 (int cast) is still not set", |
|
|
|
|
|
|
|
!GetGameFlag((int)Flag::TEST_FLAG2)); |
|
|
|
|
|
|
|
Test("Test Flag 1 (Flag cast) is still set", |
|
|
|
|
|
|
|
GetGameFlag((Flag)1)); |
|
|
|
|
|
|
|
Test("Test Flag 2 (Flag cast) is still not set", |
|
|
|
|
|
|
|
!GetGameFlag((Flag)2)); |
|
|
|
|
|
|
|
Test("Current Map is not set", |
|
|
|
|
|
|
|
CURRENT_MAP==nullptr); |
|
|
|
|
|
|
|
Test("Main Character flag is not set", |
|
|
|
|
|
|
|
!GetGameFlag(Flag::HAS_MAIN)); |
|
|
|
|
|
|
|
SetGameFlag(Flag::HAS_MAIN,true); |
|
|
|
|
|
|
|
Test("Main Character flag is set", |
|
|
|
|
|
|
|
GetGameFlag(Flag::HAS_MAIN)); |
|
|
|
|
|
|
|
SetGameFlag(Flag::HAS_MAIN,false); |
|
|
|
|
|
|
|
Test("Main Character flag is unset", |
|
|
|
|
|
|
|
!GetGameFlag(Flag::HAS_MAIN)); |
|
|
|
|
|
|
|
SetGameFlag(Flag::HAS_MAIN,true); |
|
|
|
|
|
|
|
Cutscene*FeatureTestCutscene=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_FLAG3), |
|
|
|
|
|
|
|
액션 SetFlag(Flag::TEST_FLAG2,true), |
|
|
|
|
|
|
|
액션 PanCamera({128,128},BOTH,1), |
|
|
|
|
|
|
|
액션 MoveCutsceneObjectAsync(1,{80,64},5), |
|
|
|
|
|
|
|
액션 PanCameraAsync({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), |
|
|
|
|
|
|
|
액션 DialogBox(R"(Hello!)"), |
|
|
|
|
|
|
|
액션 class LoadMap(MAPS[MapName::TWOSON]), |
|
|
|
|
|
|
|
액션 MovePlayerObjects({16,16}),}); |
|
|
|
|
|
|
|
Test("No cutscene is playing", |
|
|
|
|
|
|
|
CurrentCutscene==nullptr); |
|
|
|
|
|
|
|
StartCutscene(FeatureTestCutscene); |
|
|
|
|
|
|
|
updateGame(); |
|
|
|
|
|
|
|
Test("Current action should be fading", |
|
|
|
|
|
|
|
CurrentAction==ActionType::FADE); |
|
|
|
|
|
|
|
double previous_fade_value=CUTSCENE_FADE_VALUE; |
|
|
|
|
|
|
|
updateGame(); |
|
|
|
|
|
|
|
Test("Fading causes CUTSCENE_FADE_VALUE to increase", |
|
|
|
|
|
|
|
CUTSCENE_FADE_VALUE>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_VALUE<previous_fade_value); |
|
|
|
|
|
|
|
while (CurrentAction==ActionType::FADE) { |
|
|
|
|
|
|
|
updateGame(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
Test("Next cutscene action should be setting a flag when the cutscene ends", |
|
|
|
|
|
|
|
CurrentAction==ActionType::SET_FLAG_WHEN_CUTSCENE_ENDS); |
|
|
|
|
|
|
|
Test("Ending cutscene flag is stored properly with proper flag and value", |
|
|
|
|
|
|
|
CurrentCutscene->GetEndingCutsceneFlag()==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; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|