Tried in vain to get the game to write to a savefile in the newly created save format.

git-svn-id: http://openexile.googlecode.com/svn/trunk@52 4ebdad44-0ea0-11de-aab3-ff745001d230
This commit is contained in:
2009-05-06 19:49:07 +00:00
parent 6bc706bd7b
commit f8701fdaff
20 changed files with 424 additions and 480 deletions

View File

@@ -865,7 +865,7 @@ void init_scenario() {
scenario.ter_types[i].blockage = ter_block[i];
scenario.ter_types[i].special = (eTerSpec) ter_traits[i];
get_str(temp_str,1,i + 1);
sprintf((char *)scenario.ter_names[i], "%s", temp_str);
sprintf((char *)scenario.ter_types[i].name.c_str(), "%s", temp_str);
scenario.scen_specials[i] = null_spec_node;
}
@@ -894,9 +894,10 @@ void init_scenario() {
}
void put_ter_info_in_dlog() {
Str255 str;
strcpy((char*)str,(char*)scenario.ter_types[store_which_ter].name.c_str());
cdsin(813,12,store_which_ter);
CDST(813,2,scenario.ter_names[store_which_ter]);
CDST(813,2,(char*)str);
CDSN(813,5,store_ter.picture);
cd_set_led_range(813,19,24,store_ter.blockage);
cd_set_led(813,25,store_ter.fly_over);
@@ -975,7 +976,7 @@ bool save_ter_info() {
CDGT(813,2,(char *) str);
str[29] = 0;
sprintf(scenario.ter_names[store_which_ter],"%s",str);
scenario.ter_types[store_which_ter].name = (char*)str;
scenario.ter_types[store_which_ter] = store_ter;
return true;

View File

@@ -1320,7 +1320,7 @@ void start_data_dump() {
fout << "Scenario data for " << scen_name << ':' << endl << endl;
fout << "Terrain types for " << scen_name << ':' << endl;
for(i = 0; i < 256; i++)
fout << " Terrain type " << i << ": " << scenario.ter_names[i] << endl;
fout << " Terrain type " << i << ": " << scenario.ter_types[i].name << endl;
fout << endl << "Monster types for " << scen_name << ':' << endl;
for(i = 0; i < 256; i++)
fout << " Monster type " << i << ": " << scenario.scen_monsters[i].m_name << endl;

View File

@@ -463,50 +463,58 @@ void set_up_terrain_buttons() {
FillCRect(&terrain_buttons_rect,bg[17]);
FrameRect(&terrain_buttons_rect);
// first make terrain buttons
for (i = 0; i < 256; i++) {
ter_from = ter_from_base;
pic = scenario.ter_types[i].picture;
if (pic >= 1000) {
ter_from = get_custom_rect(pic % 1000);
rect_draw_some_item(spec_scen_g,
ter_from,terrain_buttons_gworld,terrain_rects[i],0,0);
}
else if (pic < 400) {
pic = pic % 50;
OffsetRect(&ter_from,28 * (pic % 10), 36 * (pic / 10));
rect_draw_some_item(terrain_gworld[scenario.ter_types[i].picture/50],
ter_from,terrain_buttons_gworld,terrain_rects[i],0,0);
}
else {
pic = pic % 50;
ter_from.left = 112 * (pic / 5);
ter_from.right = ter_from.left + 28;
ter_from.top = 36 * (pic % 5);
ter_from.bottom = ter_from.top + 36;
rect_draw_some_item(anim_gworld,
ter_from,terrain_buttons_gworld,terrain_rects[i],0,0);
}
small_i = small_icons[scenario.ter_types[i].special];
if ((small_i == 30) && (scenario.ter_types[i].flag2 >= 5))
small_i = 31;
if ((small_i == 31) && (scenario.ter_types[i].flag2 == 10))
small_i = 32;
if (i == 82)
small_i = 3;
if (i == 83)
small_i = 2;
if ((i == 7) || (i == 10) || (i == 13) || (i == 16))
small_i = 23;
tiny_from = base_small_button_from;
OffsetRect(&tiny_from,7 * (small_i % 10),7 * (small_i / 10));
tiny_to = terrain_rects[i];
tiny_to.top = tiny_to.bottom - 7;
tiny_to.left = tiny_to.right - 7;
if (small_i > 0)
rect_draw_some_item(editor_mixed,
tiny_from,terrain_buttons_gworld,tiny_to,0,0);
// first make terrain buttons
switch(draw_mode){
case DRAW_TERRAIN:
for (i = 0; i < 256; i++) {
ter_from = ter_from_base;
pic = scenario.ter_types[i].picture;
if (pic >= 1000) {
ter_from = get_custom_rect(pic % 1000);
rect_draw_some_item(spec_scen_g,
ter_from,terrain_buttons_gworld,terrain_rects[i],0,0);
}
else if (pic < 400) {
pic = pic % 50;
OffsetRect(&ter_from,28 * (pic % 10), 36 * (pic / 10));
rect_draw_some_item(terrain_gworld[scenario.ter_types[i].picture/50],
ter_from,terrain_buttons_gworld,terrain_rects[i],0,0);
}
else {
pic = pic % 50;
ter_from.left = 112 * (pic / 5);
ter_from.right = ter_from.left + 28;
ter_from.top = 36 * (pic % 5);
ter_from.bottom = ter_from.top + 36;
rect_draw_some_item(anim_gworld,
ter_from,terrain_buttons_gworld,terrain_rects[i],0,0);
}
small_i = small_icons[scenario.ter_types[i].special];
if ((small_i == 30) && (scenario.ter_types[i].flag2 >= 5))
small_i = 31;
if ((small_i == 31) && (scenario.ter_types[i].flag2 == 10))
small_i = 32;
if (i == 82)
small_i = 3;
if (i == 83)
small_i = 2;
if ((i == 7) || (i == 10) || (i == 13) || (i == 16))
small_i = 23;
tiny_from = base_small_button_from;
OffsetRect(&tiny_from,7 * (small_i % 10),7 * (small_i / 10));
tiny_to = terrain_rects[i];
tiny_to.top = tiny_to.bottom - 7;
tiny_to.left = tiny_to.right - 7;
if (small_i > 0)
rect_draw_some_item(editor_mixed,
tiny_from,terrain_buttons_gworld,tiny_to,0,0);
}
break;
case DRAW_MONST:
break;
case DRAW_ITEM:
break;
}
if (overall_mode < MODE_MAIN_SCREEN) {

View File

@@ -1,135 +0,0 @@
#include "mathutil.h"
#include "scen.global.h"
#include "scen.locutils.h"
//#include "boe.monster.h"
//#include "boe.fields.h"
#include "scen.graphics.h"
#include "mathutil.h"
char terrain_blocked[256];
short short_can_see();
bool combat_pt_in_light();
//extern short town_size[3];
location obs_sec;
location which_party_sec;
//extern party_record_type party;
//extern current_town_type c_town;
extern short /*overall_mode,which_combat_type,*/current_pc,town_type;
extern big_tr_type t_d;
//extern outdoor_record_type outdoors[2][2];
extern unsigned char combat_terrain[64][64];
extern unsigned char out[96][96], out_e[96][96];
extern location pc_pos[6],center;
//extern pc_record_type adven[6];
extern bool belt_present,web,crate,barrel,fire_barrier,force_barrier,quickfire,force_wall,fire_wall,antimagic,scloud,ice_wall,blade_wall;
extern unsigned char map_graphic_placed[8][64]; // keeps track of what's been filled on map
extern scenario_data_type scenario;
extern bool editing_town;
extern outdoor_record_type current_terrain;
location light_locs[40];
short num_lights = 0;
char d_s[60];
////
void set_terrain_blocked()
{
short i;
for (i = 0; i < 256; i++)
terrain_blocked[i] = scenario.ter_types[i].blockage;
}
short vdist(location p1,location p2) {
short i,j;
i = abs((short) (p1.x - p2.x)); j = abs((short) (p1.y - p2.y));
return max(i,j);
}
bool adjacent(location p1,location p2)
{
if ((abs((short) (p1.x - p2.x)) <= 1) && (abs((short) (p1.y - p2.y)) <= 1))
return true;
else return false;
}
bool point_onscreen(location center,location check)
{
if ((abs((short) (center.x - check.x)) <=4) && (abs((short) (center.y - check.y)) <= 4))
return true;
else return false;
}
short set_direction (location old_pt, location new_pt)
{
if (old_pt.x == new_pt.x)
if (old_pt.y > new_pt.y)
return 0;
else return 4;
if (old_pt.x > new_pt.x) {
if (old_pt.y > new_pt.y)
return 7;
if (old_pt.y < new_pt.y)
return 5;
return 6;
}
if (old_pt.y > new_pt.y)
return 1;
if (old_pt.y < new_pt.y)
return 3;
return 2;
}
bool is_container(location loc)
{
unsigned char ter;
if ((is_barrel(loc.x,loc.y)) || (is_crate(loc.x,loc.y)))
return true;
ter = coord_to_ter(loc.x,loc.y);
if (scenario.ter_types[ter].special == 14)
return true;
return false;
}
bool special_which_blocks_monst(location to_check)
{
if (terrain_blocked[coord_to_ter(to_check.x,to_check.y)] == 2)
return true;
else return false;
}
// Checks if space is a special that prevents movement into or placement of a PC on
bool is_special(location to_check)
{
unsigned char which_ter;
if (special_which_blocks_monst(to_check) == false)
return false;
which_ter = coord_to_ter(to_check.x,to_check.y);
if (terrain_blocked[which_ter] == 2)
return true;
else return false;
}
bool impassable(unsigned char terrain_to_check)
{
if (terrain_blocked[terrain_to_check] > 2)
return true;
else return false;
}
bool spot_impassable(short i,short j)
{
unsigned char ter;
ter = coord_to_ter(i,j);
if (terrain_blocked[ter] == 5)
return true;
else return false;
}

View File

@@ -1,42 +0,0 @@
void set_terrain_blocked();
short dist(location p1,location p2);
short ex_sqrt(short val);
short vdist(location p1,location p2) ;
bool adjacent(location p1,location p2);
bool point_onscreen(location center,location check);
short set_direction (location old_pt, location new_pt);
location global_to_local(location global);
location local_to_global(location local);
bool loc_off_world(location p1);
bool loc_off_act_area(location p1);
location get_cur_loc();
bool is_lava(short x,short y);
short can_see(location p1,location p2,short mode);
short get_obscurity(short x,short y);
unsigned char coord_to_ter(short x,short y);
bool is_container(location loc);
void update_explored(location dest);
bool is_blocked(location to_check);
bool monst_on_space(location loc,short m_num);
short monst_there(location where) ;
bool monst_can_be_there(location loc,short m_num);
bool monst_adjacent(location loc,short m_num);
bool monst_can_see(short m_num,location l);
bool party_can_see_monst(short m_num);
bool can_see_monst(location l,short m_num);
bool outd_is_blocked(location to_check);
bool special_which_blocks_monst(location to_check);
bool is_special(location to_check);
bool outd_is_special(location to_check);
bool impassable(unsigned char terrain_to_check);
short get_blockage(unsigned char terrain_type);
short light_radius();
bool pt_in_light(location from_where,location to_where) ;// Assumes, of course, in town or combat
bool combat_pt_in_light(location to_where);
bool party_sees_a_monst(); // Returns true is a hostile monster is in sight.
short party_can_see(location where);
location push_loc(location from_where,location to_where);
bool spot_impassable(short i,short j);
void swap_ter(short i,short j,unsigned char ter1,unsigned char ter2);
void alter_space(short i,short j,unsigned char ter);
bool same_point(location p1,location p2);

View File

@@ -100,6 +100,7 @@ int main(void) {
init_directories();
Initialize();
init_fileio();
init_snd_tool();
load_graphics();