void initConfiguration(int argc, const char *argv[]) { /* load some more defaults from config file */ runScript(PATH_SCRIPTS, "config.lua"); runScript(PATH_SCRIPTS, "artpack.lua"); /* go for .gltronrc (or whatever is defined in RC_NAME) */ { char *path; path = getPossiblePath(PATH_PREFERENCES, RC_NAME); if (path != NULL) { if (fileExists(path)) { printf("[status] loading settings from %s\n", path); scripting_RunFile(path); } else { printf("[error] cannot load %s from %s\n", RC_NAME, path); } free(path); } else { printf("[fatal] can't get valid pref path for %s\n", RC_NAME); exit(1); // something is seriously wrong } } if(!isSetting("version") || getSettingf("version") < 0.70f) { /* load some more defaults from config file */ runScript(PATH_SCRIPTS, "config.lua"); runScript(PATH_SCRIPTS, "artpack.lua"); printf("[warning] old config file found, overriding using defaults\n"); } // check if config is valid scripting_GetGlobal("save_completed", NULL); if(scripting_IsNilResult()) { runScript(PATH_SCRIPTS, "config.lua"); runScript(PATH_SCRIPTS, "artpack.lua"); printf("[warning] defunct config file found, overriding using defaults\n"); } setSettingf("version", 0.70f); /* parse any comandline switches overrinding the loaded settings */ parse_args(argc, argv); /* sanity check some settings */ checkSettings(); /* intialize the settings cache, remember to do that everytime you change something */ updateSettingsCache(); }
void initPause(void) { nebu_Input_HidePointer(); nebu_Input_Mouse_WarpToOrigin(); /* disable game sound effects */ Audio_DisableEngine(); /* * TODO: Provide an option to disable game music here. * Game should be totally silent in pause mode. (Nice when * the boss is walking by, phone call, etc...) */ updateSettingsCache(); }
void enterGame(void) { /* called when game mode is entered */ updateSettingsCache(); SystemHidePointer(); // SystemWarpPointer(MOUSE_ORIG_X, MOUSE_ORIG_Y); game2->time.offset = SystemGetElapsedTime() - game2->time.current; Audio_EnableEngine(); // disable booster and cam offset { int i; for(i = 0; i < game->players; i++) { game->player[i].data->boost_enabled = 0; game->player[i].camera->movement[CAM_PHI_OFFSET] = 0; } } /* reset pause flag */ if (game->pauseflag != PAUSE_GAME_FINISHED) { game->pauseflag = PAUSE_GAME_RUNNING; } /* fprintf(stderr, "init game\n"); */ }
int c_update_settings_cache(lua_State *L) { updateSettingsCache(); return 0; }
void initGui(void) { SystemUnhidePointer(); updateSettingsCache(); }