|
|
|
@ -48,7 +48,7 @@ public: |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public: |
|
|
|
|
GAMESTATE GAME_STATE=CUTSCENE_1; |
|
|
|
|
GAMESTATE GAME_STATE=GAMEWORLD; |
|
|
|
|
int textInd=0; |
|
|
|
|
int cursorX=0; |
|
|
|
|
int transitionTime=0; |
|
|
|
@ -257,16 +257,16 @@ public: |
|
|
|
|
|
|
|
|
|
if (!CUTSCENE_ACTIVE&&!messageBoxVisible) { |
|
|
|
|
if (GetKey(olc::D).bHeld||GetKey(olc::RIGHT).bHeld) { |
|
|
|
|
PLAYER_COORDS[0]=clamp(PLAYER_COORDS[0]+MOVE_SPD,0.0,(double)MAP_WIDTH); |
|
|
|
|
PLAYER_COORDS[0]=clamp(PLAYER_COORDS[0]+MOVE_SPD,0.1,(double)MAP_WIDTH); |
|
|
|
|
} |
|
|
|
|
if (GetKey(olc::A).bHeld||GetKey(olc::LEFT).bHeld) { |
|
|
|
|
PLAYER_COORDS[0]=clamp(PLAYER_COORDS[0]-MOVE_SPD,0.0,(double)MAP_WIDTH); |
|
|
|
|
PLAYER_COORDS[0]=clamp(PLAYER_COORDS[0]-MOVE_SPD,0.1,(double)MAP_WIDTH); |
|
|
|
|
} |
|
|
|
|
if (GetKey(olc::W).bHeld||GetKey(olc::UP).bHeld) { |
|
|
|
|
PLAYER_COORDS[1]=clamp(PLAYER_COORDS[1]-MOVE_SPD,0.0,(double)MAP_HEIGHT); |
|
|
|
|
PLAYER_COORDS[1]=clamp(PLAYER_COORDS[1]-MOVE_SPD,0.1,(double)MAP_HEIGHT); |
|
|
|
|
} |
|
|
|
|
if (GetKey(olc::S).bHeld||GetKey(olc::DOWN).bHeld) { |
|
|
|
|
PLAYER_COORDS[1]=clamp(PLAYER_COORDS[1]+MOVE_SPD,0.0,(double)MAP_HEIGHT); |
|
|
|
|
PLAYER_COORDS[1]=clamp(PLAYER_COORDS[1]+MOVE_SPD,0.1,(double)MAP_HEIGHT); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -442,11 +442,22 @@ public: |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void DrawGameWorld() { |
|
|
|
|
for (int y=-1;y<=HEIGHT/32;y++) { |
|
|
|
|
for (int x=-1;x<=WIDTH/32;x++) { |
|
|
|
|
for (int y=-1;y<=HEIGHT/32+1;y++) { |
|
|
|
|
for (int x=-1;x<=WIDTH/32+1;x++) { |
|
|
|
|
float xOffset=PLAYER_COORDS[0]-(WIDTH/32/2); |
|
|
|
|
float yOffset=PLAYER_COORDS[1]-(HEIGHT/32/2); |
|
|
|
|
DrawPartialDecal({(x-(PLAYER_COORDS[0]-(int)PLAYER_COORDS[0]))*32,(y-(PLAYER_COORDS[1]-(int)PLAYER_COORDS[1]))*32},{32,32},TILES,{0,0},{32,32},TILE_COLORS[MAP[clamp((int)(yOffset+y),0,MAP_HEIGHT-1)][clamp((int)(xOffset+x),0,MAP_WIDTH-1)]]); |
|
|
|
|
srand((int)(yOffset+y)*MAP_WIDTH+(int)(xOffset+x)); |
|
|
|
|
int tileX=0; |
|
|
|
|
int tileRot=0; |
|
|
|
|
while (tileX<3&&rand()%4==0) { |
|
|
|
|
tileX++; |
|
|
|
|
} |
|
|
|
|
while (tileRot<3&&rand()%8<5) { |
|
|
|
|
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]))*32,(y-(PLAYER_COORDS[1]-(int)PLAYER_COORDS[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)]]); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
for (auto&obj:OBJECTS) { |
|
|
|
|