Bring web build up-to-speed

Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
master
sigonasr2 2 years ago
parent 3b696c802a
commit 102d20e946
  1. 109
      SeasonsOfLoneliness.cpp
  2. BIN
      Seasons_of_Loneliness
  3. BIN
      Seasons_of_Loneliness.data
  4. 2
      Seasons_of_Loneliness.js
  5. BIN
      Seasons_of_Loneliness.wasm

@ -135,21 +135,25 @@ class ObjectLoadInfo{
Animation*anim;
vi2d spos;
vi2d size;
Pixel col;
bool hascut=false;
ObjectLoadInfo(Decal*spr) {
ObjectLoadInfo(Decal*spr,Pixel col=WHITE) {
this->spr=spr;
this->col=col;
}
ObjectLoadInfo(Decal*spr,Animation*anim) {
ObjectLoadInfo(Decal*spr,Animation*anim,Pixel col=WHITE) {
this->spr=spr;
this->anim=anim;
this->hasanim=true;
updateAnimationsList.push_back(anim);
this->col=col;
}
ObjectLoadInfo(Decal*spr,vi2d spos,vi2d size) {
ObjectLoadInfo(Decal*spr,vi2d spos,vi2d size,Pixel col=WHITE) {
this->spr=spr;
this->hascut=true;
this->spos=spos;
this->size=size;
this->col=col;
}
};
@ -165,21 +169,25 @@ class Object{
bool flipped=false;
bool hascut=false;
bool tempObj=false;
Pixel col;
Object(){};
Object(Decal*spr) {
Object(Decal*spr,Pixel col=WHITE) {
this->spr=spr;
this->col=col;
}
Object(Decal*spr,Animation*anim) {
Object(Decal*spr,Animation*anim,Pixel col=WHITE) {
this->spr=spr;
this->anim=anim;
this->hasAnim=true;
updateAnimationsList.push_back(anim);
this->col=col;
}
Object(Decal*spr,vi2d spos,vi2d size) {
Object(Decal*spr,vi2d spos,vi2d size,Pixel col=WHITE) {
this->spr=spr;
this->hascut=true;
this->spos=spos;
this->size=size;
this->col=col;
}
};
@ -221,10 +229,10 @@ class WEATHER_POWER{
int damage;
int damageRoll;
int range;
int playerOwnCount;
int playerOwnCount=0;
Pixel bgcol;
Pixel textcol;
int effectTime;
int effectTime=0;
ParticleEffect*effect;
WEATHER_POWER(std::string name,std::string desc,Animation*icon,Animation*effect,int dmg,int dmgRoll,int range,Pixel bgcol,Pixel textcol,int effectTime,ParticleEffect*parteff) {
this->description=desc;
@ -243,7 +251,7 @@ class WEATHER_POWER{
class Entity{
public:
bool ally;
bool ally=false;
int hp;
int maxhp;
Decal*spr;
@ -592,7 +600,7 @@ public:
BASE_OBJECTS["SNOWSTORM_NODE"]=new ObjectLoadInfo(POWER_SNOWSTORM_DECAL,&POWER_SNOWSTORM_ANIMATION);
BASE_OBJECTS["COMPUTER"]=new ObjectLoadInfo(COMPUTER_DECAL);
BASE_OBJECTS["BROKEN_ROVER"]=new ObjectLoadInfo(BROKEN_ROVER_DECAL);
BASE_OBJECTS["NADO"]=new ObjectLoadInfo(NADO_DECAL,&NADO_ANIMATION);
BASE_OBJECTS["NADO"]=new ObjectLoadInfo(NADO_DECAL,&NADO_ANIMATION,Pixel(153, 137, 75,230));
Zone*SILICON_DEPOSIT_ZONE = new Zone({109,7},{26,9},{0,0},{WIDTH,HEIGHT},{0,0},{WIDTH,HEIGHT},{1,1},{3,3},{-30,-3},{30,3},Pixel(133, 98, 66,180),Pixel(220, 120, 90,230),300,Pixel(87, 78, 69,64));
@ -1156,11 +1164,11 @@ public:
if (PLAYER_SELECTED_TARGET==-2) {
applyPixelEffect(BATTLE_CARD_SELECTION,{PLAYER_COORDS[0],PLAYER_COORDS[1]},0);
} else {
applyPixelEffect(BATTLE_CARD_SELECTION,{CURRENT_ENCOUNTER.x+CURRENT_ENCOUNTER.entities[PLAYER_SELECTED_TARGET]->x,CURRENT_ENCOUNTER.y+CURRENT_ENCOUNTER.entities[PLAYER_SELECTED_TARGET]->y},0);
applyPixelEffect(BATTLE_CARD_SELECTION,{(float)(CURRENT_ENCOUNTER.x+CURRENT_ENCOUNTER.entities[PLAYER_SELECTED_TARGET]->x),(float)(CURRENT_ENCOUNTER.y+CURRENT_ENCOUNTER.entities[PLAYER_SELECTED_TARGET]->y)},0);
}
} else {
if (CURRENT_ENCOUNTER.entities[BATTLE_CURRENT_TURN_ENTITY]->selectedMove->damage<0) {
applyPixelEffect(CURRENT_ENCOUNTER.entities[BATTLE_CURRENT_TURN_ENTITY]->selectedMove,{CURRENT_ENCOUNTER.x+CURRENT_ENCOUNTER.entities[BATTLE_CURRENT_TURN_ENTITY]->x,CURRENT_ENCOUNTER.y+CURRENT_ENCOUNTER.entities[BATTLE_CURRENT_TURN_ENTITY]->y},0);
applyPixelEffect(CURRENT_ENCOUNTER.entities[BATTLE_CURRENT_TURN_ENTITY]->selectedMove,{(float)CURRENT_ENCOUNTER.x+CURRENT_ENCOUNTER.entities[BATTLE_CURRENT_TURN_ENTITY]->x,(float)CURRENT_ENCOUNTER.y+CURRENT_ENCOUNTER.entities[BATTLE_CURRENT_TURN_ENTITY]->y},0);
} else {
applyPixelEffect(CURRENT_ENCOUNTER.entities[BATTLE_CURRENT_TURN_ENTITY]->selectedMove,{PLAYER_COORDS[0],PLAYER_COORDS[1]},0);
}
@ -1176,7 +1184,7 @@ public:
PIXEL_EFFECT_TRANSPARENCY=(0.5*cos(((M_PI/(30.0*(ref->effectTime/120.0)))/2)*EFFECT_TIMER-M_PI)+0.5);
if (EFFECT_TIMER==30&&ref->name.compare("Seed Storm")==0) {
if (BATTLE_CURRENT_TURN_ENTITY==-1) {
effectRadius({PLAYER_COORDS[0],PLAYER_COORDS[1]},ref,true);
effectRadius({(int)PLAYER_COORDS[0],(int)PLAYER_COORDS[1]},ref,true);
} else {
effectRadius({CURRENT_ENCOUNTER.entities[BATTLE_CURRENT_TURN_ENTITY]->x+CURRENT_ENCOUNTER.x,CURRENT_ENCOUNTER.entities[BATTLE_CURRENT_TURN_ENTITY]->y+CURRENT_ENCOUNTER.y},ref,false);
}
@ -1190,12 +1198,12 @@ public:
BATTLE_DISPLAY_NUMBERS.push_back(numb);
}
if (PLAYER_SELECTED_TARGET==-2) {
effectRadius({PLAYER_COORDS[0],PLAYER_COORDS[1]},ref,true);
effectRadius({(int)PLAYER_COORDS[0],(int)PLAYER_COORDS[1]},ref,true);
} else {
effectRadius({CURRENT_ENCOUNTER.entities[PLAYER_SELECTED_TARGET]->x+CURRENT_ENCOUNTER.x,CURRENT_ENCOUNTER.entities[PLAYER_SELECTED_TARGET]->y+CURRENT_ENCOUNTER.y},ref,true);
}
} else {
effectRadius({PLAYER_COORDS[0],PLAYER_COORDS[1]},ref,false);
effectRadius({(int)PLAYER_COORDS[0],(int)PLAYER_COORDS[1]},ref,false);
}
}
if (EFFECT_TIMER>ref->effectTime) {
@ -1550,20 +1558,20 @@ public:
if (CURRENT_CUTSCENE==cutscene::NONE) {
SetDrawTarget(nullptr);
if (foodMeterVisible) {
DrawStringDecal({WIDTH-36*0.4-GetTextSize(std::to_string(foodCount)).x*1-8,meterYOffset+1},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),WHITE,{1,1});
DrawDecal({WIDTH-52*0.4,meterYOffset},FOOD_METER_DECAL,{0.4,0.4});
DrawStringDecal({(float)(WIDTH-36*0.4-GetTextSize(std::to_string(foodCount)).x*1-8),(float)(meterYOffset+1)},std::to_string(foodCount),BLACK,{1,1});
DrawStringDecal({(float)(WIDTH-36*0.4-GetTextSize(std::to_string(foodCount)).x*1-7),(float)(meterYOffset+2)},std::to_string(foodCount),WHITE,{1,1});
DrawDecal({(float)(WIDTH-52*0.4),(float)(meterYOffset)},FOOD_METER_DECAL,{0.4,0.4});
meterYOffset+=(2+48*0.4);
}
if (oxygenMeterVisible) {
DrawStringDecal({WIDTH-36*0.4-GetTextSize(std::to_string(oxygenQualityLevel)+"%").x*1-8,meterYOffset+1},std::to_string(oxygenQualityLevel)+"%",BLACK,{1,1});
DrawStringDecal({WIDTH-36*0.4-GetTextSize(std::to_string(oxygenQualityLevel)+"%").x*1-7,meterYOffset+2},std::to_string(oxygenQualityLevel)+"%",WHITE,{1,1});
DrawDecal({WIDTH-52*0.4,meterYOffset},OXYGEN_METER_DECAL,{0.4,0.4});
DrawStringDecal({(float)(WIDTH-36*0.4-GetTextSize(std::to_string(oxygenQualityLevel)+"%").x*1-8),(float)(meterYOffset+1)},std::to_string(oxygenQualityLevel)+"%",BLACK,{1,1});
DrawStringDecal({(float)(WIDTH-36*0.4-GetTextSize(std::to_string(oxygenQualityLevel)+"%").x*1-7),(float)(meterYOffset+2)},std::to_string(oxygenQualityLevel)+"%",WHITE,{1,1});
DrawDecal({(float)(WIDTH-52*0.4),(float)(meterYOffset)},OXYGEN_METER_DECAL,{0.4,0.4});
meterYOffset+=(2+48*0.4);
}
DrawPartialDecal({WIDTH/2-16+(current_playerAnim.flipped?32:0),HEIGHT/2-16},current_playerAnim.spr,current_playerAnim.getCurrentFrame(),{32,32},{current_playerAnim.flipped?-1:1,1});
DrawPartialDecal({(float)(WIDTH/2-16+(current_playerAnim.flipped?32:0)),(float)(HEIGHT/2-16)},current_playerAnim.spr,current_playerAnim.getCurrentFrame(),{32,32},{(float)(current_playerAnim.flipped?-1:1),1});
if (IN_BATTLE_ENCOUNTER&&BATTLE_ENTRY_TIMER<45) {
DrawStringDecal({WIDTH/2-16+(current_playerAnim.flipped?32:0)+8,HEIGHT/2-16-sin(frameCount*12/60.0)*4-12},"!!",RED);
DrawStringDecal({(float)(WIDTH/2-16+(current_playerAnim.flipped?32:0)+8),(float)(HEIGHT/2-16-sin(frameCount*12/60.0)*4-12)},"!!",RED);
}
SetDrawTarget(2);
}
@ -1592,8 +1600,8 @@ public:
if (PLAYER_SELECTED_TARGET>=0) {
DrawWrappedText({5,5},"Target "+CURRENT_ENCOUNTER.entities[PLAYER_SELECTED_TARGET]->name+" "+(char)('A'+PLAYER_SELECTED_TARGET)+" with "+BATTLE_CARD_SELECTION->name,WIDTH-8,BLACK,{2,2});
DrawWrappedText({4,4},"Target "+CURRENT_ENCOUNTER.entities[PLAYER_SELECTED_TARGET]->name+" "+(char)('A'+PLAYER_SELECTED_TARGET)+" with "+BATTLE_CARD_SELECTION->name,WIDTH-8,WHITE,{2,2});
DrawStringDecal({WIDTH-GetTextSize("<UP> Back").x-1,HEIGHT-GetTextSize("<UP> Back").y-1},"<UP> Back",BLACK,{1,1});
DrawStringDecal({WIDTH-GetTextSize("<UP> Back").x-2,HEIGHT-GetTextSize("<UP> Back").y-2},"<UP> Back",GREEN,{1,1});
DrawStringDecal({(float)(WIDTH-GetTextSize("<UP> Back").x-1),(float)(HEIGHT-GetTextSize("<UP> Back").y-1)},"<UP> Back",BLACK,{1,1});
DrawStringDecal({(float)(WIDTH-GetTextSize("<UP> Back").x-2),(float)(HEIGHT-GetTextSize("<UP> Back").y-2)},"<UP> Back",GREEN,{1,1});
}
}break;
case battle::WAIT_TURN_ANIMATION:{
@ -1605,8 +1613,8 @@ public:
}break;
}
if (IN_BATTLE_ENCOUNTER||(!CUTSCENE_ACTIVE&&PLAYER_HP!=PLAYER_MAXHP)) {
DrawStringDecal({4+1,HEIGHT-10-GetTextSize("HP:").y+1},"HP: "+std::to_string(PLAYER_HP),BLACK);
DrawStringDecal({4,HEIGHT-10-GetTextSize("HP:").y},"HP: "+std::to_string(PLAYER_HP));
DrawStringDecal({4+1,(float)(HEIGHT-10-GetTextSize("HP:").y+1)},"HP: "+std::to_string(PLAYER_HP),BLACK);
DrawStringDecal({4,(float)(HEIGHT-10-GetTextSize("HP:").y)},"HP: "+std::to_string(PLAYER_HP));
DrawHealthbar({2,HEIGHT-10},WIDTH/2,(float)PLAYER_HP/PLAYER_MAXHP,BLACK);
for (auto&numb:BATTLE_DISPLAY_NUMBERS) {
std::string display=((numb->number>0)?"-"+std::to_string(numb->number):"+"+std::to_string(numb->number*-1));
@ -1625,9 +1633,9 @@ public:
SetDrawTarget(1);
for (int i=0;i<PIXEL_LIMIT;i++) {
if (pixels[i]->size.x==1&&pixels[i]->size.y==1) {
Draw(pixels[i]->pos,{pixels[i]->r,pixels[i]->g,pixels[i]->b,pixels[i]->a});
Draw(pixels[i]->pos,{(uint8_t)(pixels[i]->r),(uint8_t)(pixels[i]->g),(uint8_t)(pixels[i]->b),(uint8_t)(pixels[i]->a)});
} else {
FillRectDecal(pixels[i]->pos,pixels[i]->size,{pixels[i]->r,pixels[i]->g,pixels[i]->b,pixels[i]->a});
FillRectDecal(pixels[i]->pos,pixels[i]->size,{(uint8_t)(pixels[i]->r),(uint8_t)(pixels[i]->g),(uint8_t)(pixels[i]->b),(uint8_t)(pixels[i]->a)});
}
}
FillRectDecal({0,0},{WIDTH,HEIGHT},Pixel(ORIGINAL_FOREGROUND_EFFECT_COLOR.r,ORIGINAL_FOREGROUND_EFFECT_COLOR.g,ORIGINAL_FOREGROUND_EFFECT_COLOR.b,ORIGINAL_FOREGROUND_EFFECT_COLOR.a*PIXEL_EFFECT_TRANSPARENCY));
@ -1673,26 +1681,26 @@ public:
tileRot++;
}
if ((int)(xOffset+x)>=0&&(int)(xOffset+x)<MAP_WIDTH&&(int)(yOffset+y)>=0&&(int)(yOffset+y)<MAP_HEIGHT) {
DrawPartialRotatedDecal({(x-(PLAYER_COORDS[0]-(int)PLAYER_COORDS[0])+1)*32-16,(y-(PLAYER_COORDS[1]-(int)PLAYER_COORDS[1])+1)*32},TILES,tileRot*M_PI_2,{16,16},{tileX*32,0},{32,32},{1,1},TILE_COLORS[MAP[(int)(yOffset+y)][(int)(xOffset+x)]]);
DrawPartialRotatedDecal({(float)((x-(PLAYER_COORDS[0]-(int)PLAYER_COORDS[0])+1)*32-16),(float)((y-(PLAYER_COORDS[1]-(int)PLAYER_COORDS[1])+1)*32)},TILES,tileRot*M_PI_2,{16,16},{(float)(tileX*32),0},{32,32},{1,1},TILE_COLORS[MAP[(int)(yOffset+y)][(int)(xOffset+x)]]);
}
}
}
for (auto&obj:OBJECTS) {
if (obj->spr!=NULL) {
if (obj->name.compare("PLANT")==0) {
DrawPartialDecal({(obj->x-PLAYER_COORDS[0])*32+WIDTH/2,(obj->y-PLAYER_COORDS[1])*32+HEIGHT/2},{32,32},obj->spr,{getPlantStatus(obj->x,obj->y)*32,0},{32,32});
DrawPartialDecal({(float)((obj->x-PLAYER_COORDS[0])*32+WIDTH/2),(float)((obj->y-PLAYER_COORDS[1])*32+HEIGHT/2)},{32,32},obj->spr,{(float)(getPlantStatus(obj->x,obj->y)*32),0},{32,32});
} else {
if (obj->name.find("NODE")!=std::string::npos) {
DrawDecal({(obj->x-PLAYER_COORDS[0])*32+WIDTH/2-32+18,(obj->y-PLAYER_COORDS[1])*32+HEIGHT/2-32+26},WEATHERNODE_EFFECT_DECAL);
DrawPartialDecal({(obj->x-PLAYER_COORDS[0])*32+WIDTH/2-16*(float)sin(frameCount*2/60.0)+16,(obj->y-PLAYER_COORDS[1])*32+HEIGHT/2},obj->anim->spr,{obj->anim->getCurrentFrame().x,obj->anim->getCurrentFrame().y},{obj->anim->width,obj->anim->height},{(float)sin(frameCount*2/60.0),1},Pixel((float)sin(frameCount*4/60.0)*55+200,(float)sin(frameCount*4/60.0)*55+200,(float)sin(frameCount*4/60.0+M_PI)+65*125,255));
DrawPartialDecal({(float)((obj->x-PLAYER_COORDS[0])*32+WIDTH/2-16*(float)sin(frameCount*2/60.0)+16),(float)((obj->y-PLAYER_COORDS[1])*32+HEIGHT/2)},obj->anim->spr,{(float)(obj->anim->getCurrentFrame().x),(float)(obj->anim->getCurrentFrame().y)},{(float)(obj->anim->width),(float)(obj->anim->height)},{(float)sin(frameCount*2/60.0),1},Pixel((float)sin(frameCount*4/60.0)*55+200,(float)sin(frameCount*4/60.0)*55+200,(float)sin(frameCount*4/60.0+M_PI)+65*125,255));
} else
if (obj->hasAnim) {
DrawPartialDecal({(obj->x-PLAYER_COORDS[0])*32+WIDTH/2+(obj->anim->flipped?obj->anim->width:0),(obj->y-PLAYER_COORDS[1])*32+HEIGHT/2},obj->anim->spr,{obj->anim->getCurrentFrame().x,obj->anim->getCurrentFrame().y},{obj->anim->width,obj->anim->height},{obj->anim->flipped?-1:1,1});
DrawPartialDecal({(obj->x-PLAYER_COORDS[0])*32+WIDTH/2+(obj->anim->flipped?obj->anim->width:0),(obj->y-PLAYER_COORDS[1])*32+HEIGHT/2},obj->anim->spr,{(float)(obj->anim->getCurrentFrame().x),(float)(obj->anim->getCurrentFrame().y)},{(float)(obj->anim->width),(float)(obj->anim->height)},{(float)(obj->anim->flipped?-1:1),1},obj->col);
} else
if (obj->hascut) {
DrawPartialDecal({(obj->x-PLAYER_COORDS[0])*32+WIDTH/2+(obj->flipped?obj->size.x:0),(obj->y-PLAYER_COORDS[1])*32+HEIGHT/2},obj->spr,obj->spos,obj->size,{obj->flipped?-1:1,1});
DrawPartialDecal({(obj->x-PLAYER_COORDS[0])*32+WIDTH/2+(obj->flipped?obj->size.x:0),(obj->y-PLAYER_COORDS[1])*32+HEIGHT/2},obj->spr,obj->spos,obj->size,{(float)(obj->flipped?-1:1),1},obj->col);
} else {
DrawDecal({(obj->x-PLAYER_COORDS[0])*32+WIDTH/2,(obj->y-PLAYER_COORDS[1])*32+HEIGHT/2},obj->spr);
DrawDecal({(obj->x-PLAYER_COORDS[0])*32+WIDTH/2,(obj->y-PLAYER_COORDS[1])*32+HEIGHT/2},obj->spr,{1,1},obj->col);
}
}
} else
@ -1704,8 +1712,8 @@ public:
int targetX=-1,targetY=-1;
for (auto&ent:enc.entities) {
if (BATTLE_STATE==battle::PLAYER_TARGET_SELECTION&&PLAYER_SELECTED_TARGET>=0&&CURRENT_ENCOUNTER.entities[PLAYER_SELECTED_TARGET]->hp>0&&CURRENT_ENCOUNTER.entities[PLAYER_SELECTED_TARGET]->x==ent->x&&CURRENT_ENCOUNTER.entities[PLAYER_SELECTED_TARGET]->y==ent->y) {
DrawDecal({(enc.x+ent->x-PLAYER_COORDS[0])*32+WIDTH/2,(enc.y+ent->y-PLAYER_COORDS[1])*32+HEIGHT/2},TARGETING_CIRCLE,{ent->spr->sprite->width/32,ent->spr->sprite->height/32},{255,210,0,255});
DrawDecal({(enc.x+ent->x-PLAYER_COORDS[0])*32+WIDTH/2,(enc.y+ent->y-PLAYER_COORDS[1])*32+HEIGHT/2},ent->spr,{1,1},{(0.5*(float)sin(frameCount*4/60.0)+0.5)*80+175,(0.5*(float)sin(frameCount*4/60.0)+0.5)*80+175,(0.5*(float)sin(frameCount*4/60.0)+0.5)*80+175,255});
DrawDecal({(enc.x+ent->x-PLAYER_COORDS[0])*32+WIDTH/2,(enc.y+ent->y-PLAYER_COORDS[1])*32+HEIGHT/2},TARGETING_CIRCLE,{(float)(ent->spr->sprite->width/32),(float)(ent->spr->sprite->height/32)},{255,210,0,255});
DrawDecal({(enc.x+ent->x-PLAYER_COORDS[0])*32+WIDTH/2,(enc.y+ent->y-PLAYER_COORDS[1])*32+HEIGHT/2},ent->spr,{1,1},{(uint8_t)((0.5*(float)sin(frameCount*4/60.0)+0.5)*80+175),(uint8_t)((0.5*(float)sin(frameCount*4/60.0)+0.5)*80+175),(uint8_t)((0.5*(float)sin(frameCount*4/60.0)+0.5)*80+175),255});
targetX=ent->x;targetY=ent->y;
} else {
if (ent->hp>0) {
@ -1717,7 +1725,7 @@ public:
}
}
if (targetX!=-1&&targetY!=-1) {
DrawDecal({(enc.x+targetX-PLAYER_COORDS[0])*32+WIDTH/2-BATTLE_CARD_SELECTION->range+16,(enc.y+targetY-PLAYER_COORDS[1])*32+HEIGHT/2-BATTLE_CARD_SELECTION->range+16},TARGETING_RANGE_CIRCLE,{BATTLE_CARD_SELECTION->range*2/32.0,BATTLE_CARD_SELECTION->range*2/32.0},{255,60,0,(0.5*(float)sin(frameCount*4/60.0)+0.5)*100});
DrawDecal({(enc.x+targetX-PLAYER_COORDS[0])*32+WIDTH/2-BATTLE_CARD_SELECTION->range+16,(enc.y+targetY-PLAYER_COORDS[1])*32+HEIGHT/2-BATTLE_CARD_SELECTION->range+16},TARGETING_RANGE_CIRCLE,{(float)(BATTLE_CARD_SELECTION->range*2/32.0),(float)(BATTLE_CARD_SELECTION->range*2/32.0)},{255,60,0,(uint8_t)((0.5*(float)sin(frameCount*4/60.0)+0.5)*100)});
}
}
}
@ -1731,17 +1739,17 @@ public:
const int TERMINAL_WIDTH=7;
for (int i=0;i<26;i++) {
std::string s(1,(char)('A'+i));
DrawStringDecal({(32*(i%TERMINAL_WIDTH))+16,16*(i/TERMINAL_WIDTH)+HEIGHT/2},s);
DrawStringDecal({(float)((32*(i%TERMINAL_WIDTH))+16),(float)(16*(i/TERMINAL_WIDTH)+HEIGHT/2)},s);
}
std::string backspace(1,(char)('<'));
DrawStringDecal({(32*(26%TERMINAL_WIDTH))+16,16*(26/TERMINAL_WIDTH)+HEIGHT/2},backspace);
DrawStringDecal({(32*(27%TERMINAL_WIDTH))+16,16*(27/TERMINAL_WIDTH)+HEIGHT/2},"ENTER");
DrawStringDecal({(32*((TERMINAL_SELECTED_CHAR)%TERMINAL_WIDTH))+8,16*(TERMINAL_SELECTED_CHAR/TERMINAL_WIDTH)+HEIGHT/2},">");
DrawStringDecal({(float)((32*(26%TERMINAL_WIDTH))+16),(float)(16*(26/TERMINAL_WIDTH)+HEIGHT/2)},backspace);
DrawStringDecal({(float)((32*(27%TERMINAL_WIDTH))+16),(float)(16*(27/TERMINAL_WIDTH)+HEIGHT/2)},"ENTER");
DrawStringDecal({(float)((32*((TERMINAL_SELECTED_CHAR)%TERMINAL_WIDTH))+8),(float)(16*(TERMINAL_SELECTED_CHAR/TERMINAL_WIDTH)+HEIGHT/2)},">");
std::string terminal_name=TERMINAL_INPUT;
for (int i=0;i<MAX_TERMINAL_NAME_LENGTH-TERMINAL_INPUT.length();i++) {
terminal_name+="*";
}
DrawStringDecal({WIDTH/2-GetTextSize(terminal_name).x*2/2,HEIGHT/3-GetTextSize(terminal_name).y*2/2}, terminal_name,olc::WHITE,{2.0,2.0});
DrawStringDecal({(float)(WIDTH/2-GetTextSize(terminal_name).x*2/2),(float)(HEIGHT/3-GetTextSize(terminal_name).y*2/2)}, terminal_name,olc::WHITE,{2.0,2.0});
GradientFillRectDecal({0,0},{WIDTH/2,HEIGHT/2},{20, 28, 22,ALPHA_SCREEN1},{20, 28, 22,ALPHA_SCREEN1},{20, 28, 22,ALPHA_SCREEN2},{20, 28, 22,ALPHA_SCREEN1});
GradientFillRectDecal({WIDTH/2,0},{WIDTH/2,HEIGHT/2},{20, 28, 22,ALPHA_SCREEN1},{20, 28, 22,ALPHA_SCREEN2},{20, 28, 22,ALPHA_SCREEN1},{20, 28, 22,ALPHA_SCREEN1});
@ -1859,6 +1867,7 @@ public:
std::string split3 = data.substr(data.find(';',data.find(";")+1)+1,data.length()-(data.find(';',data.find(";")+1)+1));
if (split3.compare("NULL")!=0) {
obj->spr=BASE_OBJECTS[split3]->spr;
obj->col=BASE_OBJECTS[split3]->col;
if (BASE_OBJECTS[split3]->hasanim) {
obj->hasAnim=true;
obj->anim=BASE_OBJECTS[split3]->anim;
@ -1965,7 +1974,7 @@ public:
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*dimColor,data->bgcol*darknessFactor*dimColor,data->bgcol*darknessFactor*dimColor,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*dimColor,data->bgcol*darknessFactor*dimColor,data->bgcol*darknessFactor*dimColor);
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*dimColor);
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(),{(float)(data->anim->width),(float)(data->anim->height)},{3*scale.x,3*scale.y},WHITE*darknessFactor*dimColor);
for (int x=-1;x<=1;x++) {
for (int y=-1;y<=1;y++) {
if (x!=0&&y!=0) {
@ -1979,11 +1988,11 @@ public:
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({(float)((WIDTH/6+4+WIDTH/3*2-8-GetTextSizeProp(std::to_string(data->playerOwnCount)+" uses remaining.").x*1.5+x)*scale.x+offset.x),(float)((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,{(float)(1.5*scale.x),(float)(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.",(data->playerOwnCount==0)?olc::RED:olc::WHITE*darknessFactor,{1.5*scale.x,1.5*scale.y});
DrawStringPropDecal({(float)((WIDTH/6+4+WIDTH/3*2-8-GetTextSizeProp(std::to_string(data->playerOwnCount)+" uses remaining.").x*1.5)*scale.x+offset.x),(float)((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.",(data->playerOwnCount==0)?olc::RED:olc::WHITE*darknessFactor,{(float)(1.5*scale.x),(float)(1.5*scale.y)});
}
@ -2012,7 +2021,7 @@ public:
for (int i=0;i<CURRENT_ENCOUNTER.entities.size();i++) {
finalDamage=power->damage+rand()%power->damageRoll*sign(power->damage);
Entity*ent=CURRENT_ENCOUNTER.entities[i];
if (ent->hp>0&&distancetoCoords({(ent->x+CURRENT_ENCOUNTER.x)*32,(ent->y+CURRENT_ENCOUNTER.y)*32},coords*32)<=power->range) {
if (ent->hp>0&&distancetoCoords({(float)((ent->x+CURRENT_ENCOUNTER.x)*32),(float)((ent->y+CURRENT_ENCOUNTER.y)*32)},coords*32)<=power->range) {
ent->hp=std::clamp(ent->hp-finalDamage,0,ent->maxhp);
DisplayNumber*numb = new DisplayNumber(finalDamage,ent->x+CURRENT_ENCOUNTER.x,ent->y+CURRENT_ENCOUNTER.y,frameCount);
BATTLE_DISPLAY_NUMBERS.push_back(numb);
@ -2026,8 +2035,8 @@ public:
for (int i=0;i<CURRENT_ENCOUNTER.entities.size();i++) {
finalDamage=power->damage+rand()%power->damageRoll*sign(power->damage);
Entity*ent=CURRENT_ENCOUNTER.entities[i];
std::cout<<"Distance was "<<distancetoCoords({(ent->x+CURRENT_ENCOUNTER.x)*32,(ent->y+CURRENT_ENCOUNTER.y)*32},coords*32)<<"\n";
if (ent->hp>0&&distancetoCoords({(ent->x+CURRENT_ENCOUNTER.x)*32,(ent->y+CURRENT_ENCOUNTER.y)*32},coords*32)<=power->range) {
std::cout<<"Distance was "<<distancetoCoords({(float)((ent->x+CURRENT_ENCOUNTER.x)*32),(float)((ent->y+CURRENT_ENCOUNTER.y)*32)},coords*32)<<"\n";
if (ent->hp>0&&distancetoCoords({(float)((ent->x+CURRENT_ENCOUNTER.x)*32),(float)((ent->y+CURRENT_ENCOUNTER.y)*32)},coords*32)<=power->range) {
ent->hp=std::clamp(ent->hp-finalDamage,0,ent->maxhp);
DisplayNumber*numb = new DisplayNumber(finalDamage,ent->x+CURRENT_ENCOUNTER.x,ent->y+CURRENT_ENCOUNTER.y,frameCount);
BATTLE_DISPLAY_NUMBERS.push_back(numb);
@ -2209,7 +2218,7 @@ public:
}
vf2d GetMapFileCoords(int ln,int col) {
return {col-1,ln-3};
return {(float)col-1,(float)ln-3};
}
//Basically, click on a spot in the text editor and this function translates it into the proper teleport coords so you don't have to.

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 303 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.
Loading…
Cancel
Save