event fix..?
This commit is contained in:
		@@ -21,14 +21,13 @@ random_f32(void)
 | 
				
			|||||||
f32
 | 
					f32
 | 
				
			||||||
random_f32_in_range(f32 min, f32 max)
 | 
					random_f32_in_range(f32 min, f32 max)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	return (f32)((random_f32() * (max - min + 1)) + min);
 | 
						return (f32)((random_f32() * (max - min)) + min);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
s32
 | 
					s32
 | 
				
			||||||
random_s32_in_range(s32 min, s32 max)
 | 
					random_s32_in_range(s32 min, s32 max)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	return (s32)((random_f32() * (max - min + 1)) + min);
 | 
						return (s32)((random_f32() * (max - min)) + min);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool
 | 
					bool
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -87,6 +87,8 @@ renderer_init(Renderer* self, Window* window, CameraType type, const ivec2* buff
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	glEnable(GL_BLEND);
 | 
						glEnable(GL_BLEND);
 | 
				
			||||||
 | 
						glEnable(GL_DEPTH_TEST);
 | 
				
			||||||
 | 
						glDepthFunc(GL_LESS);
 | 
				
			||||||
	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
 | 
						glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -49,15 +49,12 @@ sdl_init(void)
 | 
				
			|||||||
   	SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 3);
 | 
					   	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_RED_SIZE, 8);
 | 
				
			||||||
	SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
 | 
						SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
 | 
				
			||||||
	SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
 | 
						SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
 | 
				
			||||||
	SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 8);
 | 
						SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 8);
 | 
				
			||||||
	SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
 | 
						SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
 | 
				
			||||||
 | 
						*/
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Quits SDL. */
 | 
					/* Quits SDL. */
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,15 +3,29 @@
 | 
				
			|||||||
void
 | 
					void
 | 
				
			||||||
surface_rgba_init(SDL_Surface** self, ivec2 size)
 | 
					surface_rgba_init(SDL_Surface** self, ivec2 size)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	*self = SDL_CreateRGBSurface
 | 
						#if SDL_BYTEORDER == SDL_BIG_ENDIAN
 | 
				
			||||||
	(
 | 
							*self = SDL_CreateRGBSurface
 | 
				
			||||||
		0,
 | 
							(
 | 
				
			||||||
		size[0],
 | 
								0,
 | 
				
			||||||
		size[1],
 | 
								size[0],
 | 
				
			||||||
		32,
 | 
								size[1],
 | 
				
			||||||
		0xFF000000,
 | 
								32,
 | 
				
			||||||
		0x00FF0000,
 | 
								0xFF000000,
 | 
				
			||||||
		0x0000FF00,
 | 
								0x00FF0000,
 | 
				
			||||||
		0x000000FF
 | 
								0x0000FF00,
 | 
				
			||||||
	);
 | 
								0x000000FF
 | 
				
			||||||
 | 
							);
 | 
				
			||||||
 | 
						#else
 | 
				
			||||||
 | 
							*self = SDL_CreateRGBSurface
 | 
				
			||||||
 | 
							(
 | 
				
			||||||
 | 
								0,
 | 
				
			||||||
 | 
								size[0],
 | 
				
			||||||
 | 
								size[1],
 | 
				
			||||||
 | 
								32,
 | 
				
			||||||
 | 
								0x000000FF,
 | 
				
			||||||
 | 
								0x0000FF00,
 | 
				
			||||||
 | 
								0x00FF0000,
 | 
				
			||||||
 | 
								0xFF000000
 | 
				
			||||||
 | 
							);
 | 
				
			||||||
 | 
						#endif
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -13,6 +13,9 @@ void _level_event_queue_init(Level* self);
 | 
				
			|||||||
void
 | 
					void
 | 
				
			||||||
_level_event_queue_init(Level* self)
 | 
					_level_event_queue_init(Level* self)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
						/*
 | 
				
			||||||
 | 
						random_seed_set(self->eventSeed);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for (s32 i = 0; i < LEVEL_EVENT_COUNT; i++)
 | 
						for (s32 i = 0; i < LEVEL_EVENT_COUNT; i++)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		LevelEvent event;
 | 
							LevelEvent event;
 | 
				
			||||||
@@ -21,8 +24,7 @@ _level_event_queue_init(Level* self)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
		vector_push(&self->eventQueue, &event);
 | 
							vector_push(&self->eventQueue, &event);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						*/
 | 
				
			||||||
	random_seed_set(self->eventSeed);
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void
 | 
					void
 | 
				
			||||||
@@ -392,9 +394,12 @@ level_event_return(Level* self)
 | 
				
			|||||||
void
 | 
					void
 | 
				
			||||||
level_event_choose(Level* self)
 | 
					level_event_choose(Level* self)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
						/*
 | 
				
			||||||
	u32 index;
 | 
						u32 index;
 | 
				
			||||||
	LevelEvent* event;
 | 
						LevelEvent* event;
 | 
				
			||||||
 | 
						*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/*
 | 
				
			||||||
	index = (u32)random_s32_in_range(0, self->eventQueue.count);
 | 
						index = (u32)random_s32_in_range(0, self->eventQueue.count);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	event = (LevelEvent*)vector_get(&self->eventQueue, index);
 | 
						event = (LevelEvent*)vector_get(&self->eventQueue, index);
 | 
				
			||||||
@@ -405,6 +410,9 @@ level_event_choose(Level* self)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	if (self->eventQueue.count <= 0)
 | 
						if (self->eventQueue.count <= 0)
 | 
				
			||||||
		_level_event_queue_init(self);
 | 
							_level_event_queue_init(self);
 | 
				
			||||||
 | 
						*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						self->nextEvent = (LevelEvent)random_s32_in_range(0, LEVEL_EVENT_COUNT);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	self->eventSeed++;
 | 
						self->eventSeed++;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -468,7 +476,7 @@ level_event_init(Level* self)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	self->eventSeed = self->settings.seedStart;
 | 
						self->eventSeed = self->settings.seedStart;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	_level_event_queue_init(self);
 | 
						random_seed_set(self->eventSeed);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void 
 | 
					void 
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -386,7 +386,7 @@ static const LevelData LEVEL_DATA_DEFAULT[LEVEL_COUNT] =
 | 
				
			|||||||
		.time = -1
 | 
							.time = -1
 | 
				
			||||||
	},
 | 
						},
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		.status = LEVEL_STATUS_LOCKED,
 | 
							.status = LEVEL_STATUS_UNLOCKED,
 | 
				
			||||||
		.score = -1,
 | 
							.score = -1,
 | 
				
			||||||
		.time = -1
 | 
							.time = -1
 | 
				
			||||||
	},
 | 
						},
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user