Added level complete window upon completing a stage.

pull/28/head
sigonasr2 1 year ago
parent 5b28478596
commit 5652741ec0
  1. 21
      Crawler/Crawler.cpp
  2. 1
      Crawler/Crawler.vcxproj
  3. 9
      Crawler/Crawler.vcxproj.filters
  4. 2
      Crawler/DEFINES.h
  5. 10
      Crawler/LevelCompleteWindow.cpp
  6. 1
      Crawler/Menu.cpp
  7. 3
      Crawler/Menu.h
  8. 22
      Crawler/Player.cpp
  9. 4
      Crawler/Player.h
  10. 2
      Crawler/Version.h
  11. 3
      Crawler/assets/config/Player.txt

@ -665,12 +665,14 @@ void Crawler::RenderWorld(float fElapsedTime){
auto RenderZone=[&](geom2d::rect<int>&zone){
game->SetDecalMode(DecalMode::ADDITIVE);
Pixel ringColor={64,255,64,uint8_t(abs(sin(game->levelTime))*255)};
Pixel ringColor={128,128,128,uint8_t(abs(sin(game->levelTime))*255)};
Decal*ringDecal=GFX["finishring_green.png"].Decal();
if(!player->IsOutOfCombat()){
game->SetDecalMode(DecalMode::NORMAL);
ringColor.r=ringColor.g=ringColor.b=64;
ringDecal=GFX["finishring.png"].Decal();
}
view.DrawDecal(zone.pos,GFX["finishring.png"].Decal(),vf2d(zone.size)/vf2d(GFX["finishring.png"].Sprite()->Size()),ringColor);
view.DrawDecal(zone.pos,ringDecal,vf2d(zone.size)/vf2d(GFX["finishring.png"].Sprite()->Size()),ringColor);
game->SetDecalMode(DecalMode::NORMAL);
};
@ -1094,17 +1096,24 @@ Player*Crawler::GetPlayer(){
void Crawler::RenderHud(){
RenderCooldowns();
if(GetPlayer()->GetCastInfo().castTimer>0){
auto RenderCastbar=[&](const CastInfo&cast){
FillRectDecal(vf2d{ScreenWidth()/2-92.f,ScreenHeight()-90.f},{184,20},BLACK);
FillRectDecal(vf2d{ScreenWidth()/2-90.f,ScreenHeight()-88.f},{180,16},DARK_GREY);
float timer=GetPlayer()->GetCastInfo().castTimer;
float totalTime=GetPlayer()->GetCastInfo().castTotalTime;
std::string castText=GetPlayer()->GetCastInfo().name;
float timer=cast.castTimer;
float totalTime=cast.castTotalTime;
std::string castText=cast.name;
GradientFillRectDecal(vf2d{ScreenWidth()/2-90.f,ScreenHeight()-88.f},{(timer/totalTime)*180,16},{247,125,37},{247,125,37},{247,184,37},{247,184,37});
std::stringstream castTimeDisplay;
castTimeDisplay<<std::fixed<<std::setprecision(1)<<timer;
DrawShadowStringPropDecal(vf2d{ScreenWidth()/2+90.f,ScreenHeight()-80.f}-vf2d{float(GetTextSizeProp(castTimeDisplay.str()).x),0},castTimeDisplay.str(),WHITE,BLACK);
DrawShadowStringPropDecal(vf2d{ScreenWidth()/2.f-GetTextSizeProp(castText).x*2/2,ScreenHeight()-64.f},castText,WHITE,BLACK,{2,3},2.f);
};
if(GetPlayer()->GetCastInfo().castTimer>0){
RenderCastbar(GetPlayer()->GetCastInfo());
}else
if(GetPlayer()->GetEndZoneStandTime()>0){
RenderCastbar(CastInfo{"Exiting Level...",GetPlayer()->GetEndZoneStandTime(),"Player.End Zone Wait Time"_F});
}
DrawDecal({2,2},GFX["heart.png"].Decal());

@ -342,6 +342,7 @@
<ClCompile Include="Item.cpp" />
<ClCompile Include="ItemLoadoutWindow.cpp" />
<ClCompile Include="Key.cpp" />
<ClCompile Include="LevelCompleteWindow.cpp" />
<ClCompile Include="LightningBolt.cpp" />
<ClCompile Include="LightningBoltEmitter.cpp" />
<ClCompile Include="MainMenuWindow.cpp" />

@ -392,9 +392,6 @@
<ClCompile Include="ClassSelectionWindow.cpp">
<Filter>Source Files\Interface</Filter>
</ClCompile>
<ClCompile Include="MainMenuWindow.cpp">
<Filter>Source Files\Interface</Filter>
</ClCompile>
<ClCompile Include="MenuAnimatedIconButton.h">
<Filter>Header Files\Interface</Filter>
</ClCompile>
@ -422,6 +419,12 @@
<ClCompile Include="Test.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="MainMenuWindow.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="LevelCompleteWindow.cpp">
<Filter>Source Files\Interface</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="cpp.hint" />

@ -49,6 +49,8 @@ SUCH DAMAGE.
#define DO_NOTHING [](MenuFuncData data){return true;}
#define INCLUDE_LEVEL_NAMES extern safemap<std::string,MapName>LEVEL_NAMES;
#define INCLUDE_CENTERED extern const vf2d Menu::CENTERED;
#define ACCESS_PLAYER Player*p=game->GetPlayer();
#define VARIANTS float,int,std::string,bool,vf2d

@ -0,0 +1,10 @@
#include "Menu.h"
#include "Crawler.h"
INCLUDE_game
void Menu::InitializeLevelCompleteWindow(){
Menu*levelCompleteWindow=Menu::CreateMenu(LEVEL_COMPLETE,{0,0},game->GetScreenSize());
}

@ -88,6 +88,7 @@ void Menu::InitializeMenus(){
InitializeMainMenuWindow();
InitializeOverworldMapLevelWindow();
InitializeItemLoadoutWindow();
InitializeLevelCompleteWindow();
for(MenuType type=TEST;type<MenuType::ENUM_END;type=MenuType(int(type+1))){
if(menus.count(type)==0){

@ -49,6 +49,7 @@ enum MenuType{
MAIN_MENU,
OVERWORLD_LEVEL_SELECT,
ITEM_LOADOUT,
LEVEL_COMPLETE,
///////////////////////////////////////////////////////////
/*DO NOT REMOVE!!*/ENUM_END////////////////////////////////
///////////////////////////////////////////////////////////
@ -115,6 +116,7 @@ private:
void CheckClickAndPerformMenuSelect(Crawler*game);
//Mandatory before any menu operations! This creates and sets up the menu in memory.
static Menu*CreateMenu(MenuType type,vf2d pos,vf2d size);
static void InitializeTestMenu();
static void InitializeTestSubMenu();
static void InitializeConsumableInventoryWindow();
@ -123,6 +125,7 @@ private:
static void InitializeMainMenuWindow();
static void InitializeOverworldMapLevelWindow();
static void InitializeItemLoadoutWindow();
static void InitializeLevelCompleteWindow();
//X (0-2), Y (0-2) for specific 9-patch tile (tiled version).
static Renderable&GetPatchPart(int x,int y);

@ -224,6 +224,9 @@ void Player::Update(float fElapsedTime){
blockTimer=std::max(0.f,blockTimer-fElapsedTime);
lastCombatTime=lastCombatTime+fElapsedTime;
manaTickTimer-=fElapsedTime;
CheckEndZoneCollision();
if(castInfo.castTimer>0){
castInfo.castTimer-=fElapsedTime;
if(castInfo.castTimer<=0){
@ -759,4 +762,23 @@ void Player::ResetLastCombatTime(){
bool Player::IsOutOfCombat(){
return lastCombatTime>="Player.Out of Combat Time"_F;
}
float Player::GetEndZoneStandTime(){
return endZoneStandTime;
}
void Player::CheckEndZoneCollision(){
if(IsOutOfCombat()){
for(ZoneData&zone:game->MAP_DATA[game->GetCurrentLevel()].ZoneData.at("EndZone")){
if(zone.isUpper==upperLevel&&geom2d::overlaps(GetPos(),zone.zone)){
endZoneStandTime+=game->GetElapsedTime();
if(endZoneStandTime>="Player.End Zone Wait Time"_F){
Menu::OpenMenu(LEVEL_COMPLETE);
}
return;
}
}
}
endZoneStandTime=0;
}

@ -127,6 +127,7 @@ protected:
std::vector<vf2d>ghostPositions;
float rapidFireTimer=0;
int remainingRapidFireShots=0;
float endZoneStandTime=0;
const float RAPID_FIRE_SHOOT_DELAY="Ranger.Ability 1.ArrowDelay"_F;
const int RAPID_FIRE_SHOOT_AMOUNT="Ranger.Ability 1.ArrowCount"_I;
public:
@ -192,6 +193,7 @@ public:
bool OnUpperLevel();
void ResetLastCombatTime();
bool IsOutOfCombat();
float GetEndZoneStandTime();
//Triggers when the player has moved.
void Moved();
virtual ~Player()=default;
@ -213,6 +215,8 @@ public:
virtual std::string&GetIdleSAnimation()=0;
virtual std::string&GetIdleWAnimation()=0;
void CheckEndZoneCollision();
CastInfo&GetCastInfo();
void SetAnimationBasedOnTargetingDirection(float targetDirection);

@ -33,7 +33,7 @@ SUCH DAMAGE.
#define VERSION_MAJOR 0
#define VERSION_MINOR 2
#define VERSION_PATCH 1
#define VERSION_BUILD 2920
#define VERSION_BUILD 2930
#define stringify(a) stringify_(a)
#define stringify_(a) #a

@ -15,6 +15,9 @@ Player
# How many seconds must pass before the player is considered out of combat (meaning they can exit a level)
Out of Combat Time = 5.0
# How long the player must stand in the end zone before leaving the level.
End Zone Wait Time = 5.0
# Each attack will have _N,_E,_S,_W appended to them once read in-game.
PLAYER_ANIMATION[0] = WARRIOR_WALK
PLAYER_ANIMATION[1] = WARRIOR_IDLE

Loading…
Cancel
Save