Add Sound wave Engine

Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
master
sigonasr2 2 years ago
parent 3df180280e
commit 5a153c60c0
  1. 43
      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
  6. BIN
      assets/SeasonsOfLoneliness.wav
  7. BIN
      assets/X.X.png
  8. 1963
      soundwaveEngine.h

@ -4,19 +4,21 @@
#define OLC_PGEX_SPLASHSCREEN
#include "splash.h"
#include <queue>
#define OLC_SOUNDWAVE
#include "soundwaveEngine.h"
using namespace olc;
//#define TEST_MAP1 //Toggle to just play around on map 1.
//#define TEST_MAP2 //Toggle on to just play around on map 2.
#define SKIP_INTRO true
#define SKIP_CHAPTER1 true
#define SKIP_INTRO false
#define SKIP_CHAPTER1 false
#define SKIP_CHAPTER2 false
#define SKIP_CHAPTER3 false
#define STARTING_MAP "assets/maps/map1"
#define STARTING_STATE CUTSCENE_1
#define STARTING_STATE CUTSCENE_3
#define MOVE_SPD 0.075
#define PLAYER_X 14
#define PLAYER_Y 4
@ -368,6 +370,7 @@ public:
public:
sound::WaveEngine engine;
GAMESTATE GAME_STATE=STARTING_STATE;
int textInd=0;
int cursorX=0;
@ -503,6 +506,7 @@ public:
Zone*ACTIVE_ZONE=nullptr;
std::vector<vi2d>REPAIRED_ROVERS;
std::string CONSOLE_REF_TEXT;
bool SOUND_IS_PLAYING=false;
Decal*DOME_DECAL,*FOOD_METER_DECAL,*OXYGEN_METER_DECAL,*PLANT_DECAL,
@ -521,6 +525,9 @@ public:
std::vector<WEATHER_POWER*>MOVESET_X_X;
std::vector<WEATHER_POWER*>MOVESET_XMINION;
sound::Wave SONG_MAIN;
std::queue<int> turnOrder;
#define MAX_PIXELS 500
@ -530,6 +537,7 @@ public:
{
SetPixelMode(Pixel::ALPHA);
ConsoleCaptureStdOut(true);
engine.InitialiseAudio();
#define LAYERS 3 //How many layers exist.
for (int i=1;i<LAYERS;i++) {
@ -554,6 +562,9 @@ public:
}
SONG_MAIN = sound::Wave("./assets/SeasonsOfLoneliness.wav");
//ConsoleShow(F1,false);
// Called once at the start, so create things here
TILES=new Decal(new Sprite("assets/tiles.png"));
@ -1208,7 +1219,7 @@ public:
int amountGained=rand()%4+2;
HAILSTORM->playerOwnCount+=amountGained;
std::cout<<"Increased HAILSTORM power inventory count by "<<amountGained<<".\n";
COLLECTED_ITEMS.push_back({obj->x,obj->y});
COLLECTED_ITEMS.push_back({(int)obj->x,(int)obj->y});
OBJECTS.erase(OBJECTS.begin()+i--);
delete obj;
performCropUpdate(8);
@ -1218,7 +1229,7 @@ public:
int amountGained=rand()%4+2;
HURRICANE->playerOwnCount+=amountGained;
std::cout<<"Increased HURRICANE power inventory count by "<<amountGained<<".\n";
COLLECTED_ITEMS.push_back({obj->x,obj->y});
COLLECTED_ITEMS.push_back({(int)obj->x,(int)obj->y});
OBJECTS.erase(OBJECTS.begin()+i--);
delete obj;
performCropUpdate(8);
@ -1228,7 +1239,7 @@ public:
int amountGained=rand()%4+2;
METEOR_RAIN->playerOwnCount+=amountGained;
std::cout<<"Increased METEORSHOWER power inventory count by "<<amountGained<<".\n";
COLLECTED_ITEMS.push_back({obj->x,obj->y});
COLLECTED_ITEMS.push_back({(int)obj->x,(int)obj->y});
OBJECTS.erase(OBJECTS.begin()+i--);
delete obj;
performCropUpdate(8);
@ -1238,7 +1249,7 @@ public:
int amountGained=rand()%4+2;
METEOR_STORM->playerOwnCount+=amountGained;
std::cout<<"Increased METEORSTORM power inventory count by "<<amountGained<<".\n";
COLLECTED_ITEMS.push_back({obj->x,obj->y});
COLLECTED_ITEMS.push_back({(int)obj->x,(int)obj->y});
OBJECTS.erase(OBJECTS.begin()+i--);
delete obj;
performCropUpdate(8);
@ -1248,7 +1259,7 @@ public:
int amountGained=rand()%4+2;
SNOWSTORM->playerOwnCount+=amountGained;
std::cout<<"Increased SNOWSTORM power inventory count by "<<amountGained<<".\n";
COLLECTED_ITEMS.push_back({obj->x,obj->y});
COLLECTED_ITEMS.push_back({(int)obj->x,(int)obj->y});
OBJECTS.erase(OBJECTS.begin()+i--);
delete obj;
performCropUpdate(8);
@ -1258,7 +1269,7 @@ public:
int amountGained=rand()%4+2;
PETAL_STORM->playerOwnCount+=amountGained;
std::cout<<"Increased PETALSTORM power inventory count by "<<amountGained<<".\n";
COLLECTED_ITEMS.push_back({obj->x,obj->y});
COLLECTED_ITEMS.push_back({(int)obj->x,(int)obj->y});
OBJECTS.erase(OBJECTS.begin()+i--);
delete obj;
performCropUpdate(8);
@ -1267,7 +1278,7 @@ public:
if (obj->name.compare("SILICON_PIECE")==0&&collidesWithPlayer(obj)) {
GAME_STATE=COLLECTED_SILICON;
DisplayMessageBox(14);
COLLECTED_ITEMS.push_back({obj->x,obj->y});
COLLECTED_ITEMS.push_back({(int)obj->x,(int)obj->y});
OBJECTS.erase(OBJECTS.begin()+i--);
delete obj;
} else
@ -1694,6 +1705,12 @@ public:
}break;
}
if (GAME_STATE==CUTSCENE_3&&!SOUND_IS_PLAYING) {
engine.SetOutputVolume(1);
engine.PlayWaveform(&SONG_MAIN,true);
SOUND_IS_PLAYING=true;
}
switch (GAME_STATE) {
case CUTSCENE_1:
case CUTSCENE_3:
@ -1877,6 +1894,10 @@ public:
} else {
FillRectDecal({(float)(48+(cursorX)*16%(WIDTH-32)),(float)(GetTextSize(CUTSCENE_CONSOLE_TEXT).y*2+((cursorX==28)?16:0))},{4*2,8*2},Pixel(100, 10, 255,(0.5*sin(frameCount*4/60.0)+0.5)*256));
}
DrawStringDecal({(float)(WIDTH/2-GetTextSize("NEW GAME").x*2/2),(float)(HEIGHT/2-GetTextSize("NEW GAME").y*2)},"NEW GAME",WHITE,{2,2});
DrawStringDecal({(float)(WIDTH/2-GetTextSize("CONTINUE").x*2/2),(float)(HEIGHT/2-GetTextSize("CONTINUE").y*2+32)},"CONTINUE",WHITE,{2,2});
DrawStringDecal({(float)(WIDTH/2-GetTextSize("MUTE SOUND").x*2/2),(float)(HEIGHT/2-GetTextSize("MUTE SOUND").y*2+64)},"MUTE SOUND",WHITE,{2,2});
DrawStringDecal({(float)(WIDTH/2-GetTextSize("EXIT").x*2/2),(float)(HEIGHT/2-GetTextSize("EXIT").y*2+96)},"EXIT",WHITE,{2,2});
GradientFillRectDecal({0,0},{WIDTH/2,HEIGHT/2},{100, 10, 255,ALPHA_SCREEN1},{100, 10, 255,ALPHA_SCREEN1},{100, 10, 255,ALPHA_SCREEN2},{100, 10, 255,ALPHA_SCREEN1});
GradientFillRectDecal({WIDTH/2,0},{WIDTH/2,HEIGHT/2},{100, 10, 255,ALPHA_SCREEN1},{100, 10, 255,ALPHA_SCREEN2},{100, 10, 255,ALPHA_SCREEN1},{100, 10, 255,ALPHA_SCREEN1});
GradientFillRectDecal({0,HEIGHT/2},{WIDTH/2,HEIGHT/2},{100, 10, 255,ALPHA_SCREEN1},{100, 10, 255,ALPHA_SCREEN1},{100, 10, 255,ALPHA_SCREEN1},{100, 10, 255,ALPHA_SCREEN2});
@ -1884,7 +1905,7 @@ public:
}break;
case LATER_THAT_NIGHTFADEIN:
case LATER_THAT_NIGHTFADEOUT:{
DrawDecal({WIDTH/2-LATER_THAT_NIGHT_DECAL->sprite->width/2,HEIGHT/2-LATER_THAT_NIGHT_DECAL->sprite->height/2},LATER_THAT_NIGHT_DECAL);
DrawDecal({(float)(WIDTH/2-LATER_THAT_NIGHT_DECAL->sprite->width/2),(float)(HEIGHT/2-LATER_THAT_NIGHT_DECAL->sprite->height/2)},LATER_THAT_NIGHT_DECAL);
}break;
}
switch (BATTLE_STATE) {

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 303 KiB

After

Width:  |  Height:  |  Size: 10 MiB

File diff suppressed because one or more lines are too long

Binary file not shown.

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 23 KiB

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save