More refactoring. The code is ALMOST able to compile now – all three programs together give a mere 25 errors.

git-svn-id: http://openexile.googlecode.com/svn/trunk@31 4ebdad44-0ea0-11de-aab3-ff745001d230
This commit is contained in:
2009-04-25 05:12:14 +00:00
parent c8df8232ab
commit 3ba7021543
78 changed files with 7449 additions and 5947 deletions

View File

@@ -3,6 +3,7 @@
//#include "item.h"
#include "boe.global.h"
#include "classes.h"
#include "boe.party.h"
#include "boe.town.h"
#include "boe.items.h"
@@ -16,21 +17,22 @@
#include "boe.townspec.h"
#include "soundtool.h"
#include "mathutil.h"
#include "dlgutil.h"
extern short overall_mode;
extern party_record_type party;
extern current_town_type c_town;
extern unsigned char out[96][96],out_e[96][96];
//extern party_record_type univ.party;
//extern current_town_type univ.town;
//extern unsigned char out[96][96],out_e[96][96];
extern unsigned char combat_terrain[64][64];
extern short current_pc,stat_window;
extern outdoor_record_type outdoors[2][2];
//extern cOutdoors outdoors[2][2];
extern location pc_pos[6],center;
extern town_item_list t_i;
extern pc_record_type adven[6];
extern big_tr_type t_d;
//extern town_item_list t_i;
//extern pc_record_type ADVEN[6];
//extern big_tr_type t_d;
extern WindowPtr mainPtr;
extern cScenario scenario;
extern cUniverse univ;
Str255 answer;
/*Boolean (which)
@@ -107,14 +109,14 @@ void DSG(short item_num,unsigned char *flip_bit,short dialog_num,short what_spec
did_give = TRUE;
else did_give = give_to_party(item,0);
if (did_give == TRUE) {
party.food += amt_food;
party.gold += amt_gold;
univ.party.food += amt_food;
univ.party.gold += amt_gold;
if (what_spec >= 0) {
if (party.spec_items[what_spec] > 0) {
if (univ.party.spec_items[what_spec] > 0) {
ASB("You already have this special item.");
return;
}
party.spec_items[what_spec] += 1;
univ.party.spec_items[what_spec] += 1;
put_item_screen(stat_window,0);
}
*flip_bit = 20;
@@ -159,12 +161,12 @@ Boolean run_trap(short pc_num,short trap_type,short trap_level,short diff)
i = stat_adj(pc_num,1);
if ((i_level = get_prot_level(pc_num,42)) > 0)
i = i + i_level / 2;
skill = minmax(0,20,adven[pc_num].skills[SKILL_DISARM_TRAPS] +
+ adven[pc_num].skills[SKILL_LUCK] / 2 + 1 - c_town.difficulty + 2 * i);
skill = minmax(0,20,ADVEN[pc_num].skills[SKILL_DISARM_TRAPS] +
+ ADVEN[pc_num].skills[SKILL_LUCK] / 2 + 1 - univ.town.difficulty + 2 * i);
r1 = get_ran(1,0,100) + diff;
// Nimble?
if (adven[pc_num].traits[TRAIT_NIMBLE])
if (ADVEN[pc_num].traits[TRAIT_NIMBLE])
r1 -= 6;
@@ -179,21 +181,21 @@ Boolean run_trap(short pc_num,short trap_type,short trap_level,short diff)
case TRAP_BLADE:
for (i = 0; i < num_hits; i++) {
add_string_to_buf(" A knife flies out! ");
r1 = get_ran(2 + c_town.difficulty / 14,1,10);
r1 = get_ran(2 + univ.town.difficulty / 14,1,10);
damage_pc(pc_num,r1,0,-1);
}
break;
case TRAP_DART:
add_string_to_buf(" A dart flies out. ");
r1 = 3 + c_town.difficulty / 14;
r1 = 3 + univ.town.difficulty / 14;
r1 = r1 + trap_level * 2;
poison_pc(pc_num,r1);
break;
case TRAP_GAS:
add_string_to_buf(" Poison gas pours out. ");
r1 = 2 + c_town.difficulty / 14;
r1 = 2 + univ.town.difficulty / 14;
r1 = r1 + trap_level * 2;
for(i = 0; i < 6; i++)
poison_pc(i,r1);
@@ -202,14 +204,14 @@ Boolean run_trap(short pc_num,short trap_type,short trap_level,short diff)
case TRAP_EXPLOSION:
for (i = 0; i < num_hits; i++) {
add_string_to_buf(" There is an explosion. ");
r1 = get_ran(3 + c_town.difficulty / 13,1,8);
r1 = get_ran(3 + univ.town.difficulty / 13,1,8);
hit_party(r1,1);
}
break;
case TRAP_SLEEP_RAY:
add_string_to_buf(" A purple ray flies out. ");
r1 = 200 + c_town.difficulty * 100;
r1 = 200 + univ.town.difficulty * 100;
r1 = r1 + trap_level * 400;
sleep_pc(pc_num,r1,12,50);
break;
@@ -217,7 +219,7 @@ Boolean run_trap(short pc_num,short trap_type,short trap_level,short diff)
add_string_to_buf(" You feel weak. ");
r1 = 40;
r1 = r1 + trap_level * 30;
adven[pc_num].experience = max (0,adven[pc_num].experience - r1);
ADVEN[pc_num].experience = max (0,ADVEN[pc_num].experience - r1);
break;
case TRAP_ALERT:
@@ -238,14 +240,14 @@ Boolean run_trap(short pc_num,short trap_type,short trap_level,short diff)
case TRAP_DISEASE:
add_string_to_buf(" You prick your finger. ");
r1 = 3 + c_town.difficulty / 14;
r1 = 3 + univ.town.difficulty / 14;
r1 = r1 + trap_level * 2;
disease_pc(pc_num,r1);
break;
case TRAP_DISEASE_ALL:
add_string_to_buf(" A foul substance sprays out.");
r1 = 2 + c_town.difficulty / 14;
r1 = 2 + univ.town.difficulty / 14;
r1 = r1 + trap_level * 2;
for(i = 0; i < 6; i++)
disease_pc(i,r1);
@@ -258,12 +260,12 @@ Boolean run_trap(short pc_num,short trap_type,short trap_level,short diff)
location get_spec_loc(short which)
{
location where = {0,0};
location where;
short i;
for (i = 0; i < 50; i++)
if (c_town.town.spec_id[i] == which)
return c_town.town.special_locs[i];
if (univ.town.town->spec_id[i] == which)
return univ.town.town->special_locs[i];
return where;
}
@@ -272,18 +274,18 @@ void start_split(short a,short b,short noise)
{
short i;
party.stuff_done[SDF_IS_PARTY_SPLIT] = 1;
party.stuff_done[SDF_PARTY_SPLIT_X] = c_town.p_loc.x;
party.stuff_done[SDF_PARTY_SPLIT_Y] = c_town.p_loc.y;
party.stuff_done[SDF_PARTY_SPLIT_TOWN] = c_town.town_num;
c_town.p_loc.x = a;
c_town.p_loc.y = b;
PSD[SDF_IS_PARTY_SPLIT] = 1;
PSD[SDF_PARTY_SPLIT_X] = univ.town.p_loc.x;
PSD[SDF_PARTY_SPLIT_Y] = univ.town.p_loc.y;
PSD[SDF_PARTY_SPLIT_TOWN] = univ.town.num;
univ.town.p_loc.x = a;
univ.town.p_loc.y = b;
for (i = 0; i < 6; i++)
if (i != party.stuff_done[SDF_PARTY_SPLIT_PC])
adven[i].main_status += 10;
current_pc = party.stuff_done[SDF_PARTY_SPLIT_PC];
update_explored(c_town.p_loc);
center = c_town.p_loc;
if (i != PSD[SDF_PARTY_SPLIT_PC])
ADVEN[i].main_status += 10;
current_pc = PSD[SDF_PARTY_SPLIT_PC];
update_explored(univ.town.p_loc);
center = univ.town.p_loc;
if (noise > 0)
play_sound(10);
}
@@ -292,18 +294,18 @@ void end_split(short noise)
{
short i;
if (party.stuff_done[SDF_IS_PARTY_SPLIT] == 0) {
if (PSD[SDF_IS_PARTY_SPLIT] == 0) {
ASB("Party already together!");
return;
}
c_town.p_loc.x = party.stuff_done[SDF_PARTY_SPLIT_X];
c_town.p_loc.y = party.stuff_done[SDF_PARTY_SPLIT_Y];
party.stuff_done[SDF_IS_PARTY_SPLIT] = 0;
univ.town.p_loc.x = PSD[SDF_PARTY_SPLIT_X];
univ.town.p_loc.y = PSD[SDF_PARTY_SPLIT_Y];
PSD[SDF_IS_PARTY_SPLIT] = 0;
for (i = 0; i < 6; i++)
if (adven[i].main_status >= 10)
adven[i].main_status -= 10;
update_explored(c_town.p_loc);
center = c_town.p_loc;
if (ADVEN[i].main_status >= 10)
ADVEN[i].main_status -= 10;
update_explored(univ.town.p_loc);
center = univ.town.p_loc;
if (noise > 0)
play_sound(10);
add_string_to_buf("You are reunited.");
@@ -323,6 +325,6 @@ short handle_lever(location w)
void switch_lever(location w)
{
alter_space(w.x,w.y,scenario.ter_types[t_d.terrain[w.x][w.y]].trans_to_what);
alter_space(w.x,w.y,scenario.ter_types[univ.town.town->terrain(w.x,w.y)].trans_to_what);
}