Skip to content

Commit

Permalink
REMOVEME debug asserts in neverball code
Browse files Browse the repository at this point in the history
  • Loading branch information
JayFoxRox committed Dec 16, 2019
1 parent 4d3f55a commit 80ea8a2
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 14 deletions.
15 changes: 11 additions & 4 deletions ball/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ static void make_dirs_and_migrate(void)

fs_mkdir("Screenshots");
}

#include <assert.h>
/*---------------------------------------------------------------------------*/

int main(int argc, char *argv[])
Expand Down Expand Up @@ -571,8 +571,10 @@ int main(int argc, char *argv[])

/* Initialize video. */

if (!video_init())
if (!video_init()) {
assert(0);
return 1;
}

/* Material system. */

Expand Down Expand Up @@ -623,11 +625,14 @@ int main(int argc, char *argv[])
/* Run the main game loop. */

t0 = SDL_GetTicks();

//assert(0);
while (loop())
{
//debugPrint("%d > %d?\n", t1, t0);
//assert(0);
if ((t1 = SDL_GetTicks()) > t0)
{
//assert(0);
/* Step the game state. */

st_timer(0.001f * (t1 - t0));
Expand All @@ -637,7 +642,9 @@ int main(int argc, char *argv[])
/* Render. */

hmd_step();
//assert(0);
st_paint(0.001f * t0);
//assert(0);
video_swap();

if (config_get_d(CONFIG_NICE))
Expand All @@ -653,7 +660,7 @@ int main(int argc, char *argv[])
hmd_free();
joy_quit();
SDL_Quit();

assert(0);
return 0;
}

Expand Down
3 changes: 2 additions & 1 deletion ball/st_conf.c
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ static int null_enter(struct state *st, struct state *prev)

return 0;
}

#include <assert.h>
static void null_leave(struct state *st, struct state *next, int id)
{
mtrl_load_objects();
Expand All @@ -228,6 +228,7 @@ static void null_leave(struct state *st, struct state *next, int id)
geom_init();
gui_init();
hud_init();
//assert(0);
}

/*---------------------------------------------------------------------------*/
Expand Down
3 changes: 2 additions & 1 deletion ball/st_title.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,9 +200,10 @@ static int filter_cmd(const union cmd *cmd)
{
return (cmd ? cmd->type != CMD_SOUND : 1);
}

#include <assert.h>
static int title_enter(struct state *st, struct state *prev)
{
//assert(0);
game_proxy_filter(filter_cmd);

/* Start the title screen music. */
Expand Down
8 changes: 5 additions & 3 deletions share/gui.c
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,8 @@ static void gui_theme_quit(void)
theme_free(&curr_theme);
}

#include <assert.h>

static void gui_theme_init(void)
{
gui_theme_quit();
Expand All @@ -516,11 +518,9 @@ void gui_init(void)
borders[i] = padding;

/* Initialize font rendering. */

gui_font_init();

/* Initialize GUI theme. */

gui_theme_init();

/* Initialize the VBOs. */
Expand All @@ -531,9 +531,11 @@ void gui_init(void)
glBindBuffer_(GL_ARRAY_BUFFER, vert_vbo);
glBufferData_(GL_ARRAY_BUFFER, sizeof (vert_buf), vert_buf, GL_STATIC_DRAW);
glBindBuffer_(GL_ARRAY_BUFFER, 0);

//assert(0);
glGenBuffers_(1, &vert_ebo);
//assert(0);
glBindBuffer_(GL_ELEMENT_ARRAY_BUFFER, vert_ebo);
//assert(0);
glBufferData_(GL_ELEMENT_ARRAY_BUFFER,
WIDGET_MAX * WIDGET_ELEM * sizeof (GLushort),
NULL, GL_STATIC_DRAW);
Expand Down
5 changes: 2 additions & 3 deletions share/state.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,13 @@ void init_state(struct state *st)
{
state = st;
}

#include <assert.h>
int goto_state(struct state *st)
{
struct state *prev = state;

if (state && state->leave)
state->leave(state, st, state->gui_id);

//assert(0);
state = st;
state_time = 0;
state_drawn = 0;
Expand Down
3 changes: 1 addition & 2 deletions share/theme.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ static const char *theme_path(const char *name, const char *file)
}
return "";
}

#include <assert.h>
int theme_load(struct theme *theme, const char *name)
{
char buff[MAXSTR];
Expand All @@ -101,7 +101,6 @@ int theme_load(struct theme *theme, const char *name)
memset(theme, 0, sizeof (*theme));

/* Load description. */

if ((fp = fs_open_read(theme_path(name, "theme.txt"))))
{
while ((fs_gets(buff, sizeof (buff), fp)))
Expand Down

0 comments on commit 80ea8a2

Please sign in to comment.