Update web build

Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
master
sigonasr2 2 years ago
parent c40b8f7560
commit 98bfc8e10a
  1. BIN
      C++ProjectTemplate
  2. BIN
      C++ProjectTemplate.data
  3. 2
      C++ProjectTemplate.js
  4. BIN
      C++ProjectTemplate.wasm
  5. 1
      cmake-build-debug/CMakeFiles/clion-log.txt
  6. 2
      effect.h
  7. 187
      main.cpp

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 818 KiB

After

Width:  |  Height:  |  Size: 839 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.

@ -1 +0,0 @@
CMakeLists.txt not found in /home/niconiconii/Documents/SeasonI Select CMakeLists.txt

@ -23,7 +23,7 @@ class FountainEffect:public Effect{
void create(std::vector<Particle*>&PARTICLES){ void create(std::vector<Particle*>&PARTICLES){
lifetime=maxLifeTime; lifetime=maxLifeTime;
for (int i=0;i<fountainDensity;i++) { for (int i=0;i<fountainDensity;i++) {
PARTICLES.push_back(new WaterParticle({WIDTH/2,HEIGHT},{rand()%3+1,rand()%3+1},{0,rand()%10/10.0F+0.1F},lifetime,Pixel(rand()%128,rand()%128,255))); PARTICLES.push_back(new WaterParticle({WIDTH/2,HEIGHT},{(double)(rand()%3+1),(double)(rand()%3+1)},{0,rand()%10/10.0F+0.1F},lifetime,Pixel(rand()%128,rand()%128,255)));
} }
} }
bool update()override{ bool update()override{

@ -17,7 +17,7 @@
#define ㅎ #define ㅎ
#define ㅍ #define ㅍ
#define 아 #define 아
#define α 0x391 #define α 0x391
#define β 0x392 #define β 0x392
@ -32,7 +32,7 @@
((AsyncClass*)CurrentCutscene->GetAction())->SetQueued(); \ ((AsyncClass*)CurrentCutscene->GetAction())->SetQueued(); \
CurrentCutscene->AdvanceAction(); \ CurrentCutscene->AdvanceAction(); \
#define 액션 (CutsceneAction*)new #define 액션 (CutsceneAction*)new
std::vector<Object*> OBJECTS; std::vector<Object*> OBJECTS;
const vd2d NO_NEIGHBOR = {-999,-999}; const vd2d NO_NEIGHBOR = {-999,-999};
@ -49,7 +49,7 @@ enum{
namespace layer{ namespace layer{
enum layer{ enum layer{
INTERFACE, //Interface items should be on this layer. On top of everything. INTERFACE, //Interface items should be on this layer. On top of everything.
COLLISION, //Collision checking layer. This layer is COLLISION, //Collision checking layer. This layer is
HIGH, HIGH,
DYNAMIC, DYNAMIC,
GROUND, GROUND,
@ -194,7 +194,7 @@ class Object{
return true; return true;
} }
} }
} else } else
if (move.x<0) { if (move.x<0) {
for (int i=0;i<wiggleRoom;i++) { //Search Up. for (int i=0;i<wiggleRoom;i++) { //Search Up.
if (!Collision({originPos.x+move.x,originPos.y-i})) { if (!Collision({originPos.x+move.x,originPos.y-i})) {
@ -226,7 +226,7 @@ class Object{
return true; return true;
} }
} }
} else } else
if (move.y<0) { if (move.y<0) {
for (int i=0;i<wiggleRoom;i++) { //Search Left. for (int i=0;i<wiggleRoom;i++) { //Search Left.
if (!Collision({originPos.x-i,originPos.y+move.y})) { if (!Collision({originPos.x-i,originPos.y+move.y})) {
@ -317,10 +317,20 @@ enum class ItemName{
KEY_TO_THE_PALACE, KEY_TO_THE_PALACE,
}; };
using convert_t = std::codecvt_utf8<wchar_t>; template<typename T, typename F>
std::wstring_convert<convert_t, wchar_t> strconverter; inline T
std::string to_string(std::wstring wstr){return strconverter.to_bytes(wstr);} transform_to ( F str ) noexcept
std::wstring to_wstring(std::string str){return strconverter.from_bytes(str);} {
// note: F has to have
// the empty()method
if (str.empty())
return {};
// note: F must be able to work
// with std begin and end
return { std::begin(str), std::end(str) };
// also the above line requires, T has a constructor
// that will take begin and end values of type F.
};
namespace Battle{ namespace Battle{
class Move{ class Move{
@ -363,7 +373,7 @@ struct ItemStatsStruct{
int ppRecovery=0; int ppRecovery=0;
int attack=0; int attack=0;
int defense=0; int defense=0;
EquipSlot::Equip equip=EquipSlot::NONE; //Whether or not this is equipment. EquipSlot::Equip equip=EquipSlot::NONE; //Whether or not this is equipment.
bool important=false; //If an item's important it can't be discarded. bool important=false; //If an item's important it can't be discarded.
bool consumable=false; //Whether or not this item is consumed when used. bool consumable=false; //Whether or not this item is consumed when used.
}; };
@ -647,7 +657,7 @@ public:
This is a test message that lets us trigger straight from a cutscene! Cool!)"), This is a test message that lets us trigger straight from a cutscene! Cool!)"),
ModifyObject(0,ANIMATIONS["player.png"],{5,5},MAGENTA), ModifyObject(0,ANIMATIONS["player.png"],{5,5},MAGENTA),
MoveCutsceneObject(1,{320,64},1),}); MoveCutsceneObject(1,{320,64},1),});
AddItemToPlayerInventory(ItemName::COOKIE); AddItemToPlayerInventory(ItemName::COOKIE);
AddItemToPlayerInventory(ItemName::COOKIE); AddItemToPlayerInventory(ItemName::COOKIE);
AddItemToPlayerInventory(ItemName::COOKIE); AddItemToPlayerInventory(ItemName::COOKIE);
@ -706,7 +716,7 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
ANYKEYPRESSED=true; ANYKEYPRESSED=true;
if (!UpPressed()&&!DownPressed()&&!LeftPressed()&&!RightPressed()) { if (!UpPressed()&&!DownPressed()&&!LeftPressed()&&!RightPressed()) {
ACTIONKEYPRESSED=true; ACTIONKEYPRESSED=true;
} }
} }
} }
@ -758,7 +768,7 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
HandleBattle(); HandleBattle();
HandleCutscenes(); HandleCutscenes();
switch (GAME_STATE) { switch (GAME_STATE) {
case GameState::TILE_SELECT:{ case GameState::TILE_SELECT:{
@ -776,7 +786,7 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
case GameState::ENCOUNTER_SELECT:{ case GameState::ENCOUNTER_SELECT:{
if (!GetKey(SHIFT).bHeld) { if (!GetKey(SHIFT).bHeld) {
GAME_STATE=GameState::EDITOR; GAME_STATE=GameState::EDITOR;
} }
}break; }break;
case GameState::GAME_WORLD:{ case GameState::GAME_WORLD:{
if (PlayerCanMove()) { if (PlayerCanMove()) {
@ -923,8 +933,8 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
tile->tileX=tile->tileY=15; tile->tileX=tile->tileY=15;
}break; }break;
} }
} }
}break; }break;
} }
@ -946,7 +956,7 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
if (!charsWritten&&targetText[messageBoxStopMarker+messageBoxStartMarker]!=' ') { if (!charsWritten&&targetText[messageBoxStopMarker+messageBoxStartMarker]!=' ') {
messageBoxFinalText+=targetText[messageBoxStopMarker+++messageBoxStartMarker]; messageBoxFinalText+=targetText[messageBoxStopMarker+++messageBoxStartMarker];
charsWritten=true; charsWritten=true;
} else } else
if (charsWritten){ if (charsWritten){
messageBoxFinalText+=targetText[messageBoxStopMarker+++messageBoxStartMarker]; messageBoxFinalText+=targetText[messageBoxStopMarker+++messageBoxStartMarker];
} else { } else {
@ -972,7 +982,7 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
//CAMERA UPDATES MUST BE LAST!!! COLLISIONS RELY ON THE GAME POSITION STATES REMAINING THE SAME! //CAMERA UPDATES MUST BE LAST!!! COLLISIONS RELY ON THE GAME POSITION STATES REMAINING THE SAME!
void cameraUpdate() { void cameraUpdate() {
switch (GAME_STATE) { switch (GAME_STATE) {
case GameState::EDITOR:{ case GameState::EDITOR:{
//CAMERA MOVEMENTS MUST BE LAST!!! //CAMERA MOVEMENTS MUST BE LAST!!!
@ -989,9 +999,9 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
cameraPos.y+=CAMERA_MOVESPD; cameraPos.y+=CAMERA_MOVESPD;
} }
}break; }break;
} }
} }
void OnTextEntryComplete(const std::string&text) override{ void OnTextEntryComplete(const std::string&text) override{
if (EDITING_LAYER==layer::ENCOUNTER&&EDITING_ENCOUNTER!=nullptr) { if (EDITING_LAYER==layer::ENCOUNTER&&EDITING_ENCOUNTER!=nullptr) {
int numb=0; int numb=0;
@ -1143,7 +1153,7 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
POWER_SELECTION_OFFSET[-CURRENT_TURN-1]--; POWER_SELECTION_OFFSET[-CURRENT_TURN-1]--;
} }
} }
} else } else
if (DownPressed()) { if (DownPressed()) {
if (POWER_SELECTION_CURSOR[-CURRENT_TURN-1]==(int)BATTLE_MOVELIST_DISPLAY.size()-1) { if (POWER_SELECTION_CURSOR[-CURRENT_TURN-1]==(int)BATTLE_MOVELIST_DISPLAY.size()-1) {
POWER_GRADE_CURSOR[-CURRENT_TURN-1]=0; POWER_GRADE_CURSOR[-CURRENT_TURN-1]=0;
@ -1346,6 +1356,21 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
if (LeftPressed()||RightPressed()) { if (LeftPressed()||RightPressed()) {
ITEM_SELECTION_CURSOR+=ITEM_SELECTION_CURSOR&1?-1:1; ITEM_SELECTION_CURSOR+=ITEM_SELECTION_CURSOR&1?-1:1;
} }
if (UpPressed()) {
ITEM_SELECTION_CURSOR-=2;
if (ITEM_SELECTION_CURSOR<0) {
ITEM_SELECTION_CURSOR+=PARTY_INVENTORY.size();
}
}
if (DownPressed()) {
ITEM_SELECTION_CURSOR+=2;
if (ITEM_SELECTION_CURSOR<0) {
ITEM_SELECTION_CURSOR+=PARTY_INVENTORY.size();
}
}
if (ITEM_SELECTION_CURSOR>=PARTY_INVENTORY.size()) {
ITEM_SELECTION_CURSOR=PARTY_INVENTORY.size()-1;
}
}break; }break;
} }
} }
@ -1512,7 +1537,7 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
vi2d textOffset={2,2}; vi2d textOffset={2,2};
DrawStringDecal(enc->pos-cameraPos+textOffset,std::to_string(enc->chance)+"%"); DrawStringDecal(enc->pos-cameraPos+textOffset,std::to_string(enc->chance)+"%");
} }
} else } else
if (EDITING_LAYER==layer::OBJECT) { if (EDITING_LAYER==layer::OBJECT) {
DrawStringPropDecal({2,2},"Editing Objects"); DrawStringPropDecal({2,2},"Editing Objects");
} else { } else {
@ -1606,10 +1631,10 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
DrawDialogBox({1,1},{(int)(WIDTH*0.75),HEIGHT/6},Pixel(70, 33, 105,128),Pixel(62, 54, 69,128),Pixel(185, 148, 255,128)); DrawDialogBox({1,1},{(int)(WIDTH*0.75),HEIGHT/6},Pixel(70, 33, 105,128),Pixel(62, 54, 69,128),Pixel(185, 148, 255,128));
const std::string labels[6]={"Power","Attack","Item","Defend","Move","Run"}; const std::string labels[6]={"Power","Attack","Item","Defend","Move","Run"};
for (int i=0;i<6;i+=2) { for (int i=0;i<6;i+=2) {
DrawStringPropDecal({3+8+i/2*64,9},labels[i]); DrawStringPropDecal({static_cast<float>(3+8+i/2*64),9},labels[i]);
DrawStringPropDecal({3+8+i/2*64,23},labels[i+1]); DrawStringPropDecal({static_cast<float>(3+8+i/2*64),23},labels[i+1]);
} }
DrawDecal({BATTLE_SELECTION_CURSOR/2*64+3,9+((BATTLE_SELECTION_CURSOR%2==0)?0:14)},SPRITES["cursor.png"]); DrawDecal({static_cast<float>(BATTLE_SELECTION_CURSOR/2*64+3),static_cast<float>(9+((BATTLE_SELECTION_CURSOR%2==0)?0:14))},SPRITES["cursor.png"]);
} }
if (BATTLE_STATE==BattleState::POWER_SELECT||BATTLE_STATE==BattleState::GRADE_SELECT) { if (BATTLE_STATE==BattleState::POWER_SELECT||BATTLE_STATE==BattleState::GRADE_SELECT) {
SetDrawTarget(layer::INTERFACE); SetDrawTarget(layer::INTERFACE);
@ -1623,24 +1648,24 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
DrawDialogBox(ppCostBoxPos,{(int)(WIDTH/6),HEIGHT/8},Pixel(70, 33, 105,128),Pixel(62, 54, 69,128),Pixel(185, 148, 255,128)); DrawDialogBox(ppCostBoxPos,{(int)(WIDTH/6),HEIGHT/8},Pixel(70, 33, 105,128),Pixel(62, 54, 69,128),Pixel(185, 148, 255,128));
DrawStringPropDecal(ppCostBoxPos+textStartingOffset,"PP Cost",WHITE,{0.7,0.8}); DrawStringPropDecal(ppCostBoxPos+textStartingOffset,"PP Cost",WHITE,{0.7,0.8});
std::string label = std::to_string(BATTLE_MOVELIST_DISPLAY[POWER_SELECTION_CURSOR[-CURRENT_TURN-1]][POWER_GRADE_CURSOR[-CURRENT_TURN-1]]->PPCost); std::string label = std::to_string(BATTLE_MOVELIST_DISPLAY[POWER_SELECTION_CURSOR[-CURRENT_TURN-1]][POWER_GRADE_CURSOR[-CURRENT_TURN-1]]->PPCost);
DrawStringPropDecal({ppCostBoxPos.x+textStartingOffset.x+(WIDTH/6)-8-GetTextSizeProp(label).x*1.5,ppCostBoxPos.y+textStartingOffset.y+8},label,WHITE,{1.5,1.5}); DrawStringPropDecal({static_cast<float>(ppCostBoxPos.x+textStartingOffset.x+(WIDTH/6)-8-GetTextSizeProp(label).x*1.5),static_cast<float>(ppCostBoxPos.y+textStartingOffset.y+8)},label,WHITE,{1.5,1.5});
vd2d damageBoxPos = {WIDTH-WIDTH/3+WIDTH/6-1,HEIGHT/4+2}; vd2d damageBoxPos = {WIDTH-WIDTH/3+WIDTH/6-1,HEIGHT/4+2};
DrawStringPropDecal(damageBoxPos+textStartingOffset,"Damage",WHITE,{0.7,0.8}); DrawStringPropDecal(damageBoxPos+textStartingOffset,"Damage",WHITE,{0.7,0.8});
label = (BATTLE_MOVELIST_DISPLAY[POWER_SELECTION_CURSOR[-CURRENT_TURN-1]][POWER_GRADE_CURSOR[-CURRENT_TURN-1]]->baseDmg!=0)?std::to_string(BATTLE_MOVELIST_DISPLAY[POWER_SELECTION_CURSOR[-CURRENT_TURN-1]][POWER_GRADE_CURSOR[-CURRENT_TURN-1]]->baseDmg+PARTY_MEMBER_STATS[-CURRENT_TURN-1]->baseAtk)+"~"+std::to_string(BATTLE_MOVELIST_DISPLAY[POWER_SELECTION_CURSOR[-CURRENT_TURN-1]][POWER_GRADE_CURSOR[-CURRENT_TURN-1]]->randomDmg+BATTLE_MOVELIST_DISPLAY[POWER_SELECTION_CURSOR[-CURRENT_TURN-1]][POWER_GRADE_CURSOR[-CURRENT_TURN-1]]->baseDmg+PARTY_MEMBER_STATS[-CURRENT_TURN-1]->baseAtk):"N/A"; label = (BATTLE_MOVELIST_DISPLAY[POWER_SELECTION_CURSOR[-CURRENT_TURN-1]][POWER_GRADE_CURSOR[-CURRENT_TURN-1]]->baseDmg!=0)?std::to_string(BATTLE_MOVELIST_DISPLAY[POWER_SELECTION_CURSOR[-CURRENT_TURN-1]][POWER_GRADE_CURSOR[-CURRENT_TURN-1]]->baseDmg+PARTY_MEMBER_STATS[-CURRENT_TURN-1]->baseAtk)+"~"+std::to_string(BATTLE_MOVELIST_DISPLAY[POWER_SELECTION_CURSOR[-CURRENT_TURN-1]][POWER_GRADE_CURSOR[-CURRENT_TURN-1]]->randomDmg+BATTLE_MOVELIST_DISPLAY[POWER_SELECTION_CURSOR[-CURRENT_TURN-1]][POWER_GRADE_CURSOR[-CURRENT_TURN-1]]->baseDmg+PARTY_MEMBER_STATS[-CURRENT_TURN-1]->baseAtk):"N/A";
DrawStringPropDecal({damageBoxPos.x+textStartingOffset.x+(WIDTH/6)-8-GetTextSizeProp(label).x*(std::min((double)((WIDTH/6)-8)/GetTextSizeProp(label).x,1.5)),damageBoxPos.y+textStartingOffset.y+8},label,WHITE,{std::min((double)((WIDTH/6)-8)/GetTextSizeProp(label).x,1.5),1.5}); DrawStringPropDecal({static_cast<float>(damageBoxPos.x+textStartingOffset.x+(WIDTH/6)-8-GetTextSizeProp(label).x*(std::min((double)((WIDTH/6)-8)/GetTextSizeProp(label).x,1.5))),static_cast<float>(damageBoxPos.y+textStartingOffset.y+8)},label,WHITE,{static_cast<float>(std::min((double)((WIDTH/6)-8)/GetTextSizeProp(label).x,1.5)),1.5});
DrawDialogBox({WIDTH-WIDTH/3+WIDTH/6-1,HEIGHT/4+2},{(int)(WIDTH/6),HEIGHT/8},Pixel(70, 33, 105,128),Pixel(62, 54, 69,128),Pixel(185, 148, 255,128)); DrawDialogBox({WIDTH-WIDTH/3+WIDTH/6-1,HEIGHT/4+2},{(int)(WIDTH/6),HEIGHT/8},Pixel(70, 33, 105,128),Pixel(62, 54, 69,128),Pixel(185, 148, 255,128));
vd2d rangeBoxPos = {WIDTH-WIDTH/3+WIDTH/6-1,HEIGHT/4+HEIGHT/8+3}; vd2d rangeBoxPos = {WIDTH-WIDTH/3+WIDTH/6-1,HEIGHT/4+HEIGHT/8+3};
DrawStringPropDecal(rangeBoxPos+textStartingOffset,"Range",WHITE,{0.7,0.8}); DrawStringPropDecal(rangeBoxPos+textStartingOffset,"Range",WHITE,{0.7,0.8});
label = std::to_string(BATTLE_MOVELIST_DISPLAY[POWER_SELECTION_CURSOR[-CURRENT_TURN-1]][POWER_GRADE_CURSOR[-CURRENT_TURN-1]]->range); label = std::to_string(BATTLE_MOVELIST_DISPLAY[POWER_SELECTION_CURSOR[-CURRENT_TURN-1]][POWER_GRADE_CURSOR[-CURRENT_TURN-1]]->range);
DrawStringPropDecal({rangeBoxPos.x+textStartingOffset.x+(WIDTH/6)-8-GetTextSizeProp(label).x*(std::min((double)((WIDTH/6)-8)/GetTextSizeProp(label).x,1.5)),rangeBoxPos.y+textStartingOffset.y+8},label,WHITE,{std::min((double)((WIDTH/6)-8)/GetTextSizeProp(label).x,1.5),1.5}); DrawStringPropDecal({static_cast<float>(rangeBoxPos.x+textStartingOffset.x+(WIDTH/6)-8-GetTextSizeProp(label).x*(std::min((double)((WIDTH/6)-8)/GetTextSizeProp(label).x,1.5))),static_cast<float>(rangeBoxPos.y+textStartingOffset.y+8)},label,WHITE,{static_cast<float>(std::min((double)((WIDTH/6)-8)/GetTextSizeProp(label).x,1.5)),1.5});
DrawDialogBox({WIDTH-WIDTH/3+WIDTH/6-1,HEIGHT/4+HEIGHT/8+3},{(int)(WIDTH/6),HEIGHT/8},Pixel(70, 33, 105,128),Pixel(62, 54, 69,128),Pixel(185, 148, 255,128)); DrawDialogBox({WIDTH-WIDTH/3+WIDTH/6-1,HEIGHT/4+HEIGHT/8+3},{(int)(WIDTH/6),HEIGHT/8},Pixel(70, 33, 105,128),Pixel(62, 54, 69,128),Pixel(185, 148, 255,128));
vd2d channelTimeBoxPos = {WIDTH-WIDTH/3-1,HEIGHT/4+HEIGHT/8+3}; vd2d channelTimeBoxPos = {WIDTH-WIDTH/3-1,HEIGHT/4+HEIGHT/8+3};
DrawStringPropDecal(channelTimeBoxPos+textStartingOffset,"Cast",WHITE,{0.7,0.8}); DrawStringPropDecal(channelTimeBoxPos+textStartingOffset,"Cast",WHITE,{0.7,0.8});
label = std::to_string((float)BATTLE_MOVELIST_DISPLAY[POWER_SELECTION_CURSOR[-CURRENT_TURN-1]][POWER_GRADE_CURSOR[-CURRENT_TURN-1]]->channelTime/60).erase(3); label = std::to_string((float)BATTLE_MOVELIST_DISPLAY[POWER_SELECTION_CURSOR[-CURRENT_TURN-1]][POWER_GRADE_CURSOR[-CURRENT_TURN-1]]->channelTime/60).erase(3);
DrawStringPropDecal({channelTimeBoxPos.x+textStartingOffset.x+(WIDTH/6)-8-GetTextSizeProp(label).x*(std::min((double)((WIDTH/6)-8)/GetTextSizeProp(label).x,1.5)),channelTimeBoxPos.y+textStartingOffset.y+8},label,WHITE,{std::min((double)((WIDTH/6)-8)/GetTextSizeProp(label).x,1.5),1.5}); DrawStringPropDecal({static_cast<float>(channelTimeBoxPos.x+textStartingOffset.x+(WIDTH/6)-8-GetTextSizeProp(label).x*(std::min((double)((WIDTH/6)-8)/GetTextSizeProp(label).x,1.5))),static_cast<float>(channelTimeBoxPos.y+textStartingOffset.y+8)},label,WHITE,{static_cast<float>(std::min((double)((WIDTH/6)-8)/GetTextSizeProp(label).x,1.5)),1.5});
DrawDialogBox({WIDTH-WIDTH/3-1,HEIGHT/4+HEIGHT/8+3},{(int)(WIDTH/6),HEIGHT/8},Pixel(70, 33, 105,128),Pixel(62, 54, 69,128),Pixel(185, 148, 255,128)); DrawDialogBox({WIDTH-WIDTH/3-1,HEIGHT/4+HEIGHT/8+3},{(int)(WIDTH/6),HEIGHT/8},Pixel(70, 33, 105,128),Pixel(62, 54, 69,128),Pixel(185, 148, 255,128));
int counter=0; int counter=0;
int displayLimit=0; int displayLimit=0;
@ -1650,28 +1675,28 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
std::vector<Battle::Move*> moves = BATTLE_MOVELIST_DISPLAY[i]; std::vector<Battle::Move*> moves = BATTLE_MOVELIST_DISPLAY[i];
std::string name = moves[0]->name; std::string name = moves[0]->name;
if (GetTextSizeProp(name).x>WIDTH/4) { if (GetTextSizeProp(name).x>WIDTH/4) {
DrawStringPropDecal({12,12*counter+8+displayYOffset},name,WHITE,{(WIDTH/4)/(float)GetTextSizeProp(name).x,1}); DrawStringPropDecal({12,static_cast<float>(12*counter+8+displayYOffset)},name,WHITE,{(WIDTH/4)/(float)GetTextSizeProp(name).x,1});
} else { } else {
DrawStringPropDecal({12,12*counter+8+displayYOffset},name); DrawStringPropDecal({12,static_cast<float>(12*counter+8+displayYOffset)},name);
} }
for (int i=0;i<moves.size();i++) { for (int i=0;i<moves.size();i++) {
if (BATTLE_STATE==BattleState::GRADE_SELECT&&POWER_SELECTION_CURSOR[-CURRENT_TURN-1]==counter) { if (BATTLE_STATE==BattleState::GRADE_SELECT&&POWER_SELECTION_CURSOR[-CURRENT_TURN-1]==counter) {
if (POWER_GRADE_CURSOR[-CURRENT_TURN-1]==i) { if (POWER_GRADE_CURSOR[-CURRENT_TURN-1]==i) {
DrawFancyStringDecal({8+WIDTH/4+12+i*8,12*counter+8+displayYOffset},std::wstring(1,moves[i]->grade)); DrawFancyStringDecal({static_cast<float>(8+WIDTH/4+12+i*8),static_cast<float>(12*counter+8+displayYOffset)},std::wstring(1,moves[i]->grade));
} else { } else {
DrawFancyStringDecal({8+WIDTH/4+12+i*8,12*counter+8+displayYOffset},std::wstring(1,moves[i]->grade),DARK_GREY); DrawFancyStringDecal({static_cast<float>(8+WIDTH/4+12+i*8),static_cast<float>(12*counter+8+displayYOffset)},std::wstring(1,moves[i]->grade),DARK_GREY);
} }
} else { } else {
DrawFancyStringDecal({8+WIDTH/4+12+i*8,12*counter+8+displayYOffset},std::wstring(1,moves[i]->grade)); DrawFancyStringDecal({static_cast<float>(8+WIDTH/4+12+i*8),static_cast<float>(12*counter+8+displayYOffset)},std::wstring(1,moves[i]->grade));
} }
} }
} }
++counter; ++counter;
} }
if (BATTLE_STATE==BattleState::POWER_SELECT) { if (BATTLE_STATE==BattleState::POWER_SELECT) {
DrawDecal({4,12*(POWER_SELECTION_CURSOR[-CURRENT_TURN-1]-POWER_SELECTION_OFFSET[-CURRENT_TURN-1])+8},SPRITES["cursor.png"]); DrawDecal({4,static_cast<float>(12*(POWER_SELECTION_CURSOR[-CURRENT_TURN-1]-POWER_SELECTION_OFFSET[-CURRENT_TURN-1])+8)},SPRITES["cursor.png"]);
} else { } else {
DrawDecal({WIDTH/4+4+POWER_GRADE_CURSOR[-CURRENT_TURN-1]*8+8,12*(POWER_SELECTION_CURSOR[-CURRENT_TURN-1]-POWER_SELECTION_OFFSET[-CURRENT_TURN-1])+8},SPRITES["cursor.png"]); DrawDecal({(float)(WIDTH/4+4+POWER_GRADE_CURSOR[-CURRENT_TURN-1]*8+8),static_cast<float>(12*(POWER_SELECTION_CURSOR[-CURRENT_TURN-1]-POWER_SELECTION_OFFSET[-CURRENT_TURN-1])+8)},SPRITES["cursor.png"]);
} }
if (BATTLE_MOVELIST_DISPLAY.size()>4) { if (BATTLE_MOVELIST_DISPLAY.size()>4) {
if (POWER_SELECTION_OFFSET[-CURRENT_TURN-1]>0) { if (POWER_SELECTION_OFFSET[-CURRENT_TURN-1]>0) {
@ -1684,7 +1709,7 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
} }
if (BATTLE_STATE==BattleState::ITEM_SELECT) { if (BATTLE_STATE==BattleState::ITEM_SELECT) {
SetDrawTarget(layer::INTERFACE); SetDrawTarget(layer::INTERFACE);
DrawDecal({8+ITEM_SELECTION_CURSOR*(WIDTH-8)/2,12*(POWER_SELECTION_CURSOR[-CURRENT_TURN-1]-POWER_SELECTION_OFFSET[-CURRENT_TURN-1])+8},SPRITES["cursor.png"]); DrawDecal({static_cast<float>(8+ITEM_SELECTION_CURSOR*(WIDTH-8)/2),static_cast<float>(12*(POWER_SELECTION_CURSOR[-CURRENT_TURN-1]-POWER_SELECTION_OFFSET[-CURRENT_TURN-1])+8)},SPRITES["cursor.png"]);
DrawDialogBox({4,4},{(int)(WIDTH-8),(int)(HEIGHT/2)},Pixel(70, 33, 105,128),Pixel(62, 54, 69,128),Pixel(185, 148, 255,128)); DrawDialogBox({4,4},{(int)(WIDTH-8),(int)(HEIGHT/2)},Pixel(70, 33, 105,128),Pixel(62, 54, 69,128),Pixel(185, 148, 255,128));
} }
if (BATTLE_STATE==BattleState::TARGET_SELECT) { if (BATTLE_STATE==BattleState::TARGET_SELECT) {
@ -1692,7 +1717,7 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
if (SELECTED_TARGET<0) { if (SELECTED_TARGET<0) {
vd2d scale = {PARTY_MEMBER_OBJ[-SELECTED_TARGET-1]->spr->width/(double)SPRITES["targetCircle.png"]->sprite->width,PARTY_MEMBER_OBJ[-SELECTED_TARGET-1]->spr->spr->sprite->height/(double)SPRITES["targetCircle.png"]->sprite->height}; vd2d scale = {PARTY_MEMBER_OBJ[-SELECTED_TARGET-1]->spr->width/(double)SPRITES["targetCircle.png"]->sprite->width,PARTY_MEMBER_OBJ[-SELECTED_TARGET-1]->spr->spr->sprite->height/(double)SPRITES["targetCircle.png"]->sprite->height};
vi2d size = {SPRITES["targetCircle.png"]->sprite->width,SPRITES["targetCircle.png"]->sprite->height}; vi2d size = {SPRITES["targetCircle.png"]->sprite->width,SPRITES["targetCircle.png"]->sprite->height};
DrawDecal(PARTY_MEMBER_OBJ[-SELECTED_TARGET-1]->GetPosWithOrigin()-cameraPos-size/2*scale,SPRITES["targetCircle.png"],{PARTY_MEMBER_OBJ[-SELECTED_TARGET-1]->spr->width/(double)SPRITES["targetCircle.png"]->sprite->width,PARTY_MEMBER_OBJ[-SELECTED_TARGET-1]->spr->spr->sprite->height/(double)SPRITES["targetCircle.png"]->sprite->height},GREEN); DrawDecal(PARTY_MEMBER_OBJ[-SELECTED_TARGET-1]->GetPosWithOrigin()-cameraPos-size/2*scale,SPRITES["targetCircle.png"],{static_cast<float>(PARTY_MEMBER_OBJ[-SELECTED_TARGET-1]->spr->width/(double)SPRITES["targetCircle.png"]->sprite->width),static_cast<float>(PARTY_MEMBER_OBJ[-SELECTED_TARGET-1]->spr->spr->sprite->height/(double)SPRITES["targetCircle.png"]->sprite->height)},GREEN);
DrawTargetRangeGrid(PARTY_MEMBER_OBJ[-SELECTED_TARGET-1]->GetPosWithOrigin(),PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-CURRENT_TURN-1]]->selectedMove->range); DrawTargetRangeGrid(PARTY_MEMBER_OBJ[-SELECTED_TARGET-1]->GetPosWithOrigin(),PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-CURRENT_TURN-1]]->selectedMove->range);
} else { } else {
vd2d scale = {BATTLE_ENCOUNTER->objs[SELECTED_TARGET]->obj->spr->width/(double)SPRITES["targetCircle.png"]->sprite->width,BATTLE_ENCOUNTER->objs[SELECTED_TARGET]->obj->spr->spr->sprite->height/(double)SPRITES["targetCircle.png"]->sprite->height}; vd2d scale = {BATTLE_ENCOUNTER->objs[SELECTED_TARGET]->obj->spr->width/(double)SPRITES["targetCircle.png"]->sprite->width,BATTLE_ENCOUNTER->objs[SELECTED_TARGET]->obj->spr->spr->sprite->height/(double)SPRITES["targetCircle.png"]->sprite->height};
@ -1705,9 +1730,9 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
SetDrawTarget(layer::INTERFACE); SetDrawTarget(layer::INTERFACE);
std::wstring label=L""; std::wstring label=L"";
if (CURRENT_TURN<0) { if (CURRENT_TURN<0) {
label=to_wstring(PARTY_MEMBER_OBJ[-CURRENT_TURN-1]->name)+L" uses "+to_wstring(PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-CURRENT_TURN-1]]->selectedMove->name)+L" "+((PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-CURRENT_TURN-1]]->selectedMove->grade!=0)?std::wstring(1,PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-CURRENT_TURN-1]]->selectedMove->grade):L""); label=transform_to<std::wstring>(PARTY_MEMBER_OBJ[-CURRENT_TURN-1]->name)+L" uses "+transform_to<std::wstring>(PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-CURRENT_TURN-1]]->selectedMove->name)+L" "+((PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-CURRENT_TURN-1]]->selectedMove->grade!=0)?std::wstring(1,PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-CURRENT_TURN-1]]->selectedMove->grade):L"");
} else { } else {
label=to_wstring(BATTLE_ENCOUNTER->objs[CURRENT_TURN]->obj->name)+L" uses "+to_wstring(BATTLE_ENCOUNTER->objs[CURRENT_TURN]->selectedMove->name)+L" "+((BATTLE_ENCOUNTER->objs[CURRENT_TURN]->selectedMove->grade!=0)?std::wstring(1,BATTLE_ENCOUNTER->objs[CURRENT_TURN]->selectedMove->grade):L""); label=transform_to<std::wstring>(BATTLE_ENCOUNTER->objs[CURRENT_TURN]->obj->name)+L" uses "+transform_to<std::wstring>(BATTLE_ENCOUNTER->objs[CURRENT_TURN]->selectedMove->name)+L" "+((BATTLE_ENCOUNTER->objs[CURRENT_TURN]->selectedMove->grade!=0)?std::wstring(1,BATTLE_ENCOUNTER->objs[CURRENT_TURN]->selectedMove->grade):L"");
} }
DrawFancyStringDecal({2,2},Wrap(label,ScreenWidth()-2,false,{2,2}),WHITE,{2,2}); DrawFancyStringDecal({2,2},Wrap(label,ScreenWidth()-2,false,{2,2}),WHITE,{2,2});
} }
@ -1745,7 +1770,7 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
underAttack=true; underAttack=true;
break; break;
} }
} }
if (CURRENT_TURN>=0&&BATTLE_STATE==BattleState::WAIT_ANIMATION&&underAttack) { if (CURRENT_TURN>=0&&BATTLE_STATE==BattleState::WAIT_ANIMATION&&underAttack) {
drawCheckerboardBox(box,{59,59},Pixel(180,159,194),Pixel(200,179,214),{6,6},RED,DARK_RED); drawCheckerboardBox(box,{59,59},Pixel(180,159,194),Pixel(200,179,214),{6,6},RED,DARK_RED);
} else { } else {
@ -1756,19 +1781,19 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
} else { } else {
DrawStringDecal({(float)(box.x+6),(float)(box.y+4)},obj->name,BLACK,{1,0.8}); DrawStringDecal({(float)(box.x+6),(float)(box.y+4)},obj->name,BLACK,{1,0.8});
} }
DrawPartialDecal({(float)(box.x+4),(float)(box.y+5+8+2)},SPRITES["atbbar_back.png"],{0,0},{member->atb/1000.0*SPRITES["atbbar_back.png"]->sprite->width,SPRITES["atbbar_back.png"]->sprite->height}); DrawPartialDecal({(float)(box.x+4),(float)(box.y+5+8+2)},SPRITES["atbbar_back.png"],{0,0},{static_cast<float>(member->atb/1000.0*SPRITES["atbbar_back.png"]->sprite->width),static_cast<float>(SPRITES["atbbar_back.png"]->sprite->height)});
DrawDecal({(float)(box.x+4),(float)(box.y+5+8+2)},SPRITES["atbbar_front.png"]); DrawDecal({(float)(box.x+4),(float)(box.y+5+8+2)},SPRITES["atbbar_front.png"]);
if (member->selectedMove!=nullptr) { if (member->selectedMove!=nullptr) {
DrawPartialDecal({(float)(box.x+4),(float)(box.y+5+8+2)},SPRITES["atbbar_back.png"],{0,0},{(1-((float)member->channelTimeRemaining/member->selectedMove->channelTime))*SPRITES["atbbar_back.png"]->sprite->width,SPRITES["atbbar_back.png"]->sprite->height},{1,1},GREEN*0.7); DrawPartialDecal({(float)(box.x+4),(float)(box.y+5+8+2)},SPRITES["atbbar_back.png"],{0,0},{(1-((float)member->channelTimeRemaining/member->selectedMove->channelTime))*SPRITES["atbbar_back.png"]->sprite->width,static_cast<float>(SPRITES["atbbar_back.png"]->sprite->height)},{1,1},GREEN*0.7);
std::wstring label=to_wstring(member->selectedMove->name); std::wstring label=transform_to<std::wstring>(member->selectedMove->name);
label+=L" "; label+=L" ";
if (member->selectedMove->grade!=0) { if (member->selectedMove->grade!=0) {
label+=member->selectedMove->grade; label+=member->selectedMove->grade;
} }
vd2d textOffset=GetTextSize(to_string(label))*0.6; vd2d textOffset=GetTextSize(transform_to<std::string>(label))*0.6;
textOffset.y+=10; textOffset.y+=10;
vd2d barPos = {(float)(box.x+4),(float)(box.y+5+8+2)}; vd2d barPos = {(float)(box.x+4),(float)(box.y+5+8+2)};
DrawFancyStringDecal(barPos-textOffset/2,label,BLACK,{std::min((float)54/GetTextSize(to_string(label)).x,(float)1),0.6}); DrawFancyStringDecal(barPos-textOffset/2,label,BLACK,{std::min((float)54/GetTextSize(transform_to<std::string>(label)).x,(float)1),0.6});
} }
const vi2d hpTextPos = {box.x+5,box.y+25}; const vi2d hpTextPos = {box.x+5,box.y+25};
for (int x=-1;x<=1;x++) { for (int x=-1;x<=1;x++) {
@ -1795,14 +1820,14 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
Entity*obj = BATTLE_ENCOUNTER->objs[i]; Entity*obj = BATTLE_ENCOUNTER->objs[i];
if (obj->GetHP()>0&&obj->selectedMove!=nullptr) { if (obj->GetHP()>0&&obj->selectedMove!=nullptr) {
vi2d barOffset={-SPRITES["atbbar_front.png"]->sprite->width/2,8}; vi2d barOffset={-SPRITES["atbbar_front.png"]->sprite->width/2,8};
DrawPartialDecal(obj->obj->GetPos()+obj->obj->originPoint-cameraPos+barOffset,SPRITES["atbbar_back.png"],{0,0},{(1-((float)obj->channelTimeRemaining/obj->selectedMove->channelTime))*SPRITES["atbbar_back.png"]->sprite->width,SPRITES["atbbar_back.png"]->sprite->height},{1,1},YELLOW*0.8); DrawPartialDecal(obj->obj->GetPos()+obj->obj->originPoint-cameraPos+barOffset,SPRITES["atbbar_back.png"],{0,0},{(1-((float)obj->channelTimeRemaining/obj->selectedMove->channelTime))*SPRITES["atbbar_back.png"]->sprite->width,static_cast<float>(SPRITES["atbbar_back.png"]->sprite->height)},{1,1},YELLOW*0.8);
DrawDecal(obj->obj->GetPos()+obj->obj->originPoint-cameraPos+barOffset,SPRITES["atbbar_front.png"]); DrawDecal(obj->obj->GetPos()+obj->obj->originPoint-cameraPos+barOffset,SPRITES["atbbar_front.png"]);
std::wstring label=to_wstring(obj->selectedMove->name); std::wstring label=transform_to<std::wstring>(obj->selectedMove->name);
if (obj->selectedMove->grade!=0) { if (obj->selectedMove->grade!=0) {
label+=L" "; label+=L" ";
label+=obj->selectedMove->grade; label+=obj->selectedMove->grade;
} }
vd2d textOffset=GetTextSize(to_string(label))*0.6; vd2d textOffset=GetTextSize(transform_to<std::string>(label))*0.6;
textOffset.y-=6; textOffset.y-=6;
vi2d shadowOffset = {1,1}; vi2d shadowOffset = {1,1};
DrawFancyStringDecal(obj->obj->GetPos()+obj->obj->originPoint-cameraPos+barOffset-textOffset/2+shadowOffset,label,BLACK,{0.6,0.6}); DrawFancyStringDecal(obj->obj->GetPos()+obj->obj->originPoint-cameraPos+barOffset-textOffset/2+shadowOffset,label,BLACK,{0.6,0.6});
@ -1929,7 +1954,7 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
if (sText[i]!='\n') { if (sText[i]!='\n') {
DrawStringDecal(newpos,std::string(1,sText[i]),col,scale); DrawStringDecal(newpos,std::string(1,sText[i]),col,scale);
newpos.x+=8*scale.x; newpos.x+=8*scale.x;
} else } else
if (sText[i]=='\n') { if (sText[i]=='\n') {
DrawStringDecal(newpos,std::string(1,sText[i]),col,scale); DrawStringDecal(newpos,std::string(1,sText[i]),col,scale);
newpos.x=pos.x; newpos.x=pos.x;
@ -2025,7 +2050,7 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
AddObjectToWorld(CreateObject(id,{x,y})); AddObjectToWorld(CreateObject(id,{x,y}));
} }
printf("Object %s Loaded.\n",OBJ_INFO[id]->name.c_str()); printf("Object %s Loaded.\n",OBJ_INFO[id]->name.c_str());
} else } else
if (data.find("ENCOUNTER")!=std::string::npos) { if (data.find("ENCOUNTER")!=std::string::npos) {
marker=data.find_first_of(';',marker+1); marker=data.find_first_of(';',marker+1);
std::stringstream split4(data.substr(lastMarker+1,marker-lastMarker-1)); std::stringstream split4(data.substr(lastMarker+1,marker-lastMarker-1));
@ -2285,7 +2310,7 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
CreateSprite("crosshair.png"); CreateSprite("crosshair.png");
CreateSprite("arrow_connector.png"); CreateSprite("arrow_connector.png");
} }
void SetupObjectInfo() { void SetupObjectInfo() {
CreateObjectInfo(PLAYER,"player",{0,0},"player.png",32,{2,2},WHITE); CreateObjectInfo(PLAYER,"player",{0,0},"player.png",32,{2,2},WHITE);
CreateObjectInfo(NESS,"Ness",{0,0},"player.png",32,{1,1},YELLOW); CreateObjectInfo(NESS,"Ness",{0,0},"player.png",32,{1,1},YELLOW);
@ -2591,7 +2616,7 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
OBJECTS[i]->objArrElement=i; OBJECTS[i]->objArrElement=i;
} }
} }
//printf("OBJECTS (%d):\n",OBJECTS.size()); //printf("OBJECTS (%d):\n",OBJECTS.size());
for (int i=0;i<OBJECTS.size();i++) { for (int i=0;i<OBJECTS.size();i++) {
if (i!=OBJECTS[i]->objArrElement) { if (i!=OBJECTS[i]->objArrElement) {
@ -2693,7 +2718,7 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
} }
} }
reachedPosition=false; reachedPosition=false;
} else } else
if (!secondRun&&dir!=BOTH) { if (!secondRun&&dir!=BOTH) {
MoveCameraTowardsPoint(targetPos,dir,spd,true); MoveCameraTowardsPoint(targetPos,dir,spd,true);
} }
@ -2712,7 +2737,7 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
} }
} }
reachedPosition=false; reachedPosition=false;
} else } else
if (!secondRun&&dir!=BOTH) { if (!secondRun&&dir!=BOTH) {
MoveCameraTowardsPoint(targetPos,dir,spd,true); MoveCameraTowardsPoint(targetPos,dir,spd,true);
} }
@ -2736,7 +2761,7 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
} }
} }
reachedPosition=false; reachedPosition=false;
} else } else
if (!secondRun&&dir!=BOTH) { if (!secondRun&&dir!=BOTH) {
MoveObjectTowardsPoint(obj,targetPos,dir,moveSpd,true); MoveObjectTowardsPoint(obj,targetPos,dir,moveSpd,true);
} }
@ -2755,7 +2780,7 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
} }
} }
reachedPosition=false; reachedPosition=false;
} else } else
if (!secondRun&&dir!=BOTH) { if (!secondRun&&dir!=BOTH) {
MoveObjectTowardsPoint(obj,targetPos,dir,moveSpd,true); MoveObjectTowardsPoint(obj,targetPos,dir,moveSpd,true);
} }
@ -2847,7 +2872,7 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
} }
std::string Wrap(std::string str,int width,bool proportional,vd2d scale) { std::string Wrap(std::string str,int width,bool proportional,vd2d scale) {
return to_string(Wrap(to_wstring(str),width,proportional,scale)); return transform_to<std::string>(Wrap(transform_to<std::wstring>(str),width,proportional,scale));
} }
std::wstring Wrap(std::wstring str,int width,bool proportional,vd2d scale) { std::wstring Wrap(std::wstring str,int width,bool proportional,vd2d scale) {
@ -2860,9 +2885,9 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
} }
vd2d siz; vd2d siz;
if (proportional) { if (proportional) {
siz={GetTextSizeProp(to_string(newStr)).x*scale.x,GetTextSizeProp(to_string(newStr)).y*scale.y}; siz={GetTextSizeProp(transform_to<std::string>(newStr)).x*scale.x,GetTextSizeProp(transform_to<std::string>(newStr)).y*scale.y};
} else { } else {
siz={GetTextSize(to_string(newStr)).x*scale.x,GetTextSize(to_string(newStr)).y*scale.y}; siz={GetTextSize(transform_to<std::string>(newStr)).x*scale.x,GetTextSize(transform_to<std::string>(newStr)).y*scale.y};
} }
if (siz.x>width) { if (siz.x>width) {
do { do {
@ -2899,7 +2924,7 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
for (int i=0;i<PARTY_MEMBER_COUNT;i++) { for (int i=0;i<PARTY_MEMBER_COUNT;i++) {
if (player_rollwait_counter[i]>0) { if (player_rollwait_counter[i]>0) {
if (BATTLE_ROLLING_COUNTER_WAITTIME==0) { if (BATTLE_ROLLING_COUNTER_WAITTIME==0) {
player_rollwait_counter[i]=0; player_rollwait_counter[i]=0;
} else { } else {
player_rollwait_counter[i]--; player_rollwait_counter[i]--;
} }
@ -2926,10 +2951,10 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
if (player_rollhp_counter[i][0]>0) { if (player_rollhp_counter[i][0]>0) {
if (member->GetTargetHP()<-member->maxHP) { if (member->GetTargetHP()<-member->maxHP) {
player_rollhp_counter[i][0]-=HEALTH_ROLLING_SPEED+(member->maxHP-member->GetTargetHP())/10; player_rollhp_counter[i][0]-=HEALTH_ROLLING_SPEED+(member->maxHP-member->GetTargetHP())/10;
} else } else
if (member->GetTargetHP()<0) { if (member->GetTargetHP()<0) {
player_rollhp_counter[i][0]-=HEALTH_ROLLING_SPEED+(member->maxHP-member->GetTargetHP())/20; player_rollhp_counter[i][0]-=HEALTH_ROLLING_SPEED+(member->maxHP-member->GetTargetHP())/20;
} else { } else {
player_rollhp_counter[i][0]-=HEALTH_ROLLING_SPEED; player_rollhp_counter[i][0]-=HEALTH_ROLLING_SPEED;
} }
} }
@ -2939,7 +2964,7 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
if (player_rollhp_counter[i][2]>0) { if (player_rollhp_counter[i][2]>0) {
player_rollhp_counter[i][2]--; player_rollhp_counter[i][2]--;
} }
} else } else
if (member->GetHP()<member->GetTargetHP()) { if (member->GetHP()<member->GetTargetHP()) {
if (player_rollhp_counter[i][0]>=0&&player_rollwait_counter[i]==0) { if (player_rollhp_counter[i][0]>=0&&player_rollwait_counter[i]==0) {
player_rollhp_display[i][0]++; player_rollhp_display[i][0]++;
@ -3300,7 +3325,7 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
CurrentCutscene->AdvanceAction(); CurrentCutscene->AdvanceAction();
}break; }break;
case ActionType::CLEANUP:{ case ActionType::CLEANUP:{
if (CUTSCENE_QUEUE.size()==0) { if (CUTSCENE_QUEUE.size()==0) {
for (int i=0;i<OBJECTS.size();i++) { for (int i=0;i<OBJECTS.size();i++) {
if (OBJECTS[i]->temp) { if (OBJECTS[i]->temp) {
delete OBJECTS[i]; delete OBJECTS[i];
@ -3322,7 +3347,7 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
if (CUTSCENE_FADE_VALUE==0) { if (CUTSCENE_FADE_VALUE==0) {
CurrentCutscene->AdvanceAction(); CurrentCutscene->AdvanceAction();
} }
} else } else
if (!((Fade*)CurrentCutscene->GetAction())->FadeIn()&&CUTSCENE_FADE_VALUE<255) { if (!((Fade*)CurrentCutscene->GetAction())->FadeIn()&&CUTSCENE_FADE_VALUE<255) {
CUTSCENE_FADE_VALUE=std::clamp(CUTSCENE_FADE_VALUE+((Fade*)CurrentCutscene->GetAction())->GetFadeSpd(),0.0,255.0); CUTSCENE_FADE_VALUE=std::clamp(CUTSCENE_FADE_VALUE+((Fade*)CurrentCutscene->GetAction())->GetFadeSpd(),0.0,255.0);
if (CUTSCENE_FADE_VALUE==255) { if (CUTSCENE_FADE_VALUE==255) {
@ -3337,7 +3362,7 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
if (!((DialogBox*)CurrentCutscene->GetAction())->MessageHasBeenShown()) { if (!((DialogBox*)CurrentCutscene->GetAction())->MessageHasBeenShown()) {
DisplayMessageBox(((DialogBox*)CurrentCutscene->GetAction())->GetMessage()); DisplayMessageBox(((DialogBox*)CurrentCutscene->GetAction())->GetMessage());
((DialogBox*)CurrentCutscene->GetAction())->SetMessageBoxVisible(); ((DialogBox*)CurrentCutscene->GetAction())->SetMessageBoxVisible();
} else } else
if (!messageBoxVisible) { if (!messageBoxVisible) {
CurrentCutscene->AdvanceAction(); CurrentCutscene->AdvanceAction();
} }
@ -3379,7 +3404,7 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
if (CUTSCENE_FADE_VALUE==0) { if (CUTSCENE_FADE_VALUE==0) {
CUTSCENE_QUEUE.erase(CUTSCENE_QUEUE.begin()+i--); CUTSCENE_QUEUE.erase(CUTSCENE_QUEUE.begin()+i--);
} }
} else } else
if (!((FadeAsync*)CUTSCENE_QUEUE[i])->FadeIn()&&CUTSCENE_FADE_VALUE<255) { if (!((FadeAsync*)CUTSCENE_QUEUE[i])->FadeIn()&&CUTSCENE_FADE_VALUE<255) {
CUTSCENE_FADE_VALUE=std::clamp(CUTSCENE_FADE_VALUE+((FadeAsync*)CUTSCENE_QUEUE[i])->GetFadeSpd(),0.0,255.0); CUTSCENE_FADE_VALUE=std::clamp(CUTSCENE_FADE_VALUE+((FadeAsync*)CUTSCENE_QUEUE[i])->GetFadeSpd(),0.0,255.0);
if (CUTSCENE_FADE_VALUE==255) { if (CUTSCENE_FADE_VALUE==255) {
@ -3445,7 +3470,7 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
int dist = abs(x)+abs(y); int dist = abs(x)+abs(y);
if (dist<range) { if (dist<range) {
vi2d offset = {x,y}; vi2d offset = {x,y};
//FillRectDecal(gridCenter-cameraPos+offset*32,{32,32},Pixel(255,255,0,128)); //FillRectDecal(gridCenter-cameraPos+offset*32,{32,32},Pixel(255,255,0,128));
GradientFillRectDecal(gridCenter-cameraPos+offset*32,{32,32},box1col,box2col,box1col,box2col); GradientFillRectDecal(gridCenter-cameraPos+offset*32,{32,32},box1col,box2col,box1col,box2col);
const vi2d outlineOffset = {1,1}; const vi2d outlineOffset = {1,1};
if (!connectedborder) { if (!connectedborder) {
@ -3457,20 +3482,20 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
vd2d size={32,32}; vd2d size={32,32};
vd2d size2={30,30}; vd2d size2={30,30};
if (abs(x)+abs(y-1)>=range) { if (abs(x)+abs(y-1)>=range) {
DrawLineDecal(pos,{pos.x+size.x,pos.y},outlinecol); //Top DrawLineDecal(pos,{static_cast<float>(pos.x+size.x),static_cast<float>(pos.y)},outlinecol); //Top
DrawLineDecal(pos2,{pos2.x+size2.x,pos2.y},outlinecol); //Top DrawLineDecal(pos2,{static_cast<float>(pos2.x+size2.x),static_cast<float>(pos2.y)},outlinecol); //Top
} }
if (abs(x-1)+abs(y)>=range) { if (abs(x-1)+abs(y)>=range) {
DrawLineDecal({pos.x,pos.y},{pos.x,pos.y+size.y},outlinecol); //Left DrawLineDecal({static_cast<float>(pos.x),static_cast<float>(pos.y)},{static_cast<float>(pos.x),static_cast<float>(pos.y+size.y)},outlinecol); //Left
DrawLineDecal({pos2.x,pos2.y},{pos2.x,pos2.y+size2.y},outlinecol); //Left DrawLineDecal({static_cast<float>(pos2.x),static_cast<float>(pos2.y)},{static_cast<float>(pos2.x),static_cast<float>(pos2.y+size2.y)},outlinecol); //Left
} }
if (abs(x)+abs(y+1)>=range) { if (abs(x)+abs(y+1)>=range) {
DrawLineDecal({pos.x,pos.y+size.y},{pos.x+size.x,pos.y+size.y},outlinecol); //Bottom DrawLineDecal({static_cast<float>(pos.x),static_cast<float>(pos.y+size.y)},{static_cast<float>(pos.x+size.x),static_cast<float>(pos.y+size.y)},outlinecol); //Bottom
DrawLineDecal({pos2.x,pos2.y+size2.y},{pos2.x+size2.x,pos2.y+size2.y},outlinecol); //Bottom DrawLineDecal({static_cast<float>(pos2.x),static_cast<float>(pos2.y+size2.y)},{static_cast<float>(pos2.x+size2.x),static_cast<float>(pos2.y+size2.y)},outlinecol); //Bottom
} }
if (abs(x+1)+abs(y)>=range) { if (abs(x+1)+abs(y)>=range) {
DrawLineDecal({pos.x+size.x,pos.y},{pos.x+size.x,pos.y+size.y},outlinecol); //Right DrawLineDecal({static_cast<float>(pos.x+size.x),static_cast<float>(pos.y)},{static_cast<float>(pos.x+size.x),static_cast<float>(pos.y+size.y)},outlinecol); //Right
DrawLineDecal({pos2.x+size2.x,pos2.y},{pos2.x+size2.x,pos2.y+size2.y},outlinecol); //Right DrawLineDecal({static_cast<float>(pos2.x+size2.x),static_cast<float>(pos2.y)},{static_cast<float>(pos2.x+size2.x),static_cast<float>(pos2.y+size2.y)},outlinecol); //Right
} }
} }
} }
@ -3541,7 +3566,7 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
vi2d gridCenter = (vi2d)pos/32*32; vi2d gridCenter = (vi2d)pos/32*32;
MOVEMENT_GRID.clear(); MOVEMENT_GRID.clear();
CheckGrid(0,0,gridCenter-cameraPos,range); CheckGrid(0,0,gridCenter-cameraPos,range);
} }
vi2d grid(int x, int y) { vi2d grid(int x, int y) {
@ -3619,7 +3644,7 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
for (int i=0;i<BATTLE_ENCOUNTER->objs.size();i++) { for (int i=0;i<BATTLE_ENCOUNTER->objs.size();i++) {
BATTLE_ENCOUNTER->objs[i]->obj->highlighted=false; BATTLE_ENCOUNTER->objs[i]->obj->highlighted=false;
} }
PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-CURRENT_TURN-1]]->channelTimeRemaining=PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-CURRENT_TURN-1]]->selectedMove->channelTime; PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-CURRENT_TURN-1]]->channelTimeRemaining=PARTY_MEMBER_STATS[PARTY_MEMBER_ID[-CURRENT_TURN-1]]->selectedMove->channelTime;
} }
int CalculateDamage(Entity*attacker,Entity*defender) { int CalculateDamage(Entity*attacker,Entity*defender) {
@ -3650,4 +3675,4 @@ int main()
demo.Start(); demo.Start();
return 0; return 0;
} }

Loading…
Cancel
Save