Mostly bugfixes and small changes.

- Changed the number of times a creature can appear in an outdoor encounter to match the documentation.
- Moved count_monst to cCurTown::countMonsters.
- Code cleanup in create_wand_monst() - removing unnecessary comparisons with true or false.
- Moved is_null_out_wand_entry to cOutdoors::cWandering::isNull().
- Moved is_null_wand_entry to cTown::cWandering::isNull().
- In create_wand_monst for the town case, I changed it so that the fourth monster (and only the fourth monster) has a 50% chance of appearing twice.
- In monst_check_speciall_terrain, replaced the commented check for town number in the force barrier case with a check for a new bit field variable: univ.town->strong_barrier
- Removed specials1, specials2, res1, and res2 from the townrecord; the checks for specials2 & 1 have been replaced with checks for the new bit field variable defy_mapping.
- In adj_town_look(), the lines uncommented in the previous revision were reduced to a single add_string_to_buf() call.
- Removed the 50 node limit in favour of an interrupt key. Pressing command-period while a node sequence is underway will now interrupt it. Control-C is supposed to have the same effect, but it's not working yet.
- Affect PC nodes other than Kill/Raise Dead now only affect the active character when the party is split up.
- Added missing breaks in the split party node which would allow the party to be split in combat or when already split, despite a message saying they can't.
- Added a second operator[] to cCurOut which takes a location as a parameter rather than an x coordinate.
- Properly fixed an earlier error in cPitc::init() which had a temporary fix; it turned out to be a case of static objects not being initialized in the right order.

git-svn-id: http://openexile.googlecode.com/svn/trunk@98 4ebdad44-0ea0-11de-aab3-ff745001d230
This commit is contained in:
2009-06-18 16:51:14 +00:00
parent acbba1b625
commit 2c5faa51c3
15 changed files with 142 additions and 150 deletions

View File

