Clean up tons of commented fileio code
This commit is contained in:
@@ -27,40 +27,19 @@
|
||||
|
||||
#define DONE_BUTTON_ITEM 1
|
||||
|
||||
//extern party_record_type party;
|
||||
//extern pc_record_type adven[6];
|
||||
//extern cOutdoors outdoors[2][2];
|
||||
//extern unsigned char out[96][96],out_e[96][96];
|
||||
extern short give_delays,stat_screen_mode;
|
||||
extern eGameMode overall_mode;
|
||||
extern bool play_sounds,sys_7_avail,save_maps,party_in_memory,in_scen_debug,ghost_mode;
|
||||
//extern current_town_type c_town;
|
||||
//extern town_item_list t_i;
|
||||
extern location center;
|
||||
extern long register_flag;
|
||||
extern sf::RenderWindow mainPtr;
|
||||
//extern stored_items_list_type stored_items[3];
|
||||
//extern stored_town_maps_type maps;
|
||||
//extern stored_outdoor_maps_type o_maps;
|
||||
//extern big_tr_type t_d;
|
||||
//extern short town_size[3];
|
||||
extern short town_type,current_pc;
|
||||
//extern setup_save_type setup_save;
|
||||
//extern unsigned char misc_i[64][64],sfx[64][64];
|
||||
//extern unsigned char template_terrain[64][64];
|
||||
//extern tiny_tr_type anim_t_d;
|
||||
extern bool map_visible;
|
||||
//extern location monster_targs[60];
|
||||
extern sf::RenderWindow mini_map;
|
||||
extern short which_combat_type;
|
||||
extern short cur_town_talk_loaded;
|
||||
extern cScenario scenario;
|
||||
extern cUniverse univ;
|
||||
//extern piles_of_stuff_dumping_type *data_store;
|
||||
//std::vector<std::string> scen_names;
|
||||
//stored_town_maps_type town_maps;
|
||||
//extern talking_record_type talking;
|
||||
//extern outdoor_strs_type outdoor_text[2][2];
|
||||
cScenarioList scen_headers;
|
||||
extern ter_num_t combat_terrain[64][64];
|
||||
extern bool mac_is_intel;
|
||||
@@ -82,13 +61,6 @@ char start_name[256];
|
||||
short start_volume,data_volume;
|
||||
extern fs::path progDir;
|
||||
|
||||
//outdoor_record_type dummy_out;////
|
||||
//town_record_type dummy_town;
|
||||
|
||||
// Trying this to fix bug. Hope it works.
|
||||
// tiny_tr_type tiny_t;
|
||||
// ave_tr_type ave_t;
|
||||
|
||||
//template_town_type town_template;
|
||||
cCustomGraphics spec_scen_g;
|
||||
|
||||
@@ -206,238 +178,6 @@ void finish_load_party(){
|
||||
in_scen_debug = false;
|
||||
}
|
||||
|
||||
//void port_save_file(party_record_type* party){
|
||||
// if(!mac_is_intel) return;
|
||||
// short i,j;
|
||||
// flip_long(&univ.party->age);
|
||||
// flip_short(&univ.party->gold);
|
||||
// flip_short(&univ.party->food);
|
||||
// flip_short(&univ.party->light_level);
|
||||
// for(i = 0; i < 30; i++)
|
||||
// flip_short(&univ.party->boats[i].which_town);
|
||||
// for(i = 0; i < 30; i++)
|
||||
// flip_short(&univ.party->horses[i].which_town);
|
||||
// flip_short
|
||||
// creature_list_type creature_save[4];
|
||||
// short in_boat,in_horse;
|
||||
// outdoor_creature_type out_c[10];
|
||||
// cItemRec magic_store_items[5][10];
|
||||
// short imprisoned_monst[4];
|
||||
// char m_seen[256];
|
||||
// char journal_str[50];
|
||||
// short journal_day[50];
|
||||
// short special_notes_str[140][2];
|
||||
// talk_save_type talk_save[120];
|
||||
// short direction,at_which_save_slot;
|
||||
// char alchemy[20];
|
||||
// bool can_find_town[200];
|
||||
// short key_times[100];
|
||||
// short party_event_timers[30];
|
||||
// short global_or_town[30];
|
||||
// short node_to_call[30];
|
||||
// char spec_items[50],help_received[120];
|
||||
// short m_killed[200];
|
||||
// long total_m_killed,total_dam_done,total_xp_gained,total_dam_taken;
|
||||
// char scen_name[256];
|
||||
//}
|
||||
|
||||
|
||||
void swap_val(unsigned char *val,short a,short b)
|
||||
{
|
||||
if (*val == a)
|
||||
*val = b;
|
||||
else if (*val == b)
|
||||
*val = a;
|
||||
}
|
||||
void change_val_4 (unsigned char *val,short a,short b,short c,short d)
|
||||
{
|
||||
if (*val == a)
|
||||
*val = b;
|
||||
else if (*val == b)
|
||||
*val = c;
|
||||
else if (*val == c)
|
||||
*val = d;
|
||||
else if (*val == d)
|
||||
*val = a;
|
||||
}
|
||||
void change_val (unsigned char *val,short a,short b)
|
||||
{
|
||||
if (*val == a)
|
||||
*val = b;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//void build_scen_file_name (Str255 file_n)
|
||||
//{
|
||||
// sprintf((char *) file_n,"::::Blades of Exile Scenarios:%s",univ.party.scen_name);
|
||||
// c2pstr((char*)file_n);
|
||||
//}
|
||||
|
||||
// mode 0 want town and talking, 1 talking only, 2 want a string only, and extra is string num
|
||||
// Hey's let's be kludgy and overload these value again! If extra is -1, and mode 2, that
|
||||
// means we want to load all the strings and only the strings
|
||||
//void load_town(short town_num,short mode,short extra,char *str)
|
||||
//{
|
||||
// short file_id;
|
||||
// short i,j;
|
||||
// long store = 0;
|
||||
// short which_town;
|
||||
// long len,len_to_jump = 0;
|
||||
// OSErr error;
|
||||
// char file_name[256];
|
||||
//
|
||||
// if (town_num != minmax(0,scenario.num_towns - 1,town_num)) {
|
||||
// give_error("The scenario tried to place you into a non-existant town.","",0);
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// which_town = town_num;
|
||||
//
|
||||
// //HGetVol((StringPtr) start_name,&start_volume,&start_dir);
|
||||
// build_scen_file_name(file_name);
|
||||
//
|
||||
// error = HOpen(start_volume,start_dir,file_name,3,&file_id);
|
||||
// if (error != 0) {
|
||||
// //FCD(949,0);
|
||||
// SysBeep(50);
|
||||
// return;
|
||||
// }
|
||||
// len_to_jump = sizeof(scenario_data_type);
|
||||
// len_to_jump += sizeof(scen_item_data_type);
|
||||
// for (i = 0; i < 300; i++)
|
||||
// len_to_jump += (long) scenario.scen_str_len[i];
|
||||
// store = 0;
|
||||
// for (i = 0; i < 100; i++)
|
||||
// for (j = 0; j < 2; j++)
|
||||
// store += (long) (scenario.out_data_size[i][j]);
|
||||
// for (i = 0; i < which_town; i++)
|
||||
// for (j = 0; j < 5; j++)
|
||||
// store += (long) (scenario.town_data_size[i][j]);
|
||||
// len_to_jump += store;
|
||||
//
|
||||
// error = SetFPos (file_id, 1, len_to_jump);
|
||||
// if (error != 0) {FSClose(file_id);oops_error(35);}
|
||||
//
|
||||
// len = sizeof(town_record_type);
|
||||
//
|
||||
// if (mode == 0) {
|
||||
// error = FSRead(file_id, &len , (char *) &univ.town.town);
|
||||
// port_town();
|
||||
// }
|
||||
// else error = FSRead(file_id, &len , (char *) &dummy_town);
|
||||
// if (error != 0) {FSClose(file_id);oops_error(36);}
|
||||
//
|
||||
// switch (scenario.town_size[which_town]) {
|
||||
// case 0:
|
||||
// len = sizeof(big_tr_type);
|
||||
// if (mode == 0) {
|
||||
// FSRead(file_id, &len, (char *) &t_d);
|
||||
// port_t_d();
|
||||
// }
|
||||
// else error = SetFPos (file_id, 3, len);
|
||||
//
|
||||
// break;
|
||||
//
|
||||
// case 1:
|
||||
// len = sizeof(ave_tr_type);
|
||||
// if (mode == 0) {
|
||||
// FSRead(file_id, &len, (char *) &ave_t);
|
||||
// for (i = 0; i < 48; i++)
|
||||
// for (j = 0; j < 48; j++) {
|
||||
// t_d.terrain[i][j] = ave_t.terrain[i][j];
|
||||
// t_d.lighting[i / 8][j] = ave_t.lighting[i / 8][j];
|
||||
// }
|
||||
// //print_nums(5555,5555,5555);
|
||||
// //for (i = 0; i < 8; i++)
|
||||
// // for (j = 0; j < 48; j++)
|
||||
// // if (t_d.lighting[i][j] != 0) {
|
||||
// // print_nums(i,j,t_d.lighting[i][j]);
|
||||
// // }
|
||||
//
|
||||
// for (i = 0; i < 16; i++) {
|
||||
// t_d.room_rect[i] = ave_t.room_rect[i];
|
||||
// }
|
||||
// for (i = 0; i < 40; i++) {
|
||||
// t_d.creatures[i] = ave_t.creatures[i];
|
||||
// }
|
||||
// for (i = 40; i < 60; i++) {
|
||||
// t_d.creatures[i].number = 0;
|
||||
// }
|
||||
// port_t_d();
|
||||
// }
|
||||
// else error = SetFPos (file_id, 3, len);
|
||||
//
|
||||
// break;
|
||||
//
|
||||
// case 2:
|
||||
// len = sizeof(tiny_tr_type);
|
||||
// if (mode == 0) {
|
||||
// FSRead(file_id,&len , (char *) &tiny_t);
|
||||
// for (i = 0; i < 32; i++)
|
||||
// for (j = 0; j < 32; j++) {
|
||||
// t_d.terrain[i][j] = tiny_t.terrain[i][j];
|
||||
// t_d.lighting[i / 8][j] = tiny_t.lighting[i / 8][j];
|
||||
// }
|
||||
// for (i = 0; i < 16; i++) {
|
||||
// t_d.room_rect[i] = tiny_t.room_rect[i];
|
||||
// }
|
||||
// for (i = 0; i < 30; i++) {
|
||||
// t_d.creatures[i] = tiny_t.creatures[i];
|
||||
// }
|
||||
// for (i = 30; i < 60; i++) {
|
||||
// t_d.creatures[i].number = 0;
|
||||
// }
|
||||
// port_t_d();
|
||||
// }
|
||||
// else error = SetFPos (file_id, 3, len);
|
||||
// break;
|
||||
// }
|
||||
//
|
||||
// for (i = 0; i < 140; i++) {
|
||||
// len = (mode == 0) ? (long) (univ.town.town.strlens[i]) : (long) (dummy_town.strlens[i]);
|
||||
// switch (mode) {
|
||||
// case 0:
|
||||
// FSRead(file_id, &len, (char *) &(town_strs[i]));
|
||||
// data_store->town_strs[i][len] = 0;
|
||||
// break;
|
||||
// case 1:
|
||||
// SetFPos (file_id, 3, len);
|
||||
// break;
|
||||
// case 2:
|
||||
// if (extra < 0) {
|
||||
// FSRead(file_id, &len, (char *) &(data_store->town_strs[i]));
|
||||
// data_store->town_strs[i][len] = 0;
|
||||
// }
|
||||
// else if (i == extra) {
|
||||
// FSRead(file_id, &len, (char *) str);
|
||||
// str[len] = 0;
|
||||
// }
|
||||
// else SetFPos (file_id, 3, len);
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if (mode < 2) {
|
||||
// len = sizeof(talking_record_type);
|
||||
// error = FSRead(file_id, &len , (char *) &talking);
|
||||
// port_talk_nodes();
|
||||
// if (error != 0) {FSClose(file_id);oops_error(37);}
|
||||
//
|
||||
// for (i = 0; i < 170; i++) {
|
||||
// len = (long) (talking.strlens[i]);
|
||||
// FSRead(file_id, &len, (char *) &(talk_strs[i]));
|
||||
// data_store->talk_strs[i][len] = 0;
|
||||
// }
|
||||
// cur_town_talk_loaded = town_num;
|
||||
// }
|
||||
// if (mode == 0)
|
||||
// town_type = scenario.town_size[which_town];
|
||||
// error = FSClose(file_id);
|
||||
// if (error != 0) {FSClose(file_id);oops_error(38);}
|
||||
//
|
||||
// // Now more initialization is needed. First need to properly create the misc_i array.
|
||||
//
|
||||
void init_town(){ // formerly part of load_town
|
||||
// Initialize barriers, etc. Note non-sfx gets forgotten if this is a town recently visited.
|
||||
// if (mode == 0) {
|
||||
@@ -821,87 +561,6 @@ void fix_boats()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//void load_outdoors(short to_create_x, short to_create_y, short targ_x, short targ_y,
|
||||
// short mode,short extra,char *str)
|
||||
////short to_create_x, to_create_y; // actual sector being loaded
|
||||
////short targ_x, targ_y; // 0 or 1
|
||||
//// mode 0 - whole out, 1 - just string number extra
|
||||
//{
|
||||
// short file_id;
|
||||
// short i,j;
|
||||
// long len;
|
||||
// char file_name[256];
|
||||
// short out_sec_num;
|
||||
// long len_to_jump = 0,store = 0;
|
||||
// OSErr error;
|
||||
//
|
||||
// if ((to_create_x != minmax(0,scenario.out_width - 1,to_create_x)) ||
|
||||
// (to_create_y != minmax(0,scenario.out_height - 1,to_create_y))) { // not exist
|
||||
// for (i = 0; i < 48; i++)
|
||||
// for (j = 0; j < 48; j++)
|
||||
// univ.out.outdoors[targ_x][targ_y].terrain[i][j] = 5;
|
||||
// for (i = 0; i < 18; i++) {
|
||||
// univ.out.outdoors[targ_x][targ_y].special_id[i] = -1;
|
||||
// univ.out.outdoors[targ_x][targ_y].special_locs[i].x = 100;
|
||||
// }
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// build_scen_file_name(file_name);
|
||||
//
|
||||
// error = HOpen(start_volume,start_dir,file_name,3,&file_id);
|
||||
//
|
||||
// out_sec_num = scenario.out_width * to_create_y + to_create_x;
|
||||
//
|
||||
// len_to_jump = sizeof(scenario_data_type);
|
||||
// len_to_jump += sizeof(scen_item_data_type);
|
||||
// for (i = 0; i < 300; i++)
|
||||
// len_to_jump += (long) scenario.scen_str_len[i];
|
||||
// store = 0;
|
||||
// for (i = 0; i < out_sec_num; i++)
|
||||
// for (j = 0; j < 2; j++)
|
||||
// store += (long) (scenario.out_data_size[i][j]);
|
||||
// len_to_jump += store;
|
||||
//
|
||||
// error = SetFPos (file_id, 1, len_to_jump);
|
||||
// if (error != 0) {FSClose(file_id);oops_error(32);}
|
||||
//
|
||||
// len = sizeof(outdoor_record_type);
|
||||
// if (mode == 0) {
|
||||
// error = FSRead(file_id, &len, (char *) &univ.out.outdoors[targ_x][targ_y]);
|
||||
// port_out(&univ.out.outdoors[targ_x][targ_y]);
|
||||
// if (error != 0) {FSClose(file_id);oops_error(33);}
|
||||
// }
|
||||
// else error = FSRead(file_id, &len, (char *) &dummy_out);
|
||||
//
|
||||
// if (mode == 0) {
|
||||
// for (i = 0; i < 9; i++) {
|
||||
// len = (long) (univ.out.outdoors[targ_x][targ_y].strlens[i]);
|
||||
// FSRead(file_id, &len, (char *) &(outdoor_text[targ_x][targ_y].out_strs[i]));
|
||||
// outdoor_text[targ_x][targ_y].out_strs[i][len] = 0;
|
||||
// }
|
||||
// }
|
||||
// if (mode == 1) {
|
||||
// for (i = 0; i < 120; i++) {
|
||||
// len = (long) (dummy_out.strlens[i]);
|
||||
// if (i == extra) {
|
||||
// FSRead(file_id, &len, (char *) str);
|
||||
// str[len] = 0;
|
||||
// }
|
||||
// else SetFPos (file_id, 3, len);
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//
|
||||
// error = FSClose(file_id);
|
||||
// if (error != 0) {FSClose(file_id);oops_error(33);}
|
||||
//}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void start_data_dump() {
|
||||
fs::path path = progDir/"Data Dump.txt";
|
||||
std::ofstream fout(path.c_str());
|
||||
@@ -925,108 +584,14 @@ void start_data_dump() {
|
||||
}
|
||||
}
|
||||
|
||||
// expecting party record to contain name of proper scenario to load
|
||||
//bool load_scenario()
|
||||
//{
|
||||
//
|
||||
// short i,file_id;
|
||||
// bool file_ok = false;
|
||||
// OSErr error;
|
||||
// long len;
|
||||
// char file_name[256];
|
||||
//
|
||||
// build_scen_file_name(file_name);
|
||||
//
|
||||
// error = HOpen(start_volume,start_dir,file_name,3,&file_id);
|
||||
// if (error != 0) {
|
||||
// oops_error(10000 + error);
|
||||
// SysBeep(2); return false;
|
||||
// }
|
||||
//
|
||||
// len = (long) sizeof(scenario_data_type);
|
||||
// if ((error = FSRead(file_id, &len, (char *) &scenario)) != 0){
|
||||
// FSClose(file_id); oops_error(29); return false;
|
||||
// }
|
||||
// if ((scenario.flag1 == 10) && (scenario.flag2 == 20)
|
||||
// && (scenario.flag3 == 30)
|
||||
// && (scenario.flag4 == 40)) {
|
||||
// file_ok = true;
|
||||
// cur_scen_is_mac = true;
|
||||
// }
|
||||
// if ((scenario.flag1 == 20) && (scenario.flag2 == 40)
|
||||
// && (scenario.flag3 == 60)
|
||||
// && (scenario.flag4 == 80)) {
|
||||
// file_ok = true;
|
||||
// cur_scen_is_mac = false;
|
||||
// }
|
||||
// if (file_ok == false) {
|
||||
// FSClose(file_id);
|
||||
// give_error("This is not a legitimate Blades of Exile scenario.","",0);
|
||||
// return false;
|
||||
// }
|
||||
// port_scenario();
|
||||
// len = sizeof(scen_item_data_type); // item data
|
||||
// if ((error = FSRead(file_id, &len, (char *) &(scen_item_list))) != 0){
|
||||
// FSClose(file_id); oops_error(30); return false;
|
||||
// }
|
||||
// port_item_list();
|
||||
// for (i = 0; i < 270; i++) {
|
||||
// len = (long) (scenario.scen_str_len[i]);
|
||||
// FSRead(file_id, &len, (char *) &(scen_strs[i]));
|
||||
// scen_strs[i][len] = 0;
|
||||
// }
|
||||
//
|
||||
// FSClose(file_id);
|
||||
// load_spec_graphics();
|
||||
// set_up_ter_pics();
|
||||
// return true;
|
||||
//}
|
||||
|
||||
//void set_up_ter_pics()
|
||||
//{
|
||||
// short i;
|
||||
//
|
||||
// set_terrain_blocked();
|
||||
// for (i = 0; i < 256; i++)
|
||||
// terrain_pic[i] = scenario.ter_types[i].picture;
|
||||
//}
|
||||
//void oops_error(short error)
|
||||
//{
|
||||
// char error_str[256];
|
||||
//
|
||||
// SysBeep(50);
|
||||
// SysBeep(50);
|
||||
// SysBeep(50);
|
||||
// sprintf((char *) error_str,"Giving the scenario editor more memory might also help. Be sure to back your scenario up often. Error number: %d.",error);
|
||||
// give_error("The program encountered an error while loading/saving/creating the scenario. To prevent future problems, the program will now terminate. Trying again may solve the problem.",(char *) error_str,0);
|
||||
// //ExitToShell();
|
||||
//}
|
||||
|
||||
/*
|
||||
|
||||
typedef struct {
|
||||
unsigned char flag1, flag2, flag3, flag4;
|
||||
unsigned char ver[3],min_run_ver,prog_make_ver[3],num_towns;
|
||||
unsigned char out_width,out_height,difficulty,intro_pic,default_ground;
|
||||
} scen_header_type;
|
||||
*/
|
||||
void build_scen_headers()
|
||||
{
|
||||
fs::path scenDir = progDir;
|
||||
// scenDir.erase(scenDir.find_last_of("/"));
|
||||
scenDir /= "Blades of Exile Scenarios";
|
||||
printf("%s\n%s\n",progDir.c_str(),scenDir.c_str());
|
||||
scen_headers.clear();
|
||||
// for (i = 0; i < 25; i++)
|
||||
// scen_headers[i].flag1 = 0;
|
||||
// FSOpenIterator(&folderRef,0,&files);
|
||||
fs::path folderRef(scenDir); // TODO: This variable is unnecessary
|
||||
fs::directory_iterator iter(folderRef);
|
||||
/**TESTING**/
|
||||
// UniChar x[] = {0x0024, 0x0041, 0x0020, 0x0075, 0x0073, 0x0065, 0x006c, 0x0065, 0x0073, 0x0073, 0x0020, 0x0066, 0x0069, 0x006c, 0x0065};
|
||||
// err = FSCreateFileUnicode (&ref, 15, x, NULL, NULL, NULL, NULL);
|
||||
// if(err != noErr)printf("Error creating file.");
|
||||
/**END TESTING**/
|
||||
// TODO: Double-check that kFSIterateFlat is identical to the behaviour of Boost's directory_iterator
|
||||
#if 0
|
||||
err = FSOpenIterator(&folderRef, kFSIterateFlat, &iter);
|
||||
@@ -1035,14 +600,7 @@ void build_scen_headers()
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
//myCPB.dirInfo.ioCompletion = NULL;
|
||||
//myCPB.dirInfo.ioNamePtr = scen_name;
|
||||
//myCPB.dirInfo.ioVRefNum = start_volume;
|
||||
|
||||
// HFSUniStr255 names[MAXSHEETS];
|
||||
// FSSpec locations[MAXSHEETS];
|
||||
// int numFound=0;
|
||||
// FSGetCatalogInfoBulk (files,(ItemCount)MAXSHEETS,(ItemCount*)&numFound,NULL,kFSCatInfoNone,NULL,NULL,locations, names)
|
||||
while(iter != fs::directory_iterator()) {
|
||||
fs::file_status stat = iter->status();
|
||||
if(stat.type() == fs::regular_file)
|
||||
@@ -1091,25 +649,6 @@ bool load_scenario_header(fs::path file/*,short header_entry*/){
|
||||
}
|
||||
|
||||
// So file is OK, so load in string data and close it.
|
||||
// SetFPos(file_id,1,0);
|
||||
// len = 41942;//(long) sizeof(scenario_data_type);
|
||||
// error = FSRead(file_id, &len, (char *) &scenario);
|
||||
// if (error != 0){
|
||||
// FSClose(file_id);
|
||||
// oops_error(29);
|
||||
// return false;
|
||||
// }
|
||||
// store = scenario.rating;
|
||||
// if (mac_header == false)
|
||||
// flip_short(&store);
|
||||
// curScen.default_ground = store;
|
||||
//
|
||||
// len = 39200;//sizeof(scen_item_data_type);
|
||||
// if (SetFPos(file_id,3,len) != 0){
|
||||
// FSClose(file_id);
|
||||
// return false;
|
||||
// }
|
||||
|
||||
fclose(file_id);
|
||||
load_scenario(file);
|
||||
|
||||
@@ -1127,463 +666,6 @@ bool load_scenario_header(fs::path file/*,short header_entry*/){
|
||||
return false;
|
||||
|
||||
scen_headers.push_back(curScen,scen_strs);
|
||||
// for (i = 0; i < 3; i++) {
|
||||
// store = (short) scenario.scen_str_len[i];
|
||||
// len = (long) (store);
|
||||
// FSRead(file_id, &len, (char *) load_str);
|
||||
// load_str[len] = 0;
|
||||
// if (i == 0)
|
||||
// load_str[29] = 0;
|
||||
// else load_str[59] = 0;
|
||||
// scen_strs[i] = (char*)load_str;
|
||||
// }
|
||||
|
||||
//FSClose(file_id);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//extern GWorldPtr spec_scen_g;
|
||||
//void load_spec_graphics()
|
||||
//{
|
||||
// short i,file_num;
|
||||
// char file_name[256];
|
||||
//
|
||||
// if (spec_scen_g != NULL) {
|
||||
// DisposeGWorld(spec_scen_g);
|
||||
// spec_scen_g = NULL;
|
||||
// }
|
||||
// build_scen_file_name(file_name);
|
||||
// for (i = 0; i < 250; i++) {
|
||||
// if (file_name[i] == '.') {
|
||||
// file_name[i + 1] = 'm';
|
||||
// file_name[i + 2] = 'e';
|
||||
// file_name[i + 3] = 'g';
|
||||
// i = 250;
|
||||
// }
|
||||
// }
|
||||
// file_num = HOpenResFile(start_volume,start_dir,file_name,1);
|
||||
// if (file_num < 0)
|
||||
// {
|
||||
// for (i = 0; i < 250; i++) {
|
||||
// if (file_name[i] == '.') {
|
||||
// file_name[i + 1] = 'b';
|
||||
// file_name[i + 2] = 'm';
|
||||
// file_name[i + 3] = 'p';
|
||||
// i = 250;
|
||||
// }
|
||||
// }
|
||||
// spec_scen_g = load_bmp_from_file(file_name);
|
||||
// return;
|
||||
// }
|
||||
// spec_scen_g = load_pict(1);
|
||||
// CloseResFile(file_num);
|
||||
//}
|
||||
|
||||
|
||||
//short init_data(short flag)
|
||||
//{
|
||||
// long k = 0;
|
||||
//
|
||||
// k = (long) flag;
|
||||
// k = k * k;
|
||||
// jl = jl * jl + 84 + k;
|
||||
// k = k + 51;
|
||||
// jl = jl * 2 + 1234 + k;
|
||||
//k = k % 3000;
|
||||
// jl = jl * 54;
|
||||
// jl = jl * 2 + 1234 + k;
|
||||
// k = k * 82;
|
||||
// k = k % 10000;
|
||||
// k = k + 10000;
|
||||
//
|
||||
// return (short) k;
|
||||
//}
|
||||
//
|
||||
//short town_s(short flag)
|
||||
//{
|
||||
// long k = 0;
|
||||
//
|
||||
// k = (long) flag;
|
||||
// k = k * k * k;
|
||||
// jl = jl * 54;
|
||||
// jl = jl * 2 + 1234 + k;
|
||||
// k = k + 51;
|
||||
// k = k % 3000;
|
||||
// jl = jl * 2 + 1234 + k;
|
||||
// k = k * scenario.num_towns;
|
||||
// k = k % 10000;
|
||||
// jl = jl * jl + 84 + k;
|
||||
// k = k + 10000;
|
||||
//
|
||||
// return (short) k;
|
||||
//}
|
||||
//
|
||||
//short out_s(short flag)
|
||||
//{
|
||||
// long k = 0;
|
||||
//
|
||||
// k = (long) flag;
|
||||
// k = k * k * k;
|
||||
// jl = jl * jl + 84 + k;
|
||||
// k = k + scenario.out_data_size[0][1];
|
||||
// k = k % 3000;
|
||||
// k = k * 4;
|
||||
// jl = jl * 2 + 1234 + k;
|
||||
// jl = jl * 54;
|
||||
// jl = jl * 2 + 1234 + k;
|
||||
// k = k % 10000;
|
||||
// k = k + 4;
|
||||
//
|
||||
// return (short) k;
|
||||
//}
|
||||
//
|
||||
//short str_size_1(short flag)
|
||||
//{
|
||||
// long k = 0;
|
||||
//
|
||||
// k = (long) flag;
|
||||
// k = k * k;
|
||||
// jl = jl * 2 + 1234 + k;
|
||||
// jl = jl * jl + 84 + k;
|
||||
// k = k + scenario.scen_str_len[0] + scenario.scen_str_len[1] + scenario.scen_str_len[2];
|
||||
// jl = jl * 2 + 1234 + k;
|
||||
// k = k % 3000;
|
||||
// jl = jl * 54;
|
||||
// jl = jl * jl + 84 + k;
|
||||
// k = k * 4;
|
||||
// k = k % 5000;
|
||||
// k = k - 9099;
|
||||
//
|
||||
// return (short) k;
|
||||
//}
|
||||
//
|
||||
//short str_size_2(short flag)
|
||||
//{
|
||||
// long k = 0;
|
||||
//
|
||||
// k = (long) flag;
|
||||
// jl = jl * jl + 84 + k;
|
||||
// k = k * k * k * k;
|
||||
// jl = jl * 54;
|
||||
// k = k + 80;
|
||||
// k = k % 3000;
|
||||
// jl = jl * 2 + 1234 + k;
|
||||
// k = k * scenario.out_width * scenario.out_height;
|
||||
// jl = jl * jl + 84 + k;
|
||||
// k = k % 3124;
|
||||
// k = k - 5426;
|
||||
//
|
||||
// return (short) k;
|
||||
//}
|
||||
//
|
||||
//short str_size_3(short flag)
|
||||
//{
|
||||
// long k = 0;
|
||||
//
|
||||
// k = (long) flag;
|
||||
// k = k * (scenario.town_data_size[0][0] + scenario.town_data_size[0][1] + scenario.town_data_size[0][2] + scenario.town_data_size[0][3]);
|
||||
// k = k + 80;
|
||||
// jl = jl * jl + 84 + k;
|
||||
// k = k % 3000;
|
||||
// jl = jl * 2 + 1234 + k;
|
||||
// k = k * 45;
|
||||
// jl = jl * 54;
|
||||
// jl = jl * jl + 84 + k;
|
||||
// k = k % 887;
|
||||
// k = k + 9452;
|
||||
//
|
||||
// return (short) k;
|
||||
//}
|
||||
//
|
||||
//short get_buf_ptr(short flag)
|
||||
//{
|
||||
// long k = 0;
|
||||
//
|
||||
// k = (long) flag;
|
||||
// jl = jl * jl + 84 + k;
|
||||
// k = k * (scenario.out_width + scenario.out_width + scenario.out_height + scenario.town_data_size[0][3]);
|
||||
// k = k + 80;
|
||||
// jl = jl * jl + 84 + k;
|
||||
// k = k % 2443;
|
||||
// jl = jl * 54;
|
||||
// k = k * 322;
|
||||
// jl = jl * 2 + 1234 + k;
|
||||
// k = k % 2542;
|
||||
// jl = jl * jl + 84 + k;
|
||||
// k = k + 234;
|
||||
//
|
||||
// return (short) k;
|
||||
//}
|
||||
//
|
||||
//bool check_p (short pword)
|
||||
//{
|
||||
// if (scenario.flag_b != town_s(pword))
|
||||
// return false;
|
||||
// if (scenario.flag_c != out_s(pword))
|
||||
// return false;
|
||||
// if (scenario.flag_e != str_size_1(pword))
|
||||
// return false;
|
||||
// if (scenario.flag_f != str_size_2(pword))
|
||||
// return false;
|
||||
// if (scenario.flag_h != str_size_3(pword))
|
||||
// return false;
|
||||
// if (scenario.flag_d != init_data(pword))
|
||||
// return false;
|
||||
//
|
||||
// return true;
|
||||
//}
|
||||
|
||||
//void port_talk_nodes()
|
||||
//{
|
||||
// short i;
|
||||
//
|
||||
// if (cur_scen_is_mac != mac_is_intel)
|
||||
// return;
|
||||
// for (i = 0; i < 60; i++) {
|
||||
// flip_short(&talking.talk_nodes[i].personality);
|
||||
// flip_short(&talking.talk_nodes[i].type);
|
||||
// flip_short(&talking.talk_nodes[i].extras[0]);
|
||||
// flip_short(&talking.talk_nodes[i].extras[1]);
|
||||
// flip_short(&talking.talk_nodes[i].extras[2]);
|
||||
// flip_short(&talking.talk_nodes[i].extras[3]);
|
||||
// }
|
||||
//}
|
||||
//
|
||||
//void port_town()
|
||||
//{
|
||||
// short i;
|
||||
//
|
||||
// if (cur_scen_is_mac != mac_is_intel)
|
||||
// return;
|
||||
// flip_short(&univ.town.town.town_chop_time);
|
||||
// flip_short(&univ.town.town.town_chop_key);
|
||||
// flip_short(&univ.town.town.lighting);
|
||||
// for (i =0 ; i < 4; i++)
|
||||
// flip_short(&univ.town.town.exit_specs[i]);
|
||||
// flip_rect(&univ.town.town.in_town_rect);
|
||||
// for (i =0 ; i < 64; i++) {
|
||||
// flip_short(&univ.town.town.preset_items[i].item_code);
|
||||
// flip_short(&univ.town.town.preset_items[i].ability);
|
||||
// }
|
||||
// for (i =0 ; i < 50; i++) {
|
||||
// flip_short(&univ.town.town.preset_fields[i].field_type);
|
||||
// }
|
||||
// flip_short(&univ.town.town.max_num_monst);
|
||||
// flip_short(&univ.town.town.spec_on_entry);
|
||||
// flip_short(&univ.town.town.spec_on_entry_if_dead);
|
||||
// for (i =0 ; i < 8; i++)
|
||||
// flip_short(&univ.town.town.timer_spec_times[i]);
|
||||
// for (i =0 ; i < 8; i++)
|
||||
// flip_short(&univ.town.town.timer_specs[i]);
|
||||
// flip_short(&univ.town.town.difficulty);
|
||||
// for (i =0 ; i < 100; i++)
|
||||
// flip_spec_node(&univ.town.town.specials[i]);
|
||||
//
|
||||
//}
|
||||
//
|
||||
//void port_t_d()
|
||||
//{
|
||||
// short i;
|
||||
// if (cur_scen_is_mac != mac_is_intel)
|
||||
// return;
|
||||
//
|
||||
// for (i =0 ; i < 16; i++)
|
||||
// flip_rect(&t_d.room_rect[i]);
|
||||
// for (i =0 ; i < 60; i++) {
|
||||
// flip_short(&t_d.creatures[i].spec1);
|
||||
// flip_short(&t_d.creatures[i].spec2);
|
||||
// flip_short(&t_d.creatures[i].monster_time);
|
||||
// flip_short(&t_d.creatures[i].personality);
|
||||
// flip_short(&t_d.creatures[i].special_on_kill);
|
||||
// flip_short(&t_d.creatures[i].facial_pic);
|
||||
//
|
||||
// }
|
||||
//}
|
||||
//
|
||||
//void port_scenario()
|
||||
//{
|
||||
// short i,j;
|
||||
//
|
||||
// if (cur_scen_is_mac != mac_is_intel)
|
||||
// return;
|
||||
// flip_short(&scenario.flag_a);
|
||||
// flip_short(&scenario.flag_b);
|
||||
// flip_short(&scenario.flag_c);
|
||||
// flip_short(&scenario.flag_d);
|
||||
// flip_short(&scenario.flag_e);
|
||||
// flip_short(&scenario.flag_f);
|
||||
// flip_short(&scenario.flag_g);
|
||||
// flip_short(&scenario.flag_h);
|
||||
// flip_short(&scenario.flag_i);
|
||||
// flip_short(&scenario.intro_mess_pic);
|
||||
// flip_short(&scenario.intro_mess_len);
|
||||
// flip_short(&scenario.which_town_start);
|
||||
// for (i = 0; i < 200; i++)
|
||||
// for (j = 0; j < 5; j++)
|
||||
// flip_short(&scenario.town_data_size[i][j]);
|
||||
// for (i = 0; i < 10; i++)
|
||||
// flip_short(&scenario.town_to_add_to[i]);
|
||||
// for (i = 0; i < 10; i++)
|
||||
// for (j = 0; j < 2; j++)
|
||||
// flip_short(&scenario.flag_to_add_to_town[i][j]);
|
||||
// for (i = 0; i < 100; i++)
|
||||
// for (j = 0; j < 2; j++)
|
||||
// flip_short(&scenario.out_data_size[i][j]);
|
||||
// for (i = 0; i < 3; i++)
|
||||
// flip_rect(&scenario.store_item_rects[i]);
|
||||
// for (i = 0; i < 3; i++)
|
||||
// flip_short(&scenario.store_item_towns[i]);
|
||||
// for (i = 0; i < 50; i++)
|
||||
// flip_short(&scenario.special_items[i]);
|
||||
// for (i = 0; i < 50; i++)
|
||||
// flip_short(&scenario.special_item_special[i]);
|
||||
// flip_short(&scenario.rating);
|
||||
// flip_short(&scenario.uses_custom_graphics);
|
||||
// for (i = 0; i < 256; i++) {
|
||||
// flip_short(&scenario.scen_monsters[i].health);
|
||||
// flip_short(&scenario.scen_monsters[i].m_health);
|
||||
// flip_short(&scenario.scen_monsters[i].max_mp);
|
||||
// flip_short(&scenario.scen_monsters[i].mp);
|
||||
// flip_short(&scenario.scen_monsters[i].a[1]);
|
||||
// flip_short(&scenario.scen_monsters[i].a[0]);
|
||||
// flip_short(&scenario.scen_monsters[i].a[2]);
|
||||
// flip_short(&scenario.scen_monsters[i].morale);
|
||||
// flip_short(&scenario.scen_monsters[i].m_morale);
|
||||
// flip_short(&scenario.scen_monsters[i].corpse_item);
|
||||
// flip_short(&scenario.scen_monsters[i].corpse_item_chance);
|
||||
// flip_short(&scenario.scen_monsters[i].picture_num);
|
||||
// }
|
||||
//
|
||||
// for (i = 0; i < 256; i++) {
|
||||
// flip_short(&scenario.ter_types[i].picture);
|
||||
// }
|
||||
// for (i = 0; i < 30; i++) {
|
||||
// flip_short(&scenario.boats[i].which_town);
|
||||
// }
|
||||
// for (i = 0; i < 30; i++) {
|
||||
// flip_short(&scenario.horses[i].which_town);
|
||||
// }
|
||||
// for (i = 0; i < 20; i++)
|
||||
// flip_short(&scenario.scenario_timer_times[i]);
|
||||
// for (i = 0; i < 20; i++)
|
||||
// flip_short(&scenario.scenario_timer_specs[i]);
|
||||
// for (i = 0; i < 256; i++) {
|
||||
// flip_spec_node(&scenario.scen_specials[i]);
|
||||
// }
|
||||
// for (i = 0; i < 10; i++) {
|
||||
// flip_short(&scenario.storage_shortcuts[i].ter_type);
|
||||
// flip_short(&scenario.storage_shortcuts[i].property);
|
||||
// for (j = 0; j < 10; j++) {
|
||||
// flip_short(&scenario.storage_shortcuts[i].item_num[j]);
|
||||
// flip_short(&scenario.storage_shortcuts[i].item_odds[j]);
|
||||
// }
|
||||
// }
|
||||
// flip_short(&scenario.last_town_edited);
|
||||
//}
|
||||
//
|
||||
//
|
||||
//void port_item_list()
|
||||
//{
|
||||
// short i;
|
||||
//
|
||||
// if (cur_scen_is_mac != mac_is_intel)
|
||||
// return;
|
||||
//
|
||||
// for (i = 0; i < 400; i++) {
|
||||
// flip_short(&(scenario.scen_items[i].variety));
|
||||
// flip_short(&(scenario.scen_items[i].item_level));
|
||||
// flip_short(&(scenario.scen_items[i].value));
|
||||
// }
|
||||
//}
|
||||
//
|
||||
//void port_out(outdoor_record_type *out)
|
||||
//{
|
||||
// short i;
|
||||
//
|
||||
// if (cur_scen_is_mac != mac_is_intel)
|
||||
// return;
|
||||
//
|
||||
// for (i = 0; i < 4; i++) {
|
||||
// flip_short(&(out->wandering[i].spec_on_meet));
|
||||
// flip_short(&(out->wandering[i].spec_on_win));
|
||||
// flip_short(&(out->wandering[i].spec_on_flee));
|
||||
// flip_short(&(out->wandering[i].cant_flee));
|
||||
// flip_short(&(out->wandering[i].end_spec1));
|
||||
// flip_short(&(out->wandering[i].end_spec2));
|
||||
// flip_short(&(out->special_enc[i].spec_on_meet));
|
||||
// flip_short(&(out->special_enc[i].spec_on_win));
|
||||
// flip_short(&(out->special_enc[i].spec_on_flee));
|
||||
// flip_short(&(out->special_enc[i].cant_flee));
|
||||
// flip_short(&(out->special_enc[i].end_spec1));
|
||||
// flip_short(&(out->special_enc[i].end_spec2));
|
||||
// }
|
||||
// for (i = 0; i < 8; i++)
|
||||
// flip_rect(&(out->info_rect[i]));
|
||||
// for (i = 0; i < 60; i++)
|
||||
// flip_spec_node(&(out->specials[i]));
|
||||
//}
|
||||
//
|
||||
//void flip_spec_node(cSpecial *spec)
|
||||
//{
|
||||
// flip_short(&(spec->type));
|
||||
// flip_short(&(spec->sd1));
|
||||
// flip_short(&(spec->sd2));
|
||||
// flip_short(&(spec->pic));
|
||||
// flip_short(&(spec->m1));
|
||||
// flip_short(&(spec->m2));
|
||||
// flip_short(&(spec->ex1a));
|
||||
// flip_short(&(spec->ex1b));
|
||||
// flip_short(&(spec->ex2a));
|
||||
// flip_short(&(spec->ex2b));
|
||||
// flip_short(&(spec->jumpto));
|
||||
//}
|
||||
//
|
||||
//void flip_short(short *s)
|
||||
//{
|
||||
// char store,*s1, *s2;
|
||||
//
|
||||
// s1 = (char *) s;
|
||||
// s2 = s1 + 1;
|
||||
// store = *s1;
|
||||
// *s1 = *s2;
|
||||
// *s2 = store;
|
||||
//
|
||||
//}
|
||||
//
|
||||
//void flip_long(long *s)
|
||||
//{
|
||||
// char store,*s1, *s2, *s3, *s4;
|
||||
//
|
||||
// s1 = (char *) s;
|
||||
// s2 = s1 + 1;
|
||||
// s3 = s1 + 2;
|
||||
// s4 = s1 + 3;
|
||||
// store = *s1;
|
||||
// *s1 = *s4;
|
||||
// *s4 = store;
|
||||
// store = *s2;
|
||||
// *s2 = *s3;
|
||||
// *s3 = store;
|
||||
//
|
||||
//}
|
||||
//void alter_rect(RECT *r)
|
||||
//{
|
||||
// short a;
|
||||
//
|
||||
// a = r->top;
|
||||
// r->top = r->left;
|
||||
// r->left = a;
|
||||
// a = r->bottom;
|
||||
// r->bottom = r->right;
|
||||
// r->right = a;
|
||||
//}
|
||||
//
|
||||
//void flip_rect(RECT *s)
|
||||
//{
|
||||
// flip_short(&(s->top));
|
||||
// flip_short(&(s->bottom));
|
||||
// flip_short(&(s->left));
|
||||
// flip_short(&(s->right));
|
||||
// alter_rect(s);
|
||||
//}
|
||||
|
Reference in New Issue
Block a user