/** * Loads the language-specific strings data for the current campaign. */ TbBool setup_campaign_strings_data(struct GameCampaign *campgn) { char *strings_data_end; char *fname; short result; long filelen; SYNCDBG(18,"Starting"); fname = prepare_file_path(FGrp_Main,campgn->strings_fname); filelen = LbFileLengthRnc(fname); if (filelen <= 0) { ERRORLOG("Campaign Strings file does not exist or can't be opened"); return false; } campgn->strings_data = (char *)LbMemoryAlloc(filelen + 256); if (campgn->strings_data == NULL) { ERRORLOG("Can't allocate memory for Campaign Strings data"); return false; } strings_data_end = campgn->strings_data+filelen+255; long loaded_size; loaded_size = LbFileLoadAt(fname, campgn->strings_data); if (loaded_size < 16) { ERRORLOG("Campaign Strings file couldn't be loaded or is too small"); return false; } // Resetting all values to empty strings reset_strings(campgn->strings); // Analyzing strings data and filling correct values result = create_strings_list(campgn->strings, campgn->strings_data, strings_data_end); SYNCDBG(19,"Finished"); return result; }
TbBool setup_heap_manager(void) { SYNCDBG(8,"Starting"); const char *fname; long i; //_DK_setup_heap_manager(); if (heap == NULL) { ERRORLOG("Graphics Heap not allocated"); return false; } i = heap_size / 512; if (i >= KEEPSPRITE_LENGTH) i = KEEPSPRITE_LENGTH-1; graphics_heap = heapmgr_init(heap, heap_size, i); if (graphics_heap == NULL) { ERRORLOG("Not enough memory to initialize heap."); return false; } wait_for_cd_to_be_available(); fname = prepare_file_path(FGrp_StdData,"creature.jty"); //TODO CREATURE_SPRITE Use rewritten file handling when reading is rewritten file_handle = _DK_LbFileOpen(fname, Lb_FILE_MODE_READ_ONLY); if (file_handle == -1) { ERRORLOG("Can not open 'creature.jty'"); return false; } for (i=0; i < KEEPSPRITE_LENGTH; i++) keepsprite[i] = NULL; for (i=0; i < KEEPSPRITE_LENGTH; i++) heap_handle[i] = NULL; return true; }
short save_settings(void) { char *fname; fname=prepare_file_path(FGrp_Save,"settings.dat"); LbFileSaveAt(fname, &settings, sizeof(struct GameSettings)); return true; }
TbBool load_lenses_config(const char *conf_fname, unsigned short flags) { static const char config_global_textname[] = "global eye lenses config"; static const char config_campgn_textname[] = "campaign eye lenses config"; char *fname; TbBool result; fname = prepare_file_path(FGrp_FxData,conf_fname); result = load_lenses_config_file(config_global_textname,fname,flags); fname = prepare_file_path(FGrp_CmpgConfig,conf_fname); if (strlen(fname) > 0) { load_lenses_config_file(config_campgn_textname,fname,flags|CnfLd_AcceptPartial|CnfLd_IgnoreErrors); } //Freeing and exiting return result; }
TbBool load_trapdoor_config(const char *conf_fname, unsigned short flags) { static const char config_global_textname[] = "global traps and doors config"; static const char config_campgn_textname[] = "campaign traps and doors config"; char *fname; TbBool result; fname = prepare_file_path(FGrp_FxData,conf_fname); result = load_trapdoor_config_file(config_global_textname,fname,flags); fname = prepare_file_path(FGrp_CmpgConfig,conf_fname); if (strlen(fname) > 0) { load_trapdoor_config_file(config_campgn_textname,fname,flags|CnfLd_AcceptPartial|CnfLd_IgnoreErrors); } // Creating arrays derived from the original config create_manufacture_array_from_trapdoor_data(); //Freeing and exiting return result; }
/** * Searches levels folder for LOF files and adds them to campaign levels list. */ TbBool find_and_load_lof_files(void) { struct TbFileFind fileinfo; unsigned char *buf; char *fname; short result; int rc; long i; SYNCDBG(16,"Starting"); buf = LbMemoryAlloc(MAX_LIF_SIZE); if (buf == NULL) { ERRORLOG("Can't allocate memory for .LOF files parsing."); return false; } result = false; fname = prepare_file_path(FGrp_VarLevels,"*.lof"); rc = LbFileFindFirst(fname, &fileinfo, 0x21u); while (rc != -1) { fname = prepare_file_path(FGrp_VarLevels,fileinfo.Filename); i = LbFileLength(fname); if ((i < 0) || (i >= MAX_LIF_SIZE)) { WARNMSG("File '%s' too long (Max size %d)", fileinfo.Filename, MAX_LIF_SIZE); } else if (LbFileLoadAt(fname, buf) != i) { WARNMSG("Unable to read .LOF file, '%s'", fileinfo.Filename); } else { buf[i] = '\0'; if (level_lof_file_parse(fileinfo.Filename, (char *)buf, i)) result = true; } rc = LbFileFindNext(&fileinfo); } LbFileFindEnd(&fileinfo); LbMemoryFree(buf); return result; }
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)); }
TbBool load_ceiling_table(void) { char *fname; TbFileHandle fh; unsigned short *value_array; char nchr; char numstr[8]; TbBool do_next; long i,n; //_DK_load_ceiling_table(); return true; // Prepare filename and open the file wait_for_cd_to_be_available(); fname = prepare_file_path(FGrp_StdData,"ceiling.txt"); fh = LbFileOpen(fname, Lb_FILE_MODE_READ_ONLY); if (fh == -1) { return false; } value_array = &floor_to_ceiling_map[0]; n = 0; do_next = 1; while (do_next == 1) { { do_next = LbFileRead(fh, &nchr, 1); if (do_next != 1) break; if ( (nchr == 10) || (nchr == 44) || (nchr == 32) || (nchr == 9) || (nchr == 13) ) continue; } LbMemorySet(numstr, 0, sizeof(numstr)); for (i=0; i < sizeof(numstr); i++) { numstr[i] = nchr; do_next = LbFileRead(fh, &nchr, 1); if (do_next != 1) break; if ( (nchr == 10) || (nchr == 44) || (nchr == 32) || (nchr == 9) || (nchr == 13) ) break; } value_array[n] = atol(numstr); n++; if (n >= sizeof(floor_to_ceiling_map)/sizeof(floor_to_ceiling_map[0])) { do_next = 0; } } LbFileClose(fh); memcpy(_DK_floor_to_ceiling_map,floor_to_ceiling_map,sizeof(floor_to_ceiling_map)); return true; }
TbBool init_alpha_table(void) { char *fname; static const char textname[] = "alpha color table"; fname = prepare_file_path(FGrp_StdData,"alpha.col"); SYNCDBG(0,"Reading %s file \"%s\".",textname,fname); // Loading file data if (LbFileLoadAt(fname, &alpha_sprite_table) != sizeof(struct TbAlphaTables)) { compute_alpha_tables(&alpha_sprite_table,engine_palette,engine_palette); LbFileSaveAt(fname, &alpha_sprite_table, sizeof(struct TbAlphaTables)); } return true; }
TbBool init_rgb2idx_table(void) { char *fname; static const char textname[] = "rgb-to-index color table"; fname = prepare_file_path(FGrp_StdData,"colours.col"); SYNCDBG(0,"Reading %s file \"%s\".",textname,fname); // Loading file data if (LbFileLoadAt(fname, &colours) != sizeof(TbRGBColorTable)) { compute_rgb2idx_table(colours,engine_palette); LbFileSaveAt(fname, &colours, sizeof(TbRGBColorTable)); } return true; }
TbBool init_whitepal_table(void) { char *fname; static const char textname[] = "white-blended color table"; fname = prepare_file_path(FGrp_StdData,"whitepal.col"); SYNCDBG(0,"Reading %s file \"%s\".",textname,fname); // Loading file data if (LbFileLoadAt(fname, &white_pal) != 256) { compute_shifted_palette_table(white_pal, engine_palette, engine_palette, 48, 48, 48); LbFileSaveAt(fname, &white_pal, 256); } return true; }
long load_texture_anim_file(void) { SYNCDBG(8,"Starting"); //return _DK_load_anim_file(); char *fname; static const char textname[] = "animated tmap"; fname = prepare_file_path(FGrp_StdData,"tmapanim.dat"); SYNCDBG(0,"Reading %s file \"%s\".",textname,fname); if (LbFileLoadAt(fname, game.texture_animation) != sizeof(game.texture_animation)) { return false; } return true; }
TbBool load_settings(void) { SYNCDBG(6,"Starting"); char *fname; long len; fname = prepare_file_path(FGrp_Save,"settings.dat"); len = LbFileLengthRnc(fname); if (len == sizeof(struct GameSettings)) { if (LbFileLoadAt(fname, &settings) == sizeof(struct GameSettings)) return true; } setup_default_settings(); LbFileSaveAt(fname, &settings, sizeof(struct GameSettings)); return false; }
void net_write_config_file(void) { TbFileHandle handle; char *fname; // Try to load the config file fname = prepare_file_path(FGrp_Save,keeper_netconf_file); handle = LbFileOpen(fname, Lb_FILE_MODE_NEW); if (handle != -1) { strupr(net_config_info.str_atz); strupr(net_config_info.str_ath); strupr(net_config_info.str_atdt); strupr(net_config_info.str_ats); LbFileWrite(handle, &net_config_info, sizeof(net_config_info)); LbFileClose(handle); } }
void net_load_config_file(void) { TbFileHandle handle; char *fname; // Try to load the config file fname = prepare_file_path(FGrp_Save,keeper_netconf_file); handle = LbFileOpen(fname, Lb_FILE_MODE_READ_ONLY); if (handle != -1) { if (LbFileRead(handle, &net_config_info, sizeof(net_config_info)) == sizeof(net_config_info)) { LbFileClose(handle); return; } LbFileClose(handle); } // If can't load, then use default config LbMemoryCopy(&net_config_info, &default_net_config_info, sizeof(net_config_info)); LbStringCopy(net_config_info.str_u2, get_string(GUIStr_MnuNoName), 20); }
short read_continue_game_part(unsigned char *buf,long pos,long buf_len) { TbFileHandle fh; short result; char *fname; fname = prepare_file_path(FGrp_Save,continue_game_filename); if (LbFileLength(fname) != sizeof(struct Game)) { SYNCDBG(7,"No correct .SAV file; there's no continue"); return false; } fh = LbFileOpen(fname,Lb_FILE_MODE_READ_ONLY); if (fh == -1) { SYNCDBG(7,"Can't open .SAV file; there's no continue"); return false; } LbFileSeek(fh, pos, Lb_FILE_SEEK_BEGINNING); result = (LbFileRead(fh, buf, buf_len) == buf_len); LbFileClose(fh); return result; }
TbBool init_fades_table(void) { char *fname; long i; static const char textname[] = "fade table"; fname = prepare_file_path(FGrp_StdData,"tables.dat"); SYNCDBG(0,"Reading %s file \"%s\".",textname,fname); if (LbFileLoadAt(fname, &pixmap) != sizeof(struct TbColorTables)) { compute_fade_tables(&pixmap,engine_palette,engine_palette); LbFileSaveAt(fname, &pixmap, sizeof(struct TbColorTables)); } lbDisplay.FadeTable = pixmap.fade_tables; TbPixel cblack = 144; // Update black color for (i=0; i < 8192; i++) { if (pixmap.fade_tables[i] == 0) { pixmap.fade_tables[i] = cblack; } } return true; }
TbBool parse_lenses_data_blocks(char *buf, long len, const char *config_textname, unsigned short flags) { long pos; int i,k,n; int cmd_num; char *fname; struct LensConfig *lenscfg; // Block name and parameter word store variables char block_buf[COMMAND_WORD_LEN]; char word_buf[COMMAND_WORD_LEN]; // Initialize the array int arr_size; if ((flags & CnfLd_AcceptPartial) == 0) { arr_size = sizeof(lenses_conf.lenses)/sizeof(lenses_conf.lenses[0]); for (i=0; i < arr_size; i++) { lenscfg = &lenses_conf.lenses[i]; LbMemorySet(lenscfg->code_name, 0, COMMAND_WORD_LEN); LbMemorySet(lenscfg->mist_file, 0, DISKPATH_SIZE); lenscfg->mist_lightness = 0; lenscfg->mist_ghost = 0; lenscfg->displace_kind = 0; lenscfg->displace_magnitude = 0; lenscfg->displace_period = 1; LbMemorySet(lenscfg->palette, 0, PALETTE_SIZE*sizeof(TbPixel)); lenscfg->flags = 0; if (i < lenses_conf.lenses_count) { lenses_desc[i].name = lenscfg->code_name; lenses_desc[i].num = i; } else { lenses_desc[i].name = NULL; lenses_desc[i].num = 0; } } } // Load the file arr_size = lenses_conf.lenses_count; for (i=0; i < arr_size; i++) { sprintf(block_buf,"lens%d",i); pos = 0; k = find_conf_block(buf,&pos,len,block_buf); if (k < 0) { if ((flags & CnfLd_AcceptPartial) == 0) { WARNMSG("Block [%s] not found in %s file.",block_buf,config_textname); return false; } continue; } lenscfg = &lenses_conf.lenses[i]; #define COMMAND_TEXT(cmd_num) get_conf_parameter_text(lenses_data_commands,cmd_num) while (pos<len) { // Finding command number in this line cmd_num = recognize_conf_command(buf,&pos,len,lenses_data_commands); // Now store the config item in correct place if (cmd_num == -3) break; // if next block starts if ((flags & CnfLd_ListOnly) != 0) { // In "List only" mode, accept only name command if (cmd_num > 1) { cmd_num = 0; } } n = 0; switch (cmd_num) { case 1: // NAME if (get_conf_parameter_single(buf,&pos,len,lenscfg->code_name,COMMAND_WORD_LEN) <= 0) { CONFWRNLOG("Couldn't read \"%s\" parameter in [%s] block of %s file.", COMMAND_TEXT(cmd_num),block_buf,config_textname); break; } n++; break; case 2: // MIST if (get_conf_parameter_single(buf,&pos,len,lenscfg->mist_file,DISKPATH_SIZE) > 0) { n++; } if (get_conf_parameter_single(buf,&pos,len,word_buf,sizeof(word_buf)) > 0) { k = atoi(word_buf); if ((k >= 0) && (k < 64)) { lenscfg->mist_lightness = k; n++; } } if (get_conf_parameter_single(buf,&pos,len,word_buf,sizeof(word_buf)) > 0) { k = atoi(word_buf); if ((k >= 0) && (k < 256)) { lenscfg->mist_ghost = k; n++; } } if (n < 3) { CONFWRNLOG("Incorrect value of \"%s\" parameter in [%s] block of %s file.", COMMAND_TEXT(cmd_num),block_buf,config_textname); } else { lenscfg->flags |= LCF_HasMist; } break; case 3: // DISPLACEMENT if (get_conf_parameter_single(buf,&pos,len,word_buf,sizeof(word_buf)) > 0) { k = atoi(word_buf); if ((k > 0) && (k < 256)) { lenscfg->displace_kind = k; n++; } } if (get_conf_parameter_single(buf,&pos,len,word_buf,sizeof(word_buf)) > 0) { k = atoi(word_buf); if ((k >= 0) && (k < 512)) { lenscfg->displace_magnitude = k; n++; } } if (get_conf_parameter_single(buf,&pos,len,word_buf,sizeof(word_buf)) > 0) { k = atoi(word_buf); if ((k > 0) && (k < 512)) { lenscfg->displace_period = k; n++; } } if (n < 3) { CONFWRNLOG("Incorrect value of \"%s\" parameter in [%s] block of %s file.", COMMAND_TEXT(cmd_num),block_buf,config_textname); } else { lenscfg->flags |= LCF_HasDisplace; } break; case 4: // PALETTE if (get_conf_parameter_single(buf,&pos,len,word_buf,sizeof(word_buf)) > 0) { fname = prepare_file_path(FGrp_StdData,word_buf); if ( LbFileLoadAt(fname, lenscfg->palette) == PALETTE_SIZE) { n++; } } if (n < 1) { CONFWRNLOG("Incorrect value of \"%s\" parameter in [%s] block of %s file.", COMMAND_TEXT(cmd_num),block_buf,config_textname); } else { lenscfg->flags |= LCF_HasPalette; } break; case 0: // comment break; case -1: // end of buffer break; default: CONFWRNLOG("Unrecognized command (%d) in [%s] block of %s file.", cmd_num,block_buf,config_textname); break; } skip_conf_to_next_line(buf,&pos,len); } #undef COMMAND_TEXT } return true; }
void fronttorture_load(void) { struct PlayerInfo *player; char *fname; unsigned char *ptr; long i,k; wait_for_cd_to_be_available(); frontend_load_data_from_cd(); memcpy(frontend_backup_palette, &frontend_palette, PALETTE_SIZE); // Texture blocks memory isn't used here, so reuse it instead of allocating ptr = block_mem; // Load RAW/PAL background fname = prepare_file_path(FGrp_LoData,"torture.raw"); torture_background = ptr; i = LbFileLoadAt(fname, ptr); ptr += i; fname = prepare_file_path(FGrp_LoData,"torture.pal"); torture_palette = ptr; i = LbFileLoadAt(fname, ptr); ptr += i; // Load DAT/TAB sprites for doors k = 0; { fname = prepare_file_fmtpath(FGrp_LoData,"door%02d.dat",k+1); i = LbFileLoadAt(fname, ptr); doors[k].data = ptr; ptr += i; doors[k].data_end = ptr; fname = prepare_file_fmtpath(FGrp_LoData,"door%02d.tab",k+1); i = LbFileLoadAt(fname, ptr); doors[k].sprites = (struct TbSprite *)ptr; ptr += i; doors[k].sprites_end =(struct TbSprite *) ptr; } ptr = &game.land_map_start; for (k=1; k < 8; k++) { fname = prepare_file_fmtpath(FGrp_LoData,"door%02d.dat",k+1); i = LbFileLoadAt(fname, ptr); doors[k].data = ptr; ptr += i; doors[k].data_end = ptr; fname = prepare_file_fmtpath(FGrp_LoData,"door%02d.tab",k+1); i = LbFileLoadAt(fname, ptr); doors[k].sprites = (struct TbSprite *)ptr; ptr += i; doors[k].sprites_end = (struct TbSprite *)ptr; } ptr = poly_pool; k = 8; { fname = prepare_file_fmtpath(FGrp_LoData,"door%02d.dat",k+1); i = LbFileLoadAt(fname, ptr); doors[k].data = ptr; ptr += i; doors[k].data_end = ptr; fname = prepare_file_fmtpath(FGrp_LoData,"door%02d.tab",k+1); i = LbFileLoadAt(fname, ptr); doors[k].sprites = (struct TbSprite *)ptr; ptr += i; doors[k].sprites_end = (struct TbSprite *)ptr; } if ( LbDataLoadAll(torture_load_files) ) ERRORLOG("Unable to load torture load files"); LbSpriteSetupAll(setup_torture_sprites); frontend_load_data_reset(); memcpy(&frontend_palette, torture_palette, PALETTE_SIZE); torture_state.action = 0; torture_door_selected = -1; torture_end_sprite = -1; torture_sprite_direction = 0; LbMemorySet(door_sound_state, 0, TORTURE_DOORS_COUNT*sizeof(struct DoorSoundState)); player = get_my_player(); if (player->victory_state == VicS_WonLevel) { LbMouseChangeSpriteAndHotspot(&fronttor_sprites[1], 0, 0); } else { LbMouseChangeSpriteAndHotspot(0, 0, 0); } torture_left_button = 0; }
TbBool setup_heaps(void) { TbBool low_memory; char snd_fname[2048]; char *spc_fname; long i; SYNCDBG(8,"Starting"); low_memory = false; if (!SoundDisabled) { StopAllSamples(); close_sound_heap(); if (sound_heap_memory != NULL) { LbMemoryFree(sound_heap_memory); sound_heap_memory = NULL; } } if (heap != NULL) { ERRORLOG("Graphics heap already allocated"); LbMemoryFree(heap); heap = NULL; } // Allocate sound heap if (!SoundDisabled) { i = mem_size; while (sound_heap_memory == NULL) { sound_heap_size = get_best_sound_heap_size(i); i = get_smaller_memory_amount(i); sound_heap_memory = LbMemoryAlloc(sound_heap_size); if ((i <= 8) && (sound_heap_memory == NULL)) { low_memory = true; break; } } } // Allocate graphics heap i = mem_size; while (heap == NULL) { heap_size = get_best_sound_heap_size(i); i = get_smaller_memory_amount(i); heap = LbMemoryAlloc(heap_size); if ((i <= 8) && (heap == NULL)) { low_memory = true; break; } } SYNCMSG("GraphicsHeap Size %d", heap_size); if (low_memory) { SYNCDBG(8,"Low memory mode entered on heap allocation."); while (heap != NULL) { if ((!SoundDisabled) && (sound_heap_memory == NULL)) { break; } if (!SoundDisabled) { if (sound_heap_size < heap_size) { heap_size -= 16384; } else if (sound_heap_size == heap_size) { heap_size -= 16384; sound_heap_size -= 16384; } else { sound_heap_size -= 16384; } if (sound_heap_size < 524288) { ERRORLOG("Unable to allocate heaps (small_mem)"); return false; } } else { heap_size -= 16384; } if (heap_size < 524288) { if (sound_heap_memory != NULL) { LbMemoryFree(sound_heap_memory); sound_heap_memory = NULL; } ERRORLOG("Unable to allocate heaps (small_mem)"); return false; } } if (sound_heap_memory != NULL) { LbMemoryFree(sound_heap_memory); sound_heap_memory = NULL; } if (heap != NULL) { LbMemoryFree(heap); heap = NULL; } if (!SoundDisabled) { sound_heap_memory = LbMemoryAlloc(sound_heap_size); } heap = LbMemoryAlloc(heap_size); } if (!SoundDisabled) { SYNCMSG("SoundHeap Size %d", sound_heap_size); // Prepare sound sample bank file names prepare_file_path_buf(snd_fname,FGrp_LrgSound,sound_fname); // language-specific speech file spc_fname = prepare_file_fmtpath(FGrp_LrgSound,"speech_%s.dat",get_language_lwrstr(install_info.lang_id)); // default speech file if (!LbFileExists(spc_fname)) spc_fname = prepare_file_path(FGrp_LrgSound,speech_fname); // speech file for english if (!LbFileExists(spc_fname)) spc_fname = prepare_file_fmtpath(FGrp_LrgSound,"speech_%s.dat",get_language_lwrstr(1)); // Initialize sample banks if (!init_sound_heap_two_banks(sound_heap_memory, sound_heap_size, snd_fname, spc_fname, 1622)) { LbMemoryFree(sound_heap_memory); sound_heap_memory = NULL; SoundDisabled = true; ERRORLOG("Unable to initialize sound heap. Sound disabled."); } } return true; }
/** * Loads binary config of cubes. * @deprecated Replaced by text config - remove pending. */ long load_cube_file(void) { char *buf; long len; TbBool result; char *fname; static const char textname[] = "binary cubes config"; fname = prepare_file_path(FGrp_StdData,"cube.dat"); SYNCDBG(0,"%s %s file \"%s\".","Reading",textname,fname); //return _DK_load_cube_file(); clear_cubes(); len = LbFileLengthRnc(fname); if (len < MIN_CONFIG_FILE_SIZE) { WARNMSG("The %s file \"%s\" doesn't exist or is too small.",textname,fname); return false; } if (len > MAX_CONFIG_FILE_SIZE) { WARNMSG("The %s file \"%s\" is too large.",textname,fname); return false; } buf = (char *)LbMemoryAlloc(len+256); if (buf == NULL) return false; // Loading file data len = LbFileLoadAt(fname, buf); result = (len > 0); // Parse the config file if (result) { long i,count; count = *(long *)&buf[0]; if (count > len/sizeof(struct CubeAttribs)) { count = len/sizeof(struct CubeAttribs); WARNMSG("The %s file \"%s\" seem truncated.",textname,fname); } if (count > CUBE_ITEMS_MAX-1) count = CUBE_ITEMS_MAX-1; if (count < 0) count = 0; struct CubeAttribs * cubuf; cubuf = (struct CubeAttribs *)&buf[4]; for (i=0; i < count; i++) { struct CubeAttribs * cubed; cubed = &game.cubes_data[i]; int n; for (n=0; n < CUBE_TEXTURES; n++) { cubed->texture_id[n] = cubuf->texture_id[n]; } for (n=0; n < CUBE_TEXTURES; n++) { cubed->field_C[n] = cubuf->field_C[n]; } cubuf++; } result = true; } //Freeing and exiting LbMemoryFree(buf); return result; }