Preset town fields now use the field type enum
This commit is contained in:
@@ -692,27 +692,35 @@ bool handle_action(location the_point,sf::Event /*event*/) {
|
||||
overall_mode = MODE_DRAWING;
|
||||
break;
|
||||
case MODE_PLACE_WEB:
|
||||
make_web(spot_hit.x,spot_hit.y);
|
||||
make_field_type(spot_hit.x,spot_hit.y,FIELD_WEB);
|
||||
overall_mode = MODE_DRAWING;
|
||||
break;
|
||||
case MODE_PLACE_CRATE:
|
||||
make_crate(spot_hit.x,spot_hit.y);
|
||||
make_field_type(spot_hit.x,spot_hit.y,OBJECT_CRATE);
|
||||
overall_mode = MODE_DRAWING;
|
||||
break;
|
||||
case MODE_PLACE_BARREL:
|
||||
make_barrel(spot_hit.x,spot_hit.y);
|
||||
make_field_type(spot_hit.x,spot_hit.y,OBJECT_BARREL);
|
||||
overall_mode = MODE_DRAWING;
|
||||
break;
|
||||
case MODE_PLACE_FIRE_BARRIER:
|
||||
make_fire_barrier(spot_hit.x,spot_hit.y);
|
||||
make_field_type(spot_hit.x,spot_hit.y,BARRIER_FIRE);
|
||||
overall_mode = MODE_DRAWING;
|
||||
break;
|
||||
case MODE_PLACE_FORCE_BARRIER:
|
||||
make_force_barrier(spot_hit.x,spot_hit.y);
|
||||
make_field_type(spot_hit.x,spot_hit.y,BARRIER_FORCE);
|
||||
overall_mode = MODE_DRAWING;
|
||||
break;
|
||||
case MODE_PLACE_QUICKFIRE:
|
||||
make_quickfire(spot_hit.x,spot_hit.y);
|
||||
make_field_type(spot_hit.x,spot_hit.y,FIELD_QUICKFIRE);
|
||||
overall_mode = MODE_DRAWING;
|
||||
break;
|
||||
case MODE_PLACE_STONE_BLOCK:
|
||||
make_field_type(spot_hit.x,spot_hit.y,OBJECT_BLOCK);
|
||||
overall_mode = MODE_DRAWING;
|
||||
break;
|
||||
case MODE_PLACE_FORCECAGE:
|
||||
make_field_type(spot_hit.x,spot_hit.y,BARRIER_CAGE);
|
||||
overall_mode = MODE_DRAWING;
|
||||
break;
|
||||
case MODE_TOGGLE_SPECIAL_DOT:
|
||||
@@ -721,24 +729,17 @@ bool handle_action(location the_point,sf::Event /*event*/) {
|
||||
overall_mode = MODE_DRAWING;
|
||||
break;
|
||||
}
|
||||
make_field_type(spot_hit.x, spot_hit.y, 2);
|
||||
make_field_type(spot_hit.x, spot_hit.y, SPECIAL_SPOT);
|
||||
overall_mode = MODE_DRAWING;
|
||||
break;
|
||||
case MODE_CLEAR_FIELDS:
|
||||
take_quickfire(spot_hit.x,spot_hit.y);
|
||||
take_force_barrier(spot_hit.x,spot_hit.y);
|
||||
take_fire_barrier(spot_hit.x,spot_hit.y);
|
||||
take_barrel(spot_hit.x,spot_hit.y);
|
||||
take_crate(spot_hit.x,spot_hit.y);
|
||||
take_web(spot_hit.x,spot_hit.y);
|
||||
take_field_type(spot_hit.x, spot_hit.y, 2);
|
||||
for(i = 0; i < 8; i++)
|
||||
take_sfx(spot_hit.x,spot_hit.y,i);
|
||||
for(int i = 8; i <= BARRIER_CAGE; i++)
|
||||
take_field_type(spot_hit.x,spot_hit.y, eFieldType(i));
|
||||
set_cursor(wand_curs);
|
||||
overall_mode = MODE_DRAWING;
|
||||
break;
|
||||
case MODE_PLACE_SFX:
|
||||
make_sfx(spot_hit.x,spot_hit.y,mode_count);
|
||||
make_field_type(spot_hit.x,spot_hit.y,eFieldType(SFX_SMALL_BLOOD + mode_count));
|
||||
overall_mode = MODE_DRAWING;
|
||||
break;
|
||||
case MODE_EYEDROPPER:
|
||||
@@ -916,8 +917,6 @@ bool handle_action(location the_point,sf::Event /*event*/) {
|
||||
break;
|
||||
case MODE_SET_TOWN_START: // TODO: Implement this
|
||||
break;
|
||||
case MODE_PLACE_STONE_BLOCK: // TODO: Implement this
|
||||
break;
|
||||
case MODE_INTRO_SCREEN:
|
||||
case MODE_EDIT_TYPES:
|
||||
case MODE_MAIN_SCREEN:
|
||||
|
@@ -41,6 +41,7 @@ enum eScenMode {
|
||||
MODE_PLACE_EAST_ENTRANCE = 11,
|
||||
MODE_PLACE_SOUTH_ENTRANCE = 12,
|
||||
MODE_PLACE_WEST_ENTRANCE = 13,
|
||||
MODE_PLACE_FORCECAGE = 19,
|
||||
MODE_PLACE_WEB = 20,
|
||||
MODE_PLACE_CRATE = 21,
|
||||
MODE_PLACE_BARREL = 22,
|
||||
@@ -48,7 +49,7 @@ enum eScenMode {
|
||||
MODE_PLACE_FORCE_BARRIER = 24,
|
||||
MODE_PLACE_QUICKFIRE = 25,
|
||||
MODE_CLEAR_FIELDS = 26,
|
||||
MODE_PLACE_STONE_BLOCK = 27, // unused; for something I'd like to add
|
||||
MODE_PLACE_STONE_BLOCK = 27,
|
||||
MODE_PLACE_CREATURE = 28,
|
||||
MODE_LARGE_PAINTBRUSH = 29, // uncertain
|
||||
MODE_SMALL_PAINTBRUSH = 30, // uncertain
|
||||
|
@@ -742,35 +742,45 @@ void draw_terrain(){
|
||||
tiny_to.offset(0,-7);
|
||||
i = 4;
|
||||
}
|
||||
if(is_web(cen_x + q - 4,cen_y + r - 4)) {
|
||||
if(is_field_type(cen_x + q - 4,cen_y + r - 4, FIELD_WEB)) {
|
||||
from_rect = calc_rect(5,0);
|
||||
Draw_Some_Item(fields_gworld,from_rect,ter_draw_gworld,where_draw,sf::BlendAlpha);
|
||||
}
|
||||
if(is_crate(cen_x + q - 4,cen_y + r - 4)) {
|
||||
if(is_field_type(cen_x + q - 4,cen_y + r - 4, OBJECT_CRATE)) {
|
||||
from_rect = calc_rect(6,0);
|
||||
Draw_Some_Item(fields_gworld,from_rect,ter_draw_gworld,where_draw,sf::BlendAlpha);
|
||||
}
|
||||
if(is_barrel(cen_x + q - 4,cen_y + r - 4)) {
|
||||
if(is_field_type(cen_x + q - 4,cen_y + r - 4, OBJECT_BARREL)) {
|
||||
from_rect = calc_rect(7,0);
|
||||
Draw_Some_Item(fields_gworld,from_rect,ter_draw_gworld,where_draw,sf::BlendAlpha);
|
||||
}
|
||||
if(is_fire_barrier(cen_x + q - 4,cen_y + r - 4)) {
|
||||
from_rect = calc_rect(0,2);
|
||||
Draw_Some_Item(fields_gworld,from_rect,ter_draw_gworld,where_draw,sf::BlendAlpha);
|
||||
if(is_field_type(cen_x + q - 4,cen_y + r - 4, BARRIER_FIRE)) {
|
||||
from_rect = calc_rect(8,4);
|
||||
Draw_Some_Item(anim_gworld,from_rect,ter_draw_gworld,where_draw,sf::BlendAlpha);
|
||||
}
|
||||
if(is_quickfire(cen_x + q - 4,cen_y + r - 4)) {
|
||||
if(is_field_type(cen_x + q - 4,cen_y + r - 4, FIELD_QUICKFIRE)) {
|
||||
from_rect = calc_rect(7,1);
|
||||
Draw_Some_Item(fields_gworld,from_rect,ter_draw_gworld,where_draw,sf::BlendAlpha);
|
||||
}
|
||||
if(is_force_barrier(cen_x + q - 4,cen_y + r - 4)) {
|
||||
from_rect = calc_rect(2,2);
|
||||
if(is_field_type(cen_x + q - 4,cen_y + r - 4, BARRIER_FORCE)) {
|
||||
from_rect = calc_rect(10,4);
|
||||
Draw_Some_Item(anim_gworld,from_rect,ter_draw_gworld,where_draw,sf::BlendAlpha);
|
||||
}
|
||||
if(is_field_type(cen_x + q - 4,cen_y + r - 4, OBJECT_BLOCK)) {
|
||||
from_rect = calc_rect(3,0);
|
||||
Draw_Some_Item(fields_gworld,from_rect,ter_draw_gworld,where_draw,sf::BlendAlpha);
|
||||
}
|
||||
for(i = 0; i < 8; i++)
|
||||
if(is_sfx(cen_x + q - 4,cen_y + r - 4,i)) {
|
||||
if(is_field_type(cen_x + q - 4,cen_y + r - 4, BARRIER_CAGE)) {
|
||||
from_rect = calc_rect(0,0);
|
||||
Draw_Some_Item(fields_gworld,from_rect,ter_draw_gworld,where_draw,sf::BlendAlpha);
|
||||
}
|
||||
for(i = 0; i < 8; i++) {
|
||||
eFieldType sfx = eFieldType(SFX_SMALL_BLOOD + i);
|
||||
if(is_field_type(cen_x + q - 4,cen_y + r - 4,sfx)) {
|
||||
from_rect = calc_rect(i,3);
|
||||
Draw_Some_Item(fields_gworld,from_rect,ter_draw_gworld,where_draw,sf::BlendAlpha);
|
||||
}
|
||||
}
|
||||
for(x = 0; x < town->max_items(); x++)
|
||||
if((cen_x + q - 4 == town->preset_items[x].loc.x) &&
|
||||
(cen_y + r - 4 == town->preset_items[x].loc.y) && (town->preset_items[x].code >= 0)) {
|
||||
@@ -1290,23 +1300,17 @@ bool is_special(short i,short j) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void take_special(short /*i*/,short /*j*/) {
|
||||
}
|
||||
|
||||
void make_special(short /*i*/,short /*j*/) {
|
||||
}
|
||||
|
||||
void sort_specials() {
|
||||
}
|
||||
|
||||
bool is_spot(short i,short j){
|
||||
if(editing_town)
|
||||
return is_field_type(i,j,2);
|
||||
return is_field_type(i,j,SPECIAL_SPOT);
|
||||
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,eFieldType field_type) {
|
||||
unsigned short k;
|
||||
|
||||
for(k = 0; k < town->preset_fields.size(); k++)
|
||||
@@ -1317,7 +1321,7 @@ bool is_field_type(short i,short j,short field_type) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void make_field_type(short i,short j,short field_type) {
|
||||
void make_field_type(short i,short j,eFieldType field_type) {
|
||||
unsigned short k;
|
||||
|
||||
if(is_field_type(i,j,field_type))
|
||||
@@ -1338,100 +1342,26 @@ void make_field_type(short i,short j,short field_type) {
|
||||
}
|
||||
|
||||
|
||||
void take_field_type(short i,short j,short field_type) {
|
||||
void take_field_type(short i,short j,eFieldType field_type) {
|
||||
unsigned short k;
|
||||
|
||||
for(k = 0; k < town->preset_fields.size(); k++)
|
||||
if((town->preset_fields[k].type == field_type) &&
|
||||
(town->preset_fields[k].loc.x == i) &&
|
||||
(town->preset_fields[k].loc.y == j)) {
|
||||
town->preset_fields[k].type = 0;
|
||||
town->preset_fields[k].type = FIELD_DISPEL;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
bool is_web(short i,short j) {
|
||||
return is_field_type(i,j,3);
|
||||
|
||||
}
|
||||
void make_web(short i,short j) {
|
||||
make_field_type(i,j,3);
|
||||
}
|
||||
void take_web(short i,short j) {
|
||||
take_field_type(i,j,3);
|
||||
}
|
||||
|
||||
bool is_crate(short i,short j) {
|
||||
return is_field_type(i,j,4);
|
||||
}
|
||||
void make_crate(short i,short j) {
|
||||
make_field_type(i,j,4);
|
||||
|
||||
}
|
||||
void take_crate(short i,short j) {
|
||||
take_field_type(i,j,4);
|
||||
}
|
||||
|
||||
bool is_barrel(short i,short j) {
|
||||
return is_field_type(i,j,5);
|
||||
}
|
||||
void make_barrel(short i,short j) {
|
||||
make_field_type(i,j,5);
|
||||
}
|
||||
void take_barrel(short i,short j) {
|
||||
take_field_type(i,j,5);
|
||||
}
|
||||
|
||||
bool is_fire_barrier(short i,short j) {
|
||||
return is_field_type(i,j,6);
|
||||
}
|
||||
void make_fire_barrier(short i,short j) {
|
||||
make_field_type(i,j,6);
|
||||
}
|
||||
void take_fire_barrier(short i,short j) {
|
||||
take_field_type(i,j,6);
|
||||
}
|
||||
|
||||
bool is_force_barrier(short i,short j) {
|
||||
return is_field_type(i,j,7);
|
||||
}
|
||||
void make_force_barrier(short i,short j) {
|
||||
make_field_type(i,j,7);
|
||||
}
|
||||
void take_force_barrier(short i,short j) {
|
||||
take_field_type(i,j,7);
|
||||
|
||||
}
|
||||
|
||||
bool is_sfx(short i,short j,short type) {
|
||||
return is_field_type(i,j,type + 14);
|
||||
}
|
||||
void make_sfx(short i,short j,short type) {
|
||||
make_field_type(i,j,type + 14);
|
||||
}
|
||||
void take_sfx(short i,short j,short type) {
|
||||
take_field_type(i,j,type + 14);
|
||||
}
|
||||
|
||||
|
||||
bool is_quickfire(short i,short j) {
|
||||
return is_field_type(i,j,8);
|
||||
}
|
||||
void make_quickfire(short i,short j) {
|
||||
make_field_type(i,j,8);
|
||||
}
|
||||
void take_quickfire(short i,short j) {
|
||||
take_field_type(i,j,8);
|
||||
}
|
||||
|
||||
bool container_there(location l) {
|
||||
if(!editing_town)
|
||||
return false;
|
||||
if(scenario.ter_types[town->terrain(l.x,l.y)].special == eTerSpec::IS_A_CONTAINER)
|
||||
return true;
|
||||
if(is_barrel(l.x,l.y))
|
||||
if(is_field_type(l.x,l.y, OBJECT_BARREL))
|
||||
return true;
|
||||
if(is_crate(l.x,l.y))
|
||||
if(is_field_type(l.x,l.y, OBJECT_CRATE))
|
||||
return true;
|
||||
return 0;
|
||||
}
|
||||
|
@@ -26,30 +26,9 @@ bool is_special(short i,short j);
|
||||
void take_special(short i,short j);
|
||||
void make_special(short i,short j);
|
||||
void sort_specials();
|
||||
bool is_field_type(short i,short j,short field_type);
|
||||
void make_field_type(short i,short j,short field_type);
|
||||
void take_field_type(short i,short j,short field_type);
|
||||
bool is_web(short i,short j);
|
||||
void make_web(short i,short j);
|
||||
void take_web(short i,short j);
|
||||
bool is_crate(short i,short j);
|
||||
void make_crate(short i,short j);
|
||||
void take_crate(short i,short j);
|
||||
bool is_barrel(short i,short j);
|
||||
void make_barrel(short i,short j);
|
||||
void take_barrel(short i,short j);
|
||||
bool is_fire_barrier(short i,short j);
|
||||
void make_fire_barrier(short i,short j);
|
||||
void take_fire_barrier(short i,short j);
|
||||
bool is_force_barrier(short i,short j);
|
||||
void make_force_barrier(short i,short j);
|
||||
void take_force_barrier(short i,short j);
|
||||
bool is_sfx(short i,short j,short type);
|
||||
void make_sfx(short i,short j,short type);
|
||||
void take_sfx(short i,short j,short type);
|
||||
bool is_quickfire(short i,short j);
|
||||
void make_quickfire(short i,short j);
|
||||
void take_quickfire(short i,short j);
|
||||
bool is_field_type(short i,short j,eFieldType field_type);
|
||||
void make_field_type(short i,short j,eFieldType field_type);
|
||||
void take_field_type(short i,short j,eFieldType field_type);
|
||||
bool container_there(location l);
|
||||
bool is_spot(short i,short j);
|
||||
//void get_str(const char* str,short i, short j);
|
||||
|
Reference in New Issue
Block a user