- Generalized the special queue which was formerly used only for town enter/leave specials, and made the see monster special also use it.

- Redid the draw items and draw fields code to draw just on one space rather than the entire area.
- Fixed bug where special spots were not masked properly.
- Removed some large chunks of commented, obsolete code.
- Found and fixed bug where the instant help system caused the game to believe you had stolen items when in fact you hadn't.
- Added enum for special node context (ie the context in which a special node is being run); not really used yet though.
- Added support and graphic for forcecage, and graphic for stone block; mechanics not yet implemented.

git-svn-id: http://openexile.googlecode.com/svn/trunk@88 4ebdad44-0ea0-11de-aab3-ff745001d230
This commit is contained in:
2009-06-02 02:07:17 +00:00
parent 715aab7a3c
commit c958e5b01c
15 changed files with 388 additions and 479 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.5 MiB

After

Width:  |  Height:  |  Size: 6.6 MiB

View File

@@ -728,9 +728,8 @@ void draw_terrain(){
} }
draw_one_terrain_spot(q,r,t_to_draw); draw_one_terrain_spot(q,r,t_to_draw);
if((editing_town && is_field_type(cen_x + q - 4,cen_y + r - 4, 2)) || if(is_spot(cen_x + q - 4,cen_y + r - 4))
(!editing_town && current_terrain.special_spot[cen_x + q - 4][cen_y + r - 4])) Draw_Some_Item(fields_gworld, calc_rect(4, 0), ter_draw_gworld, where_draw, 1, 0);
Draw_Some_Item(roads_gworld, calc_rect(6, 0), ter_draw_gworld, where_draw, 1, 0);
which_pt.x = cen_x + q - 4; which_pt.x = cen_x + q - 4;
which_pt.y =cen_y + r - 4; which_pt.y =cen_y + r - 4;
@@ -828,7 +827,7 @@ void draw_terrain(){
rect_draw_some_item(editor_mixed,tiny_from,ter_draw_gworld,tiny_to,0,0); rect_draw_some_item(editor_mixed,tiny_from,ter_draw_gworld,tiny_to,0,0);
OffsetRect(&tiny_to,0,-7); OffsetRect(&tiny_to,0,-7);
i = 4; i = 4;
} }
if (is_web(cen_x + q - 4,cen_y + r - 4) == true) { if (is_web(cen_x + q - 4,cen_y + r - 4) == true) {
from_rect = calc_rect(5,0); from_rect = calc_rect(5,0);
Draw_Some_Item(fields_gworld,from_rect,ter_draw_gworld,where_draw,1,0); Draw_Some_Item(fields_gworld,from_rect,ter_draw_gworld,where_draw,1,0);
@@ -1413,6 +1412,13 @@ void make_special(short i,short j) {
void sort_specials() { void sort_specials() {
} }
bool is_spot(short i,short j){
if(editing_town)
return is_field_type(i,j,2);
else return current_terrain.special_spot[i][j];
return false;
}
bool is_field_type(short i,short j,short field_type) { bool is_field_type(short i,short j,short field_type) {
unsigned short k; unsigned short k;

View File

@@ -56,6 +56,7 @@ bool is_quickfire(short i,short j);
void make_quickfire(short i,short j); void make_quickfire(short i,short j);
void take_quickfire(short i,short j); void take_quickfire(short i,short j);
bool container_there(location l); bool container_there(location l);
bool is_spot(short i,short j);
//void get_str(Str255 str,short i, short j); //void get_str(Str255 str,short i, short j);
short string_length(char *str); short string_length(char *str);
Rect get_custom_rect (short which_rect); Rect get_custom_rect (short which_rect);

View File

@@ -144,7 +144,7 @@ short monst_place_count = 0; // 1 - standard place 2 - place last
// 0 - whole area, 1 - active area 2 - graphic 3 - item name // 0 - whole area, 1 - active area 2 - graphic 3 - item name
// 4 - item cost 5 - item extra str 6 - item help button // 4 - item cost 5 - item extra str 6 - item help button
Rect shopping_rects[8][7]; Rect shopping_rects[8][7];
short special_queue[20]; pending_special_type special_queue[20];
bool end_scenario = false; bool end_scenario = false;
void init_screen_locs() //// void init_screen_locs() ////
@@ -319,7 +319,7 @@ bool handle_action(EventRecord event)
the_point.h -= ul.h; the_point.h -= ul.h;
the_point.v -= ul.v; the_point.v -= ul.v;
for (i = 0; i < 20; i++) for (i = 0; i < 20; i++)
special_queue[i] = -1; special_queue[i].spec = -1;
end_scenario = false; end_scenario = false;
if (unreg_party_in_scen_not_check == true) { if (unreg_party_in_scen_not_check == true) {
@@ -1295,16 +1295,11 @@ bool handle_action(EventRecord event)
// At this point, see if any specials have been queued up, and deal with them // At this point, see if any specials have been queued up, and deal with them
for (i = 0; i < 20; i++) for (i = 0; i < 20; i++)
if (special_queue[i] >= 0) { if (special_queue[i].spec >= 0) {
s3 = 0; s3 = 0;
switch (i) { run_special(special_queue[i].mode,special_queue[i].type,special_queue[i].spec,
case 0: special_queue[i].where,&s1,&s2,&s3);
run_special(5,2,special_queue[0],univ.town.p_loc,&s1,&s2,&s3); special_queue[i].spec = -1;
break;
case 1:
run_special(6,2,special_queue[1],univ.party.p_loc,&s1,&s2,&s3);
break;
}
if (s3 > 0) if (s3 > 0)
draw_terrain(); draw_terrain();
} }

View File

@@ -1883,206 +1883,148 @@ void draw_terrain(short mode)
} }
for (q = 0; q < 9; q++) { for (q = 0; q < 9; q++) {
for (r = 0; r < 9; r++) for (r = 0; r < 9; r++) {
{ where_draw = (is_out()) ? univ.party.p_loc : center;
where_draw = (is_out()) ? univ.party.p_loc : center; where_draw.x += q - 4;
where_draw.x += q - 4; where_draw.y += r - 4;
where_draw.y += r - 4; off_terrain = false;
off_terrain = false;
draw_frills = true;
if (!(is_out()) && ((where_draw.x < 0) || (where_draw.x > univ.town->max_dim() - 1)
|| (where_draw.y < 0) || (where_draw.y > univ.town->max_dim() - 1))) {
draw_frills = false;
// Warning - this section changes where_draw
if (where_draw.x < 0)
where_draw.x = -1;
if (where_draw.x > univ.town->max_dim() - 1)
where_draw.x = univ.town->max_dim();
if (where_draw.y < 0)
where_draw.y = -1;
if (where_draw.y > univ.town->max_dim() - 1)
where_draw.y = univ.town->max_dim();
if (can_see(view_loc,where_draw,0) < 5)
can_draw = 1;
else can_draw = 0;
spec_terrain = 0;
}
else if (is_out()) {
if ((where_draw.x < 0) || (where_draw.x > 95)
|| (where_draw.y < 0) || (where_draw.y > 95))
can_draw = 0;
else {
spec_terrain = univ.out[where_draw.x][where_draw.y];
can_draw = univ.out.out_e[where_draw.x][where_draw.y];
}
}
else if (is_combat()) {
spec_terrain = combat_terrain[where_draw.x][where_draw.y];
if (cartoon_happening == true)
can_draw = true;
else can_draw = (((is_explored(where_draw.x,where_draw.y)) ||
(which_combat_type == 0) || (monsters_going == true) || (overall_mode != MODE_COMBAT))
&& (party_can_see(where_draw) < 6)) ? 1 : 0;
}
else {
spec_terrain = univ.town->terrain(where_draw.x,where_draw.y);
can_draw = is_explored(where_draw.x,where_draw.y);
draw_frills = true; if (can_draw > 0) {
if (!(is_out()) && ((where_draw.x < 0) || (where_draw.x > univ.town->max_dim() - 1) if (pt_in_light(univ.town.p_loc,where_draw) == false)
|| (where_draw.y < 0) || (where_draw.y > univ.town->max_dim() - 1))) {
draw_frills = false;
// Warning - this section changes where_draw
if (where_draw.x < 0)
where_draw.x = -1;
if (where_draw.x > univ.town->max_dim() - 1)
where_draw.x = univ.town->max_dim();
if (where_draw.y < 0)
where_draw.y = -1;
if (where_draw.y > univ.town->max_dim() - 1)
where_draw.y = univ.town->max_dim();
if (can_see(view_loc,where_draw,0) < 5)
can_draw = 1;
else can_draw = 0;
spec_terrain = 0;
}
else if (is_out()) {
if ((where_draw.x < 0) || (where_draw.x > 95)
|| (where_draw.y < 0) || (where_draw.y > 95))
can_draw = 0; can_draw = 0;
else { }
spec_terrain = univ.out[where_draw.x][where_draw.y]; if ((overall_mode == MODE_LOOK_TOWN) && (can_draw == 0))
can_draw = univ.out.out_e[where_draw.x][where_draw.y]; can_draw = (party_can_see(where_draw) < 6) ? 1 : 0;
} }
} spot_seen[q][r] = can_draw;
else if (is_combat()) {
spec_terrain = combat_terrain[where_draw.x][where_draw.y]; if ((can_draw != 0) && (overall_mode != MODE_RESTING)) { // if can see, not a pit, and not resting
if (cartoon_happening == true) if ((is_combat()) && (cartoon_happening == false)) {
can_draw = true; anim_ticks = 0;
else can_draw = (((is_explored(where_draw.x,where_draw.y)) || }
(which_combat_type == 0) || (monsters_going == true) || (overall_mode != MODE_COMBAT))
&& (party_can_see(where_draw) < 6)) ? 1 : 0; eTrimType trim = scenario.ter_types[spec_terrain].trim_type;
}
else { // Finally, draw this terrain spot
spec_terrain = univ.town->terrain(where_draw.x,where_draw.y); if(trim == TRIM_WALKWAY){
can_draw = is_explored(where_draw.x,where_draw.y); int trim = -1;
unsigned char ground_t = scenario.ter_types[spec_terrain].trim_ter;
if (can_draw > 0) { ter_num_t ground_ter = get_ter_from_ground(ground_t);
if (pt_in_light(univ.town.p_loc,where_draw) == false) if (!loc_off_act_area(where_draw)) {
can_draw = 0; if(is_nature(where_draw.x - 1,where_draw.y,ground_t)){ // check left
} if(is_nature(where_draw.x,where_draw.y - 1,ground_t)){ // check up
if ((overall_mode == MODE_LOOK_TOWN) && (can_draw == 0))
can_draw = (party_can_see(where_draw) < 6) ? 1 : 0;
}
spot_seen[q][r] = can_draw;
if ((can_draw != 0) && (overall_mode != MODE_RESTING)) { // if can see, not a pit, and not resting
if ((is_combat()) && (cartoon_happening == false)) {
anim_ticks = 0;
}
eTrimType trim = scenario.ter_types[spec_terrain].trim_type;
// Finally, draw this terrain spot
// if(short_spec_terrain == 82) { // cave wway
// if (loc_off_act_area(where_draw) == false) {
// if ((is_nature(where_draw.x - 1,where_draw.y)) &&
// (is_nature(where_draw.x,where_draw.y - 1) ))
// short_spec_terrain = 10219;
// if ((is_nature(where_draw.x + 1,where_draw.y) ) &&
// (is_nature(where_draw.x,where_draw.y - 1) ))
// short_spec_terrain = 10220;
// if ((is_nature(where_draw.x + 1,where_draw.y) ) &&
// (is_nature(where_draw.x,where_draw.y + 1) ))
// short_spec_terrain = 10221;
// if ((is_nature(where_draw.x - 1,where_draw.y) ) &&
// (is_nature(where_draw.x,where_draw.y + 1) ))
// short_spec_terrain = 10218;
// }
// draw_one_terrain_spot(q,r,short_spec_terrain,0);
// }else if(short_spec_terrain == 83) { // ground wway
// if (loc_off_act_area(where_draw) == false) {
// if ((is_nature(where_draw.x - 1,where_draw.y)) &&
// (is_nature(where_draw.x,where_draw.y - 1)) )
// short_spec_terrain = 10223;
// if ((is_nature(where_draw.x + 1,where_draw.y) ) &&
// (is_nature(where_draw.x,where_draw.y - 1) ))
// short_spec_terrain = 10224;
// if ((is_nature(where_draw.x + 1,where_draw.y) ) &&
// (is_nature(where_draw.x,where_draw.y + 1) ))
// short_spec_terrain = 10225;
// if ((is_nature(where_draw.x - 1,where_draw.y) ) &&
// (is_nature(where_draw.x,where_draw.y + 1) ))
// short_spec_terrain = 10222;
// }
// draw_one_terrain_spot(q,r,short_spec_terrain,0);
if(trim == TRIM_WALKWAY){
int trim = -1;
unsigned char ground_t = scenario.ter_types[spec_terrain].trim_ter;
ter_num_t ground_ter = get_ter_from_ground(ground_t);
if (!loc_off_act_area(where_draw)) {
if(is_nature(where_draw.x - 1,where_draw.y,ground_t)){ // check left
if(is_nature(where_draw.x,where_draw.y - 1,ground_t)){ // check up
if(is_nature(where_draw.x + 1,where_draw.y,ground_t)){ // check right
if(is_nature(where_draw.x,where_draw.y + 1,ground_t)) // check down
trim = 8;
else trim = 4;
}else if(is_nature(where_draw.x,where_draw.y + 1,ground_t)) // check down
trim = 7;
else trim = 1;
}else if(is_nature(where_draw.x,where_draw.y + 1,ground_t)){ // check down
if(is_nature(where_draw.x + 1,where_draw.y,ground_t)) // check right
trim = 6;
else trim = 0;
}
}else if(is_nature(where_draw.x,where_draw.y - 1,ground_t)){ // check up
if(is_nature(where_draw.x + 1,where_draw.y,ground_t)){ // check right if(is_nature(where_draw.x + 1,where_draw.y,ground_t)){ // check right
if(is_nature(where_draw.x,where_draw.y + 1,ground_t)) // check down if(is_nature(where_draw.x,where_draw.y + 1,ground_t)) // check down
trim = 5; trim = 8;
else trim = 2; else trim = 4;
} }else if(is_nature(where_draw.x,where_draw.y + 1,ground_t)) // check down
}else if(is_nature(where_draw.x + 1,where_draw.y,ground_t)){ // check right trim = 7;
if(is_nature(where_draw.x,where_draw.y + 1,ground_t)) // check down else trim = 1;
trim = 3; }else if(is_nature(where_draw.x,where_draw.y + 1,ground_t)){ // check down
if(is_nature(where_draw.x + 1,where_draw.y,ground_t)) // check right
trim = 6;
else trim = 0;
} }
}else if(is_nature(where_draw.x,where_draw.y - 1,ground_t)){ // check up
if(is_nature(where_draw.x + 1,where_draw.y,ground_t)){ // check right
if(is_nature(where_draw.x,where_draw.y + 1,ground_t)) // check down
trim = 5;
else trim = 2;
}
}else if(is_nature(where_draw.x + 1,where_draw.y,ground_t)){ // check right
if(is_nature(where_draw.x,where_draw.y + 1,ground_t)) // check down
trim = 3;
} }
draw_one_terrain_spot(q,r,trim < 0 ? spec_terrain : ground_ter,0); }
if(trim >= 0) draw_one_terrain_spot(q,r,trim < 0 ? spec_terrain : ground_ter,0);
draw_trim(q,r,trim + 50,spec_terrain); if(trim >= 0)
}else if(trim == TRIM_ROAD || trim == TRIM_N || trim == TRIM_S || draw_trim(q,r,trim + 50,spec_terrain);
trim == TRIM_W || trim == TRIM_E) { }else if(trim == TRIM_ROAD || trim == TRIM_N || trim == TRIM_S ||
// if ((short_spec_terrain == 81) trim == TRIM_W || trim == TRIM_E) {
// && ((univ.out[where_draw.x][where_draw.y - 1] == 80) || (univ.out[where_draw.x][where_draw.y - 1] == 79))) draw_one_terrain_spot(q,r,spec_terrain,0);
// short_spec_terrain = 42; place_road(q,r,where_draw,trim == TRIM_ROAD);
// if ((short_spec_terrain == 81) }else if(spec_terrain == 65535) {
// && ((univ.out[where_draw.x][where_draw.y + 1] == 80) || (univ.out[where_draw.x][where_draw.y + 1] == 79))) draw_one_terrain_spot(q,r,-1,0);
// short_spec_terrain = 38; }else{
// if ((short_spec_terrain == 81) current_ground = get_ground_from_ter(spec_terrain);
// && ((univ.out[where_draw.x - 1][where_draw.y] == 80) || (univ.out[where_draw.x - 1][where_draw.y] == 79))) draw_one_terrain_spot(q,r,spec_terrain,0);
// short_spec_terrain = 44;
// if ((short_spec_terrain == 81)
// && ((univ.out[where_draw.x + 1][where_draw.y ] == 80) || (univ.out[where_draw.x + 1][where_draw.y] == 79)))
// short_spec_terrain = 40;
/*if ((short_spec_terrain == 81)
&& ((univ.out[where_draw.x][where_draw.y - 1] != 234) && (univ.out[where_draw.x][where_draw.y - 1] != 81) &&
((univ.out[where_draw.x][where_draw.y - 1] < 36) || (univ.out[where_draw.x][where_draw.y - 1] > 49))))
short_spec_terrain = 42;
if ((short_spec_terrain == 81)
&& ((univ.out[where_draw.x][where_draw.y + 1] != 234) && (univ.out[where_draw.x][where_draw.y + 1] != 81) &&
((univ.out[where_draw.x][where_draw.y + 1] < 36) || (univ.out[where_draw.x][where_draw.y + 1] > 49))))
short_spec_terrain = 38;
if ((short_spec_terrain == 81)
&& ((univ.out[where_draw.x - 1][where_draw.y] != 234) &&(univ.out[where_draw.x - 1][where_draw.y] != 81) &&
((univ.out[where_draw.x - 1][where_draw.y] < 36) || (univ.out[where_draw.x - 1][where_draw.y] > 49))))
short_spec_terrain = 44;
if ((short_spec_terrain == 81)
&& ((univ.out[where_draw.x + 1][where_draw.y] != 234) && (univ.out[where_draw.x + 1][where_draw.y] != 81) &&
((univ.out[where_draw.x + 1][where_draw.y] < 36) || (univ.out[where_draw.x + 1][where_draw.y] > 49))))
short_spec_terrain = 40;*/
draw_one_terrain_spot(q,r,spec_terrain,0);
place_road(q,r,where_draw,trim == TRIM_ROAD);
}else if(spec_terrain == 65535) {
draw_one_terrain_spot(q,r,-1,0);
}else{
// if (spec_terrain < 2)
// current_ground = 0;
// if ((spec_terrain == 2) || (
// (spec_terrain >= 22) && (spec_terrain <= 49)))
// current_ground = 2;
current_ground = get_ground_from_ter(spec_terrain);
draw_one_terrain_spot(q,r,spec_terrain,0);
}
} }
else { // Can't see. Place darkness.
draw_one_terrain_spot(q,r,-1,0);
}
if ((can_draw != 0) && (overall_mode != MODE_RESTING) && (frills_on == true)
&& (draw_frills == true) && (cartoon_happening == false)) { // Place the trim TODO: Alter trim
place_trim((short) q,(short) r,where_draw,spec_terrain);
}
if((is_town() && univ.town.is_spot(where_draw.x,where_draw.y)) ||
(is_out() && univ.out.outdoors[univ.party.i_w_c.x][univ.party.i_w_c.y].special_spot[where_draw.x][where_draw.y]))
Draw_Some_Item(roads_gworld, calc_rect(6, 0), terrain_screen_gworld, loc(q,r), 1, 0);
} }
else { // Can't see. Place darkness.
draw_one_terrain_spot(q,r,-1,0);
}
if ((can_draw != 0) && (overall_mode != MODE_RESTING) && (frills_on == true)
&& (draw_frills == true) && (cartoon_happening == false)) { // Place the trim TODO: Alter trim
place_trim((short) q,(short) r,where_draw,spec_terrain);
}
// if((is_town() && univ.town.is_spot(where_draw.x,where_draw.y)) ||
// (is_out() && univ.out.outdoors[univ.party.i_w_c.x][univ.party.i_w_c.y].special_spot[where_draw.x][where_draw.y]))
// Draw_Some_Item(roads_gworld, calc_rect(6, 0), terrain_screen_gworld, loc(q,r), 1, 0);
// TODO: Move draw_sfx, draw_items, draw_fields, draw_spec_items, etc to here
if (is_town() || is_combat()) {
draw_items(where_draw);
}
draw_fields(where_draw);
//draw_monsters(where_draw);
//draw_vehicles(where_draw);
//if(is_combat) draw_pcs(where_draw); else draw_party(where_draw);
}
} }
if ((overall_mode != MODE_RESTING) && (!is_out())) // if ((overall_mode != MODE_RESTING) && (!is_out()))
draw_sfx(); // draw_sfx();
//
// Now place items // // Now place items
if ((overall_mode > MODE_OUTDOORS) && (overall_mode != MODE_LOOK_OUTDOORS) && (overall_mode != MODE_RESTING)) // if ((overall_mode > MODE_OUTDOORS) && (overall_mode != MODE_LOOK_OUTDOORS) && (overall_mode != MODE_RESTING))
draw_items(); // draw_items();
//
// Now place fields // // Now place fields
if ((overall_mode != MODE_RESTING) && (!is_out())) { // if ((overall_mode != MODE_RESTING) && (!is_out())) {
draw_fields(); // draw_fields();
draw_spec_items(); // draw_spec_items();
} // }
//
// Not camping. Place misc. stuff // Not camping. Place misc. stuff
if (overall_mode != MODE_RESTING) { if (overall_mode != MODE_RESTING) {
if (is_out()) if (is_out())
@@ -2097,8 +2039,7 @@ void draw_terrain(short mode)
draw_party_symbol(mode,center); draw_party_symbol(mode,center);
else if (overall_mode != MODE_LOOK_TOWN) else if (overall_mode != MODE_LOOK_TOWN)
draw_pcs(center,0); draw_pcs(center,0);
// Now do the light mask thing // Now do the light mask thing
apply_light_mask(); apply_light_mask();
apply_unseen_mask(); apply_unseen_mask();
@@ -2107,12 +2048,12 @@ void draw_terrain(short mode)
redraw_terrain(); redraw_terrain();
if (cartoon_happening == false) { if (cartoon_happening == false) {
draw_text_bar(0); draw_text_bar(0);
if ((overall_mode >= MODE_COMBAT/*9*/) && (overall_mode != MODE_LOOK_OUTDOORS) && (overall_mode != MODE_LOOK_TOWN) && (overall_mode != MODE_RESTING)) if ((overall_mode >= MODE_COMBAT) && (overall_mode != MODE_LOOK_OUTDOORS) && (overall_mode != MODE_LOOK_TOWN) && (overall_mode != MODE_RESTING))
draw_pcs(center,1); draw_pcs(center,1);
if (overall_mode == MODE_FANCY_TARGET) if (overall_mode == MODE_FANCY_TARGET)
draw_targets(center); draw_targets(center);
}
} }
}
SetPort(old_port); SetPort(old_port);
supressing_some_spaces = false; supressing_some_spaces = false;
} }

View File

@@ -45,13 +45,14 @@ extern DialogPtr modeless_dialogs[18];
//extern short monst_target[60]; // 0-5 target that pc 6 - no target 100 + x - target monster x //extern short monst_target[60]; // 0-5 target that pc 6 - no target 100 + x - target monster x
extern short combat_posing_monster , current_working_monster ; // 0-5 PC 100 + x - monster x extern short combat_posing_monster , current_working_monster ; // 0-5 PC 100 + x - monster x
//extern piles_of_stuff_dumping_type *data_store; //extern piles_of_stuff_dumping_type *data_store; TODO: Abolish storage_gworld
extern GWorldPtr storage_gworld,terrain_screen_gworld,party_template_gworld,items_gworld,tiny_obj_gworld; extern GWorldPtr storage_gworld,terrain_screen_gworld,party_template_gworld,items_gworld,tiny_obj_gworld;
extern GWorldPtr fields_gworld,mixed_gworld; extern GWorldPtr fields_gworld,mixed_gworld,anim_gworld;
extern short which_g_stored[STORED_GRAPHICS]; extern short which_g_stored[STORED_GRAPHICS];
extern short wish_list[STORED_GRAPHICS]; extern short wish_list[STORED_GRAPHICS];
extern short storage_status[STORED_GRAPHICS]; // 0 - empty 1 - in use 2 - there, not in use extern short storage_status[STORED_GRAPHICS]; // 0 - empty 1 - in use 2 - there, not in use
extern short terrain_there[9][9]; extern short terrain_there[9][9];
extern pending_special_type special_queue[20];
extern Point ul; extern Point ul;
extern location pc_pos[6],center; extern location pc_pos[6],center;
@@ -248,7 +249,7 @@ void draw_monsters() ////
{{9,0,27,14},{9,14,27,28},{0,0,0,0},{0,0,0,0}}, {{9,0,27,14},{9,14,27,28},{0,0,0,0},{0,0,0,0}},
{{0,0,18,14},{0,14,18,28},{18,0,36,14},{18,14,36,28}} {{0,0,18,14},{0,14,18,28},{18,0,36,14},{18,14,36,28}}
}; };
if (is_out()) if (is_out())
for (i = 0; i < 10; i++) for (i = 0; i < 10; i++)
if (univ.party.out_c[i].exists == true) { if (univ.party.out_c[i].exists == true) {
@@ -261,111 +262,111 @@ void draw_monsters() ////
j = 0; j = 0;
while ((univ.party.out_c[i].what_monst.monst[j] == 0) && (j < 7)) { while ((univ.party.out_c[i].what_monst.monst[j] == 0) && (j < 7)) {
j++; j++;
} }
if (j == 7) univ.party.out_c[i].exists = false; // begin watch out if (j == 7) univ.party.out_c[i].exists = false; // begin watch out
else { else {
picture_wanted = get_monst_picnum(univ.party.out_c[i].what_monst.monst[j]); picture_wanted = get_monst_picnum(univ.party.out_c[i].what_monst.monst[j]);
} // end watch out } // end watch out
if (univ.party.out_c[i].exists == true) { if (univ.party.out_c[i].exists == true) {
get_monst_dims(univ.party.out_c[i].what_monst.monst[j],&width,&height); get_monst_dims(univ.party.out_c[i].what_monst.monst[j],&width,&height);
if (picture_wanted >= 1000) { if (picture_wanted >= 1000) {
for (k = 0; k < width * height; k++) { for (k = 0; k < width * height; k++) {
source_rect = get_custom_rect(picture_wanted % 1000 + source_rect = get_custom_rect(picture_wanted % 1000 +
((univ.party.out_c[i].direction < 4) ? 0 : (width * height)) + k); ((univ.party.out_c[i].direction < 4) ? 0 : (width * height)) + k);
to_rect = monst_rects[(width - 1) * 2 + height - 1][k]; to_rect = monst_rects[(width - 1) * 2 + height - 1][k];
OffsetRect(&to_rect,13 + 28 * where_draw.x,13 + 36 * where_draw.y); OffsetRect(&to_rect,13 + 28 * where_draw.x,13 + 36 * where_draw.y);
rect_draw_some_item(spec_scen_g, source_rect, terrain_screen_gworld,to_rect, 1, 0); rect_draw_some_item(spec_scen_g, source_rect, terrain_screen_gworld,to_rect, 1, 0);
} }
} }
if (picture_wanted < 1000) { if (picture_wanted < 1000) {
for (k = 0; k < width * height; k++) { for (k = 0; k < width * height; k++) {
source_rect = get_monster_template_rect(univ.party.out_c[i].what_monst.monst[j], source_rect = get_monster_template_rect(univ.party.out_c[i].what_monst.monst[j],
(univ.party.out_c[i].direction < 4) ? 0 : 1,k); (univ.party.out_c[i].direction < 4) ? 0 : 1,k);
to_rect = monst_rects[(width - 1) * 2 + height - 1][k]; to_rect = monst_rects[(width - 1) * 2 + height - 1][k];
OffsetRect(&to_rect,13 + 28 * where_draw.x,13 + 36 * where_draw.y); OffsetRect(&to_rect,13 + 28 * where_draw.x,13 + 36 * where_draw.y);
rect_draw_some_item(storage_gworld, source_rect, terrain_screen_gworld,to_rect, 1, 0); rect_draw_some_item(storage_gworld, source_rect, terrain_screen_gworld,to_rect, 1, 0);
}
} }
}
} }
} }
} }
if (is_town()) if (is_town())
for (i = 0; i < univ.town->max_monst(); i++) for (i = 0; i < univ.town->max_monst(); i++)
if ((univ.town.monst[i].active != 0) && (univ.town.monst[i].spec_skill != 11)) if ((univ.town.monst[i].active != 0) && (univ.town.monst[i].spec_skill != 11))
if (party_can_see_monst(i)) { if (party_can_see_monst(i)) {
check_if_monst_seen(univ.town.monst[i].number); check_if_monst_seen(univ.town.monst[i].number);
where_draw.x = univ.town.monst[i].cur_loc.x - center.x + 4; where_draw.x = univ.town.monst[i].cur_loc.x - center.x + 4;
where_draw.y = univ.town.monst[i].cur_loc.y - center.y + 4; where_draw.y = univ.town.monst[i].cur_loc.y - center.y + 4;
get_monst_dims(univ.town.monst[i].number,&width,&height); get_monst_dims(univ.town.monst[i].number,&width,&height);
if (point_onscreen(center,univ.town.monst[i].cur_loc) == true) if (point_onscreen(center,univ.town.monst[i].cur_loc) == true)
play_see_monster_str(univ.town.monst[i].number); play_see_monster_str(univ.town.monst[i].number);
for (k = 0; k < width * height; k++) { for (k = 0; k < width * height; k++) {
store_loc = where_draw; store_loc = where_draw;
store_loc.x += k % width; store_loc.x += k % width;
store_loc.y += k / width; store_loc.y += k / width;
// customize? // customize?
if (univ.town.monst[i].picture_num >= 1000) { if (univ.town.monst[i].picture_num >= 1000) {
source_rect = get_custom_rect((univ.town.monst[i].picture_num % 1000) + source_rect = get_custom_rect((univ.town.monst[i].picture_num % 1000) +
k + ((univ.town.monst[i].direction < 4) ? 0 : width * height) k + ((univ.town.monst[i].direction < 4) ? 0 : width * height)
+ ((combat_posing_monster == i + 100) ? (2 * width * height) : 0)); + ((combat_posing_monster == i + 100) ? (2 * width * height) : 0));
Draw_Some_Item(spec_scen_g, source_rect, terrain_screen_gworld, store_loc, 1, 0); Draw_Some_Item(spec_scen_g, source_rect, terrain_screen_gworld, store_loc, 1, 0);
} }
if (univ.town.monst[i].picture_num < 1000) { if (univ.town.monst[i].picture_num < 1000) {
source_rect = get_monster_template_rect(univ.town.monst[i].number, source_rect = get_monster_template_rect(univ.town.monst[i].number,
((univ.town.monst[i].direction < 4) ? 0 : 1) + ((combat_posing_monster == i + 100) ? 10 : 0),k); ((univ.town.monst[i].direction < 4) ? 0 : 1) + ((combat_posing_monster == i + 100) ? 10 : 0),k);
ter = univ.town->terrain(univ.town.monst[i].cur_loc.x,univ.town.monst[i].cur_loc.y); ter = univ.town->terrain(univ.town.monst[i].cur_loc.x,univ.town.monst[i].cur_loc.y);
// in bed? // in bed?
if ((store_loc.x >= 0) && (store_loc.x < 9) && (store_loc.y >= 0) && (store_loc.y < 9) && if ((store_loc.x >= 0) && (store_loc.x < 9) && (store_loc.y >= 0) && (store_loc.y < 9) &&
(scenario.ter_types[ter].special == TER_SPEC_BED) && (scenario.ter_types[ter].special == TER_SPEC_BED) &&
((univ.town.monst[i].m_type < 7) ((univ.town.monst[i].m_type < 7)
&& (univ.town.monst[i].m_type != 1) && (univ.town.monst[i].m_type != 2)) && (univ.town.monst[i].m_type != 1) && (univ.town.monst[i].m_type != 2))
&& ((univ.town.monst[i].active == 1) || (univ.town.monst[i].target == 6)) && && ((univ.town.monst[i].active == 1) || (univ.town.monst[i].target == 6)) &&
(width == 1) && (height == 1)) //// (width == 1) && (height == 1)) ////
draw_one_terrain_spot((short) where_draw.x,(short) where_draw.y,10000 + scenario.ter_types[ter].flag1.u,0); draw_one_terrain_spot((short) where_draw.x,(short) where_draw.y,10000 + scenario.ter_types[ter].flag1.u,0);
else Draw_Some_Item(storage_gworld, source_rect, terrain_screen_gworld, store_loc, 1, 0); else Draw_Some_Item(storage_gworld, source_rect, terrain_screen_gworld, store_loc, 1, 0);
} }
} }
} }
if (is_combat()) { if (is_combat()) {
for (i = 0; i < univ.town->max_monst(); i++) for (i = 0; i < univ.town->max_monst(); i++)
if ((univ.town.monst[i].active != 0) && (univ.town.monst[i].spec_skill != 11)) if ((univ.town.monst[i].active != 0) && (univ.town.monst[i].spec_skill != 11))
if (((point_onscreen(center,univ.town.monst[i].cur_loc) == true) && (cartoon_happening == true)) if (((point_onscreen(center,univ.town.monst[i].cur_loc) == true) && (cartoon_happening == true))
|| (party_can_see_monst(i) == true)) { || (party_can_see_monst(i) == true)) {
check_if_monst_seen(univ.town.monst[i].number); check_if_monst_seen(univ.town.monst[i].number);
where_draw.x = univ.town.monst[i].cur_loc.x - center.x + 4; where_draw.x = univ.town.monst[i].cur_loc.x - center.x + 4;
where_draw.y = univ.town.monst[i].cur_loc.y - center.y + 4; where_draw.y = univ.town.monst[i].cur_loc.y - center.y + 4;
get_monst_dims(univ.town.monst[i].number,&width,&height); get_monst_dims(univ.town.monst[i].number,&width,&height);
for (k = 0; k < width * height; k++) { for (k = 0; k < width * height; k++) {
store_loc = where_draw; store_loc = where_draw;
store_loc.x += k % width; store_loc.x += k % width;
store_loc.y += k / width; store_loc.y += k / width;
// customize? // customize?
if (univ.town.monst[i].picture_num >= 1000) { if (univ.town.monst[i].picture_num >= 1000) {
source_rect = get_custom_rect((univ.town.monst[i].picture_num % 1000) + source_rect = get_custom_rect((univ.town.monst[i].picture_num % 1000) +
k + ((univ.town.monst[i].direction < 4) ? 0 : width * height) k + ((univ.town.monst[i].direction < 4) ? 0 : width * height)
+ ((combat_posing_monster == i + 100) ? (2 * width * height) : 0)); + ((combat_posing_monster == i + 100) ? (2 * width * height) : 0));
Draw_Some_Item(spec_scen_g, source_rect, terrain_screen_gworld, store_loc, 1, 0); Draw_Some_Item(spec_scen_g, source_rect, terrain_screen_gworld, store_loc, 1, 0);
}
if (univ.town.monst[i].picture_num < 1000) {
source_rect = get_monster_template_rect(univ.town.monst[i].number,
((univ.town.monst[i].direction < 4) ? 0 : 1) + ((combat_posing_monster == i + 100) ? 10 : 0)
,k);
ter = univ.town->terrain(univ.town.monst[i].cur_loc.x,univ.town.monst[i].cur_loc.y);
if ((store_loc.x >= 0) && (store_loc.x < 9) && (store_loc.y >= 0) && (store_loc.y < 9) &&
(scenario.ter_types[ter].special == TER_SPEC_BED) &&
((univ.town.monst[i].m_type < 7)
&& (univ.town.monst[i].m_type != 1) && (univ.town.monst[i].m_type != 2))
&& ((univ.town.monst[i].active == 1) || (univ.town.monst[i].target == 6)) &&
(width == 1) && (height == 1))
draw_one_terrain_spot((short) where_draw.x,(short) where_draw.y,10000 + scenario.ter_types[ter].flag1.u,0); ////
else Draw_Some_Item(storage_gworld, source_rect, terrain_screen_gworld, store_loc, 1, 0);
}
}
} }
if (univ.town.monst[i].picture_num < 1000) {
source_rect = get_monster_template_rect(univ.town.monst[i].number,
((univ.town.monst[i].direction < 4) ? 0 : 1) + ((combat_posing_monster == i + 100) ? 10 : 0)
,k);
ter = univ.town->terrain(univ.town.monst[i].cur_loc.x,univ.town.monst[i].cur_loc.y);
if ((store_loc.x >= 0) && (store_loc.x < 9) && (store_loc.y >= 0) && (store_loc.y < 9) &&
(scenario.ter_types[ter].special == TER_SPEC_BED) &&
((univ.town.monst[i].m_type < 7)
&& (univ.town.monst[i].m_type != 1) && (univ.town.monst[i].m_type != 2))
&& ((univ.town.monst[i].active == 1) || (univ.town.monst[i].target == 6)) &&
(width == 1) && (height == 1))
draw_one_terrain_spot((short) where_draw.x,(short) where_draw.y,10000 + scenario.ter_types[ter].flag1.u,0); ////
else Draw_Some_Item(storage_gworld, source_rect, terrain_screen_gworld, store_loc, 1, 0);
}
}
}
} }
} }
@@ -380,9 +381,17 @@ void play_see_monster_str(unsigned short m){
// First display strings, if any // First display strings, if any
display_strings(str1 ? scenario.monst_strs[str1] : NULL, str2 ? scenario.monst_strs[str2] : NULL, "", snd, pic,type, 0); display_strings(str1 ? scenario.monst_strs[str1] : NULL, str2 ? scenario.monst_strs[str2] : NULL, "", snd, pic,type, 0);
// Then run the special, if any // Then run the special, if any
if(spec > -1) if(spec > -1){
run_special(18, 0, spec, loc(0,0), &s1, &s2, &s3); for(int i = 2; i < 20; i++){
// TODO: may need to check s3 to determine if redraw is needed if(special_queue[i].spec == -1){
special_queue[i].spec = spec;
special_queue[i].mode = SPEC_SEE_MONST;
special_queue[i].type = 0;
special_queue[i].where = loc(); // TODO: Maybe a different location should be passed?
break;
}
}
}
} }
void draw_pcs(location center,short mode) void draw_pcs(location center,short mode)
@@ -440,53 +449,33 @@ void draw_pcs(location center,short mode)
} }
} }
void draw_items(location where){
void draw_items() if(!point_onscreen(center,where)) return;
{ location where_draw(4 + where.x - center.x, 4 + where.y - center.y);
short i; Rect from_rect, to_rect;
Rect source_rect,dest_rect; if(supressing_some_spaces && (where != ok_space[0]) && (where != ok_space[1]) && (where != ok_space[2]) && (where != ok_space[3]))
location where_draw; return;
for (int i = 0; i < NUM_TOWN_ITEMS; i++) {
if(univ.town.items[i].variety != ITEM_TYPE_NO_ITEM && univ.town.items[i].item_loc == where) {
for (i = 0; i < NUM_TOWN_ITEMS; i++) { if(univ.town.items[i].is_contained()) continue;
if (univ.town.items[i].variety != 0) { if(!cartoon_happening && party_can_see(where) >= 6) continue;
where_draw.x = univ.town.items[i].item_loc.x - center.x + 4; if(univ.town.items[i].graphic_num >= 1000){
where_draw.y = univ.town.items[i].item_loc.y - center.y + 4; from_rect = get_custom_rect(univ.town.items[i].graphic_num - 1000);
to_rect = coord_to_rect(where.x,where.y);
if (supressing_some_spaces && (where_draw != ok_space[0]) && (where_draw != ok_space[1]) terrain_there[where_draw.x][where_draw.y] = -1;
&& (where_draw != ok_space[2]) && (where_draw != ok_space[3])); rect_draw_some_item(spec_scen_g,from_rect,terrain_screen_gworld,to_rect,1,0);
else if (point_onscreen(center, univ.town.items[i].item_loc) && !univ.town.items[i].is_contained() && }else{
(cartoon_happening || (party_can_see(univ.town.items[i].item_loc) < 6))) { from_rect = get_item_template_rect(univ.town.items[i].graphic_num);
// safety valve to_rect = coord_to_rect(where_draw.x,where_draw.y);
//if ((univ.town.items[i].graphic_num < 0) || terrain_there[where_draw.x][where_draw.y] = -1;
// ((univ.townt_i.items[i].graphic_num >= NUM_ITEM_G) && (univ.town.items[i].graphic_num < 1000))) { if(univ.town.items[i].graphic_num >= 45) {
// univ.town.items[i].variety = 0; InsetRect(&to_rect,5,9);
// univ.town.items[i].graphic_num = 0; rect_draw_some_item(tiny_obj_gworld, from_rect, terrain_screen_gworld, to_rect, 1, 0);
// } }else
if (univ.town.items[i].graphic_num >= 150) { rect_draw_some_item(items_gworld, from_rect, terrain_screen_gworld, to_rect, 1, 0);
source_rect = get_custom_rect(univ.town.items[i].graphic_num - 150);
dest_rect = coord_to_rect(where_draw.x,where_draw.y);
terrain_there[where_draw.x][where_draw.y] = -1;
rect_draw_some_item(spec_scen_g,
source_rect, terrain_screen_gworld, dest_rect, 1, 0);
}
else {
source_rect = get_item_template_rect(univ.town.items[i].graphic_num);
dest_rect = coord_to_rect(where_draw.x,where_draw.y);
terrain_there[where_draw.x][where_draw.y] = -1;
if (univ.town.items[i].graphic_num >= 45) {
dest_rect.top += 9;
dest_rect.bottom -= 9;
dest_rect.left += 5;
dest_rect.right -= 5;
}
rect_draw_some_item((univ.town.items[i].graphic_num < 45) ? items_gworld : tiny_obj_gworld,
source_rect, terrain_screen_gworld, dest_rect, 1, 0);
}
}
} }
} }
}
} }
void draw_outd_boats(location center) void draw_outd_boats(location center)
@@ -552,140 +541,62 @@ void draw_town_boat(location center)
} }
} }
void draw_fields() void draw_fields(location where){
{ if(!point_onscreen(center,where)) return;
if (crate == true) if(!cartoon_happening && party_can_see(where) >= 6) return;
draw_one_field(8,6,0); location where_draw(4 + where.x - center.x, 4 + where.y - center.y);
if (barrel == true) if(is_out()){
draw_one_field(16,7,0); if(univ.out.outdoors[univ.party.i_w_c.x][univ.party.i_w_c.y].special_spot[where.x][where.y])
if (web == true) Draw_Some_Item(fields_gworld,calc_rect(4,0),terrain_screen_gworld,where_draw,1,0);
draw_one_field(4,5,0);
if (quickfire == true)
draw_one_field(128,7,1);
if (fire_barrier == true)
draw_one_field(32,anim_ticks % 4,2);
if (force_barrier == true)
draw_one_field(64,anim_ticks % 4,2);
}
void draw_spec_items()
{
if (force_wall == true)
draw_one_spec_item(2,0,1);
if (fire_wall == true)
draw_one_spec_item(4,1,1);
if (antimagic == true)
draw_one_spec_item(8,2,1);
if (scloud == true)
draw_one_spec_item(16,3,1);
if (ice_wall == true)
draw_one_spec_item(32,4,1);
if (blade_wall == true)
draw_one_spec_item(64,5,1);
if (sleep_field == true)
draw_one_spec_item(128,6,1);
}
void draw_sfx()
{
short q,r,i,flag;
location where_draw,loc;
Rect orig_rect = {0,0,36,28},source_rect;
if (PSD[SDF_NO_FRILLS] > 0)
return; return;
}
for (q = 0; q < 9; q++) if(univ.town.is_force_wall(where.x,where.y))
for (r = 0; r < 9; r++) Draw_Some_Item(fields_gworld,calc_rect(0,1),terrain_screen_gworld,where_draw,1,0);
{ if(univ.town.is_fire_wall(where.x,where.y))
where_draw = center; Draw_Some_Item(fields_gworld,calc_rect(1,1),terrain_screen_gworld,where_draw,1,0);
where_draw.x += q - 4; if(univ.town.is_antimagic(where.x,where.y))
where_draw.y += r - 4; Draw_Some_Item(fields_gworld,calc_rect(2,1),terrain_screen_gworld,where_draw,1,0);
if(univ.town.is_scloud(where.x,where.y))
if ((where_draw.x < 0) || (where_draw.x > univ.town->max_dim() - 1) Draw_Some_Item(fields_gworld,calc_rect(3,1),terrain_screen_gworld,where_draw,1,0);
|| (where_draw.y < 0) || (where_draw.y > univ.town->max_dim() - 1)) if(univ.town.is_ice_wall(where.x,where.y))
; Draw_Some_Item(fields_gworld,calc_rect(4,1),terrain_screen_gworld,where_draw,1,0);
else if (univ.town.sfx(where_draw.x,where_draw.y) != 0) { if(univ.town.is_blade_wall(where.x,where.y))
for (i = 0; i < 8; i++) { Draw_Some_Item(fields_gworld,calc_rect(5,1),terrain_screen_gworld,where_draw,1,0);
flag = s_pow(2,i); if(univ.town.is_sleep_cloud(where.x,where.y))
if (univ.town.sfx(where_draw.x,where_draw.y) & flag) Draw_Some_Item(fields_gworld,calc_rect(6,1),terrain_screen_gworld,where_draw,1,0);
if (spot_seen[q][r] > 0) { if(univ.town.is_block(where.x,where.y))
loc.x = q; Draw_Some_Item(fields_gworld,calc_rect(3,0),terrain_screen_gworld,where_draw,1,0);
loc.y = r; if(univ.town.is_spot(where.x,where.y))
source_rect = orig_rect; Draw_Some_Item(fields_gworld,calc_rect(4,0),terrain_screen_gworld,where_draw,1,0);
OffsetRect(&source_rect,28 * i,36 * 3); if(univ.town.is_web(where.x,where.y))
Draw_Some_Item(fields_gworld,source_rect,terrain_screen_gworld,loc, Draw_Some_Item(fields_gworld,calc_rect(5,0),terrain_screen_gworld,where_draw,1,0);
1,0); if(univ.town.is_crate(where.x,where.y))
} Draw_Some_Item(fields_gworld,calc_rect(6,0),terrain_screen_gworld,where_draw,1,0);
} if(univ.town.is_barrel(where.x,where.y))
} Draw_Some_Item(fields_gworld,calc_rect(7,0),terrain_screen_gworld,where_draw,1,0);
} if(univ.town.is_fire_barr(where.x,where.y) || univ.town.is_force_barr(where.x,where.y))
Draw_Some_Item(anim_gworld,calc_rect(8 + (anim_ticks % 4),4),terrain_screen_gworld,where_draw,1,0);
if(univ.town.is_quickfire(where.x,where.y))
Draw_Some_Item(fields_gworld,calc_rect(7,1),terrain_screen_gworld,where_draw,1,0);
if(univ.town.is_sm_blood(where.x,where.y))
Draw_Some_Item(fields_gworld,calc_rect(0,3),terrain_screen_gworld,where_draw,1,0);
if(univ.town.is_med_blood(where.x,where.y))
Draw_Some_Item(fields_gworld,calc_rect(1,3),terrain_screen_gworld,where_draw,1,0);
if(univ.town.is_lg_blood(where.x,where.y))
Draw_Some_Item(fields_gworld,calc_rect(2,3),terrain_screen_gworld,where_draw,1,0);
if(univ.town.is_sm_slime(where.x,where.y))
Draw_Some_Item(fields_gworld,calc_rect(3,3),terrain_screen_gworld,where_draw,1,0);
if(univ.town.is_lg_slime(where.x,where.y))
Draw_Some_Item(fields_gworld,calc_rect(4,3),terrain_screen_gworld,where_draw,1,0);
if(univ.town.is_ash(where.x,where.y))
Draw_Some_Item(fields_gworld,calc_rect(5,3),terrain_screen_gworld,where_draw,1,0);
if(univ.town.is_bones(where.x,where.y))
Draw_Some_Item(fields_gworld,calc_rect(6,3),terrain_screen_gworld,where_draw,1,0);
if(univ.town.is_rubble(where.x,where.y))
Draw_Some_Item(fields_gworld,calc_rect(7,3),terrain_screen_gworld,where_draw,1,0);
if(univ.town.is_force_cage(where.x,where.y))
Draw_Some_Item(fields_gworld,calc_rect(2,0),terrain_screen_gworld,where_draw,1,0);
} }
void draw_one_field(unsigned char flag,short source_x,short source_y)
{
short q,r;
location where_draw,loc;
//Rect orig_rect = {0,0,36,28}
Rect source_rect;
for (q = 0; q < 9; q++)
for (r = 0; r < 9; r++){
where_draw = center;
where_draw.x += q - 4;
where_draw.y += r - 4;
if ((where_draw.x < 0) || (where_draw.x > univ.town->max_dim() - 1)
|| (where_draw.y < 0) || (where_draw.y > univ.town->max_dim() - 1))
;
else {
if (univ.town.misc_i(where_draw.x,where_draw.y) & flag)
if (spot_seen[q][r] > 0) {
loc.x = q; loc.y = r;
//source_rect = orig_rect;
//OffsetRect(&source_rect,28 * source_x,36 * source_y);
source_rect = calc_rect(source_x,source_y);
Draw_Some_Item(fields_gworld,source_rect,terrain_screen_gworld,loc,
1,0);
if ((is_town()) && ((flag == 32) || (flag == 64)))
anim_onscreen = true;
}
}
}
}
void draw_one_spec_item(unsigned char flag,short source_x,short source_y)
{
short q,r;
location where_draw,loc;
Rect orig_rect = {0,0,36,28},source_rect;
for (q = 0; q < 9; q++)
for (r = 0; r < 9; r++)
{
where_draw = center;
where_draw.x += q - 4;
where_draw.y += r - 4;
if ((where_draw.x < 0) || (where_draw.x > univ.town->max_dim() - 1)
|| (where_draw.y < 0) || (where_draw.y > univ.town->max_dim() - 1))
;
else {
if (univ.town.explored(where_draw.x,where_draw.y) & flag)
if (spot_seen[q][r] > 0) {
loc.x = q; loc.y = r;
source_rect = orig_rect;
OffsetRect(&source_rect,28 * source_x,36 * source_y);
Draw_Some_Item(fields_gworld,source_rect,terrain_screen_gworld,loc,
1,0);
}
}
}
}
void draw_party_symbol(short mode,location center) void draw_party_symbol(short mode,location center)
// mode currently unused // mode currently unused

