121 #define MEDALS_NUM_BUTTONS 1
122 #define MEDALS_EXIT 0
132 #define MEDALS_NUM_TEXT 1
142 static const char* Default_medals_background_filename =
"MedalsDisplayEmpty";
143 static char Medals_background_filename[
NAME_LENGTH];
145 static const char* Default_medals_mask_filename =
"Medals-M";
161 static bitmap *Medals_mask;
163 static int Medals_bitmap_mask;
164 static int Medals_bitmap;
180 #define MEDAL_BITMAP_INIT (1<<0)
181 #define MASK_BITMAP_INIT (1<<1)
185 : num_versions(1), version_starts_at_1(
false), available_from_start(
false), kills_needed(0), promotion_text()
262 strcpy_s(Medals_background_filename, Default_medals_background_filename);
270 strcpy_s(Medals_mask_filename, Default_medals_mask_filename);
279 Medals_callsign_coords[
GR_640].
x = Default_medals_callsign_coords[
GR_640][0];
280 Medals_callsign_coords[
GR_640].
y = Default_medals_callsign_coords[
GR_640][1];
287 Medals_callsign_coords[
GR_1024].
x = Default_medals_callsign_coords[
GR_1024][0];
288 Medals_callsign_coords[
GR_1024].
y = Default_medals_callsign_coords[
GR_1024][1];
298 Medals_label_coords[
GR_640].
x = Default_medals_label_coords[
GR_640][0];
299 Medals_label_coords[
GR_640].
y = Default_medals_label_coords[
GR_640][1];
300 Medals_label_coords[
GR_640].
w = Default_medals_label_coords[
GR_640][2];
308 Medals_label_coords[
GR_1024].
x = Default_medals_label_coords[
GR_1024][0];
309 Medals_label_coords[
GR_1024].
y = Default_medals_label_coords[
GR_1024][1];
310 Medals_label_coords[
GR_1024].
w = Default_medals_label_coords[
GR_1024][2];
404 Warning(
LOCATION,
"Debriefing text for %s is assigned to an invalid persona: %i (must be 0 or greater).\n", temp_medal.
name, persona);
416 Medals.push_back(temp_medal);
417 Medal_display_info.push_back(temp_display);
433 int prev_badge_kills = 0;
436 if (Medals[i].kills_needed < prev_badge_kills && Medals[i].kills_needed != 0)
437 Error(
LOCATION,
"Badges must appear sorted by lowest kill # first in medals.tbl\nFind Allender for most information.");
439 if (Medals[i].kills_needed > 0)
440 prev_badge_kills = Medals[
i].kills_needed;
445 mprintf((
"TABLES: Unable to parse '%s'! Error message = %s.\n",
"medals.tbl", e.what()));
451 DCF(medals,
"Grant or revoke medals")
458 dc_printf (
"Usage: medals all | clear | promote | demote | [index]\n");
459 dc_printf (
" [index] -- index of medal to grant\n");
460 dc_printf (
" with no parameters, displays the available medals\n");
466 dc_printf(
"You have the following medals:\n");
509 dc_printf(
"Medal index %d is out of range\n", idx);
518 dc_printf(
"The following medals are available:\n");
532 Player_score = &Medals_player->
stats;
543 if ((Medals[idx].available_from_start) && (Medals_player->
stats.
medal_counts[idx] < 1)) {
575 strcat_s(bitmap_buf, Medals_background_filename);
577 Medals_bitmap =
bm_load(bitmap_buf);
578 if (Medals_bitmap < 0) {
579 Error(
LOCATION,
"Error loading medal background bitmap %s", bitmap_buf);
588 strcat_s(bitmap_buf, Medals_mask_filename);
590 Medals_bitmap_mask =
bm_load(bitmap_buf);
591 if (Medals_bitmap_mask < 0) {
592 Error(
LOCATION,
"Error loading medal mask file %s", bitmap_buf);
616 char translated_label[256];
622 sprintf( text,
NOX(
"%s (%d)"), translated_label, num );
624 sprintf( text,
"%s", translated_label );
627 char translated_label[256];
633 sprintf( text,
NOX(
"%s (%d)"), translated_label, num );
635 sprintf( text,
"%s", translated_label );
672 int region,selected, k;
683 if (Medals_bitmap != -1) {
729 Medals_window.
draw();
747 if (
idx->bitmap >= 0){
753 delete[] Medal_regions;
754 Medal_regions = NULL;
771 Medal_display_info[
idx].bitmap = -1;
782 _splitpath( filename, NULL, NULL, base, NULL );
787 if ( num_medals > Medals[idx].num_versions )
788 num_medals = Medals[
idx].num_versions;
790 if ( num_medals > 1 ) {
795 sprintf( base,
"%s%c", temp, (num_medals-2)+
'a');
800 sprintf( filename,
"2_%s", base );
807 Assert( Medal_display_info[idx].bitmap != -1 );
826 Assert(Medal_regions == NULL);
844 if (Medal_display_info[idx].
bitmap < 0) {
865 if ( !
stricmp(name, Medals[
i].name) ) {
void bm_unlock(int handle)
Unlocks a bitmap.
void set_highlight_action(void(*_user_function)(void))
SCP_vector< medal_stuff > Medals
scoring_struct * Player_score
void add_XSTR(char *string, int _xstr_id, int _x, int _y, UI_GADGET *_assoc, int _color_type, int _font_id=-1)
int check_for_string(const char *pstr)
void lcl_translate_medal_name_gr(char *name)
int medals_info_lookup(const char *name)
int snazzy_menu_do(ubyte *data, int mask_w, int mask_h, int num_regions, MENU_REGION *regions, int *action, int poll_key, int *key)
void _cdecl void void _cdecl void _cdecl Warning(char *filename, int line, SCP_FORMAT_STRING const char *format,...) SCP_FORMAT_STRING_ARGS(3
bool dc_maybe_stuff_int(int *i)
Tries to stuff an int from the Command_string.
#define GR_NUM_RESOLUTIONS
__inline void gr_string(int x, int y, const char *string, int resize_mode=GR_RESIZE_FULL)
struct medal_display_info medal_display_info
int bm_get_info(int handle, int *w, int *h, ubyte *flags, int *nframes, int *fps)
Gets info on the bitmap indexed by handle.
char voice_base[MAX_FILENAME_LEN]
char debrief_bitmap[MAX_FILENAME_LEN]
#define GR_MAYBE_CLEAR_RES(bmap)
void gr_set_color_fast(color *dst)
void gr_set_bitmap(int bitmap_num, int alphablend_mode, int bitblt_mode, float alpha)
int required_string_either(char *str1, char *str2)
Checks for one of two required strings.
GLenum GLuint GLenum GLsizei const GLchar * buf
DCF(medals,"Grant or revoke medals")
int bm_release(int handle, int clear_render_targets)
Frees both a bitmap's data and it's associated slot.
void snazzy_menu_add_region(MENU_REGION *region, const char *text, int mask, int key, int click_sound)
char callsign[CALLSIGN_LEN+1]
#define MEDAL_BITMAP_INIT
#define BMP_AABITMAP
antialiased bitmap
const medal_stuff & operator=(const medal_stuff &m)
void set_mask_bmap(char *fname)
int set_bmaps(char *ani_filename, int nframes=3, int start_frame=1)
void medal_main_init(player *pl, int mode)
coord2d coords[GR_NUM_RESOLUTIONS]
#define MEDALS_NUM_BUTTONS
bool available_from_start
void stuff_string(char *outstr, int type, int len, char *terminators)
int Cmdline_gimme_all_medals
sprintf(buf,"(%f,%f,%f)", v3->xyz.x, v3->xyz.y, v3->xyz.z)
int required_string(const char *pstr)
bitmap * bm_lock(int handle, ubyte bpp, ubyte flags, bool nodebug)
Locks down the bitmap indexed by bitmapnum.
int optional_string(const char *pstr)
SCP_vector< int > medal_counts
bool dc_optional_string_either(const char *str1, const char *str2)
Searches for an optional string and it's alias.
void read_file_text(const char *filename, int mode, char *processed_text, char *raw_text)
GLint GLint GLint GLint GLint x
void stuff_boolean(int *i, bool a_to_eol)
void _splitpath(char *path, char *drive, char *dir, char *fname, char *ext)
char bitmap[MAX_FILENAME_LEN]
SCP_map< int, char * > promotion_text
void _cdecl void void _cdecl Error(const char *filename, int line, SCP_FORMAT_STRING const char *format,...) SCP_FORMAT_STRING_ARGS(3
void reset_parse(char *text)
GLuint const GLchar * name
void init_medal_bitmaps()
int bm_load(const char *real_filename)
Loads a bitmap so we can draw with it later.
void blit_label(char *label, int num)
void link_hotspot(int num)
void create(UI_WINDOW *wnd, char *_text, int _x, int _y, int _w, int _h, int do_repeat=0, int ignore_focus=0)
GLubyte GLubyte GLubyte GLubyte w
const char * Resolution_prefixes[GR_NUM_RESOLUTIONS]
#define UI_XSTR_COLOR_PINK
UI_XSTR Medals_text[GR_NUM_RESOLUTIONS][MEDALS_NUM_TEXT]
void create(int _x, int _y, int _w, int _h, int _flags, int _f_id=-1)
void gr_get_string_size(int *w, int *h, const char *text, int len=9999)
void palette_restore_palette()
An overhauled/updated debug console to allow monitoring, testing, and general debugging of new featur...
void common_play_highlight_sound()
void init_snazzy_regions()
ptr_u data
Pointer to data, or maybe offset into VRAM.
rank_stuff Ranks[NUM_RANKS]
void gr_bitmap(int _x, int _y, int resize_mode)
bool dc_optional_string(const char *pstr)
Searches for an optional string.
void dc_printf(const char *format,...)
Prints the given char string to the debug console.
void gamesnd_play_iface(int n)
struct ui_button_info ui_button_info
#define MAX_FREESPACE2_RANK
int process(int key_in=-1, int process_mouse=1)
void gameseq_post_event(int event)
void lcl_translate_medal_name_pl(char *name)
ui_button_info Medals_buttons[GR_NUM_RESOLUTIONS][MEDALS_NUM_BUTTONS]
char bitmap[MAX_FILENAME_LEN]