/*
Random encounter map script
*/
#include "..\headers\define.h"
//#include "..\headers\modMain.h"
#include "..\headers\updatmap.h"
#define NAME SCRIPT_RNDENC
#include "..\headers\command.h"
#define city1(x,y) ((x >= 259) and (x <= 294) and (y >= 345) and (y <= 375))
#define city2(x,y) ((x >= 763) and (x <= 794) and (y >= 1129) and (y <= 1169))
#define city3(x,y) ((x >= 598) and (x <= 639) and (y >= 911) and (y <= 959))
#define city4(x,y) ((x >= 578) and (x <= 600) and (y >= 945) and (y <= 967))
#define city5(x,y) ((x >= 543) and (x <= 591) and (y >= 968) and (y <= 1001))
#define mountain1(x,y) ((x >= 553) and (x <= 597) and (y >= 505) and (y <= 765))
#define mountain2(x,y) ((x >= 700) and (x <= 750) and (y >= 552) and (y <= 740))
#define mountain3(x,y) ((x >= 0) and (x <= 90) and (y >= 0) and (y <= 136))
#define mountain4(x,y) ((x >= 0) and (x <= 50) and (y >= 135) and (y <= 395))
#define mountain5(x,y) ((x >= 170) and (x <= 260) and (y >= 170) and (y <= 460))
#define mountain6(x,y) ((x >= 180) and (x <= 320) and (y >= 0) and (y <= 160))
#define mountain7(x,y) ((x >= 108) and (x <= 138) and (y >= 490) and (y <= 596))
#define mountain8(x,y) ((x >= 804) and (x <= 107) and (y >= 450) and (y <= 488))
#define mountain9(x,y) ((x >= 0) and (x <= 34) and (y >= 612) and (y <= 820))
#define mountain10(x,y) ((x >= 40) and (x <= 65) and (y >= 850) and (y <= 946))
#define mountain11(x,y) ((x >= 50) and (x <= 84) and (y >= 951) and (y <= 1027))
#define mountain12(x,y) ((x >= 144) and (x <= 200) and (y >= 612) and (y <= 837))
#define mountain13(x,y) ((x >= 198) and (x <= 248) and (y >= 638) and (y <= 736))
#define mountain14(x,y) ((x >= 0) and (x <= 100) and (y >= 1040) and (y <= 1384))
#define mountain15(x,y) ((x >= 100) and (x <= 400) and (y >= 1048) and (y <= 1388))
#define mountain16(x,y) ((x >= 345) and (x <= 490) and (y >= 1108) and (y <= 1303))
#define mountain17(x,y) ((x >= 490) and (x <= 1140) and (y >= 1195) and (y <= 1299))
#define mountain18(x,y) ((x >= 600) and (x <= 685) and (y >= 1103) and (y <= 1195))
#define mountain19(x,y) ((x >= 850) and (x <= 1130) and (y >= 1100) and (y <= 1190))
#define mountain20(x,y) ((x >= 1190) and (x <= 1220) and (y >= 550) and (y <= 854))
#define mountain21(x,y) ((x >= 1260) and (x <= 1397) and (y >= 132) and (y <= 401))
#define mountain22(x,y) ((x >= 1216) and (x <= 1288) and (y >= 5) and (y <= 111))
#define mountain23(x,y) ((x >= 1345) and (x <= 1400) and (y >= 60) and (y <= 135))
#define mountain24(x,y) ((x >= 937) and (x <= 988) and (y >= 560) and (y <= 708))
#define mountain25(x,y) ((x >= 996) and (x <= 108) and (y >= 575) and (y <= 648))
#define mountain26(x,y) ((x >= 641) and (x <= 724) and (y >= 104) and (y <= 241))
#define mountain27(x,y) ((x >= 677) and (x <= 745) and (y >= 0) and (y <= 55))
#define mountain28(x,y) ((x >= 447) and (x <= 637) and (y >= 849) and (y <= 899))
#define mountain29(x,y) ((x >= 427) and (x <= 540) and (y >= 900) and (y <= 932))
#define mountain30(x,y) ((x >= 400) and (x <= 450) and (y >=700) and (y <= 845))
#define mountain31(x,y) ((x >= 745) and (x <= 815) and (y >= 692) and (y <= 729))
#define mountain32(x,y) ((x >= 848) and (x <= 900) and (y >= 296) and (y <= 410))
#define mountain33(x,y) ((x >= 911) and (x <= 1132) and (y >= 1026) and (y <= 1097))
#define mountain34(x,y) ((x >= 1024) and (x <= 1133) and (y >= 860) and (y <= 1033))
#define mountain35(x,y) ((x >= 468) and (x <= 493) and (y >= 399) and (y <= 461))
#define mountain36(x,y) ((x >= 150) and (x <= 214) and (y >= 990) and (y <= 1065))
#define mixed1(x,y) ((x >= 392) and (x <= 1399) and (y >= 1299) and (y <= 1499))
#define mixed2(x,y) ((x >= 1131) and (x <= 1399) and (y >= 854) and (y <= 1299))
#define mixed3(x,y) ((x >= 1219) and (x <= 1399) and (y >= 400) and (y <= 855))
#define mixed4(x,y) ((x >= 195) and (x <= 307) and (y >= 735) and (y <= 913))
#define mixed5(x,y) ((x >= 446) and (x <= 566) and (y >= 61) and (y <= 163))
#define mixed6(x,y) ((x >= 1085) and (x <= 1220) and (y >= 426) and (y <= 545))
#define mixed7(x,y) ((x >= 762) and (x <= 1090) and (y >= 814) and (y <= 893))
#define mixed8(x,y) ((x >= 527) and (x <= 573) and (y >= 165) and (y <= 218))
#define mixed9(x,y) ((x >= 197) and (x <= 396) and (y >= 920) and (y <= 1060))
#define mixed10(x,y) ((x >= 345) and (x <= 438) and (y >= 465) and (y <= 697))
#define mixed11(x,y) ((x >= 709) and (x <= 822) and (y >= 506) and (y <= 654))
#define mixed12(x,y) ((x >= 672) and (x <= 731) and (y >= 266) and (y <= 425))
#define mixed13(x,y) ((x >= 564) and (x <= 663) and (y >= 701) and (y <= 852))
#define mixed14(x,y) ((x >= 391) and (x <= 454) and (y >= 314) and (y <= 394))
#define mixed15(x,y) ((x >= 540) and (x <= 573) and (y >= 372) and (y <= 500))
#define mixed16(x,y) ((x >= 411) and (x <= 452) and (y >= 158) and (y <= 214))
#define mixed17(x,y) ((x >= 886) and (x <= 930) and (y >= 225) and (y <= 290))
#define WM_In_City(x,y) (city1(x,y) or city2(x,y) or city3(x,y) or city4(x,y)or city5(x,y))
#define WM_In_Mixed(x,y) (mixed1(x,y) or mixed2(x,y) or mixed3(x,y) or mixed4(x,y) or mixed5(x,y) or mixed6(x,y) or mixed7(x,y) or mixed8(x,y) or mixed9(x,y) or \
mixed10(x,y) or mixed11(x,y) or mixed12(x,y) or mixed13(x,y) or mixed14(x,y) or mixed15(x,y) or mixed16(x,y) or mixed17(x,y))
#define WM_In_Mountains(x,y) (mountain1(x,y) or mountain2(x,y) or mountain3(x,y) or mountain4(x,y) or mountain5(x,y) or mountain6(x,y) or mountain7(x,y) or mountain8(x,y) or \
mountain9(x,y) or mountain10(x,y) or mountain11(x,y) or mountain12(x,y) or mountain13(x,y) or mountain14(x,y) or mountain15(x,y) or mountain16(x,y) or \
mountain17(x,y) or mountain18(x,y) or mountain19(x,y) or mountain20(x,y) or mountain21(x,y) or mountain22(x,y) or mountain23(x,y) or mountain24(x,y) or \
mountain25(x,y) or mountain26(x,y) or mountain27(x,y) or mountain28(x,y) or mountain29(x,y) or mountain30(x,y) or mountain31(x,y) or mountain32(x,y) or \
mountain33(x,y) or mountain34(x,y) or mountain35(x,y) or mountain36(x,y))
procedure start;
procedure timed_event_p_proc;
procedure map_enter_p_proc;
procedure map_update_p_proc;
procedure map_exit_p_proc;
procedure load_city;
procedure load_mountains;
procedure load_desert;
variable map;
procedure start begin
end
procedure map_exit_p_proc begin
if (global_var(GVAR_PLAYER_GOT_CAR) != 0) then begin
car_give_to_party;
end
end
procedure timed_event_p_proc begin
variable map;
if (fixed_param == 1) then begin
// In City:
if (WM_In_City(worldmap_xpos,worldmap_ypos)) then begin
call load_city;
end
// In Mountains and Desert
else if (WM_In_Mixed(worldmap_xpos,worldmap_ypos)) then begin
if (random(0,10) >= 4) then
call load_desert;
else
call load_mountains;
end
// In Mountains:
else if (WM_In_Mountains(worldmap_xpos,worldmap_ypos)) then begin
call load_mountains;
end
// In Desert:
else begin
call load_desert;
end
end
end
procedure load_city begin
wm_area_set_pos(AREA_RND_CITY, worldmap_xpos, worldmap_ypos);
map := random(1,8);
if map == 1 then
load_map(MAP_RND_CITY1, 0);
else if map == 2 then
load_map(MAP_RND_CITY_2, 0);
else if map == 3 then
load_map(MAP_RND_CITY_3, 0);
else if map == 4 then
load_map(MAP_RND_CITY_4, 0);
else if map == 5 then
load_map(MAP_RND_CITY_5, 0);
else if map == 6 then
load_map(MAP_RND_CITY_6, 0);
else if map == 7 then
load_map(MAP_RND_CITY_7, 0);
else if map == 8 then
load_map(MAP_RND_CITY_8, 0);
end
procedure load_mountains begin
wm_area_set_pos(AREA_RND_MOUNTAIN, worldmap_xpos, worldmap_ypos);
map := random(1,6);
if map == 1 then
load_map(MAP_RND_MOUNTAIN1, 0);
else if map == 2 then
load_map(MAP_RND_MOUNTAIN2, 0);
else if map == 3 then
load_map(MAP_RND_MOUNTAIN_3, 0);
else if map == 4 then
load_map(MAP_RND_MOUNTAIN_4, 0);
else if map == 5 then
load_map(MAP_RND_MOUNTAIN_5, 0);
else if map == 6 then
load_map(MAP_RND_MOUNTAIN_6, 0);
end
procedure load_desert begin
wm_area_set_pos(AREA_RND_DESERT, worldmap_xpos, worldmap_ypos);
map := random(2,10);
if map == 2 then
load_map(MAP_RND_DESERT_2, 0);
else if map == 3 then
load_map(MAP_RND_DESERT_3, 0);
else if map == 4 then
load_map(MAP_RND_DESERT4, 0);
else if map == 5 then
load_map(MAP_RND_DESERT5, 0);
else if map == 6 then
load_map(MAP_RND_DESERT6, 0);
else if map == 7 then
load_map(MAP_RND_DESERT7, 0);
else if map == 8 then
load_map(MAP_RND_DESERT_8, 0);
else if map == 9 then
load_map(MAP_RND_DESERT_9, 0);
else if map == 10 then
load_map(MAP_RND_DESERT_10, 0);
end
procedure map_enter_p_proc begin
variable map := random(1,3);
//debug("THAT map");
add_timer_event(self_obj, game_ticks(0), 1);
end
procedure map_update_p_proc begin
add_timer_event(self_obj, game_ticks(0), 1);
end