/** * Makes a bonus level for current SP level visible on the land map screen. */ TbBool activate_bonus_level(struct PlayerInfo *player) { TbBool result; LevelNumber sp_lvnum; SYNCDBG(5,"Starting"); set_flag_byte(&game.flags_font,FFlg_unk02,true); sp_lvnum = get_loaded_level_number(); result = set_bonus_level_visibility_for_singleplayer_level(player, sp_lvnum, true); if (!result) ERRORLOG("No Bonus level assigned to level %d",(int)sp_lvnum); set_flag_byte(&game.operation_flags,GOF_SingleLevel,false); return result; }
TbBool fill_game_catalogue_entry(struct CatalogueEntry *centry,const char *textname) { centry->version = (VersionMajor << 16) + VersionMinor; centry->level_num = get_loaded_level_number(); strncpy(centry->textname,textname,SAVE_TEXTNAME_LEN); strncpy(centry->campaign_name,campaign.name,LINEMSG_SIZE); strncpy(centry->campaign_fname,campaign.fname,DISKPATH_SIZE); strncpy(centry->player_name,high_score_entry,PLAYER_NAME_LENGTH); centry->textname[SAVE_TEXTNAME_LEN-1] = '\0'; centry->campaign_name[LINEMSG_SIZE-1] = '\0'; centry->campaign_fname[DISKPATH_SIZE-1] = '\0'; centry->player_name[PLAYER_NAME_LENGTH-1] = '\0'; set_flag_word(¢ry->flags, CEF_InUse, true); return true; }
void add_score_to_high_score_table(void) { struct Dungeon *dungeon; struct PlayerInfo *player; int idx; player = get_my_player(); dungeon = get_players_dungeon(player); idx = add_high_score_entry(dungeon->lvstats.player_score, get_loaded_level_number(), ""); if (idx >= 0) { // Preparing input in the new entry // Note that we're not clearing previous name - this way it may be easily kept unchanged high_score_entry_input_active = idx; high_score_entry_index = strlen(high_score_entry); } else { high_score_entry_input_active = -1; high_score_entry_index = 0; } }
short save_continue_game(LevelNumber lvnum) { char *fname; long fsize; // Update continue level number if (is_singleplayer_like_level(lvnum)) set_continue_level_number(lvnum); SYNCDBG(6,"Continue set to level %d (loaded is %d)",(int)get_continue_level_number(),(int)get_loaded_level_number()); fname = prepare_file_path(FGrp_Save,continue_game_filename); fsize = LbFileSaveAt(fname, &game, sizeof(struct Game)); return (fsize == sizeof(struct Game)); }