View File

@@ -2,14 +2,8 @@ void draw_one_terrain_spot (short i,short j,short terrain_to_draw,short dest);
void draw_monsters(); void draw_monsters();
void play_see_monster_str(unsigned short m); void play_see_monster_str(unsigned short m);
void draw_pcs(location center,short mode); void draw_pcs(location center,short mode);
void draw_items();
void draw_outd_boats(location center); void draw_outd_boats(location center);
void draw_town_boat(location center) ; void draw_town_boat(location center) ;
void draw_fields();
void draw_spec_items();
void draw_sfx();
void draw_one_field(unsigned char flag,short source_x,short short_y);
void draw_one_spec_item(unsigned char flag,short source_x,short short_y);
void draw_party_symbol(short mode,location center); void draw_party_symbol(short mode,location center);
Rect get_terrain_template_rect (ter_num_t type_wanted); Rect get_terrain_template_rect (ter_num_t type_wanted);
Rect return_item_rect(short wanted); Rect return_item_rect(short wanted);
@@ -26,3 +20,6 @@ char get_fluid_trim(location where,ter_num_t ter_type);
void check_if_monst_seen(unsigned short m_num); void check_if_monst_seen(unsigned short m_num);
void adjust_monst_menu(); void adjust_monst_menu();
void play_ambient_sound(); void play_ambient_sound();
void draw_items(location where);
void draw_fields(location where);