@@ -286,8 +286,10 @@ void start_outdoor_combat(cOutdoors::cCreature encounter,ter_num_t in_which_terr
{
short i,j,how_many,num_tries = 0;
GrafPtr old_port;
short low[10] = {15,7,3,3,1,1,1,7,2,1};
short high[10] = {30,10,5,5,3,2,1,10,4,1};
// short low[10] = {15,7,3,3,1,1,1,7,2,1};
// short high[10] = {30,10,5,5,3,2,1,10,4,1};
short low[10] = {15,7,4,3,2,1,1,7,2,1};
short high[10] = {30,10,6,5,3,2,1,10,4,1};
rectangle town_rect(0,0,47,47);
short nums[10];

View File

@@ -98,61 +98,44 @@ short out_enc_lev_tot(short which)
return count;
}
short count_monst()
{
short to_ret = 0,i;
for (i = 0; i < univ.town->max_monst(); i++)
if (univ.town.monst[i].active > 0)
to_ret++;
return to_ret;
}
void create_wand_monst()
{
short r1,r2,i = 0,num_tries = 0;
short r1,r2,r3,i = 0,num_tries = 0;
location p_loc;
r1 = get_ran(1,0,3);
if (overall_mode == MODE_OUTDOORS)
if (is_null_out_wand_entry(univ.out.outdoors[univ.party.i_w_c.x][univ.party.i_w_c.y].wandering[r1]) == 0) {
if (!univ.out.outdoors[univ.party.i_w_c.x][univ.party.i_w_c.y].wandering[r1].isNull()) {
r2 = get_ran(1,0,3);
while ((point_onscreen(univ.out.outdoors[univ.party.i_w_c.x][univ.party.i_w_c.y].wandering_locs[r2],global_to_local(univ.party.p_loc)) == true)
&& (num_tries++ < 100))
while ((point_onscreen(univ.out.outdoors[univ.party.i_w_c.x][univ.party.i_w_c.y].wandering_locs[r2],
global_to_local(univ.party.p_loc))) && (num_tries++ < 100))
r2 = get_ran(1,0,3);
if (is_blocked(univ.out.outdoors[univ.party.i_w_c.x][univ.party.i_w_c.y].wandering_locs[r2]) == false)
if (!is_blocked(univ.out.outdoors[univ.party.i_w_c.x][univ.party.i_w_c.y].wandering_locs[r2]))
place_outd_wand_monst(univ.out.outdoors[univ.party.i_w_c.x][univ.party.i_w_c.y].wandering_locs[r2],
univ.out.outdoors[univ.party.i_w_c.x][univ.party.i_w_c.y].wandering[r1],0);
}
////
if (overall_mode != MODE_OUTDOORS) // won't place wandering is more than 50 monsters
if ((is_null_wand_entry(univ.town->wandering[r1]) == 0) && (count_monst() <= 50)
else // won't place wandering is more than 50 monsters
if ((!univ.town->wandering[r1].isNull()) && (univ.town.countMonsters() <= 50)
&& (univ.party.m_killed[univ.town.num] < univ.town->max_num_monst)) {
r2 = get_ran(1,0,3);
while ((point_onscreen(univ.town->wandering_locs[r2],univ.town.p_loc) == true) &&
(loc_off_act_area(univ.town->wandering_locs[r2]) == false) && (num_tries++ < 100))
while (point_onscreen(univ.town->wandering_locs[r2],univ.town.p_loc) &&
!loc_off_act_area(univ.town->wandering_locs[r2]) && (num_tries++ < 100))
r2 = get_ran(1,0,3);
for (i = 0; i < 4; i++) {
if (univ.town->wandering[r1].monst[i] != 0) { // place a monster
p_loc = univ.town->wandering_locs[r2];
p_loc.x += get_ran(1,0,4) - 2;
p_loc.y += get_ran(1,0,4) - 2;
if (is_blocked(p_loc) == false)
if (!is_blocked(p_loc))
place_monster(univ.town->wandering[r1].monst[i],p_loc);
p_loc = univ.town->wandering_locs[r2];
p_loc.x += get_ran(1,0,4) - 2;
p_loc.y += get_ran(1,0,4) - 2;
if ((r1 >= 2) && (i == 0) && (is_blocked(p_loc) == false)) // place extra monsters?
place_monster(univ.town->wandering[r1].monst[i],p_loc);
p_loc = univ.town->wandering_locs[r2];
p_loc.x += get_ran(1,0,4) - 2;
p_loc.y += get_ran(1,0,4) - 2;
if ((r1 == 3) && (i == 1) && (is_blocked(p_loc) == false))
place_monster(univ.town->wandering[r1].monst[i],p_loc);
}
}
}
p_loc = univ.town->wandering_locs[r2];
p_loc.x += get_ran(1,0,4) - 2;
p_loc.y += get_ran(1,0,4) - 2;
r3 = get_ran(1,0,3);
if ((r3 >= 2) && (!is_blocked(p_loc))) // place extra monsters?
place_monster(univ.town->wandering[r1].monst[3],p_loc);
}
}
}
@@ -192,30 +175,6 @@ void place_outd_wand_monst(location where,cOutdoors::cWandering group,short forc
}
short is_null_wand_entry(cTown::cWandering wand_entry)
{
short i = 0;
while (i < 4) {
if (wand_entry.monst[i] != 0)
return 0;
i++;
}
return 1;
}
short is_null_out_wand_entry(cOutdoors::cWandering wand_entry)
{
short i = 0;
while (i < 7) {
if (wand_entry.monst[i] != 0)
return 0;
i++;
}
return 1;
}
location get_monst_head(short m_num)
{
location l;
@@ -1069,7 +1028,7 @@ bool monst_check_special_terrain(location where_check,short mode,short which_mon
}
if (univ.town.is_force_barr(where_check.x,where_check.y)) { /// Not in big towns
if ((which_m->attitude % 2 == 1) && (get_ran(1,1,100) < (which_m->mu * 10 + which_m->cl * 4))
/*&& (univ.town.num >= 20)*/) { // Checking for a town num > 20 seems utterly pointless
&& (!univ.town->strong_barriers)) {
play_sound(60);
add_string_to_buf("Monster breaks barrier.");
univ.town.set_force_barr(where_check.x,where_check.y,false);

View File

@@ -1,11 +1,8 @@
//cMonster return_monster_template(m_num_t store);
//short difficulty_adjust();
short out_enc_lev_tot(short which);
short count_monst();
void create_wand_monst();
void place_outd_wand_monst(location where,cOutdoors::cWandering group,short forced);
short is_null_wand_entry(cTown::cWandering wand_entry);
short is_null_out_wand_entry(cOutdoors::cWandering wand_entry);
location get_monst_head(short m_num);
short get_monst_picnum(m_num_t monst);
short get_monst_pictype(m_num_t monst);

View File

@@ -1521,7 +1521,7 @@ void do_mage_spell(short pc_num,short spell_num)
item = pc_has_abil(pc_num,158);////
if (item == 24)
add_string_to_buf(" You need a sapphire. ");
else if (univ.town->specials2 & 1)
else if (univ.town->defy_mapping)
add_string_to_buf(" The spell fails. ");
else {
remove_charge(pc_num,item);

View File

@@ -1117,7 +1117,7 @@ void use_item(short pc,short item)
}
break;
case ITEM_SPELL_MAGIC_MAP:
if (univ.town->specials2 & 1) {
if (univ.town->defy_mapping) {
add_string_to_buf(" It doesn't work.");
break;
}
@@ -1254,7 +1254,7 @@ bool use_space(location where)
// Can't get items out in combat.
bool adj_town_look(location where)
{
char terrain;
ter_num_t terrain;
bool can_open = true,item_there = false,got_special = false;
short i = 0,s1 = 0, s2 = 0, s3 = 0;
@@ -1272,11 +1272,7 @@ bool adj_town_look(location where)
if (where == univ.town->special_locs[i]) {
if (get_blockage(univ.town->terrain(where.x,where.y)) > 0) {
// tell party you find something, if looking at a space they can't step in
// TODO: That stuff done flag isn't right, is it?
if (univ.town.town.special_id[i] >= 10)
add_string_to_buf(" Search: You find something! ");
else if (PSD[univ.town.town_num][univ.town.town.special_id[i]] < 20)
add_string_to_buf(" Search: You find something! ");
add_string_to_buf(" Search: You find something! ");
}
//call special can_open = town_specials(i,univ.town.town_num);
@@ -1897,6 +1893,7 @@ void run_special(short which_mode,short which_type,short start_spec,location spe
short cur_spec,cur_spec_type,next_spec,next_spec_type;
cSpecial cur_node;
short num_nodes = 0;
EventRecord evt;
if (special_in_progress == true) {
give_error("The scenario called a special node while processing another special encounter. The second special will be ignored.","",0);
@@ -1948,10 +1945,21 @@ void run_special(short which_mode,short which_type,short start_spec,location spe
}
num_nodes++;
if (num_nodes >= 50) {
give_error("A special encounter can be at most 50 nodes long. The 50th node was just processed. The encounter will now end.","",0);
next_spec = -1;
if(WaitNextEvent(keyDownMask|autoKeyMask, &evt, 1, NULL)){
char c = evt.message & charCodeMask;
bool interrupt = false;
if((toupper(c) == 'C' && (evt.modifiers & controlKey))) interrupt = true;
if((c == '.' && (evt.modifiers & cmdKey))) interrupt = true;
if(interrupt){
give_error("The special encounter was interrupted. The scenario may be in an unexpected state; it is recommended that you reload from a saved game.","",0);
next_spec = -1;
}
}
// if (num_nodes >= 50) {
// give_error("A special encounter can be at most 50 nodes long. The 50th node was just processed. The encounter will now end.","",0);
// next_spec = -1;
// }
}
if (is_out())
erase_out_specials();
@@ -2359,16 +2367,13 @@ void affect_spec(short which_mode,cSpecial cur_node,short cur_spec_type,
spec = cur_node;
*next_spec = cur_node.jumpto;
pc = current_pc_picked_in_spec_enc;
if ((check_mess == true) && (cur_node.type != 80)) {
handle_message(which_mode,cur_spec_type,cur_node.m1,cur_node.m2,a,b);
}
if(PSD[SDF_IS_PARTY_SPLIT] && cur_node.type != SPEC_AFFECT_DEADNESS)
pc = PSD[SDF_PARTY_SPLIT_PC];
else pc = current_pc_picked_in_spec_enc;
switch (cur_node.type) {
case SPEC_SELECT_PC:
check_mess = false;
if (spec.ex1a == 2)
current_pc_picked_in_spec_enc = -1;
else if (spec.ex1a == 1) {
@@ -2399,13 +2404,13 @@ void affect_spec(short which_mode,cSpecial cur_node,short cur_spec_type,
case SPEC_AFFECT_HP:
for (i = 0; i < 6; i++)
if ((pc < 0) || (pc == i))
univ.party[i].cur_health = minmax(0, univ.party[i].max_health,
univ.party[i].cur_health + spec.ex1a * ((spec.ex1b != 0) ? -1: 1));
univ.party[i].cur_health = minmax(0,univ.party[i].max_health,
univ.party[i].cur_health + spec.ex1a * (spec.ex1b ? -1: 1));
break;
case SPEC_AFFECT_SP:
for (i = 0; i < 6; i++)
if ((pc < 0) || (pc == i))
univ.party[i].cur_sp = minmax(0, univ.party[i].max_sp,
univ.party[i].cur_sp = minmax(0, univ.party[i].max_sp,
univ.party[i].cur_sp + spec.ex1a * ((spec.ex1b != 0) ? -1: 1));
break;
case SPEC_AFFECT_XP:
@@ -2581,6 +2586,9 @@ void affect_spec(short which_mode,cSpecial cur_node,short cur_spec_type,
}
break;
}
if (check_mess) {
handle_message(which_mode,cur_spec_type,cur_node.m1,cur_node.m2,a,b);
}
}
void ifthen_spec(short which_mode,cSpecial cur_node,short cur_spec_type,
@@ -3057,6 +3065,7 @@ void townmode_spec(short which_mode,cSpecial cur_node,short cur_spec_type,
*a = 1;
*next_spec = -1;
check_mess = false;
break;
}
if (PSD[SDF_IS_PARTY_SPLIT] > 0) {
ASB("Party is already split.");
@@ -3064,6 +3073,7 @@ void townmode_spec(short which_mode,cSpecial cur_node,short cur_spec_type,
*a = 1;
*next_spec = -1;
check_mess = false;
break;
}
r1 = char_select_pc(1,0,"Which character goes?");
if (which_mode < 3)

View File

@@ -1546,7 +1546,7 @@ pascal void draw_map (DialogPtr the_dialog, short the_item)
SetPort(old_port);
return;
}
}else if((is_town() && univ.town->specials2 & 1)) {
}else if((is_town() && univ.town->defy_mapping)) {
if (modeless_exists[5] == true) {
SetPort(GetDialogPort(the_dialog));
tileImage(map_bar_rect,bg_gworld,bg[4]);

View File

@@ -185,3 +185,10 @@ void cOutdoors::cWandering::readAttrFrom(std::string cur, std::istream& sin){
else if(cur == "SDF")
sin >> end_spec1 >> end_spec2;
}
bool cOutdoors::cWandering::isNull(){
for (short i = 0; i < 7; i++)
if (monst[i] != 0)
return false;
return true;
}

View File

@@ -28,6 +28,7 @@ public:
short spec_on_meet,spec_on_win,spec_on_flee,cant_flee;
short end_spec1,end_spec2;
bool isNull();
cWandering& operator = (legacy::out_wandering_type old);
void writeTo(std::ostream& file, std::string prefix = "");
void readAttrFrom(std::string cur, std::istream& sin);
@@ -58,9 +59,9 @@ public:
char comment[256];
char spec_strs[90][256];
char sign_strs[8][256];
char(& out_strs(short i))[256] __attribute__((deprecated));
bool special_spot[48][48];
char(& out_strs(short i))[256] __attribute__((deprecated));
cOutdoors();
cOutdoors& operator = (legacy::outdoor_record_type& old);
void writeTo(std::ostream& file);

View File

@@ -75,10 +75,6 @@ cTown& cTown::operator = (legacy::town_record_type& old){
strlens[i] = old.strlens[i];
for(i = 0; i < 100; i++)
specials[i] = old.specials[i];
specials1 = old.specials1;
specials2 = old.specials2;
res1 = old.res1;
res2 = old.res2;
difficulty = old.difficulty;
return *this;
}
@@ -140,10 +136,6 @@ cTown::cTown(short size){
for (i = 0; i < 100; i++) {
specials[i] = cSpecial();
}
specials1 = 0;
specials2 = 0;
res1 = 0;
res2 = 0;
difficulty = 0;
}
@@ -183,3 +175,9 @@ cTown::cField& cTown::cField::operator = (legacy::preset_field_type old){
return *this;
}
bool cTown::cWandering::isNull(){
for (short i = 0;i < 4;i++)
if (monst[i] != 0)
return false;
return true;
}

View File

@@ -44,6 +44,7 @@ public:
public:
m_num_t monst[4];
bool isNull();
cWandering& operator = (legacy::wandering_type old);
};
class cItem { // formerly preset_item_type
@@ -80,7 +81,10 @@ public:
short timer_specs[8];
unsigned char strlens[180];
cSpecial specials[100];
unsigned char specials1,specials2,res1,res2;
//unsigned char specials1,specials2,res1,res2;
bool strong_barriers : 1;
bool defy_mapping : 1;
char reserved_bits : 6;
short difficulty;
//char town_strs[180][256];
char town_name[256];

View File

@@ -674,6 +674,10 @@ ter_num_t(& cCurOut::operator [] (size_t i))[96]{
return out[i];
}
ter_num_t& cCurOut::operator [] (location loc) {
return out[loc.x][loc.y];
}
void cCurOut::writeTo(std::ostream& file){
// for(int i = 0; i < 96; i++){
// file << expl[i][0];
@@ -823,3 +827,11 @@ short cUniverse::difficulty_adjust() {
return adj;
}
short cCurTown::countMonsters(){
short to_ret = 0;
for (short i = 0; i < record->max_monst(); i++)
if (monst[i].active > 0)
to_ret++;
return to_ret;
}

View File

@@ -46,14 +46,15 @@ public:
void append(unsigned char(& old_sfx)[64][64], unsigned char(& old_misc_i)[64][64]);
void cCurTown::append(legacy::big_tr_type& old);
unsigned char explored(char x,char y) const;
unsigned char misc_i(char x, char y) const;
unsigned char sfx(char x, char y) const;
unsigned char explored(char x,char y) const __attribute__((deprecated));
unsigned char misc_i(char x, char y) const __attribute__((deprecated));
unsigned char sfx(char x, char y) const __attribute__((deprecated));
cTown* operator -> ();
cCurTown();
bool loaded() const;
void unload();
short countMonsters();
bool is_explored(char x, char y) const;
bool is_force_wall(char x, char y) const;
@@ -126,6 +127,7 @@ public:
void append(legacy::out_info_type& old);
ter_num_t(& operator [] (size_t i))[96];
ter_num_t& operator [] (location loc);
void writeTo(std::ostream& file);
void readFrom(std::istream& file);
};

View File

@@ -40,17 +40,13 @@ template<> pair<string,cPict*> cDialog::parse(Element& who /*pict*/){
std::istringstream sin(val);
bool wide = false, tall = false, custom = false;
int width = 0, height = 0;
printf("%p\n",p.second);
p.second = new cPict(this);
printf("%p\n",p.second);
for(attr = attr.begin(&who); attr != attr.end(); attr++){
printf("%p\n",p.second);
attr->GetName(&name);
attr->GetValue(&val);
if(name == "name")
p.first = val;
else if(name == "type"){
printf("%p\n",p.second);
if(val == "blank"){
p.second->picType = PIC_TER;
p.second->picNum = -1;
@@ -93,7 +89,6 @@ template<> pair<string,cPict*> cDialog::parse(Element& who /*pict*/){
else if(val == "large") wide = tall = true;
else throw xBadVal("pict",name,val);
}else if(name == "num"){
printf("%p\n",p.second);
sin.str(val);
sin >> p.second->picNum;
}else if(name == "top"){

View File

@@ -19,46 +19,51 @@ extern GWorldPtr bg_gworld;
void cPict::init(){
// TODO: Load or otherwise acquire the various GWorlds.
teranim = dlog = talk = scen = largeScen = item = tinyItem = pc = field = boom = missile = save = header = map = status = NULL;
drawPict[PIC_TER] = drawPresetTer;
drawPict[PIC_TER_ANIM] = drawPresetTerAnim;
drawPict[PIC_MONST] = drawPresetMonstSm;
drawPict[PIC_DLOG] = drawPresetDlog;
drawPict[PIC_TALK] = drawPresetTalk;
drawPict[PIC_SCEN] = drawPresetScen;
drawPict[PIC_ITEM] = drawPresetItem;
drawPict[PIC_PC] = drawPresetPc;
drawPict[PIC_FIELD] = drawPresetField;
drawPict[PIC_BOOM] = drawPresetBoom;
drawPict[PIC_FULL] = drawFullSheet;
drawPict[PIC_MISSILE] = drawPresetMissile;
drawPict[PIC_DLOG_LG] = drawPresetDlogLg;
drawPict[PIC_SCEN_LG] = drawPresetScenLg;
drawPict[PIC_TER_MAP] = drawPresetTerMap;
drawPict[PIC_TER_MAP] = drawStatusIcon;
drawPict[PIC_MONST_WIDE] = drawPresetMonstWide;
drawPict[PIC_MONST_TALL] = drawPresetMonstTall;
drawPict[PIC_MONST_LG] = drawPresetMonstLg;
drawPict[PIC_CUSTOM_TER] = drawCustomTer;
drawPict[PIC_CUSTOM_TER_ANIM] = drawCustomTerAnim;
drawPict[PIC_CUSTOM_MONST] = drawCustomMonstSm;
drawPict[PIC_CUSTOM_DLOG] = drawCustomDlog;
drawPict[PIC_CUSTOM_TALK] = drawCustomTalk;
drawPict[PIC_CUSTOM_SCEN] = drawCustomTalk;
drawPict[PIC_CUSTOM_ITEM] = drawCustomItem;
drawPict[PIC_CUSTOM_FULL] = drawFullSheet;
drawPict[PIC_CUSTOM_MISSILE] = drawCustomMissile;
drawPict[PIC_CUSTOM_DLOG_LG] = drawCustomDlogLg;
drawPict[PIC_CUSTOM_TER_MAP] = drawCustomTerMap;
drawPict[PIC_CUSTOM_MONST_WIDE] = drawCustomMonstWide;
drawPict[PIC_CUSTOM_MONST_TALL] = drawCustomMonstTall;
drawPict[PIC_CUSTOM_MONST_LG] = drawCustomMonstLg;
drawPict[PIC_PARTY_MONST] = drawPartyMonstSm;
drawPict[PIC_PARTY_SCEN] = drawPartyScen;
drawPict[PIC_PARTY_ITEM] = drawPartyItem;
drawPict[PIC_PARTY_PC] = drawPartyPc;
drawPict[PIC_PARTY_MONST_WIDE] = drawPartyMonstWide;
drawPict[PIC_PARTY_MONST_TALL] = drawPartyMonstTall;
drawPict[PIC_PARTY_MONST_LG] = drawPartyMonstLg;
drawPict()[PIC_TER] = drawPresetTer;
drawPict()[PIC_TER_ANIM] = drawPresetTerAnim;
drawPict()[PIC_MONST] = drawPresetMonstSm;
drawPict()[PIC_DLOG] = drawPresetDlog;
drawPict()[PIC_TALK] = drawPresetTalk;
drawPict()[PIC_SCEN] = drawPresetScen;
drawPict()[PIC_ITEM] = drawPresetItem;
drawPict()[PIC_PC] = drawPresetPc;
drawPict()[PIC_FIELD] = drawPresetField;
drawPict()[PIC_BOOM] = drawPresetBoom;
drawPict()[PIC_FULL] = drawFullSheet;
drawPict()[PIC_MISSILE] = drawPresetMissile;
drawPict()[PIC_DLOG_LG] = drawPresetDlogLg;
drawPict()[PIC_SCEN_LG] = drawPresetScenLg;
drawPict()[PIC_TER_MAP] = drawPresetTerMap;
drawPict()[PIC_TER_MAP] = drawStatusIcon;
drawPict()[PIC_MONST_WIDE] = drawPresetMonstWide;
drawPict()[PIC_MONST_TALL] = drawPresetMonstTall;
drawPict()[PIC_MONST_LG] = drawPresetMonstLg;
drawPict()[PIC_CUSTOM_TER] = drawCustomTer;
drawPict()[PIC_CUSTOM_TER_ANIM] = drawCustomTerAnim;
drawPict()[PIC_CUSTOM_MONST] = drawCustomMonstSm;
drawPict()[PIC_CUSTOM_DLOG] = drawCustomDlog;
drawPict()[PIC_CUSTOM_TALK] = drawCustomTalk;
drawPict()[PIC_CUSTOM_SCEN] = drawCustomTalk;
drawPict()[PIC_CUSTOM_ITEM] = drawCustomItem;
drawPict()[PIC_CUSTOM_FULL] = drawFullSheet;
drawPict()[PIC_CUSTOM_MISSILE] = drawCustomMissile;
drawPict()[PIC_CUSTOM_DLOG_LG] = drawCustomDlogLg;
drawPict()[PIC_CUSTOM_TER_MAP] = drawCustomTerMap;
drawPict()[PIC_CUSTOM_MONST_WIDE] = drawCustomMonstWide;
drawPict()[PIC_CUSTOM_MONST_TALL] = drawCustomMonstTall;
drawPict()[PIC_CUSTOM_MONST_LG] = drawCustomMonstLg;
drawPict()[PIC_PARTY_MONST] = drawPartyMonstSm;
drawPict()[PIC_PARTY_SCEN] = drawPartyScen;
drawPict()[PIC_PARTY_ITEM] = drawPartyItem;
drawPict()[PIC_PARTY_PC] = drawPartyPc;
drawPict()[PIC_PARTY_MONST_WIDE] = drawPartyMonstWide;
drawPict()[PIC_PARTY_MONST_TALL] = drawPartyMonstTall;
drawPict()[PIC_PARTY_MONST_LG] = drawPartyMonstLg;
}
std::map<ePicType,void(*)(short,GWorldPtr,Rect)>& cPict::drawPict(){
static std::map<ePicType,void(*)(short,GWorldPtr,Rect)> f;
return f;
}
void cPict::attachClickHandler(click_callback_t f) throw(){
@@ -500,8 +505,8 @@ GWorldPtr cPict::item = NULL, cPict::tinyItem = NULL, cPict::pc = NULL, cPict::f
GWorldPtr cPict::missile = NULL, cPict::save = NULL, cPict::header = NULL, cPict::map = NULL, cPict::status = NULL;
std::vector<GWorldPtr> cPict::ter, cPict::monst, cPict::customSheets;
std::map<size_t,GWorldPtr> cPict::largeSheets;
//std::map<ePicType,void(*)(short,GWorldPtr,Rect)> cPict::drawPict;
void(* cPict::drawPict[NUM_PIC_TYPES])(short,GWorldPtr,Rect);
//std::map<ePicType,void(*)(short,GWorldPtr,Rect)> cPict::drawPict();
//void(* cPict::drawPict()[NUM_PIC_TYPES])(short,GWorldPtr,Rect);
short cPict::animFrame = 0;
void cPict::draw(){
@@ -523,7 +528,7 @@ void cPict::draw(){
GetBackColor(&store_color);
BackColor(whiteColor);
drawPict[picType](picNum,(GWorldPtr) parent->win,rect);
drawPict()[picType](picNum,(GWorldPtr) parent->win,rect);
if(drawFramed) drawFrame(2,0);
}

View File

@@ -154,8 +154,8 @@ private:
static void drawPartyScen(short num, GWorldPtr to_gw, Rect to_rect);
static void drawPartyItem(short num, GWorldPtr to_gw, Rect to_rect);
static void drawPartyPc(short num, GWorldPtr to_gw, Rect to_rect);
//static std::map<ePicType,void(*)(short,GWorldPtr,Rect)> drawPict;
static void(* drawPict[NUM_PIC_TYPES])(short,GWorldPtr,Rect);
static std::map<ePicType,void(*)(short,GWorldPtr,Rect)>& drawPict();
//static void(* drawPict[NUM_PIC_TYPES])(short,GWorldPtr,Rect);
click_callback_t onClick;
};