#include <define.h>

//#define NAME                    SCRIPT_

#include <command.h>
//#include <ModReact.h>



procedure start;
#include <push.h>
procedure map_enter_p_proc;
procedure spatial_p_proc;
procedure use_p_proc;

import variable Tardis_ptr;


procedure start
begin
if (script_action == map_enter_proc) then begin
    call map_enter_p_proc;
  end
  else begin
    if (script_action == spatial_proc) then begin
      call spatial_p_proc;
    end
    else begin
      if (script_action == use_proc) then begin
        call use_p_proc;
      end
    end
  end
end

procedure map_enter_p_proc
begin
  if (obj_pid(self_obj) == 33555090) then begin
    Tardis_ptr := self_obj;
  end
  if (metarule(14, 0)) then begin
    override_map_start(113, 107, 0, 0);
    display_msg(message_str(SCRIPT_RNDDESRT, 317));
    set_global_var(GVAR_SPECIAL_ENCOUNTER_TARDIS, 1);
  end
end

procedure spatial_p_proc
begin
  reg_anim_func(2, dude_obj);
  play_sfx("STARDIS1");
  use_obj(Tardis_ptr);
  destroy_object(self_obj);
end

procedure use_p_proc
begin
  if (source_obj != dude_obj) then begin
    animate_stand_obj(self_obj);
  end
end