|
|
@ -439,7 +439,6 @@ public: |
|
|
|
}break; |
|
|
|
}break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
drawGame(); |
|
|
|
drawGame(); |
|
|
|
// called once per frame
|
|
|
|
// called once per frame
|
|
|
|
return true; |
|
|
|
return true; |
|
|
@ -498,7 +497,7 @@ public: |
|
|
|
|
|
|
|
|
|
|
|
void updateGame(){ |
|
|
|
void updateGame(){ |
|
|
|
frameCount++; |
|
|
|
frameCount++; |
|
|
|
if (CURRENT_CUTSCENE!=NONE) { |
|
|
|
if (CURRENT_CUTSCENE!=cutscene::NONE) { |
|
|
|
CUTSCENE_TIMER++; |
|
|
|
CUTSCENE_TIMER++; |
|
|
|
} |
|
|
|
} |
|
|
|
if (fade&&transparency<255) { |
|
|
|
if (fade&&transparency<255) { |
|
|
@ -803,7 +802,7 @@ public: |
|
|
|
case GAMEWORLD:{ |
|
|
|
case GAMEWORLD:{ |
|
|
|
DrawGameWorld(); |
|
|
|
DrawGameWorld(); |
|
|
|
int meterYOffset=2; |
|
|
|
int meterYOffset=2; |
|
|
|
if (CURRENT_CUTSCENE==NONE) { |
|
|
|
if (CURRENT_CUTSCENE==cutscene::NONE) { |
|
|
|
if (foodMeterVisible) { |
|
|
|
if (foodMeterVisible) { |
|
|
|
DrawStringDecal({WIDTH-36*0.4-GetTextSize(std::to_string(foodCount)).x*1-8,meterYOffset+2},std::to_string(foodCount),BLUE,{1,1}); |
|
|
|
DrawStringDecal({WIDTH-36*0.4-GetTextSize(std::to_string(foodCount)).x*1-8,meterYOffset+2},std::to_string(foodCount),BLUE,{1,1}); |
|
|
|
DrawStringDecal({WIDTH-36*0.4-GetTextSize(std::to_string(foodCount)).x*1-7,meterYOffset+2},std::to_string(foodCount),BLACK,{1,1}); |
|
|
|
DrawStringDecal({WIDTH-36*0.4-GetTextSize(std::to_string(foodCount)).x*1-7,meterYOffset+2},std::to_string(foodCount),BLACK,{1,1}); |
|
|
@ -837,29 +836,10 @@ public: |
|
|
|
} |
|
|
|
} |
|
|
|
switch (BATTLE_STATE) { |
|
|
|
switch (BATTLE_STATE) { |
|
|
|
case battle::PLAYER_SELECTION:{ |
|
|
|
case battle::PLAYER_SELECTION:{ |
|
|
|
GradientFillRectDecal({WIDTH/6,HEIGHT/6},{WIDTH/3,HEIGHT/6*2},BATTLE_CARD_SELECTION->bgcol,BATTLE_CARD_SELECTION->bgcol,Pixel(72, 160, 212,0),BATTLE_CARD_SELECTION->bgcol); |
|
|
|
SetDrawTarget(nullptr); |
|
|
|
GradientFillRectDecal({WIDTH/6*3+1,HEIGHT/6},{WIDTH/3,HEIGHT/6*2},BATTLE_CARD_SELECTION->bgcol,Pixel(72, 160, 212,0),BATTLE_CARD_SELECTION->bgcol,BATTLE_CARD_SELECTION->bgcol); |
|
|
|
DrawCard(availablePowers[(BATTLE_CARD_SELECTION_IND+1)%availablePowers.size()],{WIDTH-96,32},{0.7,0.7},0.4); |
|
|
|
GradientFillRectDecal({WIDTH/6,HEIGHT/6*3},{WIDTH/3,HEIGHT/6*2},BATTLE_CARD_SELECTION->bgcol,BATTLE_CARD_SELECTION->bgcol,BATTLE_CARD_SELECTION->bgcol,Pixel(72, 160, 212,0)); |
|
|
|
DrawCard(availablePowers[(BATTLE_CARD_SELECTION_IND-1<0)?availablePowers.size()-1:BATTLE_CARD_SELECTION_IND-1],{-96,32},{0.7,0.7},0.4); |
|
|
|
GradientFillRectDecal({WIDTH/6*3+1,HEIGHT/6*3},{WIDTH/3,HEIGHT/6*2},Pixel(72, 160, 212,0),BATTLE_CARD_SELECTION->bgcol,BATTLE_CARD_SELECTION->bgcol,BATTLE_CARD_SELECTION->bgcol); |
|
|
|
DrawCard(BATTLE_CARD_SELECTION); |
|
|
|
DrawPartialDecal({WIDTH/2-BATTLE_CARD_SELECTION->anim->width/2*3,HEIGHT/6+16-BATTLE_CARD_SELECTION->anim->height/2},BATTLE_CARD_SELECTION->anim->spr,BATTLE_CARD_SELECTION->anim->getCurrentFrame(),{BATTLE_CARD_SELECTION->anim->width,BATTLE_CARD_SELECTION->anim->height},{3,3}); |
|
|
|
|
|
|
|
for (int x=-1;x<=1;x++) { |
|
|
|
|
|
|
|
for (int y=-1;y<=1;y++) { |
|
|
|
|
|
|
|
if (x!=0&&y!=0) { |
|
|
|
|
|
|
|
DrawStringPropDecal({WIDTH/6+4+x,HEIGHT/2+8+y},BATTLE_CARD_SELECTION->name,BLACK,{2,2}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
DrawStringPropDecal({WIDTH/6+4,HEIGHT/2+8},BATTLE_CARD_SELECTION->name,BATTLE_CARD_SELECTION->textcol,{2,2}); |
|
|
|
|
|
|
|
DrawWrappedPropText({WIDTH/6+4+1,HEIGHT/2+24+1},BATTLE_CARD_SELECTION->description,WIDTH/3*2-8,BLACK,{1,1}); |
|
|
|
|
|
|
|
DrawWrappedPropText({WIDTH/6+4,HEIGHT/2+24},BATTLE_CARD_SELECTION->description,WIDTH/3*2-8,Pixel(227, 245, 255,255),{1,1}); |
|
|
|
|
|
|
|
for (int x=-1;x<=1;x++) { |
|
|
|
|
|
|
|
for (int y=-1;y<=1;y++) { |
|
|
|
|
|
|
|
if (x!=0&&y!=0) { |
|
|
|
|
|
|
|
DrawStringPropDecal({WIDTH/6+4+WIDTH/3*2-8-GetTextSizeProp(std::to_string(BATTLE_CARD_SELECTION->playerOwnCount)+" uses remaining.").x*1.5+x,HEIGHT/6*3+HEIGHT/6*2-GetTextSizeProp(std::to_string(BATTLE_CARD_SELECTION->playerOwnCount)+" uses remaining.").y*1.5-4+y},std::to_string(BATTLE_CARD_SELECTION->playerOwnCount)+" uses remaining.",olc::BLACK,{1.5,1.5}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
DrawStringPropDecal({WIDTH/6+4+WIDTH/3*2-8-GetTextSizeProp(std::to_string(BATTLE_CARD_SELECTION->playerOwnCount)+" uses remaining.").x*1.5,HEIGHT/6*3+HEIGHT/6*2-GetTextSizeProp(std::to_string(BATTLE_CARD_SELECTION->playerOwnCount)+" uses remaining.").y*1.5-4},std::to_string(BATTLE_CARD_SELECTION->playerOwnCount)+" uses remaining.",olc::WHITE,{1.5,1.5}); |
|
|
|
|
|
|
|
}break; |
|
|
|
}break; |
|
|
|
} |
|
|
|
} |
|
|
|
if (messageBoxVisible) { |
|
|
|
if (messageBoxVisible) { |
|
|
@ -1065,7 +1045,7 @@ public: |
|
|
|
int marker=0; |
|
|
|
int marker=0; |
|
|
|
while (marker<text.length()) { |
|
|
|
while (marker<text.length()) { |
|
|
|
wrappedText+=text[marker]; |
|
|
|
wrappedText+=text[marker]; |
|
|
|
if (GetTextSizeProp(wrappedText).x>targetWidth*scale.x) { |
|
|
|
if (GetTextSizeProp(wrappedText).x*scale.x>targetWidth) { |
|
|
|
int tempMarker=marker; |
|
|
|
int tempMarker=marker; |
|
|
|
while (wrappedText[tempMarker]!=' ') { |
|
|
|
while (wrappedText[tempMarker]!=' ') { |
|
|
|
wrappedText.erase(tempMarker--); |
|
|
|
wrappedText.erase(tempMarker--); |
|
|
@ -1082,7 +1062,35 @@ public: |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool playerCanMove() { |
|
|
|
bool playerCanMove() { |
|
|
|
return CURRENT_CUTSCENE==NONE&&!messageBoxVisible&&!IN_BATTLE_ENCOUNTER; |
|
|
|
return CURRENT_CUTSCENE==cutscene::NONE&&!messageBoxVisible&&!IN_BATTLE_ENCOUNTER; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void DrawCard(WEATHER_POWER*data,vf2d offset={0,0},vf2d scale={1,1},float darknessFactor=1.0) { |
|
|
|
|
|
|
|
GradientFillRectDecal({(WIDTH/6)*scale.x+offset.x,(HEIGHT/6)*scale.y+offset.y},{WIDTH/3*scale.x,HEIGHT/6*2*scale.y},data->bgcol*darknessFactor,data->bgcol*darknessFactor,Pixel(72, 160, 212,0),data->bgcol*darknessFactor); |
|
|
|
|
|
|
|
GradientFillRectDecal({(WIDTH/6*3+1)*scale.x+offset.x,(HEIGHT/6)*scale.y+offset.y},{WIDTH/3*scale.x,HEIGHT/6*2*scale.y},data->bgcol*darknessFactor,Pixel(72, 160, 212,0),data->bgcol*darknessFactor,data->bgcol*darknessFactor); |
|
|
|
|
|
|
|
GradientFillRectDecal({(WIDTH/6)*scale.x+offset.x,(HEIGHT/6*3)*scale.y+offset.y},{WIDTH/3*scale.x,HEIGHT/6*2*scale.y},data->bgcol*darknessFactor,data->bgcol*darknessFactor,data->bgcol*darknessFactor,Pixel(72, 160, 212,0)); |
|
|
|
|
|
|
|
GradientFillRectDecal({(WIDTH/6*3+1)*scale.x+offset.x,(HEIGHT/6*3)*scale.y+offset.y},{WIDTH/3*scale.x,HEIGHT/6*2*scale.y},Pixel(72, 160, 212,0),data->bgcol*darknessFactor,data->bgcol*darknessFactor,data->bgcol*darknessFactor); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DrawPartialDecal({(WIDTH/2-data->anim->width/2*3)*scale.x+offset.x,(HEIGHT/6+16-data->anim->height/2)*scale.y+offset.y},data->anim->spr,data->anim->getCurrentFrame(),{data->anim->width,data->anim->height},{3*scale.x,3*scale.y},WHITE*darknessFactor); |
|
|
|
|
|
|
|
for (int x=-1;x<=1;x++) { |
|
|
|
|
|
|
|
for (int y=-1;y<=1;y++) { |
|
|
|
|
|
|
|
if (x!=0&&y!=0) { |
|
|
|
|
|
|
|
DrawStringPropDecal({(WIDTH/6+4+x)*scale.x+offset.x,(HEIGHT/2+8+y)*scale.y+offset.y},data->name,BLACK,{2*scale.x,2*scale.y}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
DrawStringPropDecal({(WIDTH/6+4)*scale.x+offset.x,(HEIGHT/2+8)*scale.y+offset.y},data->name,data->textcol*darknessFactor,{2*scale.x,2*scale.y}); |
|
|
|
|
|
|
|
DrawWrappedPropText({(WIDTH/6+4+1)*scale.x+offset.x,(HEIGHT/2+24+1)*scale.y+offset.y},data->description,(WIDTH/3*2-8)*scale.x,BLACK,{scale.x,scale.y}); |
|
|
|
|
|
|
|
DrawWrappedPropText({(WIDTH/6+4)*scale.x+offset.x,(HEIGHT/2+24)*scale.y+offset.y},data->description,(WIDTH/3*2-8)*scale.x,Pixel(227, 245, 255,255)*darknessFactor,{scale.x,scale.y}); |
|
|
|
|
|
|
|
for (int x=-1;x<=1;x++) { |
|
|
|
|
|
|
|
for (int y=-1;y<=1;y++) { |
|
|
|
|
|
|
|
if (x!=0&&y!=0) { |
|
|
|
|
|
|
|
DrawStringPropDecal({(WIDTH/6+4+WIDTH/3*2-8-GetTextSizeProp(std::to_string(data->playerOwnCount)+" uses remaining.").x*1.5+x)*scale.x+offset.x,(HEIGHT/6*3+HEIGHT/6*2-GetTextSizeProp(std::to_string(data->playerOwnCount)+" uses remaining.").y*1.5-4+y)*scale.y+offset.y},std::to_string(data->playerOwnCount)+" uses remaining.",olc::BLACK,{1.5*scale.x,1.5*scale.y}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
DrawStringPropDecal({(WIDTH/6+4+WIDTH/3*2-8-GetTextSizeProp(std::to_string(data->playerOwnCount)+" uses remaining.").x*1.5)*scale.x+offset.x,(HEIGHT/6*3+HEIGHT/6*2-GetTextSizeProp(std::to_string(data->playerOwnCount)+" uses remaining.").y*1.5-4)*scale.y+offset.y},std::to_string(data->playerOwnCount)+" uses remaining.",olc::WHITE*darknessFactor,{1.5*scale.x,1.5*scale.y}); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|