map::map(levelwin *p, mapdata *data) : window(p), map_data(data) { int i; SDL_Surface *image; v_type = V_WINTYPE_MAP; autobg = 1; need_redraw = 1; w = 640; h = 480; x = (parent->w - w) / 2; y = (parent->h - h) / 2; abs_x = parent->abs_x + x; abs_y = parent->abs_y + y; /* Load map parchment */ mapbg = vultures_load_graphic(V_FILENAME_MAP_PARCHMENT); /* level title */ textwin *txt = new textwin(this, ""); txt->x = w/2; txt->y = 48; /* close button */ hotspot *close = new hotspot(this, 598, 11, 28, 24, 1, "Close map"); close->abs_x = abs_x + close->x; close->abs_y = abs_y + close->y; /* Load map symbols */ image = vultures_load_graphic(V_FILENAME_MAP_SYMBOLS); if (image == NULL) return; else { for (i = 0; i < V_MAX_MAP_SYMBOLS; i++) map_symbols[i] = vultures_get_img_src( (i%40)*SYMBOL_WIDTH, (i/40)*SYMBOL_HEIGHT, (i%40)*SYMBOL_WIDTH + (SYMBOL_WIDTH - 1), (i/40)*SYMBOL_HEIGHT+ (SYMBOL_HEIGHT - 1), image); SDL_FreeSurface(image); } }
minimap::minimap(levelwin *p, mapdata *data) : window(p), level(p), map_data(data) { minimapbg = vultures_load_graphic(V_FILENAME_MINIMAPBG); w = minimapbg->w; h = minimapbg->h; x = parent->w - (w + 6); y = 6; visible = vultures_opts.show_minimap; menu_id = V_WIN_MINIMAP; autobg = 1; minimapwin = this; }
statuswin::statuswin(window *p) : window(p) { window *subwin; statusbg = vultures_load_graphic(V_FILENAME_STATUS_BAR); this->w = statusbg->w; this->h = statusbg->h; this->x = 6; this->y = vultures_screen->h - (this->h + 6); this->menu_id = V_WIN_STATUSBAR; /* The enhance symbol: usually invisible, it is shown only when skill enhancement is possible */ subwin = new enhancebutton(this->parent); subwin->x = this->x + this->w; subwin->y = this->y - subwin->h; subwin->menu_id = V_WIN_ENHANCE; for (int i = 0; i < 5; i++) for (int j = 0; j < 5; j++) { tokenarray[i][j] = new textwin(this, ""); tokenarray[i][j]->x = 3 + status_xpos[i]; tokenarray[i][j]->y = 2 + j*vultures_get_lineheight(V_FONT_STATUS); tokenarray[i][j]->w = 100; tokenarray[i][j]->h = vultures_get_lineheight(V_FONT_STATUS); } /* the player is longer than everything else */ tokenarray[0][0]->w = 250; stwin = this; /* Set warning colors */ warn_colors[V_WARN_NONE] = V_COLOR_TEXT; warn_colors[V_WARN_NORMAL] = CLR32_GREEN; warn_colors[V_WARN_MORE] = CLR32_YELLOW; warn_colors[V_WARN_ALERT] = CLR32_ORANGE; warn_colors[V_WARN_CRITICAL] = CLR32_RED; }
bool endingwin::draw() { int lines; int textpos_x, textpos_y; SDL_Surface *image; if (!flags.tombstone) { for (item_iterator i = items.begin(); i != items.end(); ++i) printf("%s\n", i->str.c_str()); printf("\n\n"); return false; } /* make sure the screen is cleared */ SDL_FillRect(vultures_screen, NULL, CLR32_BLACK); switch (ending_type-1) { case QUIT: image = vultures_load_graphic(V_FILENAME_ENDING_QUIT); vultures_play_event_sound("nhfe_music_end_quit"); break; case ASCENDED: image = vultures_load_graphic(V_FILENAME_ENDING_ASCENDED); vultures_play_event_sound("nhfe_music_end_ascended"); break; case ESCAPED: image = vultures_load_graphic(V_FILENAME_ENDING_ESCAPED); vultures_play_event_sound("nhfe_music_end_ascended"); break; case PANICKED: image = NULL; break; default: image = vultures_load_graphic(V_FILENAME_ENDING_DIED); vultures_play_event_sound("nhfe_music_end_died"); } if (image != NULL) { vultures_put_img((vultures_screen->w - image->w) / 2, (vultures_screen->h - image->h) / 2, image); SDL_FreeSurface(image); vultures_fade_in(0.5); } /* Count n. of rows to display */ lines = items.size(); /* Add prompt line */ lines++; /* Display the rows */ textpos_y = vultures_screen->h - (lines+1) * vultures_get_lineheight(V_FONT_INTRO); for (item_iterator i = items.begin(); i != items.end(); ++i) { textpos_x = (vultures_screen->w - vultures_text_length(V_FONT_INTRO, i->str))/2; vultures_put_text_shadow(V_FONT_INTRO, i->str, vultures_screen, textpos_x, textpos_y, V_COLOR_INTRO_TEXT, V_COLOR_BACKGROUND); textpos_y += vultures_get_lineheight(V_FONT_INTRO); } textpos_x = (vultures_screen->w - vultures_text_length(V_FONT_INTRO, "(press any key)"))/2; vultures_put_text_shadow(V_FONT_INTRO, "(press any key)", vultures_screen, textpos_x, textpos_y, V_COLOR_INTRO_TEXT, V_COLOR_BACKGROUND); vultures_refresh(); return false; }