summaryrefslogtreecommitdiff
path: root/src/state.c
diff options
context:
space:
mode:
authorjussi2022-05-31 18:05:44 +0300
committerjussi2022-05-31 18:05:44 +0300
commitc106785ae5b446ad9460843ee57f823abacd553f (patch)
tree2758bc9cf63b6d5990e2d9436b10d31e50a56ccd /src/state.c
parentb1bb77e1398b2f73623ef8c1e9cb2d7adbdea139 (diff)
downloadreilua-enhanced-c106785ae5b446ad9460843ee57f823abacd553f.tar.gz
reilua-enhanced-c106785ae5b446ad9460843ee57f823abacd553f.tar.bz2
reilua-enhanced-c106785ae5b446ad9460843ee57f823abacd553f.zip
Wave and more sound functions.
Diffstat (limited to 'src/state.c')
-rw-r--r--src/state.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/state.c b/src/state.c
index 7a3ba32..5129748 100644
--- a/src/state.c
+++ b/src/state.c
@@ -33,6 +33,10 @@ bool stateInit( const char *exePath ) {
state->fontAlloc = ALLOC_PAGE_SIZE;
state->fontCount = 1;
state->fonts = malloc( state->fontAlloc * sizeof( Font* ) );
+ /* Wavess. */
+ state->waveAlloc = ALLOC_PAGE_SIZE;
+ state->waveCount = 0;
+ state->waves = malloc( state->waveAlloc * sizeof( Wave* ) );
/* Sounds. */
state->soundAlloc = ALLOC_PAGE_SIZE;
state->soundCount = 0;
@@ -74,6 +78,7 @@ bool stateInit( const char *exePath ) {
state->images[i] = NULL;
state->textures[i] = NULL;
state->renderTextures[i] = NULL;
+ state->waves[i] = NULL;
state->sounds[i] = NULL;
state->camera2Ds[i] = NULL;
state->camera3Ds[i] = NULL;
@@ -136,6 +141,12 @@ void stateFree() {
free( state->fonts[i] );
}
}
+ for ( int i = 0; i < state->waveCount; ++i ) {
+ if ( state->waves[i] != NULL ) {
+ UnloadWave( *state->waves[i] );
+ free( state->waves[i] );
+ }
+ }
for ( int i = 0; i < state->soundCount; ++i ) {
if ( state->sounds[i] != NULL ) {
UnloadSound( *state->sounds[i] );
@@ -208,6 +219,7 @@ void stateFree() {
free( state->textures );
free( state->renderTextures );
free( state->fonts );
+ free( state->waves );
free( state->sounds );
free( state->camera2Ds );
free( state->camera3Ds );
@@ -217,5 +229,6 @@ void stateFree() {
free( state->animations );
free( state->shaders );
free( state->lights );
+ free( state->exePath );
free( state );
}