void warlock_init (void) { #ifdef DEBUG g_log_set_always_fatal (G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING); #endif preferences_init (); highlight_init (); preferences_dialog_init (); profile_dialog_init (); text_strings_dialog_init (); hand_init (warlock_get_widget ("left_hand_label"), warlock_get_widget ("right_hand_label")); status_init (warlock_get_widget ("status_table")); compass_init (warlock_get_widget ("compass_table")); warlock_entry_init (warlock_get_widget ("warlock_entry")); macro_init (); macro_dialog_init (); warlock_time_init (); warlock_views_init (); warlock_log_init (); script_init (); }
bool baekwha(const char *pcArgv0) { time_t t_start, t_end; double t_elapsed; bool ok; if( cfg_showHelp ) { showHelp(pcArgv0); return true; } else if( cfg_showVersion ) { showVersion(); return true; } /* * Open Debug log if '-d' was set */ if( cfg_debug==true ) { /* catch special filename "-" for stdout */ if( strcmp(pcDebugLogName, "-")==0 ) { /* set output file to stdout */ debugLog = stdout; } else { debugLog = fopen(pcDebugLogName, "w"); if( debugLog==NULL ) { fprintf(stderr, "error opening debug log '%s' : %s\n", pcDebugLogName, strerror(errno)); return false; } } fprintf(debugLog, "<html><head><title>DreamAss debug log</title></head><body>\n"); } /* * No Sourecfiles means nothing to do */ if( srcFileNames_count==0 ) { printf("No sourcefiles - nothing to do.\n"); return true; } if( filelist_init(16) && macro_init(16) && srcstack_init(16) && termlist_init(1024) && new_variable(1024) && segment_init(16) ) { /* Stop assembly time from now on */ t_start = time(NULL); ok = assembleAllFiles(); if( ok ) { if( cfg_verbose ) { t_end = time(NULL); t_elapsed = difftime(t_end, t_start); printf("%f seconds used\n", t_elapsed); } if( warningcnt>=cfg_maxwarnings ) { printf("further warnings suppressed.\n"); } if( cfg_verbose ) { if( warningcnt ) printf("%u",warningcnt); else printf("no"); printf(" warning%s, ",(warningcnt==1)?"":"s"); if( errorcnt ) printf("%u",errorcnt); else printf("no"); printf(" error%s.\n",(errorcnt==1)?"":"s"); } if( errorcnt==0 ) { if( pcLabelLogName!=NULL ) dumpLabels( pcLabelLogName ); if( !allBytesResolved ) { fprintf(stderr, "Some vars still undefined. Dump not yet supported, sorry!\n"); pass_showUndefs(topLevelSrc); } else dumpObject(topLevelSrc, pcOutFileName); } } if( topLevelSrc!=NULL ) delSourcefile(topLevelSrc); return ok; } return false; }
/* * Initialize some other arrays */ static errr init_other(void) { int i; /*** Prepare the various "bizarre" arrays ***/ /* Initialize the "macro" package */ (void)macro_init(); /* Initialize the "quark" package */ (void)quarks_init(); /* Initialize squelch things */ autoinscribe_init(); squelch_init(); init_cmd_know(); /* Initialize the "message" package */ (void)messages_init(); /*** Prepare grid arrays ***/ /* Array of grids */ view_g = C_ZNEW(VIEW_MAX, u16b); /* Array of grids */ temp_g = C_ZNEW(TEMP_MAX, u16b); /* Hack -- use some memory twice */ temp_y = ((byte*)(temp_g)) + 0; temp_x = ((byte*)(temp_g)) + TEMP_MAX; /*** Prepare dungeon arrays ***/ /* Padded into array */ cave_info = C_ZNEW(DUNGEON_HGT, byte_256); cave_info2 = C_ZNEW(DUNGEON_HGT, byte_256); /* Feature array */ cave_feat = C_ZNEW(DUNGEON_HGT, byte_wid); /* Entity arrays */ cave_o_idx = C_ZNEW(DUNGEON_HGT, s16b_wid); cave_m_idx = C_ZNEW(DUNGEON_HGT, s16b_wid); /* Flow arrays */ cave_cost = C_ZNEW(DUNGEON_HGT, byte_wid); cave_when = C_ZNEW(DUNGEON_HGT, byte_wid); /*** Prepare "vinfo" array ***/ /* Used by "update_view()" */ (void)vinfo_init(); /*** Prepare entity arrays ***/ /* Objects */ o_list = C_ZNEW(z_info->o_max, object_type); /* Monsters */ mon_list = C_ZNEW(z_info->m_max, monster_type); /*** Prepare lore array ***/ /* Lore */ l_list = C_ZNEW(z_info->r_max, monster_lore); /*** Prepare mouse buttons ***/ button_init(button_add_text, button_kill_text); /*** Prepare quest array ***/ /* Quests */ q_list = C_ZNEW(MAX_Q_IDX, quest); /*** Prepare the inventory ***/ /* Allocate it */ inventory = C_ZNEW(ALL_INVEN_TOTAL, object_type); /*** Prepare the options ***/ option_set_defaults(); /* Initialize the window flags */ for (i = 0; i < ANGBAND_TERM_MAX; i++) { /* Assume no flags */ op_ptr->window_flag[i] = 0L; } /*** Pre-allocate space for the "format()" buffer ***/ /* Hack -- Just call the "format()" function */ (void)format("I wish you could swim, like dolphins can swim..."); /* Success */ return (0); }
/* * Initialize some other arrays */ static errr init_other(void) { int i; /*** Prepare the various "bizarre" arrays ***/ /* Initialize the "macro" package */ (void)macro_init(); /* Initialize the "quark" package */ (void)quarks_init(); /* Initialize squelch things */ autoinscribe_init(); init_cmd_know(); /* Initialize the "message" package */ (void)messages_init(); /*** Prepare grid arrays ***/ /* Array of grids */ view_g = C_ZNEW(VIEW_MAX, u16b); /* Array of grids */ temp_g = C_ZNEW(TEMP_MAX, u16b); /* Hack -- use some memory twice */ temp_y = ((byte*)(temp_g)) + 0; temp_x = ((byte*)(temp_g)) + TEMP_MAX; /* Array of grids */ fire_g = C_ZNEW(VIEW_MAX, u16b); /* has_LIGHT patch causes both temp_g and temp_x/y to be used in targetting mode: can't use the same memory any more. */ temp_y = C_ZNEW(TEMP_MAX, byte); temp_x = C_ZNEW(TEMP_MAX, byte); /* Array of dynamic grids */ dyna_g = C_ZNEW(DYNA_MAX, dynamic_grid_type); /* Array of stacked monster messages */ mon_msg = C_ZNEW(MAX_STORED_MON_MSG, monster_race_message); mon_message_hist = C_ZNEW(MAX_STORED_MON_CODES, monster_message_history); /* Prepare monster movement array*/ mon_moment_info = C_ZNEW(z_info->m_max, move_moment_type); /*** Prepare dungeon arrays ***/ /* Padded into array */ cave_info = C_ZNEW(MAX_DUNGEON_HGT, u16b_256); /* Feature array */ cave_feat = C_ZNEW(MAX_DUNGEON_HGT, byte_wid); /* Entity arrays */ cave_o_idx = C_ZNEW(MAX_DUNGEON_HGT, s16b_wid); cave_m_idx = C_ZNEW(MAX_DUNGEON_HGT, s16b_wid); cave_x_idx = C_ZNEW(MAX_DUNGEON_HGT, s16b_wid); #ifdef MONSTER_SMELL /* Flow arrays */ cave_when = C_ZNEW(MAX_DUNGEON_HGT, byte_wid); #endif /* MONSTER_SMELL */ /*start with cost at center 0*/ for (i = 0; i < MAX_FLOWS; i++) { cost_at_center[i] = 0; } /*** Prepare "vinfo" array ***/ /* Used by "update_view()" */ (void)vinfo_init(); /*** Prepare entity arrays ***/ /* Objects */ o_list = C_ZNEW(z_info->o_max, object_type); /* Monsters */ mon_list = C_ZNEW(z_info->m_max, monster_type); /* Effects */ x_list = C_ZNEW(z_info->x_max, effect_type); /*** Prepare mosnter lore array ***/ /* Lore */ l_list = C_ZNEW(z_info->r_max, monster_lore); /*** Prepare terrain lore array ***/ /* Lore */ f_l_list = C_ZNEW(z_info->f_max, feature_lore); /*** Prepare artifact lore array ***/ /* Lore */ a_l_list = C_ZNEW(z_info->art_max, artifact_lore); /*** Prepare mouse buttons ***/ button_init(button_add_text, button_kill_text); /*** Prepare the inventory ***/ /* Allocate it */ inventory = C_ZNEW(ALL_INVEN_TOTAL, object_type); /*** Prepare the stores ***/ /* Allocate the stores */ store = C_ZNEW(MAX_STORES, store_type); /* Fill in each store */ for (i = 0; i < MAX_STORES; i++) { /* Get the store */ store_type *st_ptr = &store[i]; /* Assume full stock */ st_ptr->stock_size = STORE_INVEN_MAX; /* Allocate the stock */ st_ptr->stock = C_ZNEW(st_ptr->stock_size, object_type); } /*** Prepare the options ***/ /* Initialize the options */ for (i = 0; i < OPT_MAX; i++) { /* Default value */ op_ptr->opt[i] = options[i].normal; } /* Initialize the window flags */ for (i = 0; i < ANGBAND_TERM_MAX; i++) { /* Assume no flags */ op_ptr->window_flag[i] = 0L; } /*Clear the update flags*/ p_ptr->notice = 0L; p_ptr->update = 0L; p_ptr->redraw = 0L; /*** Pre-allocate space for the "format()" buffer ***/ /* Hack -- Just call the "format()" function */ (void)format("%s", MAINTAINER); /* Success */ return (0); }