event fix..?

This commit is contained in:
shweet 2024-08-30 01:18:18 -04:00
parent fe421727d0
commit f0858189e2
6 changed files with 42 additions and 22 deletions

View File

@ -21,14 +21,13 @@ random_f32(void)
f32
random_f32_in_range(f32 min, f32 max)
{
return (f32)((random_f32() * (max - min + 1)) + min);
return (f32)((random_f32() * (max - min)) + min);
}
s32
random_s32_in_range(s32 min, s32 max)
{
return (s32)((random_f32() * (max - min + 1)) + min);
return (s32)((random_f32() * (max - min)) + min);
}
bool

View File

@ -87,6 +87,8 @@ renderer_init(Renderer* self, Window* window, CameraType type, const ivec2* buff
}
glEnable(GL_BLEND);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LESS);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}

View File

@ -49,15 +49,12 @@ sdl_init(void)
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 3);
/*
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
*/
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
*/
}
/* Quits SDL. */

View File

@ -3,15 +3,29 @@
void
surface_rgba_init(SDL_Surface** self, ivec2 size)
{
*self = SDL_CreateRGBSurface
(
0,
size[0],
size[1],
32,
0xFF000000,
0x00FF0000,
0x0000FF00,
0x000000FF
);
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
*self = SDL_CreateRGBSurface
(
0,
size[0],
size[1],
32,
0xFF000000,
0x00FF0000,
0x0000FF00,
0x000000FF
);
#else
*self = SDL_CreateRGBSurface
(
0,
size[0],
size[1],
32,
0x000000FF,
0x0000FF00,
0x00FF0000,
0xFF000000
);
#endif
}

View File

@ -13,6 +13,9 @@ void _level_event_queue_init(Level* self);
void
_level_event_queue_init(Level* self)
{
/*
random_seed_set(self->eventSeed);
for (s32 i = 0; i < LEVEL_EVENT_COUNT; i++)
{
LevelEvent event;
@ -21,8 +24,7 @@ _level_event_queue_init(Level* self)
vector_push(&self->eventQueue, &event);
}
random_seed_set(self->eventSeed);
*/
}
void
@ -392,9 +394,12 @@ level_event_return(Level* self)
void
level_event_choose(Level* self)
{
/*
u32 index;
LevelEvent* event;
*/
/*
index = (u32)random_s32_in_range(0, self->eventQueue.count);
event = (LevelEvent*)vector_get(&self->eventQueue, index);
@ -405,6 +410,9 @@ level_event_choose(Level* self)
if (self->eventQueue.count <= 0)
_level_event_queue_init(self);
*/
self->nextEvent = (LevelEvent)random_s32_in_range(0, LEVEL_EVENT_COUNT);
self->eventSeed++;
@ -468,7 +476,7 @@ level_event_init(Level* self)
self->eventSeed = self->settings.seedStart;
_level_event_queue_init(self);
random_seed_set(self->eventSeed);
}
void

View File

@ -386,7 +386,7 @@ static const LevelData LEVEL_DATA_DEFAULT[LEVEL_COUNT] =
.time = -1
},
{
.status = LEVEL_STATUS_LOCKED,
.status = LEVEL_STATUS_UNLOCKED,
.score = -1,
.time = -1
},