View File

@@ -1030,7 +1030,6 @@ short display_item(location from_loc,short pc_num,short mode, bool check_contain
store_get_mode = mode; store_get_mode = mode;
current_getting_pc = current_pc; current_getting_pc = current_pc;
store_pcnum = pc_num; store_pcnum = pc_num;
dialog_answer = 0;
for (i = 0; i < 130; i++) for (i = 0; i < 130; i++)
item_array[i] = 200; item_array[i] = 200;
@@ -1071,6 +1070,7 @@ short display_item(location from_loc,short pc_num,short mode, bool check_contain
give_help(36,37,987); give_help(36,37,987);
} }
dialog_answer = 0;
item_hit = cd_run_dialog(); item_hit = cd_run_dialog();
cd_kill_dialog(987); cd_kill_dialog(987);

View File

@@ -47,7 +47,7 @@ extern short store_current_pc,current_ground;
extern short dungeon_font_num,geneva_font_num; extern short dungeon_font_num,geneva_font_num;
extern eGameMode store_pre_shop_mode,store_pre_talk_mode; extern eGameMode store_pre_shop_mode,store_pre_talk_mode;
//extern location monster_targs[60]; //extern location monster_targs[60];
extern short special_queue[20]; extern pending_special_type special_queue[20];
extern bool modeless_exists[18],diff_depth_ok,belt_present; extern bool modeless_exists[18],diff_depth_ok,belt_present;
extern short modeless_key[18]; extern short modeless_key[18];
@@ -747,15 +747,21 @@ void handle_town_specials(short town_number, short entry_dir,location start_loc)
// run_special(5,2,univ.town.town.spec_on_entry_if_dead,start_loc,&s1,&s2,&s3); // run_special(5,2,univ.town.town.spec_on_entry_if_dead,start_loc,&s1,&s2,&s3);
// else run_special(5,2,univ.town.town.spec_on_entry,start_loc,&s1,&s2,&s3); // else run_special(5,2,univ.town.town.spec_on_entry,start_loc,&s1,&s2,&s3);
if (entry_dir > 0) if (entry_dir > 0)
special_queue[0] = univ.town->spec_on_entry_if_dead; special_queue[0].spec = univ.town->spec_on_entry_if_dead;
else special_queue[0] = univ.town->spec_on_entry; else special_queue[0].spec = univ.town->spec_on_entry;
special_queue[0].where = univ.town.p_loc;
special_queue[0].type = 2;
special_queue[0].mode = SPEC_ENTER_TOWN;
} }
void handle_leave_town_specials(short town_number, short which_spec,location start_loc) void handle_leave_town_specials(short town_number, short which_spec,location start_loc)
{ {
//run_special(6,2,which_spec,start_loc,&s1,&s2,&s3); //run_special(6,2,which_spec,start_loc,&s1,&s2,&s3);
special_queue[1] = which_spec; special_queue[1].spec = which_spec;
special_queue[1].where = univ.party.p_loc;
special_queue[1].type = 2;
special_queue[1].mode = SPEC_LEAVE_TOWN;
} }
bool abil_exists(short abil) // use when univ.out.outdoors bool abil_exists(short abil) // use when univ.out.outdoors

