void Render::draw(int mode) { switch(mode) { case 0: prelude(); break; case 1: theme(); break; case 2: finale(); break; } // switch mode } // draw()
void Game::update() { switch(mode) { case PRELUDE: prelude(); break; case THEME: theme(); break; case FINALE: finale(); break; }; // switch state } // update()
/* append msg to memory log */ void debuglog(char *msg) { int length; static int count = 0; length = strlen(msg); if (length > MAX_LOG_MSG) { length = MAX_LOG_MSG; /* truncate overly long message */ } if (debug_log_cursor < DEBUG_AREA || debug_log_cursor >= DEBUG_AREA + DEBUG_AREA_LENGTH) { kprintf("debuglog detected memory corruption, exiting to Tutor\n"); kprintf(" --use md %x to see debuglog\n", DEBUG_AREA); finale(); } if (debug_log_cursor + length >= DEBUG_AREA + DEBUG_AREA_LENGTH) { debug_log_cursor = DEBUG_AREA; /* wrap around in provided memory */ debug_log_wrapcount++; } strncpy(debug_log_cursor, msg, length); /* append msg to end of log */ debug_log_cursor += length; /* advance cursor */ }