# Jedi Knight Cog Script
#
# 07_Rahnlines.COG
#
# The Sage words of Rahn Jedi Grandmaster
#
# [SXC]
#
# (C) 1997 LucasArts Entertainment Co. All Rights Reserved

symbols

   message     startup
   thing       yun
   thing       camera1
   sound       line1
   sound       line2
   sound       line4
   keyframe    keyfile
   cog         yuncog      nolink
   int         playerx     local

   material        tip_mat=sabergreen0.mat         local
   material        side_mat=sabergreen1.mat        local

   template        tpl_wall=+ssparks_wall          local
   template        tpl_blood=+ssparks_blood        local
   template        tpl_saber=+ssparks_saber        local

end

# =========================================================================================

code

startup:
      SetMusicVol(0.3);
      AiSetMode(yun, 0x2000);
      SetCurrentCamera(0);
      SetCameraFocus(0, camera1);
      PlayKey(camera1, keyfile, 1, 2);

      playerx = GetLocalPlayerThing();

      SetInv(playerx, 10, 1);
      jkSetSaberInfo(playerx, side_mat, tip_mat, 0.0128, 0.0128, 0.100, tpl_wall, tpl_blood, tpl_saber);
      jkSetFlags(playerx, 0x1);

      // When playerx starts, give him fists, and a saber.
      SetInv(playerx, 1, 1.0);
      SetInv(playerx, 10, 1.0);

      // Initialize weapon.
      SetFireWait(playerx, -1);
      SetMountWait(playerx, 0);
      SetCurInvWeapon(playerx, 0);
      SelectWeapon(playerx, 10);

      SetActorFlags(playerx, 0xa00000);
      Sleep(2);
      PlaySoundLocal(line1, 1, 0, 0);
      Sleep(8);
      PlaySoundLocal(line2, 1, 0, 0);
      Sleep(8);
      PlaySoundLocal(line4, 1, 0, 0);
      Sleep(7);
      ClearActorFlags(playerx, 0xa00000);
      AiClearMode(yun, 0x2000);
      SetCameraFocus(0, playerx);
      SetCurrentCamera(0);
      SetMusicVol(1.0);
		// Go to external if sabercam is enabled.
		if (jkGetSaberCam() == 1)
			CycleCamera();
		
      DestroyThing(camera1);
      AutosaveGame();
      Sleep(3.0);
      SendMessage(yuncog, user1);
      return;
end