View File

@@ -55,9 +55,15 @@ cMonster& cMonster::operator = (legacy::monster_record_type& old){
default_facial_pic = old.default_facial_pic; default_facial_pic = old.default_facial_pic;
picture_num = old.picture_num; picture_num = old.picture_num;
if(picture_num == 122) picture_num = 119; if(picture_num == 122) picture_num = 119;
see_spec = -1;
return *this; return *this;
} }
cMonster::cMonster(){
// TODO: Fill in
see_spec = -1;
}
cCreature::cCreature(){ cCreature::cCreature(){
// short personality; // short personality;
// short special_on_kill,facial_pic; // short special_on_kill,facial_pic;

View File

@@ -146,6 +146,7 @@ public:
std::string getAbil2Name(); std::string getAbil2Name();
bool hasAbil(eMonstAbil what, unsigned char* x1 = NULL, unsigned char* x2 = NULL); bool hasAbil(eMonstAbil what, unsigned char* x1 = NULL, unsigned char* x2 = NULL);
cMonster& operator = (legacy::monster_record_type& old); cMonster& operator = (legacy::monster_record_type& old);
cMonster();
void writeTo(std::ostream& file, std::string prefix); void writeTo(std::ostream& file, std::string prefix);
}; };

View File

@@ -484,3 +484,25 @@ inline void operator += (eDamageType& cur, eDamageType othr){
// operator int() {return c;} // operator int() {return c;}
// sbyte(signed char k) : c(k) {} // sbyte(signed char k) : c(k) {}
//} //}
enum eSpecContext {
SPEC_OUT_MOVE = 0,
SPEC_TOWN_MOVE = 1,
SPEC_COMBAT_MOVE = 2,
SPEC_OUT_LOOK = 3,
SPEC_TOWN_LOOK = 4,
SPEC_ENTER_TOWN = 5,
SPEC_LEAVE_TOWN = 6,
SPEC_TALK = 7,
SPEC_USE_SPEC_ITEM = 8,
SPEC_TOWN_TIMER = 9,
SPEC_SCEN_TIMER = 10,
SPEC_PARTY_TIMER = 11,
SPEC_KILL_MONST = 12,
SPEC_OUTDOOR_ENC = 13,
SPEC_WIN_ENCOUNTER = 14,
SPEC_FLEE_ENCOUNTER = 15,
SPEC_TARGET = 16,
SPEC_USE_SPACE = 17,
SPEC_SEE_MONST = 18,
};

View File

@@ -32,4 +32,11 @@ public:
void writeTo(std::ostream& file); void writeTo(std::ostream& file);
}; };
struct pending_special_type {
spec_num_t spec;
eSpecContext mode;
unsigned char type; // 0 - scen, 1 - out, 2 - town
location where;
};
#endif #endif

