/*
	Copyright 1998-2003 Interplay Entertainment Corp.  All rights reserved.
*/

/*
        Name: Arroyo Bridge
        Location: Arroyo
        Description: This is the Map Script for the Bridge of Arroyo

        Log:
           Please note any changes that have been made to the file in Updated. Then comment
           the code which you have changed/altered/commented out. Please, do not delete any
           code which was written.

           Created: December 04, 1997

           Updated:
*/

/* Include Files */

/* Note, the Following Lines need to be in this order so that
   the script will be compilable. The define Name is referenced
   in a module from define.h and used in command.h. Please do
   not change the ordering.
        -rwh2   11/13/97
*/
#include "..\headers\define.h"
#include "..\headers\KlaToxCv.h"
#include "..\headers\updatmap.h"

#define NAME                    SCRIPT_KLATOXCV

#include "..\headers\command.h"

export variable i_toxic_bay_door;

procedure start;
procedure map_enter_p_proc;
procedure map_update_p_proc;

procedure start begin
end

procedure map_enter_p_proc begin
   i_toxic_bay_door := -1;
   if (map_first_run) then begin
       display_msg(mstr(100));
       set_global_var(GVAR_TOXIC_SEC_OVERRIDE,0);
       set_global_var(GVAR_TOXIC_SEC_FIXED,0);
   end

   if ((map_var(MVAR_Made_Car) == 0) and (global_var(GVAR_PLAYER_GOT_CAR) != 0) and (car_current_town == AREA_KLAMATH_TOXIC_CAVES)) then begin
       set_map_var(MVAR_Made_Car,1);
       Create_Car(CAR_KLAMATH_TOXIC_CAVES_HEX,CAR_KLAMATH_TOXIC_CAVES_ELEV)
   end
   else if ((map_var(MVAR_Made_Car) == 1) and (car_current_town != AREA_KLAMATH_TOXIC_CAVES)) then begin
       set_map_var(MVAR_Made_Car,0);
       Dest_Car(CAR_KLAMATH_TOXIC_CAVES_HEX,CAR_KLAMATH_TOXIC_CAVES_ELEV)
   end

   override_map_start_hex(18532,0,1);

   set_global_var(GVAR_LOAD_MAP_INDEX,0);
  
   

end

procedure map_update_p_proc begin
   if (elevation(dude_obj) == 2)then begin
     if (global_var (GVAR_TOXIC_POWER) == 0 )then begin
       set_light_level (40);
     end
     else if (global_var (GVAR_TOXIC_POWER) == 1) then begin
            set_light_level(70);
     end
   end
   else begin
     Cavern_Lighting;
   end
end