View File

@@ -237,6 +237,11 @@ bool cCurTown::is_rubble(char x, char y) const{
return fields[x][y] & 8388608L; return fields[x][y] & 8388608L;
} }
bool cCurTown::is_force_cage(char x, char y) const{
if(x > record->max_dim() || y > record->max_dim()) return false;
return fields[x][y] & 16777216L;
}
//bool cCurTown::is_trim(char x, char y, char t){ //bool cCurTown::is_trim(char x, char y, char t){
// unsigned char bit = 1 << t; // unsigned char bit = 1 << t;
// return trim[x][y] & bit; // return trim[x][y] & bit;
@@ -612,6 +617,15 @@ bool cCurTown::set_rubble(char x, char y, bool b){
return true; return true;
} }
bool cCurTown::set_force_cage(char x, char y, bool b){
// TODO: Consider whether placing a forcecage should erase anything already present, or fail due to something already present
// TODO: Also consider checking for forcecage in some of the other placement functions.
if(x > record->max_dim() || y > record->max_dim()) return false;
if(b) fields[x][y] |= 16777216L;
else fields[x][y] &= ~16777216L;
return true;
}
//bool cCurTown::set_trim(char x, char y, char t, bool b){ //bool cCurTown::set_trim(char x, char y, char t, bool b){
// unsigned char bit = 1 << t; // unsigned char bit = 1 << t;
// if(b){ // if(b){

View File

@@ -80,6 +80,7 @@ public:
bool is_ash(char x, char y) const; bool is_ash(char x, char y) const;
bool is_bones(char x, char y) const; bool is_bones(char x, char y) const;
bool is_rubble(char x, char y) const; bool is_rubble(char x, char y) const;
bool is_force_cage(char x, char y) const;
// bool is_trim(char x, char y, char t) const; // bool is_trim(char x, char y, char t) const;
bool set_explored(char x, char y, bool b); bool set_explored(char x, char y, bool b);
bool set_force_wall(char x, char y, bool b); bool set_force_wall(char x, char y, bool b);
@@ -106,6 +107,7 @@ public:
bool set_ash(char x, char y, bool b); bool set_ash(char x, char y, bool b);
bool set_bones(char x, char y, bool b); bool set_bones(char x, char y, bool b);
bool set_rubble(char x, char y, bool b); bool set_rubble(char x, char y, bool b);
bool set_force_cage(char x, char y, bool b);
// bool set_trim(char x, char y, char t, bool b); // bool set_trim(char x, char y, char t, bool b);
void writeTo(std::ostream& file); void writeTo(std::ostream& file);
void readFrom(std::istream& file); void readFrom(std::istream& file);