[Scummvm-git-logs] scummvm master -> f0d42d36fd9739baed4cafbfc4b8527a6d6bad4c

sev- sev at scummvm.org
Thu Apr 9 21:34:31 UTC 2020


This automated email contains information about 4 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
6dac3cc97e NUVIE: Add engine_should_quit() Lua function
86b42201f4 NUVIE: Check EVENT_QUIT in intro
1bbcf24d40 NUVIE: JANITORIAL: Remove trailing whitepaces in Lua scripts
f0d42d36fd NUVIE: Fix regression in scripts when engine is requested to quit


Commit: 6dac3cc97e4fc6371b0e114ddaa33732b48e1a19
    https://github.com/scummvm/scummvm/commit/6dac3cc97e4fc6371b0e114ddaa33732b48e1a19
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-04-09T23:19:31+02:00

Commit Message:
NUVIE: Add engine_should_quit() Lua function

Changed paths:
    engines/ultima/nuvie/script/script_cutscene.cpp


diff --git a/engines/ultima/nuvie/script/script_cutscene.cpp b/engines/ultima/nuvie/script/script_cutscene.cpp
index 23e3affba6..dba94a80f4 100644
--- a/engines/ultima/nuvie/script/script_cutscene.cpp
+++ b/engines/ultima/nuvie/script/script_cutscene.cpp
@@ -123,6 +123,8 @@ static int nscript_input_poll(lua_State *L);
 
 static int nscript_config_set(lua_State *L);
 
+static int nscript_engine_should_quit(lua_State *L);
+
 void nscript_init_cutscene(lua_State *L, Configuration *cfg, GUI *gui, SoundManager *sm) {
 	cutScene = new ScriptCutscene(gui, cfg, sm);
 
@@ -239,6 +241,9 @@ void nscript_init_cutscene(lua_State *L, Configuration *cfg, GUI *gui, SoundMana
 
 	lua_pushcfunction(L, nscript_config_set);
 	lua_setglobal(L, "config_set");
+
+	lua_pushcfunction(L, nscript_engine_should_quit);
+	lua_setglobal(L, "engine_should_quit");
 }
 
 bool nscript_new_image_var(lua_State *L, CSImage *image) {
@@ -1042,6 +1047,11 @@ static int nscript_input_poll(lua_State *L) {
 			lua_pushinteger(L, key.keycode);
 			return 1;
 		}
+		if (event.type == Common::EVENT_QUIT) {
+			lua_pushinteger(L, 'Q');
+			return 1;
+		}
+
 		if (event.type == Common::EVENT_LBUTTONDOWN || event.type == Common::EVENT_RBUTTONDOWN) {
 			lua_pushinteger(L, 0);
 			return 1;
@@ -1069,6 +1079,12 @@ static int nscript_config_set(lua_State *L) {
 	return 0;
 }
 
+static int nscript_engine_should_quit(lua_State *L) {
+	int x = g_engine->shouldQuit();
+	lua_pushinteger(L, x);
+	return 1;
+}
+
 ScriptCutscene::ScriptCutscene(GUI *g, Configuration *cfg, SoundManager *sm) : GUI_Widget(NULL) {
 	config = cfg;
 	gui = g;


Commit: 86b42201f485593c93b34ee394977e1d0e85b306
    https://github.com/scummvm/scummvm/commit/86b42201f485593c93b34ee394977e1d0e85b306
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-04-09T23:24:28+02:00

Commit Message:
NUVIE: Check EVENT_QUIT in intro

Changed paths:
    devtools/create_ultima/files/ultima6/scripts/common/intro_common.lua
    devtools/create_ultima/files/ultima6/scripts/u6/intro.lua


diff --git a/devtools/create_ultima/files/ultima6/scripts/common/intro_common.lua b/devtools/create_ultima/files/ultima6/scripts/common/intro_common.lua
index e13593ebcd..c088b23124 100644
--- a/devtools/create_ultima/files/ultima6/scripts/common/intro_common.lua
+++ b/devtools/create_ultima/files/ultima6/scripts/common/intro_common.lua
@@ -61,11 +61,21 @@ function poll_for_input()
       end
    end
 
+   if engine_should_quit() == 1 then
+	   g_should_exit = true
+   end
+
    return input
 end
 
 function poll_for_key_or_button(cycles)
    local input
+
+   if engine_should_quit() == 1 then
+	   g_should_exit = true
+	   return true
+   end
+
    if cycles == nil then
       input = input_poll()
       if input ~= nil then
@@ -84,6 +94,10 @@ function poll_for_key_or_button(cycles)
             end
             return true
          end
+         if engine_should_quit() == 1 then
+            g_should_exit = true
+            return true
+         end
          canvas_update()
       end
    end
@@ -97,6 +111,9 @@ function poll_for_esc(cycles)
       if input ~= nil and input == SDLK_ESCAPE then
          return true
       end
+      if engine_should_quit() == 1 then
+         return true
+      end
    else
       local i
       for i=0,cycles,1 do
@@ -104,6 +121,9 @@ function poll_for_esc(cycles)
          if input ~= nil and input == SDLK_ESCAPE then
             return true
          end
+         if engine_should_quit() == 1 then
+            return true
+         end
          canvas_update()
       end
    end
@@ -119,6 +139,10 @@ function fade_in(speed)
    for i=0x0,0xff,speed do
       canvas_set_opacity(i)
       canvas_update()
+
+      if engine_should_quit() == 1 then
+         return false
+      end
    end
 
    return false
@@ -133,6 +157,10 @@ function fade_out(speed)
    for i=0xff,0,-speed do
       canvas_set_opacity(i)
       canvas_update()
+
+      if engine_should_quit() == 1 then
+         return false
+      end
    end
 
    return false
diff --git a/devtools/create_ultima/files/ultima6/scripts/u6/intro.lua b/devtools/create_ultima/files/ultima6/scripts/u6/intro.lua
index b634704fd8..b15b963be9 100644
--- a/devtools/create_ultima/files/ultima6/scripts/u6/intro.lua
+++ b/devtools/create_ultima/files/ultima6/scripts/u6/intro.lua
@@ -10,7 +10,11 @@ local function poll_for_esc()
 	if input ~= nil and input == 27 then
 		return true
 	end
-	
+
+	if engine_should_quit() == 1 then
+		return true
+	end
+
 	return false
 end
 
@@ -22,12 +26,20 @@ local function wait_for_input()
 			if input ~= nil then
 				break
 			end
+
+			if engine_should_quit() == 1 then
+				break
+			end
 	end
 	
 	return input
 end
 
 local function should_exit(input)
+	if engine_should_quit() == 1 then
+		return true
+	end
+
 	if input ~=nil and input == 27 then
 		return true
 	end
@@ -40,6 +52,10 @@ local function fade_out()
 	for i=0xff,0,-3 do
 		canvas_set_opacity(i)
 		canvas_update()
+
+		if engine_should_quit() == 1 then
+			break
+		end
 	end
 	
 	return false
@@ -56,6 +72,10 @@ local function fade_out_sprite(sprite, speed)
 	for i=0xff,0,speed do
 		sprite.opacity = i
 		canvas_update()
+
+		if engine_should_quit() == 1 then
+			break
+		end
 	end
 
 	return false
@@ -66,6 +86,10 @@ local function fade_in()
 	for i=0x0,0xff,3 do
 		canvas_set_opacity(i)
 		canvas_update()
+
+		if engine_should_quit() == 1 then
+			break
+		end
 	end
 
 	return false
@@ -82,6 +106,10 @@ local function fade_in_sprite(sprite, speed)
 	for i=0,0xff,speed do
 		sprite.opacity = i
 		canvas_update()
+
+		if engine_should_quit() == 1 then
+			break
+		end
 	end
 
 	return false
@@ -2953,6 +2981,10 @@ local function main_menu_set_pal(idx)
 end
 
 local function main_menu_load()
+	if engine_should_quit() == 1 then
+		return
+	end
+
 	music_play("ultima.m")
 	g_menu = {}
 	
@@ -3025,6 +3057,11 @@ local function main_menu()
 	while true do
 		canvas_update()
 		input = input_poll(true)
+
+		if engine_should_quit() == 1 then
+			return "Q"
+		end
+
 		if input ~= nil then
 			if input == 113 then     --q quit
 				return "Q"


Commit: 1bbcf24d403c837e8c30fad02601ffd458339799
    https://github.com/scummvm/scummvm/commit/1bbcf24d403c837e8c30fad02601ffd458339799
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-04-09T23:30:08+02:00

Commit Message:
NUVIE: JANITORIAL: Remove trailing whitepaces in Lua scripts

Changed paths:
    devtools/create_ultima/files/ultima6/scripts/common/actor.lua
    devtools/create_ultima/files/ultima6/scripts/common/common.lua
    devtools/create_ultima/files/ultima6/scripts/common/intro_common.lua
    devtools/create_ultima/files/ultima6/scripts/common/lang.lua
    devtools/create_ultima/files/ultima6/scripts/md/actor.lua
    devtools/create_ultima/files/ultima6/scripts/md/combat.lua
    devtools/create_ultima/files/ultima6/scripts/md/dreamworld.lua
    devtools/create_ultima/files/ultima6/scripts/md/ending.lua
    devtools/create_ultima/files/ultima6/scripts/md/init.lua
    devtools/create_ultima/files/ultima6/scripts/md/intro.lua
    devtools/create_ultima/files/ultima6/scripts/md/lang/en/game.lua
    devtools/create_ultima/files/ultima6/scripts/md/lang/it/game.lua
    devtools/create_ultima/files/ultima6/scripts/md/look.lua
    devtools/create_ultima/files/ultima6/scripts/md/player.lua
    devtools/create_ultima/files/ultima6/scripts/md/talk.lua
    devtools/create_ultima/files/ultima6/scripts/md/usecode.lua
    devtools/create_ultima/files/ultima6/scripts/md/worktype.lua
    devtools/create_ultima/files/ultima6/scripts/se/actor.lua
    devtools/create_ultima/files/ultima6/scripts/se/init.lua
    devtools/create_ultima/files/ultima6/scripts/se/intro.lua
    devtools/create_ultima/files/ultima6/scripts/se/look.lua
    devtools/create_ultima/files/ultima6/scripts/se/usecode.lua
    devtools/create_ultima/files/ultima6/scripts/u6/actor.lua
    devtools/create_ultima/files/ultima6/scripts/u6/ending.lua
    devtools/create_ultima/files/ultima6/scripts/u6/init.lua
    devtools/create_ultima/files/ultima6/scripts/u6/intro.lua
    devtools/create_ultima/files/ultima6/scripts/u6/magic.lua
    devtools/create_ultima/files/ultima6/scripts/u6/magic/circle_01/create_food.lua
    devtools/create_ultima/files/ultima6/scripts/u6/magic/circle_01/detect_magic.lua
    devtools/create_ultima/files/ultima6/scripts/u6/magic/circle_01/detect_trap.lua
    devtools/create_ultima/files/ultima6/scripts/u6/magic/circle_01/douse.lua
    devtools/create_ultima/files/ultima6/scripts/u6/magic/circle_01/heal.lua
    devtools/create_ultima/files/ultima6/scripts/u6/magic/circle_01/help.lua
    devtools/create_ultima/files/ultima6/scripts/u6/magic/circle_01/ignite.lua
    devtools/create_ultima/files/ultima6/scripts/u6/magic/circle_02/infravision.lua
    devtools/create_ultima/files/ultima6/scripts/u6/magic/circle_02/magic_arrow.lua
    devtools/create_ultima/files/ultima6/scripts/u6/magic/circle_02/reappear.lua
    devtools/create_ultima/files/ultima6/scripts/u6/magic/circle_02/sleep.lua
    devtools/create_ultima/files/ultima6/scripts/u6/magic/circle_02/trap.lua
    devtools/create_ultima/files/ultima6/scripts/u6/magic/circle_02/untrap.lua
    devtools/create_ultima/files/ultima6/scripts/u6/magic/circle_02/vanish.lua
    devtools/create_ultima/files/ultima6/scripts/u6/magic/circle_03/curse.lua
    devtools/create_ultima/files/ultima6/scripts/u6/magic/circle_03/dispel_field.lua
    devtools/create_ultima/files/ultima6/scripts/u6/magic/circle_03/fireball.lua
    devtools/create_ultima/files/ultima6/scripts/u6/magic/circle_03/magic_lock.lua
    devtools/create_ultima/files/ultima6/scripts/u6/magic/circle_03/mass_awaken.lua
    devtools/create_ultima/files/ultima6/scripts/u6/magic/circle_03/mass_sleep.lua
    devtools/create_ultima/files/ultima6/scripts/u6/magic/circle_03/protection.lua
    devtools/create_ultima/files/ultima6/scripts/u6/magic/circle_04/animate.lua
    devtools/create_ultima/files/ultima6/scripts/u6/magic/circle_04/conjure.lua
    devtools/create_ultima/files/ultima6/scripts/u6/magic/circle_04/disable.lua
    devtools/create_ultima/files/ultima6/scripts/u6/magic/circle_04/fire_field.lua
    devtools/create_ultima/files/ultima6/scripts/u6/magic/circle_04/poison_field.lua
    devtools/create_ultima/files/ultima6/scripts/u6/magic/circle_04/sleep_field.lua
    devtools/create_ultima/files/ultima6/scripts/u6/magic/circle_04/wind_change.lua
    devtools/create_ultima/files/ultima6/scripts/u6/magic/circle_05/energy_field.lua
    devtools/create_ultima/files/ultima6/scripts/u6/magic/circle_05/explosion.lua
    devtools/create_ultima/files/ultima6/scripts/u6/magic/circle_05/insect_swarm.lua
    devtools/create_ultima/files/ultima6/scripts/u6/magic/circle_05/invisibility.lua
    devtools/create_ultima/files/ultima6/scripts/u6/magic/circle_05/lightning.lua
    devtools/create_ultima/files/ultima6/scripts/u6/magic/circle_05/paralyze.lua
    devtools/create_ultima/files/ultima6/scripts/u6/magic/circle_06/clone.lua
    devtools/create_ultima/files/ultima6/scripts/u6/magic/circle_06/flame_wind.lua
    devtools/create_ultima/files/ultima6/scripts/u6/magic/circle_06/hail_storm.lua
    devtools/create_ultima/files/ultima6/scripts/u6/magic/circle_06/mass_protect.lua
    devtools/create_ultima/files/ultima6/scripts/u6/magic/circle_06/negate_magic.lua
    devtools/create_ultima/files/ultima6/scripts/u6/magic/circle_06/replicate.lua
    devtools/create_ultima/files/ultima6/scripts/u6/magic/circle_06/web.lua
    devtools/create_ultima/files/ultima6/scripts/u6/magic/circle_07/chain_bolt.lua
    devtools/create_ultima/files/ultima6/scripts/u6/magic/circle_07/enchant.lua
    devtools/create_ultima/files/ultima6/scripts/u6/magic/circle_07/fear.lua
    devtools/create_ultima/files/ultima6/scripts/u6/magic/circle_07/kill.lua
    devtools/create_ultima/files/ultima6/scripts/u6/magic/circle_07/mass_curse.lua
    devtools/create_ultima/files/ultima6/scripts/u6/magic/circle_07/mass_invisibility.lua
    devtools/create_ultima/files/ultima6/scripts/u6/magic/circle_07/wing_strike.lua
    devtools/create_ultima/files/ultima6/scripts/u6/magic/circle_07/wizard_eye.lua
    devtools/create_ultima/files/ultima6/scripts/u6/magic/circle_08/armageddon.lua
    devtools/create_ultima/files/ultima6/scripts/u6/magic/circle_08/death_wind.lua
    devtools/create_ultima/files/ultima6/scripts/u6/magic/circle_08/eclipse.lua
    devtools/create_ultima/files/ultima6/scripts/u6/magic/circle_08/mass_charm.lua
    devtools/create_ultima/files/ultima6/scripts/u6/magic/circle_08/mass_kill.lua
    devtools/create_ultima/files/ultima6/scripts/u6/magic/circle_08/resurrect.lua
    devtools/create_ultima/files/ultima6/scripts/u6/magic/circle_08/slime.lua
    devtools/create_ultima/files/ultima6/scripts/u6/magic/circle_08/summon.lua
    devtools/create_ultima/files/ultima6/scripts/u6/magic/circle_08/time_stop.lua
    devtools/create_ultima/files/ultima6/scripts/u6/magic/circle_08/tremor.lua
    devtools/create_ultima/files/ultima6/scripts/u6/usecode.lua


diff --git a/devtools/create_ultima/files/ultima6/scripts/common/actor.lua b/devtools/create_ultima/files/ultima6/scripts/common/actor.lua
index 3b2b8e34d9..7a07e81d23 100644
--- a/devtools/create_ultima/files/ultima6/scripts/common/actor.lua
+++ b/devtools/create_ultima/files/ultima6/scripts/common/actor.lua
@@ -1,7 +1,7 @@
 ALIGNMENT_DEFAULT = 0
 ALIGNMENT_NEUTRAL = 1
 ALIGNMENT_EVIL    = 2
-ALIGNMENT_GOOD    = 3 
+ALIGNMENT_GOOD    = 3
 ALIGNMENT_CHAOTIC = 4
 
 HEAD   = 0
@@ -35,7 +35,7 @@ end
 function get_weapon_range(obj_n)
 
    local range = g_range_weapon_tbl[obj_n]
-   
+
    if range == nil then
       return 1
    end
@@ -48,13 +48,13 @@ function actor_randomise_stat(base_stat)
    if tmp == 0 then
       return base_stat
    end
-   
+
    return math.random(0, tmp) + math.random(0, tmp)  + base_stat - tmp
 end
 
 function actor_is_holding_obj(actor, obj_n)
    local hand
-   
+
    hand = Actor.inv_get_readied_obj_n(actor, HAND)
    if hand == obj_n then
       return true
@@ -63,8 +63,8 @@ function actor_is_holding_obj(actor, obj_n)
    if hand == obj_n then
       return true
    end
-   
-   return false   
+
+   return false
 end
 
 function actor_has_free_arm(actor)
diff --git a/devtools/create_ultima/files/ultima6/scripts/common/common.lua b/devtools/create_ultima/files/ultima6/scripts/common/common.lua
index 880435dc30..d3a12001c2 100644
--- a/devtools/create_ultima/files/ultima6/scripts/common/common.lua
+++ b/devtools/create_ultima/files/ultima6/scripts/common/common.lua
@@ -8,7 +8,7 @@ DIR_EAST      = 1
 DIR_SOUTH     = 2
 DIR_WEST      = 3
 DIR_NORTHEAST = 4
-DIR_SOUTHEAST = 5 
+DIR_SOUTHEAST = 5
 DIR_SOUTHWEST = 6
 DIR_NORTHWEST = 7
 DIR_NONE      = 8
@@ -55,7 +55,7 @@ function get_direction(prompt)
 	if prompt ~= nil then
 		print(prompt)
 	end
-	
+
 	local dir = coroutine.yield("dir")
 
 	return dir
@@ -83,7 +83,7 @@ function direction_string(dir)
 		if dir == DIR_WEST then return "west" end
 		if dir == DIR_NORTHWEST then return "northwest" end
 	end
-	
+
 	return "unknown"
 end
 
@@ -98,7 +98,7 @@ local dir_rev_tbl =
    [DIR_WEST] = DIR_EAST,
    [DIR_NORTHWEST] = DIR_SOUTHEAST
 }
-   
+
 function direction_reverse(dir) return dir_rev_tbl[dir] end
 
 local g_dir_offset_tbl =
@@ -122,7 +122,7 @@ function abs(val)
    if val < 0 then
       return -val
    end
-   
+
    return val
 end
 
@@ -139,7 +139,7 @@ end
 
 function play_midgame_sequence(seq_num)
    local ui_style = game_get_ui_style()
-   
+
    canvas_show()
    canvas_hide_all_sprites()
    canvas_set_opacity(0xff);
@@ -148,10 +148,10 @@ function play_midgame_sequence(seq_num)
 
    local bg = sprite_new(nil, 8, 16, true)
    local avatar = sprite_new(nil, 8, 16, false)
-   
+
    local text_sprite
    --local text_sprite_bg
-      
+
    if ui_style == UI_STYLE_ORIG then
       canvas_set_solid_bg(false)
    else
@@ -172,9 +172,9 @@ function play_midgame_sequence(seq_num)
    local midgame_data = midgame_load("midgame"..string.format("%x", seq_num)..".lzc")
    local i = 0
    local data = midgame_data[i]
-   
 
-      
+
+
    while data ~= nil do
       bg.image = data.images[0]
       if data.images[1] ~= nil then
@@ -184,7 +184,7 @@ function play_midgame_sequence(seq_num)
       else
          avatar.visible = false
       end
-      
+
       local j = 0
       local text = data.text[j]
       while text ~= nil do
@@ -223,17 +223,17 @@ end
 
 function get_wrapped_dist(pt1, pt2)
    local diff
-   
+
    if pt2 >= pt1 then
       diff = pt2 - pt1
    else
       diff = pt1 - pt2
    end
-   
+
    if diff > 512 then
       diff = 1024 - diff
    end
-   
+
    return diff
 end
 
@@ -244,7 +244,7 @@ function get_anim_index_for_tile(tile_number)
          return i
       end
    end
-   
+
    return nil
 end
 
@@ -265,9 +265,9 @@ function altcode_242_set_actor_talk_flag()
    print(" is "..value_str..".\n")
    print("New value? ")
    value = input_select_integer(nil, true)
-   
+
    value_str = "off"
-   
+
    if value == 1 or value == "o" then
       value_str = "on"
       Actor.set_talk_flag(actor, bit)
@@ -286,13 +286,13 @@ function altcode_250_create_object()
    if tmp_obj ~= nil and tmp_obj.tile_num - obj.tile_num > 1 then
       print("\nFrame:0x")
       input = input_select(nil, true)
-      obj.frame_n = tonumber(input, 16) 
+      obj.frame_n = tonumber(input, 16)
    end
-   
+
    print("\nQual:0x")
    input = input_select(nil, true)
    obj.quality = tonumber(input, 16)
-   
+
    if obj.stackable or create_object_needs_quan(obj_n) then
       print("\nQuan:0x")
       input = input_select(nil, true)
@@ -395,5 +395,3 @@ lua_file();
 lang_init("game")
 
 lua_file = nuvie_load("common/actor.lua"); lua_file();
-
-
diff --git a/devtools/create_ultima/files/ultima6/scripts/common/intro_common.lua b/devtools/create_ultima/files/ultima6/scripts/common/intro_common.lua
index c088b23124..ac7bf6986a 100644
--- a/devtools/create_ultima/files/ultima6/scripts/common/intro_common.lua
+++ b/devtools/create_ultima/files/ultima6/scripts/common/intro_common.lua
@@ -134,7 +134,7 @@ function fade_in(speed)
    if speed == nil then
       speed = 3
    end
-   
+
    local i
    for i=0x0,0xff,speed do
       canvas_set_opacity(i)
@@ -152,7 +152,7 @@ function fade_out(speed)
    if speed == nil then
       speed = 3
    end
-    
+
    local i
    for i=0xff,0,-speed do
       canvas_set_opacity(i)
@@ -178,7 +178,7 @@ local rand = math.random
    players[7].image = img_tbl[7][rand(0,4)]
    players[8].image = img_tbl[8][rand(0,4)]
    players[9].image = img_tbl[9][rand(0,3)]
-      
+
 end
 
 function create_player_sprite(image, x, y)
@@ -220,7 +220,7 @@ function fireworks_update(exp_tbl, img_tbl)
          v[1].image = img_tbl[11][8*v[2]+v[3]]
       end
    end
-   
+
    return exp_finished
 end
 
@@ -243,16 +243,16 @@ function fireworks(img_tbl, logo)
       exp_count = exp_count - num_finished
       poll_for_esc(1)
    end
-   
+
    --wait for remaining explosions to finish
    while exp_count > 0 do
       local num_finished = fireworks_update(exp_tbl, img_tbl)
       exp_count = exp_count - num_finished
       poll_for_esc(1)
    end
-   
+
    poll_for_esc(10)
-      
+
    -- create final 30 explosions.
    for i=1,30 do
       local exp = create_firework(img_tbl)
@@ -272,21 +272,21 @@ function display_image_table(img_tbl, x, y)
    if x == nil then
       x = 160
    end
-   
+
    if y == nil then
       y = 100
    end
-   
+
    local sprite = sprite_new(nil, x, y, true)
-   
+
    local text_sprite = sprite_new(nil, 100, 180, true)
-            
+
    local i = 0
    for k,v in pairs(img_tbl) do
       if type(v) == "table" then
          local j = 0
          for l,m in pairs(v) do
-   
+
             local img = image_new(50,20)
             text_sprite.image = img
             image_print(img, "("..k..","..l..")", 0, 50, 0, 8, 0x6)
@@ -307,11 +307,11 @@ end
 
 function about_martian_dreams()
    canvas_hide_all_sprites()
-   local bg = sprite_new(image_load("mars.lzc", 0), 0, 24, true)   
-   
+   local bg = sprite_new(image_load("mars.lzc", 0), 0, 24, true)
+
    local text_tbl = text_load("scenetxt.lzc", 4)
    music_play("mdd_mus.lzc", 8)
-   
+
    local sprites = {}
    local i
    for i=0,81 do
@@ -319,18 +319,18 @@ function about_martian_dreams()
       s.text_color = 6
       s.text = text_tbl[i]
       table.insert(sprites, s)
-      
+
       s = sprite_new(nil, 12, 152 + i * 14, true)
       s.text_color = 14
       s.text = text_tbl[i]
       table.insert(sprites, s)
    end
-   
+
    --black bars for the top and bottom of the screen.
    --These hide the text as it is scrolling in and out.
-   sprite_new(image_new(220, 24, 0), 0, 0, true)  
+   sprite_new(image_new(220, 24, 0), 0, 0, true)
    sprite_new(image_new(220, 48, 0), 0, 152, true)
-   
+
    --scroll the text up the screen
    for i=0,90*14 do
       local j
@@ -345,4 +345,4 @@ function about_martian_dreams()
    end
    music_stop()
    fade_out()
-end
\ No newline at end of file
+end
diff --git a/devtools/create_ultima/files/ultima6/scripts/common/lang.lua b/devtools/create_ultima/files/ultima6/scripts/common/lang.lua
index 693ece89ed..2d084982ef 100644
--- a/devtools/create_ultima/files/ultima6/scripts/common/lang.lua
+++ b/devtools/create_ultima/files/ultima6/scripts/common/lang.lua
@@ -9,7 +9,7 @@ function lang_init(lang_type)
    if lang_type ~= "intro" then
       lang_type = "game"
    end
-   
+
    lang_en = nuvie_load(string.lower(game_type).."/lang/en/"..lang_type..".lua")
 
    if lang_en == nil then
@@ -17,7 +17,7 @@ function lang_init(lang_type)
    else
       lang_en = lang_en()
    end
-   
+
    if lang_selected ~= "en" then
        lang = nuvie_load(string.lower(game_type).."/lang/"..lang_selected.."/"..lang_type..".lua")
        if lang == nil then
diff --git a/devtools/create_ultima/files/ultima6/scripts/md/actor.lua b/devtools/create_ultima/files/ultima6/scripts/md/actor.lua
index b2b582e28f..979c98257a 100644
--- a/devtools/create_ultima/files/ultima6/scripts/md/actor.lua
+++ b/devtools/create_ultima/files/ultima6/scripts/md/actor.lua
@@ -1,6 +1,6 @@
 io.stderr:write("actor.lua get here\n")
 
---Worktypes      
+--Worktypes
 WT_NOTHING                = 0x0  --do nothing
 
 WT_FOLLOW                 = 0x1  --follow avatar (in party)
@@ -132,25 +132,25 @@ function actor_is_affected_by_purple_berries(actor_num)
    if actor_num < 16 and timer_get(actor_num*3) > 0 then
       return true
    end
-   
+
    return false
 end
 
 function actor_is_affected_by_green_berries(actor_num)
- 
+
    if actor_num < 16 and timer_get(actor_num*3+1) > 0 then
       return true
    end
-   
+
    return false
 end
 
 function actor_is_affected_by_brown_berries(actor_num)
- 
+
    if actor_num < 16 and timer_get(actor_num*3+2) > 0 then
       return true
    end
-   
+
    return false
 end
 
@@ -158,7 +158,7 @@ function actor_get_purple_berry_count(actor_num)
    if actor_num < 16 then
       return timer_get(actor_num*3)
    end
-   
+
    return 0
 end
 
@@ -166,7 +166,7 @@ function actor_get_green_berry_count(actor_num)
    if actor_num < 16 then
       return timer_get(actor_num*3+1)
    end
-   
+
    return 0
 end
 
@@ -174,7 +174,7 @@ function actor_get_brown_berry_count(actor_num)
    if actor_num < 16 then
       return timer_get(actor_num*3+2)
    end
-   
+
    return 0
 end
 
@@ -183,12 +183,12 @@ function actor_decrement_berry_counter(actor, berry_type)
    local count = timer_get(actor_num*3+berry_type)
    if count > 0 and math.random(1, actor_int_adj(actor) * 4) == 1 then
       timer_set(actor_num*3+berry_type, count - 1)
-      if (actor_num == 0 and g_in_dream_mode) or 
+      if (actor_num == 0 and g_in_dream_mode) or
          (actor_num ~= 0 and g_in_dream_mode == false) then
          play_md_sfx(0x32)
          printl("A_PSYCHIC_POWER_FADES")
       end
-   end   
+   end
 end
 
 function actor_decrement_berry_counters(actor)
@@ -262,16 +262,16 @@ function actor_init(actor, alignment)
    actor.level = 1
    actor.align = ALIGNMENT_CHAOTIC
  end
- 
+
  if alignment ~= nil and alignment ~= ALIGNMENT_DEFAULT then
    actor.align = alignment
  end
-   
+
  actor.wt = 8
  actor.combat_mode = 8
  actor.mpts = actor.dex
  actor.exp = 0
-   
+
 end
 
 
@@ -660,15 +660,15 @@ function actor_move(actor, direction, flag)
    end
 
    local did_move = Actor.move(actor, x, y, z)
-   
+
    --FIXME need more logic here.
    --footprints, bots etc.
-      
+
    if did_move then
       subtract_map_movement_pts(actor)
       ----dgb("actor_move() did move actor("..actor.x..","..actor.y..")\n");
    end
-   
+
    return did_move
 end
 
@@ -751,7 +751,7 @@ end
 
 function avatar_falls_unconscious()
    printl("OVERCOME_BY_YOUR_WOUNDS_YOU_FALL_UNCONSCIOUS")
-   
+
    fade_out()
 
    local input
@@ -772,18 +772,18 @@ function avatar_falls_unconscious()
       location = i18n("THE_SPACE_CAPSULE")
       target={x=0x19d,y=0x278,z=0}
    end
-   
+
    printfl("YOU_AWAKEN_BACK_AT_FEELING_RESTORED", location)
 
    input_select(nil, true)
 
    party_resurrect_dead_members()
-   
+
    for actor in party_members() do
       actor.hp = actor.max_hp
       actor.mpts = actor_dex_adj(actor)
    end
-   
+
    party_move(target)
    local hour = clock_get_hour()
    local minutes = clock_get_minute()
@@ -793,15 +793,15 @@ function avatar_falls_unconscious()
    else
       hour = 24 - (hour + 1) + 7
    end
-   
+
    clock_inc(hour * 60 + minutes + math.random(0,59)) --advance time to between 7am and 8am on the next day
    update_watch_tile()
    advance_time(0)
-   
+
    party_update_leader()
    party_set_combat_mode(false)
    party_set_party_mode()
-   
+
    local blood = Actor.get(0x12)
    if blood.alive then
       Actor.set_talk_flag(blood, 5)
@@ -853,13 +853,13 @@ function party_update()
          revive_avatar()
       end
    end
-   
+
 end
 
 function actor_update_all()
    party_update()
    --pathfinding here.
-   
+
    local actor
    local selected_actor
    repeat
@@ -870,13 +870,13 @@ function actor_update_all()
          local player_loc = player_get_location()
          local var_C = (player_loc.x - 16) - (player_loc.x - 16) % 8
          local var_A = (player_loc.y - 16) - (player_loc.y - 16) % 8
-         
+
          for actor in party_members() do
             if actor.wt == WT_FOLLOW and actor.mpts < 0 then
                actor.mpts = 0
             end
          end
-         
+
          local player_z = player_loc.z
          for i=0,0xff do
             local actor = Actor.get(i)
@@ -908,7 +908,7 @@ function actor_update_all()
                            di = actor.mpts
                            dex_6 = dex_adjusted
                         end
-                        
+
                         if dex_adjusted <= actor.mpts then
                            break
                         end
@@ -916,7 +916,7 @@ function actor_update_all()
                   end
             end
          end
-         
+
          if di <= 0 then
             for i=0,0xff do
                local actor = Actor.get(i)
@@ -929,7 +929,7 @@ function actor_update_all()
             end
             advance_time(1)
          end
-         
+
       until di > 0
 
       if selected_actor.wt ~= WT_PLAYER and selected_actor.wt ~= WT_FOLLOW then
@@ -941,15 +941,15 @@ function actor_update_all()
          end
       end
 
-   until selected_actor.obj_n ~= 0 and selected_actor.wt == WT_PLAYER    
+   until selected_actor.obj_n ~= 0 and selected_actor.wt == WT_PLAYER
 
    if selected_actor ~= nil then --swap player to next party member with 'command' combat worktype.
     local old_player = Actor.get_player_actor()
     player_set_actor(selected_actor)
     old_player.wt = WT_PLAYER --reset worktype to player as it gets changed to follow in Player::set_actor() :-(
    end
- 
-   
+
+
    display_prompt(true)
 end
 
@@ -1073,7 +1073,7 @@ function clothing_get_warmth_rating(obj)
    if rating == nil then
       rating = 0
    end
-   
+
    return rating
 end
 
@@ -1089,29 +1089,29 @@ function is_lit_lightsource(obj)
    if lit_lightsource_tbl[obj.obj_n] ~= nil then
       return true
    end
-   
+
    return false
 end
 
 function actor_str_adj(actor)
    local actor_num = actor.actor_num
    local str = actor.str
-   
+
    if actor.hypoxia then
       str = str - 3
    end
-   
+
    if actor_is_affected_by_purple_berries(actor_num) then
       str = str - 3
    end
-   
+
    if actor.frenzy then
       str = str + 3
       if str > 30 then
          str = 30
       end
    end
-   
+
    if str <= 3 then
       return 1
    end
@@ -1136,23 +1136,23 @@ function actor_dex_adj(actor)
          dex = 30
       end
    end
-   
+
    if actor.asleep then
       dex = 1
    end
-   
+
    return dex
 end
 
 function actor_int_adj(actor)
    local int = actor.int
-   
+
    if actor.hypoxia == true or (actor.frenzy and actor.actor_num ~= 1) then
       int = int - 3
    end
-   
+
    if int < 1 then int = 1 end
-   
+
    return int
 end
 
@@ -1216,11 +1216,11 @@ function actor_remove_charm(actor)
 
    actor.charmed = false;
    actor.align = actor.old_align
-   
+
    if actor.in_party then
       actor.align = ALIGNMENT_GOOD
    end
-   
+
    if party_is_in_combat_mode() then
       actor.wt = actor.combat_mode
    else
@@ -1239,7 +1239,7 @@ function advance_time(num_turns)
    --FIXME
    local rand = math.random
    local hour = clock_get_hour()
-   
+
    local quake = Actor.get_talk_flag(0x46, 3) --rasputin
 
    if quake then
@@ -1247,9 +1247,9 @@ function advance_time(num_turns)
          quake_start(1, 200)
       end
    end
-   
+
    local max_light = 0
-   
+
    local actor_num
    for actor_num=0,0xff do
       local actor = Actor.get(actor_num)
@@ -1267,13 +1267,13 @@ function advance_time(num_turns)
                      printfl("GASPS_FOR_AIR", actor.name)
                   end
                end
-  
+
                local warmth_rating = 0
                local obj
                for obj in actor_inventory(actor) do
                   if obj.readied then
                      warmth_rating = warmth_rating + clothing_get_warmth_rating(obj)
-                     
+
                      if is_lit_lightsource(obj) then
                         if rand(0, 1) == 1 then
                            if obj.quality <= num_turns then
@@ -1301,7 +1301,7 @@ function advance_time(num_turns)
                      end
                   end
                end
-               
+
                if g_party_is_warm or actor.z ~= 0 then
                   if actor.cold then
                      actor.cold = false
@@ -1309,7 +1309,7 @@ function advance_time(num_turns)
                   end
                else
                   local cold_status = 0
-                  
+
                   if hour <= 3 or hour >= 22 then
                      if warmth_rating >= 10 then
                         cold_status = 1
@@ -1321,11 +1321,11 @@ function advance_time(num_turns)
                         cold_status = 1
                      end
                   end
-                  
+
                   if actor_num == 6 then
                      cold_status = 0
                   end
-                  
+
                   if cold_status == 0 then
                      if actor.cold then
                         actor.cold = false
@@ -1355,9 +1355,9 @@ function advance_time(num_turns)
                   end
                end
 
-            end               
+            end
          end
-                  
+
          if num_turns ~= 0 then
             for i=1,num_turns do
                --FIXME what does  word_4E6FA do?
@@ -1366,7 +1366,7 @@ function advance_time(num_turns)
                if actor.frenzy and not party_is_in_combat_mode() then
                   actor.frenzy = false
                end
-               
+
                if actor.poisoned then
                   if rand(0, 25) == 0 then
                      actor.poisoned = false
@@ -1376,13 +1376,13 @@ function advance_time(num_turns)
                if actor.charmed and rand(0, 0x19) == 0 then
                   actor_remove_charm(actor)
                end
-               
+
                if actor.paralyzed then
                   if actor_num == 6 or (rand(0, 3) == 0 and actor.str >= rand(1, 0x1e)) then --FIXME used adjusted str
                      actor.paralyzed = false
                   end
                end
- 
+
                if actor.asleep and actor.wt ~= WT_SLEEP and (not g_party_is_warm or not actor.in_party) then
                   --FIXME check sub_2B0EC(actor.x,actor.y,actor.z)
                   if rand(0,0x14) == 0 then
@@ -1390,14 +1390,14 @@ function advance_time(num_turns)
                      --FIXME bit 3 set on 1af1 flags
                   end
                end
-               
+
                if actor.poisoned and actor_num ~= 6 and rand(0, 7) == 0 then
                   actor_hit(actor, 1)
                end
-               
+
                if actor_num < 8 then
                   actor_decrement_berry_counters(actor)
-                  
+
                   for obj in actor_inventory(actor, true) do
                      local obj_n = obj.obj_n
                      if obj_n == 160 and obj.frame_n > 1 then --OBJ_EMPTY_BUCKET with ice
@@ -1416,9 +1416,9 @@ function advance_time(num_turns)
                            actor.poisoned = true
                         end
                      end
-                  end                       
+                  end
                end
-               
+
             end
          end
 
@@ -1426,27 +1426,27 @@ function advance_time(num_turns)
          actor.hit_flag = false
       end
    end
-   
+
    local minute = clock_get_minute()
 
    clock_inc(num_turns)
 
    if minute + num_turns >= 60 then
-      
+
       update_watch_tile()
-      
+
       update_actor_schedules()
       if g_hours_till_next_healing > 0 then
          g_hours_till_next_healing = g_hours_till_next_healing - 1
       end
-      
+
       update_lamp_posts()
-      
+
       local blue_berry_counter = actor_get_blue_berry_counter()
       if blue_berry_counter > 0 then
          actor_get_blue_berry_counter(blue_berry_counter - 1)
       end
-      
+
       if not g_party_is_warm and not g_in_dream_mode and Actor.get_talk_flag(0x10, 5) then
          for actor in party_members() do
             if actor.actor_num ~= 6 and not actor.asleep then
@@ -1481,7 +1481,7 @@ function advance_time(num_turns)
             end
          end
       end
-      
+
    end
 end
 
@@ -1499,7 +1499,7 @@ function subtract_movement_pts(actor, points)
    if points < 1 then
       points = 1
    end
-   
+
    actor.mpts = actor.mpts - points
 end
 
@@ -1513,7 +1513,7 @@ function actor_radiation_check(actor, obj)
          or Actor.inv_get_readied_obj_n(actor, ARM_2) == 136 then
          return
       end
-      
+
       actor.poisoned = true
       printl("OUCH_IT_IS_VERY_HOT")
    end
@@ -1591,11 +1591,11 @@ function actor_get_max_hp(actor)
    if actor.actor_num == 6 then
       return 0xf0
    end
-   
+
    if actor.in_party then
       return actor.str * 2 + actor.level * 24
    end
-   
+
    --FIXME return actor max hp from stat table.
    return 1;
 end
@@ -1682,4 +1682,4 @@ function find_rockworm_actor(obj)
    end
 
    return obj
-end
\ No newline at end of file
+end
diff --git a/devtools/create_ultima/files/ultima6/scripts/md/combat.lua b/devtools/create_ultima/files/ultima6/scripts/md/combat.lua
index f03f6a569f..a8d36e7bed 100644
--- a/devtools/create_ultima/files/ultima6/scripts/md/combat.lua
+++ b/devtools/create_ultima/files/ultima6/scripts/md/combat.lua
@@ -526,4 +526,4 @@ function fire_range_based_weapon(attacker, target_x, target_y, weapon)
       end
       --FIXME original updated readied weapons here. We might also need to do that.
    end
-end
\ No newline at end of file
+end
diff --git a/devtools/create_ultima/files/ultima6/scripts/md/dreamworld.lua b/devtools/create_ultima/files/ultima6/scripts/md/dreamworld.lua
index deb08feaec..80124592ab 100644
--- a/devtools/create_ultima/files/ultima6/scripts/md/dreamworld.lua
+++ b/devtools/create_ultima/files/ultima6/scripts/md/dreamworld.lua
@@ -289,4 +289,4 @@ function dreamworld_cleanup_state(obj)
       g_current_dream_stage = new_stage
    end
 
-end
\ No newline at end of file
+end
diff --git a/devtools/create_ultima/files/ultima6/scripts/md/ending.lua b/devtools/create_ultima/files/ultima6/scripts/md/ending.lua
index 1db65c7e8e..55886bb4de 100644
--- a/devtools/create_ultima/files/ultima6/scripts/md/ending.lua
+++ b/devtools/create_ultima/files/ultima6/scripts/md/ending.lua
@@ -11,10 +11,10 @@ function play()
    text.text_color = 4
    text.text = text_tbl[0]
    text.text_align = 2
-   
+
    local bg = sprite_new(g_img_tbl[0][0], 0, 24, true)
    local jack = sprite_new(g_img_tbl[0][gender+1], 155, 151, true)
-   
+
    canvas_set_palette("md_title.pal", 0)
    canvas_set_opacity(0xff);
    mouse_cursor_visible(false)
@@ -22,59 +22,59 @@ function play()
 
    music_play("mdd_mus.lzc", 11)
    fade_in()
-   
+
    poll_for_key_or_button(150)
    if should_exit() then return end
-   
+
    text.text = text_tbl[1]
 
    poll_for_key_or_button(150)
    if should_exit() then return end
 
    --space capsule rockets away from mars
-      
+
    jack.visible = false
    text.text = text_tbl[2]
 
    bg.image = g_img_tbl[1][0]
-   
+
    local capsule = create_sprite(g_img_tbl[1][1], 105, 112)
    capsule.visible = false
    local smoke = sprite_new(g_img_tbl[1][2], 105, 112, false)
- 
+
    local i
    for i=-1,39 do
       bg.y = 23 + ((i + 3) % 4)
       bg.x = ((i + 2) % 5) - 2
-      
+
       if i > -1 and i < 13 then
          capsule.visible = true
          capsule.x = 105 + (i * i * 2) / 3
          capsule.y = 112 - i * i
          capsule.image.scale = (i * i) + 16
-         
+
          smoke.image = g_img_tbl[1][2 + math.floor(i/2)]
          smoke.visible = true
       else
          capsule.visible = false
          smoke.visible = false
       end
-      
+
       poll_for_key_or_button(3)
       if should_exit() then return end
    end
-   
+
    --capsule lands in the ocean.
    bg.image = g_img_tbl[2][0]
    bg.x = 0
    bg.y = 24
-   
+
    capsule.visible = true
    capsule.x = 170
    capsule.y = 150
-   
+
    text.text = text_tbl[3]
-   
+
    for i=0,9 do
       local j
       for j=0,3 do
@@ -86,7 +86,7 @@ function play()
          if should_exit() then return end
       end
    end
-   
+
    --ticket tape parade
    canvas_set_opacity(0);
    capsule.visible = false
@@ -94,29 +94,29 @@ function play()
    bg.image = g_img_tbl[3][0]
    local spector = sprite_new(g_img_tbl[3][gender+1], 190, 151, true)
    text.text = text_tbl[5]
-   
+
    fade_in(6)
-      
+
    poll_for_key_or_button(150)
    if should_exit() then return end
-   
-   
+
+
    --group photo.
    canvas_set_opacity(0);
    spector.visible = false
-   
+
    bg.image = g_img_tbl[4][0]
-   
+
    local moongate_tbl = image_load_all("moongate.lzc")
    local moongate = sprite_new(moongate_tbl[1][0], 35, 135, true)
    local group = sprite_new(g_img_tbl[4][gender+1], 195, 151, true)
-   
+
    local photographer = sprite_new(g_img_tbl[4][3], 75, 151, true)
 
    text.text = text_tbl[6]
 
    fade_in(6)
-      
+
    for i=0,79 do
       if i == 40 then
          moongate.visible = false
@@ -140,37 +140,37 @@ function play()
          if i == 41 then
             text.text = text_tbl[7]
          end
-         
+
          poll_for_key_or_button(3)
          if should_exit() then return end
       end
    end
-  
+
    --mars dust storm
-   
+
    moongate.visible = false
    group.visible = false
    photographer.visible = false
-           
+
    bg.image = g_img_tbl[5]
-   
+
    local sand = sprite_new(nil, 240, 140, true)
    local tree = sprite_new(nil, 0, 140, true)
-   
+
    local dust = create_sprite(g_img_tbl[6], 0, 24)
    local dust1 = create_sprite(g_img_tbl[6], 0, 24)
    local dust2 = create_sprite(g_img_tbl[6], 0, 24)
    local dust3 = create_sprite(g_img_tbl[6], 0, 24)
    local dust4 = create_sprite(g_img_tbl[6], 0, 24)
-            
+
    dust.visible = true
    dust1.visible = true
    dust2.visible = true
    dust3.visible = true
    dust4.visible = true
-   
+
    text.text = text_tbl[8]
-        
+
    for i=0,63 do
       if math.floor(i / 8) > 4 then
          sand.image = g_img_tbl[7][4]
@@ -186,10 +186,10 @@ function play()
       else
          tree.visible = false
       end
-      
+
       dust.x = 340 - (i * 10) - math.random(0, 19)
       dust.y = 24 - math.random(0, 9)
-      
+
       dust1.x = 420 - (i * 20) - math.random(0, 19)
       dust1.y = 24 - math.random(0, 9)
 
@@ -201,11 +201,11 @@ function play()
 
       dust4.x = 660 - (i * 20) - math.random(0, 19)
       dust4.y = 24 - math.random(0, 9)
-      
+
       if i == 62 then
          text.text = text_tbl[9]
       end
-                              
+
       poll_for_key_or_button(2)
       if should_exit() then return end
    end
@@ -217,4 +217,4 @@ function play()
 end
 
 
-play()
\ No newline at end of file
+play()
diff --git a/devtools/create_ultima/files/ultima6/scripts/md/init.lua b/devtools/create_ultima/files/ultima6/scripts/md/init.lua
index 6a9ca95b77..53a59cfd16 100644
--- a/devtools/create_ultima/files/ultima6/scripts/md/init.lua
+++ b/devtools/create_ultima/files/ultima6/scripts/md/init.lua
@@ -36,7 +36,7 @@ function load_game()
 
    objlist_seek(OBJLIST_OFFSET_HOURS_TILL_NEXT_HEALING)
    g_hours_till_next_healing = objlist_read1()
-   
+
    objlist_seek(OBJLIST_OFFSET_DREAM_MODE_FLAG)
    g_in_dream_mode = bit32.btest(objlist_read2(), 0x10)
    map_enable_temp_actor_cleaning(not g_in_dream_mode)
@@ -63,7 +63,7 @@ end
 function save_game()
    objlist_seek(OBJLIST_OFFSET_HOURS_TILL_NEXT_HEALING)
    objlist_write1(g_hours_till_next_healing)
-   
+
    objlist_seek(OBJLIST_OFFSET_DREAM_MODE_FLAG)
    local bytes = objlist_read2()
    if g_in_dream_mode then
@@ -195,7 +195,7 @@ function search(obj)
    if obj.on_map == false then
       return
    end
-   
+
    local found_obj = false
    local child
    local first_loop = true
@@ -217,18 +217,18 @@ function search(obj)
       script_wait(50)
       first_loop = false
    end
-   
+
    if prev_obj ~= nil then
       printfl("SEARCH_LAST_OBJ", prev_obj.look_string)
       Obj.moveToMap(prev_obj, obj.x, obj.y, obj.z)
    end
-   
+
    if found_obj == false then
       printl("SEARCHING_HERE_YOU_FIND_NOTHING")
    else
       print(".\n")
    end
-   
+
 end
 
 --tile_num, readied location
@@ -374,7 +374,7 @@ function update_lamp_posts()
    if Actor.get_talk_flag(0x73, 4) and (hour < 6 or hour > 17) then
       frame_n = 7
    end
-   
+
    local loc = player_get_location()
    for obj in find_obj(loc.z, 228) do --OBJ_LAMP_POST
       if obj ~= nil then
@@ -437,4 +437,4 @@ player_init = nuvie_load("md/player.lua"); player_init();
 
 worktype_init = nuvie_load("md/worktype.lua"); worktype_init();
 
-dreamworld_init = nuvie_load("md/dreamworld.lua"); dreamworld_init();
\ No newline at end of file
+dreamworld_init = nuvie_load("md/dreamworld.lua"); dreamworld_init();
diff --git a/devtools/create_ultima/files/ultima6/scripts/md/intro.lua b/devtools/create_ultima/files/ultima6/scripts/md/intro.lua
index e074d370a1..9bb2b406c9 100644
--- a/devtools/create_ultima/files/ultima6/scripts/md/intro.lua
+++ b/devtools/create_ultima/files/ultima6/scripts/md/intro.lua
@@ -8,18 +8,18 @@ local FREUD_STATE_WRITING  = 1
 
 local function origin_fx_sequence()
    local g_img_tbl = image_load_all("title.lzc")
-   
+
    canvas_set_palette("strax.pal", 0)
 
-   
+
    local stars = sprite_new(g_img_tbl[0][0], 0, 24, true)
    local logo_image = image_new(282,82)
    image_blit(logo_image, g_img_tbl[0][1],0,16)
    image_blit(logo_image, g_img_tbl[0][2],g_img_tbl[0][1].w,14)
    image_blit(logo_image, g_img_tbl[0][3],g_img_tbl[0][1].w+g_img_tbl[0][2].w,0)
-   
+
    local  logo = sprite_new(logo_image, 20, 70, false)
-   
+
    local planet = sprite_new(g_img_tbl[12], 160, 48, true)
 
    planet.clip_x = 0
@@ -30,15 +30,15 @@ local function origin_fx_sequence()
    players[1] = create_player_sprite(g_img_tbl[1][0], 58, 118)
    players[2] = create_player_sprite(g_img_tbl[2][0], 186, 118)
    players[3] = create_player_sprite(g_img_tbl[3][0], 278, 118)
-   
+
    players[4] = create_player_sprite(g_img_tbl[4][0], 58, 126)
    players[5] = create_player_sprite(g_img_tbl[5][0], 186, 126)
    players[6] = create_player_sprite(g_img_tbl[6][0], 278, 126)
-   
+
    players[7] = create_player_sprite(g_img_tbl[7][0], 58, 134)
    players[8] = create_player_sprite(g_img_tbl[8][0], 186, 134)
    players[9] = create_player_sprite(g_img_tbl[9][0], 278, 134)
-   
+
    local conductor = sprite_new(g_img_tbl[10][0], 158, 98, true)
    conductor.clip_x = 0
    conductor.clip_y = 24
@@ -46,9 +46,9 @@ local function origin_fx_sequence()
    conductor.clip_h = 128
 
    music_play("strx_mus.lzc", 0)
-   
+
    fade_in()
-     
+
    local i = 0
    for i=0,6,1 do
       conductor.image = g_img_tbl[10][i]
@@ -74,7 +74,7 @@ local function origin_fx_sequence()
          conductor.image = g_img_tbl[10][j]
          if poll_for_key_or_button(1) == true then return end
       end
-   
+
       conductor.image = g_img_tbl[10][14]
       if poll_for_key_or_button(2) == true then return end
       conductor.image = g_img_tbl[10][13]
@@ -84,21 +84,21 @@ local function origin_fx_sequence()
       if poll_for_key_or_button(1) == true then return end
          play_sfx(38, false)
    end
-   
+
    for i=16,20,1 do
       conductor.image = g_img_tbl[10][i]
       if poll_for_key_or_button(4) == true then return end
    end
    if poll_for_key_or_button(135) == true then return end
-   
+
    --play_sfx(12, false)
-   
+
    conductor.image = g_img_tbl[10][6]
-   
+
    for i=1,21,1 do
       conductor.y = 98 + i * 12
       conductor.image.scale = 100 + i * 15
-      
+
       for j=1,9,1 do
          players[j].y = players[j].y + 5
          players[j].image.scale = 100 + i * 5
@@ -109,15 +109,15 @@ local function origin_fx_sequence()
             players[j].x = players[j].x + 2
          end
       end
-   
+
       if poll_for_esc(4) == true then return end
    end
-   
-   
+
+
    logo.visible = true
-   logo.image.scale = 10   
-   
-   
+   logo.image.scale = 10
+
+
    for i=1,18,1 do
       planet.y = planet.y + 6
 
@@ -128,12 +128,12 @@ local function origin_fx_sequence()
       else
          logo.y = logo.y + 1
       end
-   
+
       if poll_for_key_or_button(4) == true then return end
    end
-   
+
    if poll_for_esc(45) == true then return end
-   
+
    fireworks(g_img_tbl, logo)
    fade_out()
 end
@@ -151,7 +151,7 @@ function show_logos()
    fade_in()
    poll_for_key_or_button(195)
    if should_exit() then return end
-   
+
    sprite.image = g_img_tbl[2]
    sprite.x = 15
    music_play("mdd_mus.lzc", 1)
@@ -164,14 +164,14 @@ function flash_effect(image, text_delay)
    if text_delay == nil then
       text_delay = 300
    end
-   
+
    canvas_hide_all_sprites()
 
    local s = sprite_new(image, 0, 0, true)
    local bg = sprite_new(image_new(320,200,15), 0, 0, true)
-   
+
    if poll_for_key_or_button(6) == true then return end
-   
+
    local speed = 10
    local i
    for i=0x0,0xff,speed do
@@ -186,7 +186,7 @@ function show_fair_ground()
    local g_img_tbl = image_load_all("fair.lzc")
 
    canvas_hide_all_sprites()
-   
+
    local fair_bg = sprite_new(g_img_tbl[0], 0, 24, true)
    local buildings = sprite_new(g_img_tbl[1][0], 0, 24, true)
    local buildings1 = sprite_new(g_img_tbl[1][1], 320, 24, true)
@@ -195,13 +195,13 @@ function show_fair_ground()
    local podium = sprite_new(g_img_tbl[4], 240, 24, true)
    local people = sprite_new(g_img_tbl[5][0], 0, 24, true)
    local people1 = sprite_new(g_img_tbl[5][1], 320, 24, true)
-   
+
    local i
    for i=0,9 do
       wheel.image = g_img_tbl[2][i%5]
       if poll_for_key_or_button(7) == true then return end
    end
-   
+
    for i=0,79 do
       buildings.x = 0 - i
       buildings1.x = 320 - i
@@ -213,69 +213,69 @@ function show_fair_ground()
       people1.x = 320 - i * 3
       if poll_for_key_or_button(7) == true then return end
    end
-   
+
    if poll_for_key_or_button(15) == true then return end
 
 end
 
-function show_lowell()   
+function show_lowell()
 
    flash_effect(image_load("credits.lzc", 0))
 
    canvas_hide_all_sprites()
-   
+
    local g_img_tbl = image_load_all("lowell.lzc")
    local bg = sprite_new(g_img_tbl[0][0], 0, 24, true)
    local lowell = sprite_new(g_img_tbl[0][1], 0, 24, true)
 
    fade_in()
-   
+
    for i=1,20 do
       lowell.image = g_img_tbl[0][i]
       if poll_for_key_or_button(5) == true then return end
    end
-   
+
    flash_effect(image_load("credits.lzc", 1))
-   
+
    if poll_for_key_or_button(70) == true then return end
 end
 
 function show_fuse()
-   
+
    canvas_hide_all_sprites()
-   
+
    local g_img_tbl = image_load_all("fuse.lzc")
    local bg = sprite_new(g_img_tbl[0][0], 0, 24, true)
    local fuse = sprite_new(g_img_tbl[0][1], 0, 24, true)
-   
+
    music_play("mdd_mus.lzc", 2)
-      
+
    fade_in(4)
-         
+
    for i=1,28 do
       fuse.image = g_img_tbl[0][i]
       if poll_for_key_or_button(2) == true then return end
    end
-   
+
       flash_effect(image_load("credits.lzc", 2))
 end
 
 function show_flash()
 
    canvas_hide_all_sprites()
-   
+
       local g_img_tbl = image_load_all("fair.lzc")
 
       canvas_hide_all_sprites()
-      
+
       local fair_bg = sprite_new(g_img_tbl[0], 0, 24, true)
       local buildings = sprite_new(g_img_tbl[1][0], -80, 24, true)
       local buildings1 = sprite_new(g_img_tbl[1][1], 240, 24, true)
       local column = sprite_new(g_img_tbl[3], 30, 24, true)
       local podium = sprite_new(g_img_tbl[4], 80, 24, true)
-   
+
    music_play("mdd_mus.lzc", 3)
-   
+
    g_img_tbl = image_load_all("flash.lzc")
 
    fade_in(8)
@@ -290,7 +290,7 @@ function show_flash()
       s.image = g_img_tbl[1][i]
       if poll_for_key_or_button(6) == true then return end
    end
-   
+
    flash_effect(image_load("credits.lzc", 3), 215)
 end
 
@@ -310,7 +310,7 @@ function show_flight()
       capsule.y = 140 - i * 2 * i
       if poll_for_key_or_button(6) == true then return end
    end
-   
+
    if poll_for_key_or_button(98) == true then return end
    music_stop()
    if poll_for_key_or_button(8) == true then return end
@@ -330,11 +330,11 @@ function show_cabin()
    local hat1 = create_sprite(g_img_tbl[4], 62, -150)
    local hat2 = create_sprite(g_img_tbl[5], 62, 0)
    local hat3 = create_sprite(g_img_tbl[6], 62, 0)
-             
+
    music_play("mdd_mus.lzc", 5)
-   
+
    --FIXME rotate sprites.
-   
+
    local i
    for i=0,30 do
       cloud.image = g_img_tbl[1][(i + 2) % 15]
@@ -350,16 +350,16 @@ function show_cabin()
       else
          hat1.y = i * 8 + 15
       end
-      
+
       hat2.x = i * 32 - 150
       hat2.y = i * 8
 
       hat3.x = i * 32 - 500
       hat3.y = i * 4
-            
+
       if poll_for_key_or_button(8) == true then return end
    end
-   
+
    flash_effect(image_load("credits.lzc", 4),250)
 end
 
@@ -367,14 +367,14 @@ function show_mars_flash()
    canvas_hide_all_sprites()
 
    local g_img_tbl = image_load_all("mars.lzc")
-   
+
    music_play("mdd_mus.lzc", 6)
-   
+
    local bg = sprite_new(g_img_tbl[0][0], 0, 24, true)
    local flash = sprite_new(g_img_tbl[0][1], 0, 24, true)
-   
+
    fade_in(12)
-   
+
    if poll_for_key_or_button(60) == false then
 
    local i
@@ -400,17 +400,17 @@ function show_mars_flash()
             return
          end
       end
-      
+
       if poll_for_key_or_button(30) == true then
          flash_effect(image_load("credits.lzc", 5))
          return
       end
    end
-   
+
    end
-   
+
    poll_for_key_or_button(40)
-   
+
    flash_effect(image_load("credits.lzc", 5))
 end
 
@@ -421,7 +421,7 @@ function play_intro()
 
    show_fair_ground()
    if should_exit() then return end
-   
+
    show_lowell()
    if should_exit() then return end
 
@@ -433,22 +433,22 @@ function play_intro()
 
    show_flight()
    if should_exit() then return end
-    
+
    show_cabin()
    if should_exit() then return end
- 
+
    show_mars_flash()
    if should_exit() then return end
-   
+
 end
 
 function show_home()
    canvas_hide_all_sprites()
 
    local text_tbl = text_load("scenetxt.lzc", 0)
-   
+
    local g_img_tbl = image_load_all("scene1.lzc")
-   
+
    local bg = sprite_new(g_img_tbl[0][0], 0, 24, true)
    local door = sprite_new(g_img_tbl[0][1], 0, 24, true)
    local avatar = sprite_new(g_img_tbl[1][0], 240, 151, true)
@@ -458,36 +458,36 @@ function show_home()
    text.text_align = 2
    fade_in()
    music_play("mdd_mus.lzc", 8)
-   
+
    poll_for_key_or_button(75)
    if should_exit() then return end
 
    local woman = sprite_new(g_img_tbl[8][0], 0, 151, true)
    local spector = create_sprite(g_img_tbl[2][0], 60, 151)
-   
+
    door.visible = false
    avatar.image = g_img_tbl[1][1]
    text.text = text_tbl[2]
-   
+
    poll_for_key_or_button(100)
    if should_exit() then return end
-   
+
    avatar.image = g_img_tbl[1][3]
    spector.image = g_img_tbl[2][1]
    spector.x = 80
    text.text = text_tbl[3]
    text.text_color = 2
-      
+
    poll_for_key_or_button(100)
    if should_exit() then return end
-   
+
    woman.image = g_img_tbl[8][1]
    text.text = text_tbl[4]
    text.text_color = 14
-      
+
    poll_for_key_or_button(100)
    if should_exit() then return end
-   
+
    woman.image = g_img_tbl[8][2]
    spector.image = g_img_tbl[2][2]
    spector.x = 100
@@ -496,7 +496,7 @@ function show_home()
 
    poll_for_key_or_button(75)
    if should_exit() then return end
-   
+
    woman.image = g_img_tbl[3][0]
    woman.x = -10
    woman.y = 155
@@ -504,10 +504,10 @@ function show_home()
    spector.x = 145
    text.text = text_tbl[6]
    text.text_color = 9
-   
+
    poll_for_key_or_button(75)
    if should_exit() then return end
-      
+
    --woman hands spector note
    text.text = text_tbl[7]
    local i
@@ -518,36 +518,36 @@ function show_home()
       spector.image = g_img_tbl[2][i + 5]
       poll_for_key_or_button(5)
    end
-   
+
    poll_for_key_or_button(50)
    if should_exit() then return end
-   
+
    text.text = text_tbl[8]
    text.text_color = 2
-   
+
    poll_for_key_or_button(100)
    if should_exit() then return end
-   
-   
+
+
    --close up on woman
    canvas_hide_all_sprites()
-      
+
    bg.image = g_img_tbl[7]
    bg.visible = true
    text.text = text_tbl[9]
    text.text_color = 9
    text.visible = true
-      
+
    poll_for_key_or_button(100)
    if should_exit() then return end
-    
+
    --spector, avatar review papers
-   
+
    bg.image = g_img_tbl[0][0]
    avatar.image = g_img_tbl[1][1]
    avatar.x = 270
    avatar.visible = true
-   
+
    spector.image = g_img_tbl[2][16]
    spector.x = 193
    spector.y = 161
@@ -558,47 +558,47 @@ function show_home()
 
    poll_for_key_or_button(75)
    if should_exit() then return end
-          
+
    --close up on papers
-   canvas_hide_all_sprites()   
+   canvas_hide_all_sprites()
    bg.image = g_img_tbl[5][0]
    bg.visible = true
-   
+
    local letter = sprite_new(g_img_tbl[5][1], 50, 24, true)
    local hand = sprite_new(g_img_tbl[4], 235, 78, true)
-   
+
    text.text = text_tbl[11]
    text.text_color = 14
    text.visible = true
-   
+
    poll_for_key_or_button(100)
    if should_exit() then return end
-   
+
    hand.visible = false
    text.text = text_tbl[12]
    text.text_color = 2
-   
+
    poll_for_key_or_button(100)
    if should_exit() then return end
-   
+
    --pickup letter
    letter.image = g_img_tbl[6]
    letter.x = 0
-   
+
    text.text = text_tbl[13]
    --FIXME need to rotate the letter sprite.
    for i=0,19 do
       letter.y = -20 - i
       poll_for_key_or_button(1)
    end
-      
+
    letter.visible = false
    text.text = text_tbl[14]
    text.text_color = 14
-      
+
    poll_for_key_or_button(100)
    if should_exit() then return end
-   
+
    fade_out(6)
 end
 
@@ -620,10 +620,10 @@ function show_map()
    }
 
    canvas_hide_all_sprites()
-   
+
    local bg = sprite_new(image_load("scene2.lzc", 0), 0, 24, true)
    fade_in(6)
-   
+
    poll_for_key_or_button(50)
    if should_exit() then return end
 
@@ -634,9 +634,9 @@ function show_map()
       poll_for_key_or_button(20)
       if should_exit() then return end
    end
-   
+
    poll_for_key_or_button(50)
-      
+
    fade_out(6)
 
 end
@@ -644,14 +644,14 @@ end
 function show_hike()
    canvas_hide_all_sprites()
    local g_img_tbl = image_load_all("scene2.lzc")
-   
+
    local bg = sprite_new(g_img_tbl[1], 0, 24, true)
    local avatar = sprite_new(g_img_tbl[3][0], -15, 148, true)
    local spector = sprite_new(g_img_tbl[4][0], -45, 149, true)
    local fg = sprite_new(g_img_tbl[2], 0, 24, true)
-   
+
    fade_in(6)
-   
+
    local i
    for i=0,94 do
       avatar.image = g_img_tbl[3][i % 12]
@@ -659,9 +659,9 @@ function show_hike()
       spector.image = g_img_tbl[4][(i+4) % 12]
       spector.x = i * 4 + -45
       poll_for_key_or_button(3)
-      if should_exit() then return end      
+      if should_exit() then return end
    end
-   
+
    fade_out(6)
 end
 
@@ -676,21 +676,21 @@ function show_lab_present_day()
    text.text_align = 2
 
    local moongate_tbl = image_load_all("moongate.lzc")
-         
+
    local bg = sprite_new(g_img_tbl[0], 0, 24, true)
 
    local moongate = create_sprite(moongate_tbl[0][0], 125, 130)
    moongate.visible = false
-   
+
    local spector = sprite_new(g_img_tbl[3][0], 165, 137,true)
    local table = create_sprite(g_img_tbl[1][0], 151, 82)
    local avatar = create_sprite(g_img_tbl[2][0], 65, 150)
 
    --local s = sprite_new(g_img_tbl[4][0], 0, 24,true)
    music_play("mdd_mus.lzc", 9)
-   
+
    fade_in(6)
-   
+
    local lab_tbl = {
       {1, 2,  0, 0, 50},
       {1, 2,  0, 1, 100},
@@ -704,7 +704,7 @@ function show_lab_present_day()
       {9, 14, 0, 2, 100}
 
    }
-   
+
    local i
    for i=1,7 do
       if lab_tbl[i][3] >= 0 then
@@ -717,20 +717,20 @@ function show_lab_present_day()
       end
 
       text.text = text_tbl[lab_tbl[i][1]]
-      text.text_color = lab_tbl[i][2]      
+      text.text_color = lab_tbl[i][2]
       poll_for_key_or_button(lab_tbl[i][5])
       if should_exit() then return end
    end
-   
+
    bg.image = g_img_tbl[0]
    spector.visible = true
    avatar.visible = true
    table.visible = true
    table.image = g_img_tbl[1][1]
-   
+
    spector.image = g_img_tbl[3][3]
    avatar.image = g_img_tbl[2][1]
-   
+
    moongate.visible = true
 
    --moongate rises up from floor
@@ -739,7 +739,7 @@ function show_lab_present_day()
       poll_for_key_or_button(4)
       if should_exit() then return end
    end
-   
+
    --avatar, spector discuss moongate
    moongate.image = moongate_tbl[1][0]
    for i=8,10 do
@@ -749,35 +749,35 @@ function show_lab_present_day()
          avatar.image = g_img_tbl[2][lab_tbl[i][3]]
          spector.image = g_img_tbl[3][lab_tbl[i][4]]
          text.text = text_tbl[lab_tbl[i][1]]
-         text.text_color = lab_tbl[i][2]  
-               
+         text.text_color = lab_tbl[i][2]
+
          poll_for_key_or_button(4)
          if should_exit() then return end
       end
    end
-   
-   
+
+
    spector.image = moongate_tbl[4][0]
    for i=0,64 do
       moongate.image = moongate_tbl[1][i % 8]
       avatar.image = moongate_tbl[2][math.floor(i/2)]
-      
+
       poll_for_key_or_button(4)
       if should_exit() then return end
    end
-   
+
    avatar.visible = false
-   
+
    for i=0,39 do
       moongate.image = moongate_tbl[1][i % 8]
       if i ~= 39 then
          spector.image = moongate_tbl[4][math.floor(i/2)]
       end
-      
+
       poll_for_key_or_button(4)
       if should_exit() then return end
    end
-   
+
    fade_out(6)
 end
 
@@ -786,19 +786,19 @@ function show_lab_1895()
    local scene4a_tbl = image_load_all("scene4a.lzc")
    local scene4b_tbl = image_load_all("scene4b.lzc")
    local moongate_tbl = image_load_all("moongate.lzc")
-      
+
    local text_tbl = text_load("scenetxt.lzc", 2)
 
    local text = sprite_new(nil, 0, 160, true)
    text.text = text_tbl[1]
    text.text_color = 6
    text.text_align = 2
-   
+
    local bg = sprite_new(scene4a_tbl[0], 0, 24, true)
-      
+
    local moongate = create_sprite(moongate_tbl[0][0], 140, 125)
    moongate.visible = false
-      
+
    local tesla = sprite_new(scene4a_tbl[6][0], 187, 125, true)
    local spark = sprite_new(scene4b_tbl[2][0], 32, 24, false)
 
@@ -806,16 +806,16 @@ function show_lab_1895()
    local freud_head = create_sprite(scene4a_tbl[4][2], 23, 100)
 
    local nellie = sprite_new(scene4b_tbl[1][0], 242, 24, false)
-   
+
    local bookcase = sprite_new(scene4a_tbl[1], 242, 24, false)
-      
+
    local blood = sprite_new(scene4a_tbl[5][0], 240, 40, true)
    local garrett = sprite_new(scene4b_tbl[0][0], 270, 45, false)
-   
+
    fade_in(6)
-   
+
    music_play("mdd_mus.lzc", 10)
-      
+
    local i
    for i=1,2 do
       text.text = text_tbl[i]
@@ -826,42 +826,42 @@ function show_lab_1895()
          else
             tesla.image = scene4a_tbl[6][10 - math.abs(j-10)]
          end
-         
+
          if j > 4 and j < 16 then
             --FIXME need spark sfx
             spark.visible = true
             spark.image = scene4b_tbl[2][j % 10]
          else
             spark.visible = false
-         end 
-                  
+         end
+
          poll_for_key_or_button(4)
          if should_exit() then return end
       end
       text.text_color = 7
    end
-   
+
    moongate.visible = true
 
    --moongate rises up from floor
    tesla.x = 188
    tesla.y = 128
    tesla.image = scene4a_tbl[6][6]
-   
+
    for i=0,8 do
       moongate.image = moongate_tbl[0][i]
       if i == 5 then
          tesla.image = scene4a_tbl[6][7]
       end
-      
+
       if i == 2 then
          blood.image = scene4a_tbl[5][1]
       end
-      
+
       poll_for_key_or_button(4)
       if should_exit() then return end
    end
-   
+
    --avatar walks out of the newly risen moongate
    local avatar = create_sprite(moongate_tbl[3][0], 80, 150)
 
@@ -875,131 +875,131 @@ function show_lab_1895()
       if i == 3 then
          blood.image = scene4a_tbl[5][2]
       end
-      
+
       if i == 4 then
          freud_head.image = scene4a_tbl[4][3]
       end
-      
+
       if i == 11 then
          text.text = text_tbl[3]
          text.text_color = 7
       end
-      
+
       poll_for_key_or_button(3)
       if should_exit() then return end
    end
-   
+
    --spector walks out of moongate
    local spector = create_sprite(moongate_tbl[5][0], 140, 130)
-   
+
    text.text = text_tbl[4]
    text.text_color = 14
 
    for i=0,24 do
       moongate.image = moongate_tbl[1][i % 8]
       spector.image = moongate_tbl[5][math.floor(i/2)]
-      
+
       poll_for_key_or_button(3)
       if should_exit() then return end
    end
-   
+
    --spector face closeup shot
    canvas_hide_all_sprites()
-   
+
    bg.image = scene4a_tbl[9][0]
    bg.visible = true
-   
+
    local face = sprite_new(scene4a_tbl[9][1], 0, 24, true)
-   
+
    text.text = text_tbl[5]
    text.text_color = 2
    text.visible = true
-   
+
    poll_for_key_or_button(200)
    if should_exit() then return end
-   
+
    --spector shows note to tesla
    text.text = text_tbl[6]
    face.visible = false
    bg.image = scene4a_tbl[0]
-   
+
    tesla.visible = true
    tesla.image = scene4a_tbl[6][9]
-   
+
    blood.visible = true
 
    freud_head.image = scene4a_tbl[4][2]
    freud_head.visible = true
 
    freud_body.visible = true
-   
+
    avatar.visible = true
    avatar.x = 80
    avatar.y = 150
    avatar.image = scene4a_tbl[2][1]
-   
+
    spector.visible = true
    spector.x = 145
    spector.y = 140
    spector.image = scene4a_tbl[3][1]
-   
+
    poll_for_key_or_button(200)
    if should_exit() then return end
-   
+
    --tesla face closeup shot
    canvas_hide_all_sprites()
-   
+
    bg.image = scene4a_tbl[7][0]
    bg.visible = true
-   
+
    face.image = scene4a_tbl[7][1]
    face.visible = true
-   
+
    text.text = text_tbl[7]
    text.text_color = 7
    text.visible = true
-      
+
    poll_for_key_or_button(200)
    if should_exit() then return end
 
-   --blood closeup.    
+   --blood closeup.
    canvas_hide_all_sprites()
-   
+
    bg.image = scene4a_tbl[8][0]
    bg.visible = true
-   
+
    face.visible = true
    text.visible = true
    text.text_color = 4
-   
+
    for i=8,9 do
       face.image = scene4a_tbl[8][i - 7]
       text.text = text_tbl[i]
-      
+
       poll_for_key_or_button(200)
       if should_exit() then return end
    end
-   
+
    --Tesla calls Mr Garrett.
    text.text = text_tbl[10]
    text.text_color = 7
    face.visible = false
    bg.image = scene4a_tbl[0]
-   
+
    tesla.visible = true
    tesla.image = scene4a_tbl[6][10]
-   
+
    blood.visible = true
 
    freud_head.visible = true
    freud_body.visible = true
-   
+
    avatar.visible = true
    avatar.image = scene4a_tbl[2][0]
-   
+
    spector.visible = true
    spector.image = scene4a_tbl[3][0]
-   
+
    poll_for_key_or_button(200)
    if should_exit() then return end
 
@@ -1016,22 +1016,22 @@ function show_lab_1895()
       if i <= 10 then
          avatar.image = scene4a_tbl[2][i]
       end
-      
+
       garrett.image = scene4b_tbl[0][i]
-      
+
       poll_for_key_or_button(3)
       if should_exit() then return end
    end
-   
+
    --Tesla checks note, talks about mission.
-   
+
    spector.image = scene4a_tbl[3][1]
    spector.x = 155
    avatar.image = scene4a_tbl[2][10]
    freud_head.image = scene4a_tbl[4][1]
 
    local text_color_tbl = {4, 6, 7, 7, 14, 2, 2, 7, 4, 4, 7, 9, 7, 4, 7, 4, 7, 2, 7, 7, 7, 7, 7, 11, 2, 7, 7}
-   
+
    for i=12,20 do
       if i==13 or i==16 or i==20 then
          face.visible = true
@@ -1046,15 +1046,15 @@ function show_lab_1895()
          if i==13 then
             idx = 8
          else
-            idx = 7   
+            idx = 7
          end
          bg.image = scene4a_tbl[idx][0]
-         
+
          if i==16 then
             face.image = scene4a_tbl[idx][2]
          else
             face.image = scene4a_tbl[idx][1]
-         end 
+         end
       else
          local idx
          if i == 14 then
@@ -1069,13 +1069,13 @@ function show_lab_1895()
          end
          tesla.image = scene4a_tbl[6][idx]
       end
-      
+
       text.text = text_tbl[i]
       text.text_color = text_color_tbl[i+1]
-      
+
       poll_for_key_or_button(200)
-      if should_exit() then return end  
-               
+      if should_exit() then return end
+
       face.visible = false
       tesla.visible = true
       blood.visible = true
@@ -1086,19 +1086,19 @@ function show_lab_1895()
       garrett.visible = true
       bg.image = scene4a_tbl[0]
    end
-   
-   
+
+
    --Nellie walks in
-      
+
    tesla.image = scene4a_tbl[6][10]
-   
+
    text.text = text_tbl[21]
    text.text_color = text_color_tbl[22]
-   
+
    nellie.visible = true
-   nellie.y = 125         
+   nellie.y = 125
    bookcase.visible = true
-   
+
    for i=0,31 do
       if i == 7 then
          freud_head.image = scene4a_tbl[4][2]
@@ -1108,12 +1108,12 @@ function show_lab_1895()
       if i > 25 then
          nellie.y = 125 + (i - 26) * 2
       end
-      
+
       local avatar_idx = 20 - i
       if avatar_idx > 10 then
       avatar_idx = 10
       end
-      
+
       if avatar_idx < 4 then
       avatar_idx = 4
       end
@@ -1123,22 +1123,22 @@ function show_lab_1895()
       if garrett_idx > 31 then
          garrett_idx = 31
       end
-      
+
       if garrett_idx < 18 then
          garrett_idx = 18
       end
       garrett.image = scene4b_tbl[0][garrett_idx]
-      
+
       poll_for_key_or_button(3)
       if should_exit() then return end
    end
-   
+
    --Nellie shakes hands with Spector, Avatar
-   
+
    spector.x = 165
    nellie.x = 227
    nellie.y = 135
-   
+
    for i=22,26 do
       if i == 24 then
          nellie.image = scene4b_tbl[1][7]
@@ -1151,7 +1151,7 @@ function show_lab_1895()
          end
          spector.image = scene4a_tbl[3][0]
       end
-      
+
       if i == 25 then
          tesla.image = scene4a_tbl[6][9]
       elseif i == 26 then
@@ -1162,30 +1162,30 @@ function show_lab_1895()
 
       text.text = text_tbl[i]
       text.text_color = text_color_tbl[i+1]
-      
+
       poll_for_key_or_button(200)
       if should_exit() then return end
    end
-   
+
 end
 
 function run_introduction()
 
    show_home()
    if should_exit() then return end
-   
+
    show_map()
    if should_exit() then return end
 
    show_hike()
    if should_exit() then return end
-   
+
    show_lab_present_day()
    if should_exit() then return end
 
    show_lab_1895()
    if should_exit() then return end
-   
+
    fade_out(6)
 end
 
@@ -1287,8 +1287,8 @@ local char_creation_tbl = {
 
 local g_player_name = ""
 local gender_answer = ""
-local avatar_str  
-local avatar_dex 
+local avatar_str
+local avatar_dex
 local avatar_int
 
 function insert_player_name(text)
@@ -1300,7 +1300,7 @@ function insert_player_name(text)
       i = string.find(text, "$P")
    end
    output = output .. text
-   
+
    return output
 end
 
@@ -1388,9 +1388,9 @@ g_char_index = 0
 function collect_player_name()
    local name_text = g_name_sprite.text
    local len = string.len(name_text)
-   
+
    g_name_sprite.visible = true
-   
+
    local input = poll_for_input()
    if input ~= nil then
       if should_exit() then
@@ -1481,7 +1481,7 @@ function collect_player_name()
          g_cursor_timer = g_cursor_timer - 1
       end
    end
-   
+
    return false
 end
 
@@ -1497,7 +1497,7 @@ function update_freud(freud)
       else
          freud.timer = freud.timer - 1
       end
-      
+
       local state = freud.state
       if state == FREUD_STATE_STARING then
          if freud.can_move_pen == true then
@@ -1520,7 +1520,7 @@ function update_freud(freud)
          end
       end
    end
-   
+
    if freud.eyes.blink_timer == 200 then
       if freud.eyes.sprite_idx == 2 then
          freud.eyes.sprite.image = freud.images[0][5]
@@ -1535,16 +1535,16 @@ function update_freud(freud)
       end
       freud.eyes.blink_timer = -1
    end
-   freud.eyes.blink_timer = freud.eyes.blink_timer + 1   
+   freud.eyes.blink_timer = freud.eyes.blink_timer + 1
 end
 
 function ask_question(question_idx, text, freud)
    question_idx = question_idx + 1
-   
+
    local key_input = nil
-   
+
    local text_offset = char_creation_tbl[question_idx].text
-   
+
    while text_offset ~= 0 do
 
       if text_offset < 0 then
@@ -1552,9 +1552,9 @@ function ask_question(question_idx, text, freud)
       else
          text.text_color = 6
       end
-      
+
       text.text = insert_player_name(freud.text_tbl[math.abs(text_offset)])
-      
+
       freud.eyes.sprite_idx = char_creation_tbl[question_idx].eye_sprite
       freud.eyes.sprite.image = freud.images[0][freud.eyes.sprite_idx]
       freud.eyes.blink_timer = 0
@@ -1563,7 +1563,7 @@ function ask_question(question_idx, text, freud)
       local action = char_creation_tbl[question_idx].action_code
 
       local continue_loop = true
-      while continue_loop do 
+      while continue_loop do
          if action == -1 then
             local input = poll_for_input()
             if input ~= nil then
@@ -1587,19 +1587,19 @@ function ask_question(question_idx, text, freud)
                continue_loop = false
             end
          end
-         
+
          if should_exit() then
             return nil
          end
-         
+
          update_freud(freud)
          canvas_update()
       end
-      
+
       question_idx = question_idx + 1
       text_offset = char_creation_tbl[question_idx].text
    end
-   
+
    return key_input
 end
 
@@ -1627,7 +1627,7 @@ function question_1_answer_a(text, freud, rand_high, rand_low)
             if answer == SDLK_a then
                avatar_int = rand_high
                avatar_dex = rand_low
-               ask_question(40, text, freud)              
+               ask_question(40, text, freud)
             elseif answer == SDLK_b then
                avatar_dex = rand_high
                avatar_int = rand_low
@@ -1640,20 +1640,20 @@ function question_1_answer_a(text, freud, rand_high, rand_low)
             local answer = ask_question(46, text, freud)
             if answer == SDLK_a then
                avatar_str = rand_high
-               avatar_dex = rand_low               
+               avatar_dex = rand_low
                if gender_answer == SDLK_a then
                   ask_question(49, text, freud)
                else
                   ask_question(52, text, freud)
-               end               
+               end
             elseif answer == SDLK_b then
                avatar_dex = rand_high
-               avatar_str = rand_low               
+               avatar_str = rand_low
                if gender_answer == SDLK_a then
                   ask_question(58, text, freud)
                else
                   ask_question(55, text, freud)
-               end                
+               end
             end
          elseif var_16 == SDLK_b then
             local answer = ask_question(61, text, freud)
@@ -1664,7 +1664,7 @@ function question_1_answer_a(text, freud, rand_high, rand_low)
             elseif answer == SDLK_b then
                avatar_dex = rand_high
                avatar_int = rand_low
-               ask_question(66, text, freud)               
+               ask_question(66, text, freud)
             end
          end
       end
@@ -1683,10 +1683,10 @@ function question_1_answer_b(text, freud, rand_high, rand_low)
                ask_question(31, text, freud)
             else
                ask_question(34, text, freud)
-            end 
+            end
          elseif answer == SDLK_b then
             avatar_int = rand_high
-            avatar_str = rand_low            
+            avatar_str = rand_low
          end
       elseif var_16 == SDLK_b then
          local answer = ask_question(37, text, freud)
@@ -1697,7 +1697,7 @@ function question_1_answer_b(text, freud, rand_high, rand_low)
          elseif answer == SDLK_b then
             avatar_dex = rand_high
             avatar_int = rand_low
-            ask_question(43, text, freud)            
+            ask_question(43, text, freud)
          end
       end
    elseif var_14 == SDLK_b then
@@ -1711,7 +1711,7 @@ function question_1_answer_b(text, freud, rand_high, rand_low)
          elseif answer == SDLK_b then
             avatar_str = rand_high
             avatar_int = rand_low
-            ask_question(78, text, freud)         
+            ask_question(78, text, freud)
          end
       elseif var_16 == SDLK_b then
          local answer = ask_question(46, text, freud)
@@ -1722,7 +1722,7 @@ function question_1_answer_b(text, freud, rand_high, rand_low)
                ask_question(49, text, freud)
             else
                ask_question(52, text, freud)
-            end 
+            end
          elseif answer == SDLK_b then
             avatar_dex = rand_high
             avatar_str = rand_low
@@ -1730,8 +1730,8 @@ function question_1_answer_b(text, freud, rand_high, rand_low)
                ask_question(58, text, freud)
             else
                ask_question(55, text, freud)
-            end            
-         end         
+            end
+         end
       end
    end
 end
@@ -1750,7 +1750,7 @@ function question_1_answer_c(text, freud, rand_high, rand_low)
                ask_question(49, text, freud)
             else
                ask_question(52, text, freud)
-            end           
+            end
          elseif answer == SDLK_b then
             avatar_dex = rand_high
             avatar_str = rand_low
@@ -1758,7 +1758,7 @@ function question_1_answer_c(text, freud, rand_high, rand_low)
                ask_question(58, text, freud)
             else
                ask_question(55, text, freud)
-            end              
+            end
          end
       elseif var_16 == SDLK_b then
          local answer = ask_question(37, text, freud)
@@ -1769,8 +1769,8 @@ function question_1_answer_c(text, freud, rand_high, rand_low)
          elseif answer == SDLK_b then
             avatar_dex = rand_high
             avatar_int = rand_low
-            ask_question(43, text, freud)            
-         end         
+            ask_question(43, text, freud)
+         end
       end
    elseif var_14 == SDLK_b then
       local var_16 = ask_question(20, text, freud)
@@ -1783,7 +1783,7 @@ function question_1_answer_c(text, freud, rand_high, rand_low)
                ask_question(31, text, freud)
             else
                ask_question(34, text, freud)
-            end 
+            end
          elseif answer == SDLK_b then
             avatar_int = rand_high
             avatar_str = rand_low
@@ -1797,7 +1797,7 @@ function question_1_answer_c(text, freud, rand_high, rand_low)
          elseif answer == SDLK_b then
             avatar_str = rand_high
             avatar_dex = rand_low
-            ask_question(90, text, freud)               
+            ask_question(90, text, freud)
          end
       end
    end
@@ -1806,35 +1806,35 @@ end
 function create_character()
    canvas_hide_all_sprites()
    local create_tbl = image_load_all("create.lzc")
-   
+
    local text_tbl = text_load("scenetxt.lzc", 5)
 
    local text = sprite_new(nil, 0, 160, true)
    text.text = text_tbl[0]
    text.text_color = 2
    text.text_align = 2
-   
+
    local bg = sprite_new(create_tbl[0][0], 0, 24, true)
    local eyes_sprite = sprite_new(create_tbl[0][4], 0, 24, true)
    local pen_sprite = sprite_new(create_tbl[2][0], 128, 83, true)
    local clipboard = sprite_new(create_tbl[1], 89, 109, true)
-   
+
    local eyes ={["sprite"]=eyes_sprite, ["sprite_idx"]=4, ["blink_timer"]=0}
    local pen = {["sprite"]=pen_sprite,["x_off"]=0,["y_off"]=0,["sprite_idx"]=0,["timer"]=0,}
    local freud = {["eyes"]=eyes, ["pen"]=pen, ["state"]=FREUD_STATE_STARING, ["timer"] = 0, ["can_move_pen"] = false, ["images"]=create_tbl, ["text_tbl"]=text_tbl}
-   
+
    music_play("mdd_mus.lzc", 7)
 
    local rand_high = math.random(24,26)
    local rand_low = math.random(22,24)
    local stat_base = math.random(18,22)
-   
+
    avatar_str = stat_base
    avatar_dex = stat_base
    avatar_int = stat_base
-   
+
    local gender
-   
+
    gender_answer = ask_question(0, text, freud)
    if gender_answer == SDLK_a then
       gender = 0 --male
@@ -1843,9 +1843,9 @@ function create_character()
       gender = 1 --female
       ask_question(11, text, freud)
    end
-   
+
    local answer = ask_question(14, text, freud)
-   
+
    if answer == SDLK_a then
       question_1_answer_a(text, freud, rand_high, rand_low)
    elseif answer == SDLK_b then
@@ -1853,23 +1853,23 @@ function create_character()
    elseif answer == SDLK_c then
       question_1_answer_c(text, freud, rand_high, rand_low)
    end
-   
+
    if should_exit() then
       return false
    end
-   
+
    ask_question(69, text, freud)
-   
+
    config_set("config/newgame", true)
    config_set("config/newgamedata/name", g_player_name)
    config_set("config/newgamedata/gender", gender)
    config_set("config/newgamedata/str", avatar_str)
    config_set("config/newgamedata/dex", avatar_dex)
    config_set("config/newgamedata/int", avatar_int)
-   
+
    --wait_for_input()
    fade_out(6)
-   
+
    return true
 end
 
@@ -1884,9 +1884,9 @@ function execute_menu_item(cursor_pos)
    if cursor_pos ~= nil then
       set_menu_cursor_pos(cursor_pos)
    end
-   
+
    hide_mouse_cursor()
-   
+
    if g_menu_idx == 0 then -- story so far
       run_introduction()
    elseif g_menu_idx == 1 then -- create char
@@ -1899,7 +1899,7 @@ function execute_menu_item(cursor_pos)
    elseif g_menu_idx == 3 then -- about md
       about_martian_dreams()
    end
-   
+
    clear_should_exit_flag()
    canvas_hide_all_sprites()
    canvas_set_opacity(0xff)
diff --git a/devtools/create_ultima/files/ultima6/scripts/md/lang/en/game.lua b/devtools/create_ultima/files/ultima6/scripts/md/lang/en/game.lua
index 9a5d644fdb..fda8e30c2d 100644
--- a/devtools/create_ultima/files/ultima6/scripts/md/lang/en/game.lua
+++ b/devtools/create_ultima/files/ultima6/scripts/md/lang/en/game.lua
@@ -261,4 +261,4 @@ SPRAY_GUN_WEED_KILLER="The spray gun now contains 10 charges of weed killer.\n",
 SPRAY_GUN_10_MORE_CHARGES="The spray gun has 10 more charges.\n",
 THERE_IS_NOTHING_IN_THE_GUN="There is nothing in the gun.\n",
 YOU_KILLED_THE_PLANT="You killed the plant.\n",
-}
\ No newline at end of file
+}
diff --git a/devtools/create_ultima/files/ultima6/scripts/md/lang/it/game.lua b/devtools/create_ultima/files/ultima6/scripts/md/lang/it/game.lua
index 62aa9af7bc..fe6cb66a1a 100644
--- a/devtools/create_ultima/files/ultima6/scripts/md/lang/it/game.lua
+++ b/devtools/create_ultima/files/ultima6/scripts/md/lang/it/game.lua
@@ -5,4 +5,4 @@ TO="A - ",
 NOTHING="nessuna cosa!\n",
 NO_EFFECT="\nNessun effetto\n",
 IT_IS_STUCK="Si e bloccato.\n"
-}
\ No newline at end of file
+}
diff --git a/devtools/create_ultima/files/ultima6/scripts/md/look.lua b/devtools/create_ultima/files/ultima6/scripts/md/look.lua
index e9e6a36e99..7086235c61 100644
--- a/devtools/create_ultima/files/ultima6/scripts/md/look.lua
+++ b/devtools/create_ultima/files/ultima6/scripts/md/look.lua
@@ -13,7 +13,7 @@ function look_pocketwatch(obj)
    if am == false then
    time = "TIME_PM"
    end
-   
+
    printfl(time, hour, minute)
 end
 
@@ -28,7 +28,7 @@ function look_barrow(obj)
       printl("IT_IS_EMPTY")
       return
    end
-   
+
    local quality = obj.quality
    local material
    if quality == 1 then
@@ -40,7 +40,7 @@ function look_barrow(obj)
    elseif quality == 4 then
       material = i18n("COAL")
    end
-   
+
    if obj.qty == 1 then
       printfl("IT_HAS_1_LOAD_OF", material)
    else
@@ -51,10 +51,10 @@ end
 function get_lat_long_string(x, y)
    local lat_str = "N"
    local long_str = "W"
-   
+
    local lat = math.modf(((y - 512) * 240) / 1024)
    local long = math.modf(((x - 512) * 360) / 1024)
-   
+
    if lat > 0 then
       lat_str = "S"
    else
@@ -62,7 +62,7 @@ function get_lat_long_string(x, y)
          lat_str = " "
       end
    end
-   
+
    if long == 180 or long == -180 or long == 0 then
       long_str = " "
    else
@@ -70,10 +70,10 @@ function get_lat_long_string(x, y)
          long_str = "E"
       end
    end
-   
+
    lat = math.abs(lat)
    long = 180 - math.abs(long)
-   
+
    return lat..lat_str.." "..long..long_str
 end
 
@@ -132,7 +132,7 @@ end
 
 function look_sprayer_system(obj)
    local quality = obj.quality
-   
+
    if bit32.btest(quality, 1) then
       local actor = Actor.get(0x3e)
       if Actor.get_talk_flag(actor, 5) == true then
@@ -163,15 +163,15 @@ end
 
 function look_tracking_motor(obj)
    local quality = obj.quality
-   
+
    if bit32.btest(quality, 1) and obj.on_map == true then
       printl("IT_APPEARS_TO_BE_LOOSE")
    end
-   
+
    if bit32.btest(quality, 2) then
       printl("IT_APPEARS_TO_BE_BROKEN")
    end
-   
+
 end
 
 function look_panel(obj)
@@ -184,7 +184,7 @@ function look_panel(obj)
          printl("THESE_APPEAR_TO_BE_VALVE_CONTROLS")
       elseif frame_n == 2 then
          printl("THESE_APPEAR_TO_BE_ELECTRICAL_CONTROLS")
-      end    
+      end
    elseif qty == 4 then
       printl("IT_APPEARS_TO_CONTROL_A_DREAM_MACHINE")
    elseif qty == 5 then
@@ -192,16 +192,16 @@ function look_panel(obj)
    elseif qty == 6 then
       printl("IT_APPEARS_TO_CONTROL_THE_RUBY_LENS_SYSTEM")
    elseif qty == 7 then
-      printl("IT_APPEARS_TO_CONTROL_THE_CISTERN_VALVES")   
+      printl("IT_APPEARS_TO_CONTROL_THE_CISTERN_VALVES")
    else
       printl("YOU_CANNOT_DECIPHER_ITS_PURPOSE")
    end
-   
+
    local quality = obj.quality
    if bit32.btest(quality, 1) and obj.on_map == true then
       printl("THE_PANEL_IS_LOOSE")
    end
-   
+
    if bit32.btest(quality, 2) then
       printl("THE_PANEL_IS_BROKEN")
    end
@@ -220,9 +220,9 @@ function look_portable_sprayer(obj)
    if obj.quality == 0 then
       contents = tile_get_description(649)
    else
-      contents = tile_get_description(640)      
+      contents = tile_get_description(640)
    end
-   
+
    printfl("IT_IS_LOADED_WITH", contents)
    print_number_of_charges(obj.qty)
 end
@@ -237,7 +237,7 @@ function get_weapon_mode_string(obj)
    else
       mode = i18n("SHOTGUN")
    end
-   
+
    return mode
 end
 
@@ -264,11 +264,11 @@ function look_light_source(obj)
    local obj_n = obj.obj_n
    local qty = obj.qty
    local quality = obj.quality
-   
+
    if (obj_n == 109 or obj_n == 110) and qty > 1 then
       return
    end
-   
+
    if quality > 30 then
       printl("PLENTY_OF")
    elseif quality > 6 and quality <= 30 then
@@ -280,13 +280,13 @@ function look_light_source(obj)
    else
       printl("PLENTY_OF")
    end
-   
+
    if obj_n == 115 or obj_n == 117 or obj_n == 116 or obj_n == 118 then
       printl("FUEL")
    else
       printl("WICK")
    end
-   
+
 end
 
 function look_door(obj)
@@ -305,20 +305,20 @@ function look_obelisk(obj)
    if obj.quality == 0 then
       return
    end
-   
+
    local ui_style = game_get_ui_style()
-   
+
    canvas_show()
    canvas_hide_all_sprites()
    canvas_set_opacity(0xff);
    canvas_set_update_interval(25)
    canvas_rotate_game_palette(true)
-   
+
    local obelisk = sprite_new(nil, 184, 0, true)
-   
+
    local text_sprite
    --local text_sprite_bg
-   
+
    if ui_style == UI_STYLE_ORIG then
       canvas_set_solid_bg(false)
    else
@@ -329,9 +329,9 @@ function look_obelisk(obj)
       obelisk.x = 96
       obelisk.y = 41
    end
-   
+
    obelisk.image = image_load("mdream.lzc", obj.quality-1)
-   
+
    local input = nil
    while input == nil do
       canvas_update()
@@ -383,23 +383,23 @@ local look_usecode = {
 
 function look_obj(obj)
    printfl("YOU_SEE", obj.look_string);
-   
+
    --FIXME usecode look description should be lua code.
    if usecode_look(obj) then
       print("\n")
       return false
    end
-   
+
    print(".\n\n");
-   
+
    if look_usecode[obj.obj_n] ~= nil then
       look_usecode[obj.obj_n](obj)
       print("\n")
    end
-   
+
    if is_container_obj(obj.obj_n) then
       search(obj)
    end
-   
+
    return false
-end
\ No newline at end of file
+end
diff --git a/devtools/create_ultima/files/ultima6/scripts/md/player.lua b/devtools/create_ultima/files/ultima6/scripts/md/player.lua
index 4b8084ed0c..9c8774e733 100644
--- a/devtools/create_ultima/files/ultima6/scripts/md/player.lua
+++ b/devtools/create_ultima/files/ultima6/scripts/md/player.lua
@@ -346,4 +346,4 @@ function player_attack_with_weapon(weapon, target_loc)
 
     end
 
-end
\ No newline at end of file
+end
diff --git a/devtools/create_ultima/files/ultima6/scripts/md/talk.lua b/devtools/create_ultima/files/ultima6/scripts/md/talk.lua
index b1196f19f0..e3ed47628f 100644
--- a/devtools/create_ultima/files/ultima6/scripts/md/talk.lua
+++ b/devtools/create_ultima/files/ultima6/scripts/md/talk.lua
@@ -6,14 +6,14 @@ function open_gates_at_olympus_mons()
    else
       printl("AARGH")
    end
-   
+
    gate = map_get_obj(0x2c4, 0x1f3, 0, 181) -- OBJ_GATE
    if gate ~= nil then
       gate.frame_n = 7
    else
       printl("AARGH")
    end
-   
+
 end
 
 function open_dream_machine_door()
@@ -181,4 +181,4 @@ function talk_to_obj(obj)
    end
 
    return false
-end
\ No newline at end of file
+end
diff --git a/devtools/create_ultima/files/ultima6/scripts/md/usecode.lua b/devtools/create_ultima/files/ultima6/scripts/md/usecode.lua
index df0e77f10e..b6090697bc 100644
--- a/devtools/create_ultima/files/ultima6/scripts/md/usecode.lua
+++ b/devtools/create_ultima/files/ultima6/scripts/md/usecode.lua
@@ -19,7 +19,7 @@ function use_door(obj, actor)
       printl("BLOCKED")
       return
    end
-	
+
    obj.frame_n = bit32.bxor(obj.frame_n, 2)
 
 end
@@ -79,7 +79,7 @@ function use_hammer_on_oxium_geode(obj, target_obj, actor)
          Actor.inv_add_obj(actor, oxium)
       end
    end
-   
+
 end
 
 function use_prybar_on_hatch(obj, target_obj, actor)
@@ -88,20 +88,20 @@ function use_prybar_on_hatch(obj, target_obj, actor)
 		printfl("IS_NOT_STRONG_ENOUGH", actor.name)
 		return
 	end
-	
+
 	local tesla = Actor.get(16)
 	if Actor.get_talk_flag(tesla, 4) == false then
 		Actor.set_talk_flag(tesla, 2)
 		Actor.talk(tesla)
 	else
 		play_midgame_sequence(1)
-		
+
 		Actor.set_talk_flag(tesla, 5)
 		target_obj.obj_n = 428
 		target_obj.frame_n = 0;
 		target_obj.x = target_obj.x + 1
 		target_obj.y = target_obj.y + 1
-		
+
 		local blood = Actor.get(18)
 		Actor.set_talk_flag(blood, 3)
 		Actor.set_talk_flag(blood, 6)
@@ -117,10 +117,10 @@ function use_sextant(obj, actor)
 
 	local lat_str = "N"
 	local long_str = "W"
-	
+
 	local lat = math.modf(((actor.y - 512) * 240) / 1024)
 	local long = math.modf(((actor.x - 512) * 360) / 1024)
-	
+
 	if lat > 0 then
 		lat_str = "S"
 	else
@@ -128,7 +128,7 @@ function use_sextant(obj, actor)
 			lat_str = " "
 		end
 	end
-	
+
 	if long == 180 or long == -180 or long == 0 then
 		long_str = " "
 	else
@@ -136,7 +136,7 @@ function use_sextant(obj, actor)
 			long_str = "E"
 		end
 	end
-	
+
 	lat = math.abs(lat)
 	long = 180 - math.abs(long)
 	printl("YOU_ARE_SOMEWHERE_NEAR")
@@ -149,11 +149,11 @@ function use_berry(obj, actor)
       printl("A_MECHANICAL_PERSON_CANT_EAT_BERRIES")
       return
    end
-   
+
    play_md_sfx(0x32)
    local berry_type = obj.obj_n - 73 --OBJ_BERRY
    local first_berry = true
-   
+
    if (berry_type == 0 and actor_is_affected_by_purple_berries(actor_num))
       or (berry_type == 1 and actor_is_affected_by_green_berries(actor_num))
       or (berry_type == 2 and actor_is_affected_by_brown_berries(actor_num)) then
@@ -178,7 +178,7 @@ function use_berry(obj, actor)
       local counter = actor_get_blue_berry_counter()
       actor_set_blue_berry_counter(counter + math.random(1, 2))
    end
-   
+
    if obj.qty == 1 then
       Obj.removeFromEngine(obj)
    else
@@ -221,7 +221,7 @@ function get_pile_obj_num(map_tile)
 		return 256 --OBJ_CHUNK_OF_ICE
 	end
 
-	return 0 --CANNOT DIG HERE 
+	return 0 --CANNOT DIG HERE
 end
 
 function get_free_location_around_actor(actor)
@@ -231,7 +231,7 @@ function get_free_location_around_actor(actor)
 	local i
 
 	pos.z = actor.z
-	
+
 	for i=1,8 do
 		pos.x = actor.x + x_tbl[i]
 		pos.y = actor.y + y_tbl[i]
@@ -239,7 +239,7 @@ function get_free_location_around_actor(actor)
 			return pos
 		end
 	end
-	
+
 	return nil
 end
 
@@ -249,28 +249,28 @@ function use_tool_on_ground(obj, target_obj, actor, target_x, target_y, target_z
 		printl("THE_GROUND_IS_NOT_CLEAR_FOR_DIGGING")
 		return
 	end
-		
+
 	local map_tile = map_get_tile_num(target_x, target_y, target_z)
-	
+
 	local pile_obj_num = get_pile_obj_num(map_tile)
-	
+
 	if pile_obj_num == 0 then
 		printl("IT_HAS_NO_EFFECT")
 		return
 	end
 
 	local hole_obj_num = 257
-	
+
 	if pile_obj_num == 256 then
 		hole_obj_num = 255
 	end
-	
+
 	local hole = Obj.new(hole_obj_num)
 	hole.temporary = true
 	Obj.moveToMap(hole, target_x, target_y, target_z)
 
 	local loc = get_free_location_around_actor(actor)
-	
+
 	if loc ~= nil then
 		local pile = Obj.new(pile_obj_num)
 		pile.temporary = true
@@ -327,7 +327,7 @@ function use_shovel_on_ore_to_container(obj, target_obj, to_obj, actor)
          return false
       end
    end
-   
+
    return true
 end
 
@@ -337,11 +337,11 @@ function use_shovel_to_unload_container(obj, target_obj, to_obj, actor)
       play_md_sfx(5)
       return
    end
-   
+
    local ore = Obj.new(get_obj_num_from_ore_quality(target_obj.quality))
-   
+
    --FIXME if to_obj == nil do something
-   
+
    local success_flag = false
    if to_obj.obj_n == 268 or to_obj.obj_n == 410 then --OBJ_MARTIAN_WHEEL_BARROW
       success_flag = use_shovel_on_ore_to_container(obj, ore, to_obj, actor)
@@ -352,7 +352,7 @@ function use_shovel_to_unload_container(obj, target_obj, to_obj, actor)
    else
       --FIXME need to implement burying logic
    end
-   
+
    if success_flag then
       target_obj.qty = target_obj.qty - 1
       if target_obj.obj_n == 410 then --OBJ_RAIL_CAR
@@ -360,14 +360,14 @@ function use_shovel_to_unload_container(obj, target_obj, to_obj, actor)
             target_obj.frame_n = target_obj.frame_n - 2
          end
       end
-   end 
+   end
 end
 
 function use_shovel_on_ore_to_furnace(obj, target_obj, to_obj, actor)
    local obj_n = target_obj.obj_n
-   
+
    play_md_sfx(0x1b)
-   
+
    Obj.removeFromEngine(target_obj)
    if obj_n == 444 then --OBJ_PILE_OF_COAL
       if to_obj.frame_n < 4 then
@@ -376,7 +376,7 @@ function use_shovel_on_ore_to_furnace(obj, target_obj, to_obj, actor)
    else
       printl("IT_HAS_NO_EFFECT")
    end
-   
+
    return true
 end
 
@@ -462,7 +462,7 @@ function update_conveyor_belt(can_stop)
       return
    end
    local player_loc = player_get_location()
-   
+
    if player_loc.z ~= 5 then
       return
    end
@@ -473,9 +473,9 @@ function update_conveyor_belt(can_stop)
    local x = 0x3c
    local y = 0x63
    local z = 5
-   
+
    local conveyor = map_get_obj(x, y, z, 188) --OBJ_CONVEYOR_BELT
-   
+
    while conveyor ~= nil do
       if conveyor.frame_n == 2 then
          local seam = map_get_obj(x, y, z, 189) --OBJ_CONVEYOR_BELT1
@@ -490,7 +490,7 @@ function update_conveyor_belt(can_stop)
          end
          conveyor.qty = conveyor.qty - 1
       end
-      
+
       local seam = map_get_obj(x, y, z, 189) --OBJ_CONVEYOR_BELT1
       if seam ~= nil then
          seam.x = seam.x + 1
@@ -510,8 +510,8 @@ function update_conveyor_belt(can_stop)
       x = x - 1
       conveyor = map_get_obj(x, y, z, 188) --OBJ_CONVEYOR_BELT
    end
-   
-   
+
+
    if can_stop and Actor.get_talk_flag(0x71, 3) then
       if math.random(0, 6) == 0 then
          printl("THE_CONVEYOR_BELT_STOPS")
@@ -520,24 +520,24 @@ function update_conveyor_belt(can_stop)
          shutdown_power_update_tiles()
       end
    end
-   
-   
+
+
 end
 
 function midgame_cutscene_2()
    play_midgame_sequence(2)
-   
+
    for tower in find_obj(0, 201) do --OBJ_TOWER_TOP
       if tower.x >= 0x3d0 and tower.x <= 0x3f0 and tower.y >= 0x1d0 and tower.y <= 0x1e7 then
          tower.frame_n = 4 + (tower.frame_n % 4)
       end
    end
-   
+
    for cable in find_obj(0, 214) do --OBJ_POWER_CABLE
       if cable.x >= 0x3d0 and cable.x <= 0x3f0 and cable.y >= 0x1d0 and cable.y <= 0x1e7 then
          cable.obj_n = 215
       end
-   end   
+   end
 end
 
 function use_fixed_belt_on_bare_rollers(obj, target_obj, actor)
@@ -550,12 +550,12 @@ function use_fixed_belt_on_bare_rollers(obj, target_obj, actor)
       end
       rollers = map_get_obj(rollers.x-1,rollers.y,rollers.z, rollers.obj_n)
    end
-   
+
    if start_obj == nil then
       printl("OOOPS_THESE_ROLLERS_CAN_NEVER_BE_FIXED")
       return
    end
-   
+
    rollers = start_obj
    local i = 4
    while rollers ~= nil do
@@ -569,7 +569,7 @@ function use_fixed_belt_on_bare_rollers(obj, target_obj, actor)
       end
       rollers = map_get_obj(rollers.x+1,rollers.y,rollers.z, 192) --OBJ_BARE_ROLLERS
    end
-   
+
    Obj.removeFromEngine(obj)
    Actor.set_talk_flag(0x72, 2)
 end
@@ -581,7 +581,7 @@ function use_ruby_slippers(obj, actor)
       Actor.inv_ready_obj(actor, obj)
       return
    end
-   
+
    if obj.quality == 2 then
       printl("YOU_MAY_USE_THE_RUBY_SLIPPERS_TO_GO_HOME")
       local input = input_select("yn", false)
@@ -607,7 +607,7 @@ function foes_are_nearby()
          end
       end
    end
-   
+
    return false
 end
 
@@ -640,7 +640,7 @@ function is_actor_able_to_talk_to_player(actor)
          return true
       end
    end
-   
+
    return false
 end
 
@@ -661,7 +661,7 @@ function rest_level_up_actor(actor)
    if actor.actor_num > 15 then
       return
    end
-   
+
    local exp_level_tbl = {
    [0] = 0,
    [1] = 100,
@@ -677,18 +677,18 @@ function rest_level_up_actor(actor)
    if actor.exp <= exp_level_tbl[actor.level] then
       return
    end
-   
+
    actor.level = actor.level + 1
-   
+
    local max_hp = actor_get_max_hp(actor)
    if actor.hp + 30 > max_hp then
       actor.hp = max_hp
    else
       actor.hp = actor.hp + 30
    end
-   
+
    Actor.show_portrait(actor)
-   
+
    local obj_n = actor.obj_n
    local gender = math.random(0,1)
    if obj_n == 342 or obj_n == 343 or obj_n == 345 or (obj_n >= 347 and obj_n <= 353) then
@@ -696,12 +696,12 @@ function rest_level_up_actor(actor)
    elseif obj_n == 344 or obj_n == 346 or (obj_n >= 354 and obj_n <= 357) then
       gender = 1
    end
-   
+
    local gender_pronoun = "He"
    if gender == 1 then
       gender_pronoun = "She"
    end
-   
+
    printfl("HAS_A_DREAM", actor.name)
    printfl("SEES_THREE_STONE_OBELISKS", gender_pronoun)
    printfl("FEELS_DRAWN_TO_ONE_OF_THE_OBELISKS", gender_pronoun)
@@ -709,7 +709,7 @@ function rest_level_up_actor(actor)
    printl("WHICH_BHS")
 
    local answer = input_select("bhs", false)
-   
+
    if answer == "B" then
       if actor.int < 30 then
          actor.int = actor.int + 1
@@ -717,13 +717,13 @@ function rest_level_up_actor(actor)
    elseif answer == "H" then
       if actor.dex < 30 then
          actor.dex = actor.dex + 1
-      end   
+      end
    elseif answer == "S" then
       if actor.str < 30 then
          actor.str = actor.str + 1
-      end  
+      end
    end
-   
+
 end
 
 function use_tent(obj, actor)
@@ -738,9 +738,9 @@ function use_tent(obj, actor)
      play_md_sfx(5)
      return
   end
-  
+
    local tent_loc = {}
-  
+
    if obj.on_map then
       tent_loc.x = obj.x
       tent_loc.y = obj.y
@@ -748,9 +748,9 @@ function use_tent(obj, actor)
    else
       tent_loc = player_get_location()
    end
-   
+
    local x, y
-   
+
    for y = tent_loc.y - 2, tent_loc.y do
       for x = tent_loc.x - 1, tent_loc.x + 1 do
          local map_obj = map_get_obj(x,y,tent_loc.z)
@@ -773,16 +773,16 @@ function use_tent(obj, actor)
          end
       end
    end
-   
+
    printl("REST")
-   
+
    if party_is_in_combat_mode() then
       print(" - ")
       printl("NOT_WHILE_IN_COMBAT_MODE")
       play_md_sfx(5)
       return
    end
-   
+
    if foes_are_nearby() then
       printl("NOT_WHILE_FOES_ARE_NEAR")
       play_md_sfx(5)
@@ -794,8 +794,8 @@ function use_tent(obj, actor)
       printfl("IS_TOO_NEAR_TO_SETUP_CAMP", npc.name)
       play_md_sfx(5)
       return
-   end   
-   
+   end
+
    --poison check
 
    local actor
@@ -806,7 +806,7 @@ function use_tent(obj, actor)
          printfl("IS_POISONED", actor.name)
       end
    end
-   
+
    if poisoned then
       printl("DO_YOU_REALLY_WANT_TO_SLEEP")
       local answer = input_select("yn", false)
@@ -820,7 +820,7 @@ function use_tent(obj, actor)
       local actor_num = actor.actor_num
       local green = actor_is_affected_by_green_berries(actor_num)
       local brown = actor_is_affected_by_brown_berries(actor_num)
-      
+
       if brown or green then
          party_is_using_berries = true
          if brown and green then
@@ -828,29 +828,29 @@ function use_tent(obj, actor)
          elseif brown then
             printfl("COMPLAINS_OF_TOO_MUCH_LIGHT", actor.name)
          else --green
-            printfl("COMPLAINS_OF_INANIMATE_THINGS_TALKING", actor.name)            
-         end  
+            printfl("COMPLAINS_OF_INANIMATE_THINGS_TALKING", actor.name)
+         end
       end
-      
+
    end
-   
+
    if party_is_using_berries then
       if party_get_size() == 1 then
          printl("YOU_CANT_SLEEP")
       else
          printl("NOBODY_CAN_SLEEP")
       end
-      
+
       return
    end
-   
+
    local player = Actor.get_player_actor()
    player.x = tent_loc.x
    player.y = tent_loc.y
-   
+
    local tent = Obj.new(134, 3)
    Obj.moveToMap(tent, player.x, player.y-1, player.z)
-   
+
    tent = Obj.new(134, 5)
    Obj.moveToMap(tent, player.x+1, player.y-1, player.z)
 
@@ -862,19 +862,19 @@ function use_tent(obj, actor)
 
    tent = Obj.new(134, 8)
    Obj.moveToMap(tent, player.x, player.y, player.z)
-            
+
    party_move(player.x, player.y, player.z)
-   
+
    script_wait(500)
-   
+
    party_hide_all()
-   
+
    tent.frame_n = 7
-   
+
    local hour = clock_get_hour()
    local time
    local hours_to_rest
-   
+
    if hour < 7 or hour > 16 then
       time = i18n("SUNRISE")
       if hour < 7 then
@@ -886,27 +886,27 @@ function use_tent(obj, actor)
       time = i18n("SUNSET")
       hours_to_rest = 18 - hour
    end
-   
+
    printfl("REST_UNTIL", time)
    local answer = input_select("yn", false)
-   
+
    if answer == "N" or answer == "n" then
       printl("HOW_MANY_HOURS")
       hours_to_rest = input_select_integer("0123456789", true)
    end
-   
+
    g_party_is_warm = true
-   
+
    if g_hours_till_next_healing == 0 and hours_to_rest > 4 then
       rest_heal_party(hours_to_rest)
       g_hours_till_next_healing = 6
    end
-   
+
    local can_level_up = false
    if hours_to_rest * 3 > party_get_size() then
       can_level_up = true
    end
-   
+
    local i
    for i=0,hours_to_rest*3-1 do
       advance_time(20)
@@ -937,15 +937,15 @@ function use_tent(obj, actor)
 
    tent.frame_n = 8 --Open the tent flap
    party_show_all()
-         
+
    party_move(player.x, player.y + 1, player.z)
 
    script_wait(500)
-   
+
    --remove tent from map
    local z = player.z
    for tent in find_obj(z, 134) do
-      if tent ~= nil and 
+      if tent ~= nil and
       ((tent.x == tent_loc.x and tent.y == tent_loc.y-1) or
        (tent.x == wrap_coord(tent_loc.x+1,z) and tent.y == tent_loc.y-1) or
        (tent.x == wrap_coord(tent_loc.x-1,z) and tent.y == tent_loc.y) or
@@ -964,16 +964,16 @@ function use_red_berry(obj, actor)
       printl("THAT_WOULD_BE_A_WASTE_OUTSIDE_OF_COMBAT")
       return
    end
-   
+
    if actor.frenzy == false then
       printfl("ENTERS_A_BATTLE_FRENZY", actor.name)
       play_md_sfx(0x32)
    end
-   
+
    actor.frenzy = true
-   
+
    local qty = obj.qty
-   
+
    if qty > 1 then
       obj.qty = qty - 1
    else
@@ -991,13 +991,13 @@ end
 
 function use_gong(obj, target_obj, actor)
    printl("GONG")
-   play_md_sfx(0xf) 
+   play_md_sfx(0xf)
 end
 
 function use_musical_instrument(obj, actor)
 
    local obj_n = obj.obj_n
-   
+
    if obj_n == 280 then --OBJ_CYMBALS
       printl("CHING")
       play_md_sfx(0x36)
@@ -1027,7 +1027,7 @@ function use_wrench_on_switchbar(obj, target_obj, actor)
             printl("THE_SWITCH_IS_FASTENED")
             play_md_sfx(0x1f)
             return
-         end   
+         end
       end
       printl("THIS_SWITCH_CANNOT_BE_FIXED")
       play_md_sfx(0x5)
@@ -1043,7 +1043,7 @@ function use_wrench_on_drill(obj, target_obj, actor)
    if target_obj.on_map then
       drill_cart = map_get_obj(target_obj.x, target_obj.y, target_obj.z, 439)
    end
-   
+
    if drill_cart ~= nil then
       local drill = Obj.new(441,1) --assembled drill
       Obj.moveToMap(drill, target_obj.x, target_obj.y, target_obj.z)
@@ -1061,7 +1061,7 @@ function use_wrench_on_panel(obj, target_obj, actor)
       printl("IT_HAS_NO_EFFECT")
       return
    end
-   
+
    local quality = target_obj.quality
    local panel_qty = target_obj.qty
    if quality == 0 then
@@ -1096,7 +1096,7 @@ function use_wrench_on_panel(obj, target_obj, actor)
          end
       end
    end
-   
+
 end
 
 function use_oxium_bin(obj, actor)
@@ -1104,10 +1104,10 @@ function use_oxium_bin(obj, actor)
       printl("BLOCKED")
       return
    end
-   
+
    local oxium = Obj.new(131) --OBJ_BLOB_OF_OXIUM
    oxium.qty = 20
-   
+
    if Actor.can_carry_obj(actor, oxium) then
       Actor.inv_add_obj(actor, oxium, STACK_OBJECT_QTY)
       printl("YOU_GET_TWO_HANDFULS_OF_OXIUM_FROM_THE_BIN")
@@ -1135,7 +1135,7 @@ function use_pliers_on_spool_to_tower(obj, target_obj, to_obj, actor)
       printl("THE_CABLE_DOES_NOT_NEED_REPLACEMENT")
       return
    end
-   
+
    if actor_is_holding_obj(actor, 38) == false then --OBJ_RUBBER_GLOVES
       Actor.hit(actor, math.random(0, math.floor(actor.max_hp/2)))
       local spector = Actor.get(2)
@@ -1158,7 +1158,7 @@ function use_pliers_on_spool_to_tower(obj, target_obj, to_obj, actor)
          Obj.removeFromEngine(obj)
       end
    end
-   
+
 end
 
 function use_gate(obj, actor)
@@ -1179,8 +1179,8 @@ function use_gate(obj, actor)
    elseif frame_n == 6 or frame_n == 7 then
       obj.frame_n = 5
    end
-   
-   
+
+
 end
 
 function use_switch_bar(obj, actor)
@@ -1189,20 +1189,20 @@ function use_switch_bar(obj, actor)
    else
       obj.frame_n = 0
    end
-   
+
    if obj.on_map == false or map_get_obj(obj.x-1,obj.y-1,obj.z, 413) == nil then
       printl("IT_HAS_NO_EFFECT")
       return
    end
-   
+
    if obj.quality == 1 then
       printl("IT_TURNS_LOOSELY")
       return
    end
-   
+
    local turntable = map_get_obj(obj.x-1,obj.y-1,obj.z, 413)
    turntable.frame_n = obj.frame_n
-   
+
    local railcar = map_get_obj(obj.x-1,obj.y-1,obj.z, 410)
    if railcar ~= nil then
       railcar.frame_n = railcar.frame_n - (railcar.frame_n % 2)
@@ -1318,11 +1318,11 @@ end
 function use_assembled_drill(obj, actor)
 
    play_md_sfx(0x10)
-   
+
    local x = obj.x
    local y = obj.y
    local z = obj.z
-   
+
    if obj.frame_n == 1 then
       x = x - 1
    elseif obj.frame_n == 3 then
@@ -1332,7 +1332,7 @@ function use_assembled_drill(obj, actor)
    else
       x = x + 1
    end
-   
+
    local target_obj
    for obj in objs_at_loc(x, y, z) do
       if obj.obj_n == 445 --OBJ_IRON_ORE
@@ -1342,13 +1342,13 @@ function use_assembled_drill(obj, actor)
          break
       end
    end
-   
+
    if target_obj == nil then
       target_obj = map_get_obj(x, y, z, 213, true)
    end
-   
+
    local drilled_matterial
-   
+
    if target_obj == nil then
       if can_drill_at_loc(x, y, z) == true then
          drilled_matterial = 442 --OBJ_PILE_OF_ROCKS
@@ -1366,7 +1366,7 @@ function use_assembled_drill(obj, actor)
    elseif target_obj.obj_n == 446 then --OBJ_VEIN_OF_COAL
       drilled_matterial = 444 --OBJ_PILE_OF_COAL
    end
-   
+
    if drilled_matterial ~= nil then
       local spoil_location = get_free_location_around_drill(obj)
       if spoil_location ~= nil then
@@ -1376,19 +1376,19 @@ function use_assembled_drill(obj, actor)
          printl("THERE_IS_NO_ROOM_LEFT_FOR_THE_ORE")
       end
    end
-   
+
    if target_obj then
       if target_obj.quality > 1 then
          target_obj.quality = target_obj.quality - 1
       else
          Obj.removeFromEngine(target_obj)
-      end  
+      end
    end
-   
+
    if drilled_matterial == nil then
       Obj.removeFromEngine(target_obj)
    end
-   
+
 end
 
 function get_free_location_around_drill(drill)
@@ -1398,7 +1398,7 @@ function get_free_location_around_drill(drill)
    local i
 
    pos.z = drill.z
-   
+
    for i=1,8 do
       pos.x = drill.x + x_tbl[i]
       pos.y = drill.y + y_tbl[i]
@@ -1409,7 +1409,7 @@ function get_free_location_around_drill(drill)
          end
       end
    end
-   
+
    return nil
 end
 
@@ -1419,8 +1419,8 @@ function get_ore_container_quality(ore_obj_num)
    if quality == nil then
       quality = 1
    end
-   
-   return quality   
+
+   return quality
 end
 
 function get_obj_num_from_ore_quality(ore_quality)
@@ -1437,11 +1437,11 @@ end
 
 function can_drill_at_loc(x,y,z)
    local tile_num = map_get_tile_num(x, y, z)
-   
+
    if tile_num >= 0xf0 and tile_num <= 0xfb then
       return true
    end
-   
+
    return false
 end
 
@@ -1961,8 +1961,8 @@ local usecode_table = {
 --OBJ_PICK
 [65]={[255]=use_misc_text,[257]=use_misc_text}, --hole in ice, hole
 --OBJ_SHOVEL
-[66]=use_shovel_on_tbl, 
---OBJ_HOE 
+[66]=use_shovel_on_tbl,
+--OBJ_HOE
 [67]={[255]=use_misc_text,[257]=use_misc_text}, --hole in ice, hole
 --OBJ_BERRY
 [73]=use_berry,
@@ -1975,7 +1975,7 @@ local usecode_table = {
 --OBJ_BERRY4
 [77]=use_red_berry,
 --OBJ_CLUMP_OF_ROUGE_BERRIES
-[78]=use_misc_text, 
+[78]=use_misc_text,
 [86]=use_container,
 [87]=use_container,
 --OBJ_MANUSCRIPT
@@ -2048,7 +2048,7 @@ local usecode_table = {
 [148]=use_reading_material,
 --OBJ_NOTE
 [151]=use_reading_material,
---OBJ_DOOR 
+--OBJ_DOOR
 [152]=use_door,
 [181]=use_gate,
 --OBJ_CAMERA
@@ -2168,7 +2168,7 @@ function ready_winged_shoes(obj, actor)
       bridge.temporary = false
       Obj.moveToMap(bridge, 0xc9, 0x9b, 2)
    end
-   
+
    return true
 end
 
@@ -2211,7 +2211,7 @@ function move_drill(obj, rel_x, rel_y)
   elseif rel_y > 0 then
       obj.frame_n = 5
   end
-    
+
   return true
 end
 
@@ -2219,7 +2219,7 @@ function move_wheelbarrow(obj, rel_x, rel_y)
   if rel_x ~= 0 and rel_y ~= 0 then
     return false
   end
-  
+
   if rel_x < 0 then
     obj.frame_n = 3
   elseif rel_x > 0 then
@@ -2229,7 +2229,7 @@ function move_wheelbarrow(obj, rel_x, rel_y)
   elseif rel_y > 0 then
       obj.frame_n = 2
   end
-  
+
   return true
 end
 
@@ -2253,13 +2253,13 @@ function move_rail_cart(obj, rel_x, rel_y)
    end
 
    move_car_obj(obj, rel_x, rel_y)
-   return false     
+   return false
 end
 
 function check_for_track(car, rel_x, rel_y)
    local x = car.x + rel_x
    local y = car.y + rel_y
-   
+
    for obj in objs_at_loc(x, y, car.z) do
    	if (obj.obj_n >= 412 and obj.obj_n <= 414) or obj.obj_n == 419 or obj.obj_n == 175 or obj.obj_n == 163 then --track object
 
@@ -2281,12 +2281,12 @@ function check_for_track(car, rel_x, rel_y)
    if map_get_obj(x, y, car.z, 412, true) then
       return true
    end
-      
+
    local tile_num = map_get_tile_num(x,y, car.z)
    if is_track_tile(tile_num) then
       return true
    end
-   
+
    return false
 end
 
@@ -2325,7 +2325,7 @@ function has_usecode(obj, usecode_type)
    elseif usecode_type == USE_EVENT_MOVE and usecode_move_obj_table[obj.obj_n] ~= nil then
       return true
    end
-   
+
    return false
 end
 
@@ -2335,11 +2335,11 @@ function use_obj_on_to(obj, target_obj, actor, use_to_tbl)
 		printl("NOTHING")
 		return
 	end
-	
+
 	local to_x, to_y = direction_get_loc(dir, actor.x, actor.y)
-	
+
 	local to_obj = map_get_obj(to_x, to_y, actor.z)
-	
+
 	if to_obj ~= nil then
 		print(to_obj.name.."\n\n")
 		local func = use_to_tbl[to_obj.obj_n]
@@ -2364,7 +2364,7 @@ function use_obj_on(obj, actor, use_on_tbl)
    if target_entity == nil then
       target_entity = map_get_obj(target_x, target_y, actor.z)
    end
-	
+
 	if target_entity ~= nil then
 		print(target_entity.name.."\n\n")
 		local on = use_on_tbl[target_entity.obj_n]
@@ -2444,7 +2444,7 @@ function ready_obj(obj, actor)
          return func(obj, actor)
       end
    end
-   
+
    return true
 end
 
@@ -2457,4 +2457,4 @@ end
 
 function is_ranged_select(operation)
     return actor_is_affected_by_purple_berries(Actor.get_player_actor().actor_num)
-end
\ No newline at end of file
+end
diff --git a/devtools/create_ultima/files/ultima6/scripts/md/worktype.lua b/devtools/create_ultima/files/ultima6/scripts/md/worktype.lua
index 10c9d17872..6cffbda97a 100644
--- a/devtools/create_ultima/files/ultima6/scripts/md/worktype.lua
+++ b/devtools/create_ultima/files/ultima6/scripts/md/worktype.lua
@@ -156,7 +156,7 @@ end
 function worktype_9D_stoker_wait_for_coal(actor)
    local coal
    coal = map_get_obj(actor.x, actor.y+1, actor.z, 447) --OBJ_HUGE_LUMP_OF_COAL
-   
+
    if coal ~= nil then
       while coal ~= nil do
          Obj.removeFromEngine(coal)
@@ -164,7 +164,7 @@ function worktype_9D_stoker_wait_for_coal(actor)
       end
       actor.wt = 0x9E
    end
-   
+
 end
 
 function worktype_9E_stoker_walk_to_furnace(actor)
@@ -173,7 +173,7 @@ function worktype_9E_stoker_walk_to_furnace(actor)
       if furnace == nil then
          furnace = map_get_obj(actor.x+1, actor.y-1, actor.z, 233)
       end
-      
+
       if furnace ~= nil then
          if Actor.get_talk_flag(0x72, 2) == false then
             activate_power_system()
@@ -221,7 +221,7 @@ function stoker_blocked(stoker)
    if map_is_on_screen(stoker.x, stoker.y, stoker.z) then
       printl("STOKERS_PATH_IS_BLOCKED")
       play_md_sfx(0)
-   end  
+   end
 end
 
 function worktype_9C_stoker_return_to_conveyor_belt(actor)
@@ -252,9 +252,8 @@ function perform_worktype(actor)
       local func = worktype_tbl[actor.wt]
       func(actor)
    end
-   
+
    if mpts == actor.mpts then
       subtract_movement_pts(actor, 10)
    end
 end
-
diff --git a/devtools/create_ultima/files/ultima6/scripts/se/actor.lua b/devtools/create_ultima/files/ultima6/scripts/se/actor.lua
index 920d11b1bd..4968e4ba61 100644
--- a/devtools/create_ultima/files/ultima6/scripts/se/actor.lua
+++ b/devtools/create_ultima/files/ultima6/scripts/se/actor.lua
@@ -192,7 +192,7 @@ weapon_dmg_tbl = { --FIXME: all damage is made up
 [209] = 15, --lit torch
 --[212] = 1, --fishing pole (says bare handed)
 [240] = 30, --device (FIXME: explosive gas only hurts Myrmidex)
-[241] = 30 --activated device (FIXME: explosive gas only hurts Myrmidex) 
+[241] = 30 --activated device (FIXME: explosive gas only hurts Myrmidex)
 }
 
 armour_tbl = --FIXME: all armor value is made up
@@ -255,9 +255,9 @@ end
 function advance_time(num_turns)
 	--FIXME
 	local minute = clock_get_minute()
-	
+
 	clock_inc(num_turns)
-		
+
 	if minute + num_turns >= 60 then
 		update_actor_schedules()
 	end
@@ -273,7 +273,7 @@ function actor_get_obj(actor, obj) -- FIXME need to limit inventory slots
 		print("\nNot possible.")
 		return false
 	end
-	
+
 	if Actor.can_carry_obj_weight(actor, obj) == false then
 		print("\nThe total is too heavy.")
 		return false
@@ -289,4 +289,3 @@ end
 
 function player_post_move_action(did_move)
 end
-
diff --git a/devtools/create_ultima/files/ultima6/scripts/se/init.lua b/devtools/create_ultima/files/ultima6/scripts/se/init.lua
index 5856147d27..bc7588021e 100644
--- a/devtools/create_ultima/files/ultima6/scripts/se/init.lua
+++ b/devtools/create_ultima/files/ultima6/scripts/se/init.lua
@@ -58,7 +58,7 @@ function search(obj)
    if obj.on_map == false then
       return
    end
-   
+
    local found_obj = false
    local child
    local first_loop = true
@@ -80,18 +80,18 @@ function search(obj)
       script_wait(50)
       first_loop = false
    end
-   
+
    if prev_obj ~= nil then
       printfl("SEARCH_LAST_OBJ", prev_obj.look_string)
       Obj.moveToMap(prev_obj, obj.x, obj.y, obj.z)
    end
-   
+
    if found_obj == false then
       printl("SEARCHING_HERE_YOU_FIND_NOTHING")
    else
       print(".\n")
    end
-   
+
 end
 
 --tile_num, readied location
@@ -161,8 +161,8 @@ function obj_get_readiable_location(obj)
 	if g_readiable_objs_tbl[obj.tile_num] ~= nil then
 		return g_readiable_objs_tbl[obj.tile_num]
 	end
-	
-	return -1	
+
+	return -1
 end
 
 function create_object_needs_quan(obj_n)
diff --git a/devtools/create_ultima/files/ultima6/scripts/se/intro.lua b/devtools/create_ultima/files/ultima6/scripts/se/intro.lua
index 74ca1ef957..4c8360195b 100644
--- a/devtools/create_ultima/files/ultima6/scripts/se/intro.lua
+++ b/devtools/create_ultima/files/ultima6/scripts/se/intro.lua
@@ -14,7 +14,7 @@ local function should_exit(input)
 	if input ~=nil and input == SDLK_ESCAPE then
 		return true
 	end
-	
+
 	return false
 end
 
@@ -25,7 +25,7 @@ local function fade_out_sprite(sprite, speed)
 	else
 		speed = -3
 	end
-	
+
 	for i=0xff,0,speed do
 		sprite.opacity = i
 		canvas_update()
@@ -108,18 +108,18 @@ end
 
 local function origin_fx_sequence()
 	local g_img_tbl = image_load_all("title.lzc")
-	
+
 	canvas_set_palette("savage.pal", 2)
 
-	
+
 	local stars = sprite_new(g_img_tbl[0][0], 0, 24, true)
 	local logo_image = image_new(282,82)
 	image_blit(logo_image, g_img_tbl[0][1],0,16)
 	image_blit(logo_image, g_img_tbl[0][2],g_img_tbl[0][1].w,14)
 	image_blit(logo_image, g_img_tbl[0][3],g_img_tbl[0][1].w+g_img_tbl[0][2].w,0)
-	
+
 	local  logo = sprite_new(logo_image, 20, 70, false)
-	
+
 	local planet = sprite_new(g_img_tbl[12], 160, 48, true)
 	planet.clip_x = 0
 	planet.clip_y = 0
@@ -129,25 +129,25 @@ local function origin_fx_sequence()
 	players[1] = create_player_sprite(g_img_tbl[1][0], 58, 118)
 	players[2] = create_player_sprite(g_img_tbl[2][0], 186, 118)
 	players[3] = create_player_sprite(g_img_tbl[3][0], 278, 118)
-	
+
 	players[4] = create_player_sprite(g_img_tbl[4][0], 58, 126)
 	players[5] = create_player_sprite(g_img_tbl[5][0], 186, 126)
 	players[6] = create_player_sprite(g_img_tbl[6][0], 278, 126)
-	
+
 	players[7] = create_player_sprite(g_img_tbl[7][0], 58, 134)
 	players[8] = create_player_sprite(g_img_tbl[8][0], 186, 134)
 	players[9] = create_player_sprite(g_img_tbl[9][0], 278, 134)
-	
+
 	local conductor = sprite_new(g_img_tbl[10][0], 158, 98, true)
 	conductor.clip_x = 0
 	conductor.clip_y = 24
 	conductor.clip_w = 320
 	conductor.clip_h = 128
-	
+
 	fade_in()
 
 	music_play("music.lzc", 19)
-	
+
 	local i = 0
 	for i=0,6,1 do
 		conductor.image = g_img_tbl[10][i]
@@ -173,7 +173,7 @@ local function origin_fx_sequence()
 			conductor.image = g_img_tbl[10][j]
 			if poll_for_key_or_button(1) == true then return end
 		end
-	
+
 		conductor.image = g_img_tbl[10][14]
 		if poll_for_key_or_button(2) == true then return end
 		conductor.image = g_img_tbl[10][13]
@@ -183,21 +183,21 @@ local function origin_fx_sequence()
 		if poll_for_key_or_button(1) == true then return end
 			play_sfx(38, false)
 	end
-	
+
 	for i=16,20,1 do
 		conductor.image = g_img_tbl[10][i]
 		if poll_for_key_or_button(4) == true then return end
 	end
 	if poll_for_key_or_button(200) == true then return end
-	
+
 	play_sfx(12, false)
-	
+
 	conductor.image = g_img_tbl[10][6]
-	
+
 	for i=1,21,1 do
 		conductor.y = 98 + i * 12
 		conductor.image.scale = 100 + i * 15
-		
+
 		for j=1,9,1 do
 			players[j].y = players[j].y + 5
 			players[j].image.scale = 100 + i * 5
@@ -208,15 +208,15 @@ local function origin_fx_sequence()
 				players[j].x = players[j].x + 2
 			end
 		end
-	
+
 		if poll_for_esc(4) == true then return end
 	end
-	
-	
+
+
 	logo.visible = true
-	logo.image.scale = 10	
-	
-	
+	logo.image.scale = 10
+
+
 	for i=1,18,1 do
 		planet.y = planet.y + 6
 
@@ -227,18 +227,18 @@ local function origin_fx_sequence()
 		else
 			logo.y = logo.y + 1
 		end
-	
+
 		if poll_for_key_or_button(4) == true then return end
 	end
-	
+
 	fireworks(g_img_tbl, logo)
 end
 
 local function intro_sequence(g_img_tbl)
-	
+
 	canvas_set_palette("savage.pal", 0)
 	music_play("music.lzc", 18)
-		
+
 	local  logo = sprite_new(g_img_tbl[0][0], 0, 0, true)
 	fade_in()
 	if poll_for_key_or_button(175) == true then return end
@@ -511,7 +511,7 @@ local function ask_question(q_num, q_ord, sprites, text_image, a_b_border_img, i
 		end
 	end
 
-	local red = 0x04 
+	local red = 0x04
 	local black = 0x00
 	local answer = SDLK_a
 	local old_answer = 0
@@ -599,12 +599,12 @@ local function ask_question(q_num, q_ord, sprites, text_image, a_b_border_img, i
 			next_q = 3
 		end
 	end
-	
+
 	return next_q
 end
 
 
- 
+
 g_keycode_tbl =
 {
 [32]=" ",
@@ -698,22 +698,22 @@ local function create_new_character(img_tbl2)
 	create_char_sprites[28] = sprite_new(img_tbl2[3][18], 8, 28, false) -- Yellow
 	create_char_sprites[29] = sprite_new(img_tbl2[3][19], 8, 28, false) -- Blue
 	create_char_sprites[10] = sprite_new(img_tbl2[3][0], 8, 28, false) -- Drop Anim
-	create_char_sprites[11] = sprite_new(img_tbl2[3][1], 8, 28, false) -- 
-	create_char_sprites[12] = sprite_new(img_tbl2[3][2], 8, 28, false) -- 
-	create_char_sprites[13] = sprite_new(img_tbl2[3][3], 8, 28, false) -- 
-	create_char_sprites[14] = sprite_new(img_tbl2[3][4], 8, 28, false) -- 
-	create_char_sprites[15] = sprite_new(img_tbl2[3][5], 8, 28, false) -- 
-	create_char_sprites[16] = sprite_new(img_tbl2[3][6], 8, 28, false) -- 
-	create_char_sprites[17] = sprite_new(img_tbl2[3][7], 8, 28, false) -- 
-	create_char_sprites[18] = sprite_new(img_tbl2[3][8], 8, 28, false) -- 
-	create_char_sprites[19] = sprite_new(img_tbl2[3][9], 8, 28, false) -- 
-	create_char_sprites[20] = sprite_new(img_tbl2[3][10], 8, 28, false) -- 
-	create_char_sprites[21] = sprite_new(img_tbl2[3][11], 8, 28, false) -- 
-	create_char_sprites[22] = sprite_new(img_tbl2[3][12], 8, 28, false) -- 
-	create_char_sprites[23] = sprite_new(img_tbl2[3][13], 8, 28, false) -- 
-	create_char_sprites[24] = sprite_new(img_tbl2[3][14], 8, 28, false) -- 
-	create_char_sprites[25] = sprite_new(img_tbl2[3][15], 8, 28, false) -- 
-	create_char_sprites[26] = sprite_new(img_tbl2[3][16], 8, 28, false) -- 
+	create_char_sprites[11] = sprite_new(img_tbl2[3][1], 8, 28, false) --
+	create_char_sprites[12] = sprite_new(img_tbl2[3][2], 8, 28, false) --
+	create_char_sprites[13] = sprite_new(img_tbl2[3][3], 8, 28, false) --
+	create_char_sprites[14] = sprite_new(img_tbl2[3][4], 8, 28, false) --
+	create_char_sprites[15] = sprite_new(img_tbl2[3][5], 8, 28, false) --
+	create_char_sprites[16] = sprite_new(img_tbl2[3][6], 8, 28, false) --
+	create_char_sprites[17] = sprite_new(img_tbl2[3][7], 8, 28, false) --
+	create_char_sprites[18] = sprite_new(img_tbl2[3][8], 8, 28, false) --
+	create_char_sprites[19] = sprite_new(img_tbl2[3][9], 8, 28, false) --
+	create_char_sprites[20] = sprite_new(img_tbl2[3][10], 8, 28, false) --
+	create_char_sprites[21] = sprite_new(img_tbl2[3][11], 8, 28, false) --
+	create_char_sprites[22] = sprite_new(img_tbl2[3][12], 8, 28, false) --
+	create_char_sprites[23] = sprite_new(img_tbl2[3][13], 8, 28, false) --
+	create_char_sprites[24] = sprite_new(img_tbl2[3][14], 8, 28, false) --
+	create_char_sprites[25] = sprite_new(img_tbl2[3][15], 8, 28, false) --
+	create_char_sprites[26] = sprite_new(img_tbl2[3][16], 8, 28, false) --
 	create_char_sprites[3] = sprite_new(img_tbl2[1][1], 8, 28, true) -- Weird Border Around Shaman
 	-- TODO BORDER SHADOW (Solid Black)
 	-- TODO Memory Management on Image?
@@ -884,7 +884,7 @@ local function about_the_savage_empire(img_tbl2)
 	  table.insert(about_sprites, create_about_sprite(img_tbl2[6][i],   100, ypos))
 	  ypos = ypos + credit_heights[i+1]
 	end
-	
+
 	local done = 0
 
    local k,v
@@ -899,7 +899,7 @@ local function about_the_savage_empire(img_tbl2)
 			break
 		end
 	end
-   
+
 	destroy_sprites(about_sprites)
 end
 
@@ -1113,7 +1113,7 @@ canvas_set_bg_color(0)
 canvas_set_opacity(0)
 
 origin_fx_sequence()
-	
+
 --canvas_hide_all_sprites()
 
 -- Load Graphics for Intro & Main Menu
@@ -1128,4 +1128,4 @@ end
 
 music_stop()
 canvas_hide_all_sprites()
-canvas_hide()
\ No newline at end of file
+canvas_hide()
diff --git a/devtools/create_ultima/files/ultima6/scripts/se/look.lua b/devtools/create_ultima/files/ultima6/scripts/se/look.lua
index 80a31eaacc..2e3994426f 100644
--- a/devtools/create_ultima/files/ultima6/scripts/se/look.lua
+++ b/devtools/create_ultima/files/ultima6/scripts/se/look.lua
@@ -3,23 +3,23 @@ local look_usecode = {
 
 function look_obj(obj)
    printfl("YOU_SEE", obj.look_string);
-   
+
    --FIXME usecode look description should be lua code.
    if usecode_look(obj) then
       print("\n")
       return false
    end
-   
+
    print(".\n\n");
-   
+
    if look_usecode[obj.obj_n] ~= nil then
       look_usecode[obj.obj_n](obj)
       print("\n")
    end
-   
+
    if is_container_obj(obj.obj_n) then
       search(obj)
    end
-   
+
    return false
-end
\ No newline at end of file
+end
diff --git a/devtools/create_ultima/files/ultima6/scripts/se/usecode.lua b/devtools/create_ultima/files/ultima6/scripts/se/usecode.lua
index 43166923ed..cc7d5c4c8f 100644
--- a/devtools/create_ultima/files/ultima6/scripts/se/usecode.lua
+++ b/devtools/create_ultima/files/ultima6/scripts/se/usecode.lua
@@ -253,4 +253,4 @@ end
 
 function is_ranged_select(operation)
    return false
-end
\ No newline at end of file
+end
diff --git a/devtools/create_ultima/files/ultima6/scripts/u6/actor.lua b/devtools/create_ultima/files/ultima6/scripts/u6/actor.lua
index 0d83f7706c..2ff0e6300b 100644
--- a/devtools/create_ultima/files/ultima6/scripts/u6/actor.lua
+++ b/devtools/create_ultima/files/ultima6/scripts/u6/actor.lua
@@ -1,7 +1,7 @@
 --io.stderr:write("actor.lua get here\n")
 
 
---Worktypes      
+--Worktypes
 WT_NOTHING                = 0x0  --do nothing
 
 WT_FOLLOW                 = 0x1  --follow avatar (in party)
@@ -54,9 +54,9 @@ wt_rear_max_monster = nil
 wt_rear_min_monster = nil
 wt_rear_max_party = nil
 wt_rear_min_party = nil
-      
+
 combat_avg_x, combat_avg_y, party_avg_x, party_avg_y = -1, -1, -1, -1
-      
+
 wt_front_target_actor = nil
 
 wt_num_monsters_near = 0
@@ -100,9 +100,9 @@ actor_tbl = {
 [411] = {40, 35, 27, 150, 30, ALIGNMENT_EVIL, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, {34,83,68,96,119}, {}, {}, {98,88,88}, 12},
 --Drake
 [369] = {22, 22, 13, 50, 10, ALIGNMENT_EVIL, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, {34,68}, {}, {}, {88,88}, 4},
---Woman 
+--Woman
 [387] = {10, 14, 15, 8, 4, ALIGNMENT_NEUTRAL, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, {}, {38}, {185}, {88}, 0},
---Farmer 
+--Farmer
 [385] = {15, 15, 10, 8, 4, ALIGNMENT_NEUTRAL, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, {}, {105,101}, {17}, {88}, 0},
 --Fighter
 [376] = {20, 17, 11, 20, 6, ALIGNMENT_CHAOTIC, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, {}, {43,42}, {21,10,3,22}, {88,88}, 0},
@@ -132,11 +132,11 @@ actor_tbl = {
 [383] = {14, 16, 12, 8, 4, ALIGNMENT_CHAOTIC, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, {}, {38,33}, {17}, {88}, 0},
 --Lord British
 [409] = {30, 30, 30, 255, 255, ALIGNMENT_GOOD, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, {}, {}, {}, {}, 30},
---Musician 
+--Musician
 [386] = {12, 16, 14, 8, 4, ALIGNMENT_CHAOTIC, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, {}, {41,33,43}, {19,1,9}, {88,158}, 0},
 --Mage
 [378] = {10, 14, 22, 30, 4, ALIGNMENT_EVIL, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, {17,34,20,49,68,80,69,83}, {38}, {17,1}, {58,98,88}, 0},
---Merchant 
+--Merchant
 [380] = {12, 12, 18, 8, 4, ALIGNMENT_EVIL, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, {}, {38,43}, {17,1}, {88}, 0},
 --Mimic
 [98] = {22, 9, 8, 30, 15, ALIGNMENT_CHAOTIC, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, {18,80}, {}, {}, {98,98}, 5},
@@ -204,7 +204,7 @@ function actor_put_to_sleep(actor)
 	if actor.obj_n == 431 then --horse with rider
 		Actor.use(actor) --dismount from horse
 	end
-	
+
 	if actor.actor_num ~= 0 then
 		actor.asleep = true
 		if actor.in_party == true then
@@ -236,20 +236,20 @@ function actor_int_check(defender, attacker)
    if (math.floor(actor_int_adj(attacker) / 2) + 15) - actor_int_adj(defender) > math.random(1, 30) then
       return true -- defender lost
    end
-   
+
    return false
 -- if((actor1_int_adj / 2 + 15) - actor2_int_adj > random(1,30))
---return 
+--return
 
 end
 
 function subtract_movement_pts(actor, pts)
    if actor.obj_n == 0x1af then pts = math.floor(pts / 2) end --if horse with rider
-    
+
    --fixme check with the original there are two timers that are checked but never seem to be used.
-   
+
    if pts < 1 then pts = 1 end
-   
+
    actor.mpts = actor.mpts - pts
 
    if g_avatar_died == true then
@@ -264,25 +264,25 @@ function actor_move(actor, direction, flag)
    if direction == DIR_SOUTH then y = y + 1 end
    if direction == DIR_EAST then x = x + 1 end
    if direction == DIR_WEST then x = x - 1 end
-   
+
    actor.direction = direction
    local did_move = Actor.move(actor, x, y, z)
-   
+
    --actor.direction = direction
-      
+
    if did_move then
       if actor.obj_n == 0x177 then slime_update_frames() end
       subtract_map_movement_pts(actor)
       ----dgb("actor_move() did move actor("..actor.x..","..actor.y..")\n");
    end
-   
+
    return did_move and 1 or 0
 end
 
 function actor_move_diagonal(actor, x_direction, y_direction)
    local x,y,z = actor.x, actor.y, actor.z
    local direction
-   
+
    if y_direction == DIR_NORTH then
       y = y - 1
       direction = x_direction == DIR_EAST and DIR_NORTHEAST or DIR_NORTHWEST
@@ -303,7 +303,7 @@ function actor_move_diagonal(actor, x_direction, y_direction)
    ----dgb("actor_move_diagonal("..actor.name..", "..direction_string(direction)..")\n");
    actor.direction = y_direction
    local did_move = Actor.move(actor, x, y, z)
-   
+
    if did_move then
       ----dgb("did move\n");
       if actor.obj_n == 0x177 then slime_update_frames() end
@@ -311,7 +311,7 @@ function actor_move_diagonal(actor, x_direction, y_direction)
 
       --dgb("set dir = "..direction_string(direction).." y_dir ="..direction_string(y_direction).." ")
    end
-   
+
    return did_move and 1 or 0
 end
 
@@ -328,7 +328,7 @@ function actor_map_dmg(actor, map_x, map_y, map_z)
 		local map_tile = map_get_dmg_tile_num(map_x, map_y, map_z)
 		if map_tile ~= nil then
 			actor_tile_dmg(actor, map_tile)
-			
+
 			if map_tile == 732 then
 				local trap_obj = map_get_obj(map_x, map_y, map_z, 0xad) --trap
 				if trap_obj ~= nil then
@@ -378,7 +378,7 @@ function actor_tile_dmg(actor, map_tile)
 				if actor_type ~= nil and actor_type[17] == 1 then --double damage from fire
 					dmg = dmg * 2
 				end
-				
+
 				actor_hit(actor, dmg, nil)
 
 			elseif map_tile == 732 or map_tile == 1010 then
@@ -393,7 +393,7 @@ function actor_tile_dmg(actor, map_tile)
 			elseif map_tile == 562 or map_tile == 731 then
 				--force field, spikes
 				actor_hit(actor, random(1, 8), nil)
-					
+
 			elseif map_tile == 1167 then
 				--sleepfield
 				if (actor_type == nil or actor_type[21] == 0) and actor.asleep == false then --21 immune to sleep spell
@@ -409,33 +409,33 @@ function actor_get_max_magic_points(actor)
    if obj_n == 410 then --avatar
       return actor.int * 2
    end
-   
+
    if obj_n == 378 then --mage
       return actor.int
    end
-   
+
    if obj_n == 377 or obj_n == 386 then --swashbuckler, musician
       return math.floor(actor.int/2)
    end
-   
+
    return 0
 end
 
 function actor_str_adj(actor)
-   
+
    local str = actor.str
 
    if actor.cursed == false then return str end
-   
+
    if str <= 3 then
       return 1
    end
-   
+
    return str - 3
 end
 
 function actor_dex_adj(actor)
-   
+
    local dex = actor.dex
    if actor.cursed == true then
       if dex <= 3 then
@@ -444,11 +444,11 @@ function actor_dex_adj(actor)
          dex = dex - 3
       end
    end
-        
+
    if g_time_stopped == true or actor.asleep == true then
      dex = 1
    end
-   
+
    return dex
 end
 
@@ -458,9 +458,9 @@ function actor_int_adj(actor)
    if actor.cursed == true then
      int = int - 3
    end
-   
+
    if int < 1 then int = 1 end
-   
+
    return int
 end
 
@@ -491,24 +491,24 @@ function actor_combat_hit_check(attacker, foe, weapon_obj)
 			use_str = true
 		end
 	end
-   
+
    local attack_role
-   
+
    if use_str then
       attack_role = actor_str_adj(attacker)
    else
       attack_role = actor_dex_adj(attacker)
    end
-   
+
    local foe_dex = actor_dex_adj(foe)
    local roll = math.random(1,30)
-   
+
    --dgb("foe_dex = "..foe_dex.." attack_role = "..attack_role.." random(1,30) = "..roll.."\n\n")
-   
+
    if math.floor((foe_dex + 30 - attack_role) / 2) >= roll then
       return false
    end
-   
+
    return true
 end
 
@@ -520,7 +520,7 @@ function actor_init(actor, alignment)
 
  local actor_base = actor_tbl[actor.obj_n]
  if actor_base ~= nil then
- 
+
    actor.str = actor_randomise_stat(actor_base[1])
    actor.dex = actor_randomise_stat(actor_base[2])
    actor.int = actor_randomise_stat(actor_base[3])
@@ -536,17 +536,17 @@ function actor_init(actor, alignment)
    actor.level = 1
    --actor.status = 32
  end
- 
+
    if alignment ~= nil and alignment ~= ALIGNMENT_DEFAULT then
       actor.align = alignment
    end
-   
+
    actor.wt = 8
    actor.combat_mode = 8
    actor.magic = actor_get_max_magic_points(actor)
    actor.mpts = actor.dex
    actor.exp = 100
-   
+
 	if actor.obj_n == 0x16d then --tangle vine pod. Add tangle vines.
 		local actor_x = actor.x
 		local actor_y = actor.y
@@ -560,21 +560,21 @@ function actor_init(actor, alignment)
      	if map_can_put(actor_x - 1, actor_y, actor_z) then
      		a = Actor.new(0x16e, actor_x - 1, actor_y, actor_z, actor.align, WT_TANGLE)
      		if a ~= nil then a.direction = DIR_WEST end
-     	end 
+     	end
      	if map_can_put(actor_x, actor_y + 1, actor_z) then
      		a = Actor.new(0x16e, actor_x, actor_y + 1, actor_z, actor.align, WT_TANGLE)
      		if a ~= nil then a.direction = DIR_SOUTH end
-     	end  
+     	end
 		if map_can_put(actor_x, actor_y - 1, actor_z) then
      	   	a = Actor.new(0x16e, actor_x, actor_y - 1, actor_z, actor.align, WT_TANGLE)
      	   	if a ~= nil then a.direction = DIR_NORTH end
-     	end    	
+     	end
 	end
-   
+
  if actor_base ~= nil then
-   
+
    local obj,i,v,j,qty,chance,chest
-   
+
    --add spells
    for i,v in ipairs(actor_base[22]) do
         obj = Obj.new(336) --charge
@@ -612,19 +612,19 @@ function actor_init(actor, alignment)
             obj = Obj.new(56) --bolt
             obj.status = 49
             obj.qty = math.random(12, 24)
-            Actor.inv_add_obj(actor, obj)           
+            Actor.inv_add_obj(actor, obj)
          end
       end
 
       chance = chance * 2
    end
-   
+
    -- actor armor
    chance = 2
    for i,v in ipairs(actor_base[24]) do
-      
+
       if math.random(1,chance) == 1 then
-      
+
         obj = Obj.new(v)
         obj.status = 57
         obj.qty = 1
@@ -632,15 +632,15 @@ function actor_init(actor, alignment)
         Actor.inv_add_obj(actor, obj)
         Actor.inv_ready_obj(actor, obj)
       end
-      
+
       chance = chance * 2
    end
-   
+
    --actor treasure
    chance = 2
    for i,v in ipairs(actor_base[25]) do
-      
-      if math.random(1,chance) == 1 then    
+
+      if math.random(1,chance) == 1 then
          if v == 98 then --chest
             chest = Obj.new(v)
             chest.frame_n = 1
@@ -697,7 +697,7 @@ function actor_init(actor, alignment)
                obj.status = 49
                obj.qty = 1
                Actor.inv_add_obj(actor, obj)
-            end              
+            end
          elseif v == 88 then --gold coin
             obj = Obj.new(v)
             obj.status = 49
@@ -711,10 +711,10 @@ function actor_init(actor, alignment)
          end
 
       end
-      
+
       chance = chance * 2
    end
- end   
+ end
 end
 
 -- [objectnum] = range
@@ -739,7 +739,7 @@ end
       [80] = 7, -- fire wand
    }
 
-local projectile_weapon_tbl = 
+local projectile_weapon_tbl =
 {
 --obj_n = {tile_num, initial_tile_rotation, speed, rotation_amount}
 [33] = {398, 0, 2, 0}, -- sling
@@ -830,11 +830,11 @@ armour_tbl =
 
 function get_weapon_dmg(weapon_obj_n)
    local dmg = weapon_dmg_tbl[weapon_obj_n]
-   
+
    if dmg == nil and actor_tbl[weapon_obj_n] ~= nil then
       dmg = actor_tbl[weapon_obj_n][5]
    end
-   
+
    return dmg
 end
 
@@ -842,10 +842,10 @@ function actor_get_ac(actor)
 
    local ac = 0
    local obj
-     
+
    for obj in actor_inventory(actor) do
       if obj.readied then
-      
+
          local armour = armour_tbl[obj.obj_n]
          if armour ~= nil then
             ac = ac + armour
@@ -856,11 +856,11 @@ function actor_get_ac(actor)
    if actor.cursed == true then
       ac = ac - 3
    end
-   
+
    if actor.protected == true then
       ac = ac + 3
    end
-   
+
    return ac
 end
 
@@ -875,7 +875,7 @@ function actor_select_obj_from_tbl(actor, obj_list_tbl)
 			end
 		end
 	end
-	
+
 	return selected_obj
 end
 
@@ -899,9 +899,9 @@ function acid_slug_dissolve_item(target_actor)
 	[0x2B] = 1,
 	[0x71] = 1,
 	[0x72] = 1 }
-	
+
 	local obj = actor_select_obj_from_tbl(target_actor, acid_slug_items)
-	
+
 	if obj ~= nil then
 		play_sfx(SFX_SLUG_DISSOLVE, true)
 		print("A slug dissolves "..target_actor.name.."'s "..obj.name.."!\n")
@@ -921,9 +921,9 @@ function gremlin_steal_item(target_actor)
 	[0xD1] = 1,
 	[0xD2] = 1,
 	[0xD3] = 1 }
-	
+
 	local obj = actor_select_obj_from_tbl(target_actor, gremlin_items)
-	
+
 	if obj ~= nil then
 		play_sfx(SFX_FAILURE, true)
 		print("`"..target_actor.name.."  has been robbed!\n")
@@ -941,7 +941,7 @@ function actor_take_hit(attacker, defender, max_dmg)
    elseif max_dmg > 1 and max_dmg ~= 255 then
       max_dmg = math.random(1, max_dmg)
    end
-   
+
    local ac
    local defender_type = defender.luatype
    if defender_type == "actor" then
@@ -959,7 +959,7 @@ function actor_take_hit(attacker, defender, max_dmg)
         return
      elseif attacker.in_party then
         max_dmg = 255
-     end 
+     end
    end
    if max_dmg > 0 then
       if defender_type == "actor" and defender.wt > 1 and defender.wt < 16 then
@@ -967,26 +967,26 @@ function actor_take_hit(attacker, defender, max_dmg)
       end
 
       local exp_gained = actor_hit(defender, max_dmg, attacker)
-      
+
       attacker.exp = attacker.exp + exp_gained
    else
       print("`"..defender.name.." grazed.\n")
    end
-   
+
    if defender_type == "actor" then
-      
+
       actor_yell_for_help(attacker, defender, max_dmg)
-      
+
       local defender_obj_n = defender.obj_n
-      
-      if defender.alive == true 
+
+      if defender.alive == true
         or defender_obj_n == 0x1a7 --balloon
         or defender_obj_n == 0x19e --skiff
         or defender_obj_n == 0x19f --raft
         or defender_obj_n == 0x19c then --ship
-        
+
          local attacker_obj_n = attacker.obj_n
-         
+
          if attacker_obj_n == 0x165 then --corpser
          	play_sfx(SFX_CORPSER_DRAGGED_UNDER, true)
             print("`"..defender.name.." dragged under!\n")
@@ -995,21 +995,21 @@ function actor_take_hit(attacker, defender, max_dmg)
                party_update_leader()
             end
          end
-        
+
          if attacker_obj_n == 0x16c then --acid slug
          	acid_slug_dissolve_item(defender)
          end
-         
+
          if attacker_obj_n == 0x161 then --gremlin
          	gremlin_steal_item(defender)
          end
-         
+
          local actor_type = actor_tbl[attacker_obj_n]
          if actor_type ~= nil and actor_type[15] == 1 and math.random(0, 3) == 0 and defender.actor_num ~= 0 then --actor is poisonous, don't poison vehicles.
          	defender.poisoned = true
          	print("`"..defender.name.." poisoned!\n")
          end
-         
+
          if max_dmg > 0 then
          	actor_hit_msg(defender)
          end
@@ -1017,19 +1017,19 @@ function actor_take_hit(attacker, defender, max_dmg)
          print("`"..defender.name.." killed!\n")
          --FIXME do party roster change. maybe
       end
-      
+
    end
 end
 
 function actor_hit(defender, max_dmg, attacker, no_hit_anim)
-	
+
 	local defender_obj_n = defender.obj_n
 	local exp_gained = 0
-	
+
 	if defender_obj_n == 0x1a7 then -- balloon.
 		return 0
 	end
-	
+
 	if defender.luatype == "actor" then
 		if is_god_mode_enabled() then
 			if defender.in_party then
@@ -1052,7 +1052,7 @@ function actor_hit(defender, max_dmg, attacker, no_hit_anim)
 			if num_in_party > 1 then
 				party_member_num = math.random(0, num_in_party - 1)
 			end
-			
+
 			local rand_party_member = party_get_member(party_member_num)
 			actor_hit(rand_party_member, max_dmg, attacker, true)
 			actor_hit_msg(rand_party_member)
@@ -1071,9 +1071,9 @@ function actor_hit(defender, max_dmg, attacker, no_hit_anim)
 							exp_gained = math.floor((actor_base[1] + actor_base[2] + actor_base[3] + actor_base[4] + actor_base[5] + actor_base[26]) / 4)
 						end
 					end
-					
+
 					defender.visible = true
-					
+
 					if defender.obj_n == 412 and defender.actor_num == 0 then --handle ship destruction
 						Actor.unlink_surrounding_objs(defender, true) --unlink ship front/back and make objects temporary.
 						defender.base_obj_n = 0x19f --raft
@@ -1095,7 +1095,7 @@ function actor_hit(defender, max_dmg, attacker, no_hit_anim)
 						if defender.in_party == true and defender.in_vehicle == false then
 							party_update_leader()
 						end
-					end	
+					end
 				end
 			else
 				defender.hp = defender.hp - max_dmg
@@ -1118,9 +1118,9 @@ function actor_hit(defender, max_dmg, attacker, no_hit_anim)
 				and (defender_obj_n ~= 0x62 or defender.frame_n ~= 3) then --don't attack open chests
 				if defender.qty <= max_dmg then
 					print("\n`"..defender.name .. " broken!\n")
-	
+
 					local child
-					for child in container_objs(defender) do  -- look through container for effect object. 
+					for child in container_objs(defender) do  -- look through container for effect object.
 					  if child.obj_n == 0x151 then --effect
 					  	if attacker ~= nil then
 					  	  actor_use_effect(attacker, child)
@@ -1130,7 +1130,7 @@ function actor_hit(defender, max_dmg, attacker, no_hit_anim)
 					  	Obj.moveToMap(child, defender.x, defender.y, defender.z)
 					  end
 					end
-					
+
 					if defender_obj_n == 0x7b then --mirror
 						play_sfx(SFX_BROKEN_GLASS)
 						defender.frame_n = 2
@@ -1144,26 +1144,26 @@ function actor_hit(defender, max_dmg, attacker, no_hit_anim)
 			end
 		end
 	end
-	
+
 	return exp_gained
 end
 
 function actor_hit_msg(actor)
 
 	if actor.obj_n == 0x1a7 then return end --balloon
-	
+
 	local hp = actor.hp
-	
+
 	if hp == 0 then return end
-	
+
 	local di = math.floor((hp * 4) / actor.max_hp)
-	
+
 	local s
-	
+
 	if di < 4 then
 		s = "\n`"..actor.name.." "
 	end
-	
+
 	if di == 0 then
 		s = s.."critical!\n"
 		local wt = actor.wt
@@ -1171,7 +1171,7 @@ function actor_hit_msg(actor)
 			actor.wt = WT_RETREAT
 		end
 	elseif di < 4 then
-	
+
 		if di == 1 then
 			s = s.."heavily "
 		elseif di == 2 then
@@ -1181,7 +1181,7 @@ function actor_hit_msg(actor)
 		end
 		s = s.."wounded.\n"
 	end
-	
+
 	if s ~= nil then
 		print(s)
 	end
@@ -1193,14 +1193,14 @@ function actor_dead(actor)
 		if actor.obj_n == 0x163 then --gazer
 			Actor.new(0x157, actor.x, actor.y, actor.z) --insect
 		end
-		
+
 		if actor_base[9] == 1 then --fades away. magical creature.
 			Actor.fade_out(actor, 20) --FIXME make fade speed configurable.
 		end
 	end
-	
+
 	local in_vehicle = actor.in_vehicle
-	
+
 	if in_vehicle == false and actor_base ~= nil and actor_base[8] == 1 or actor.obj_n == 0x187 or actor.obj_n == 0x188 then --farmer, musician
 		--add some blood.
 		--dgb("\nAdding Blood\n")
@@ -1214,7 +1214,7 @@ function actor_dead(actor)
 		if in_vehicle == true then
 			create_body = false -- don't drop body when party member dies on raft.
 		end
-		
+
 		if actor_is_readiable_obj(actor) then
 			local animated_obj = Obj.new(actor.obj_n)
 			Obj.moveToMap(animated_obj, actor.x, actor.y, actor.z)
@@ -1227,7 +1227,7 @@ function actor_dead(actor)
 		actor.hp = 0 -- hackish way of making the Avatar not extinguish his torch
 		g_avatar_died = true
 	end
-	
+
 	if actor.obj_n == 0x177 then
 		slime_update_frames()
 	end
@@ -1256,26 +1256,26 @@ function bitor(x, y)
  local p = 1
   while p < x do p = p + p end
   while p < y do p = p + p end
-  local z = 0 
+  local z = 0
   repeat
    if p <= x or p <= y then
-     z = z + p 
-     if p <= x then 
-     x = x - p 
-     end 
+     z = z + p
+     if p <= x then
+     x = x - p
+     end
      if p <= y then y = y - p end
-   
+
    end
   p = p * 0.5
   until p < 1
   return z
-end 
+end
 --]]
 function slime_update_frames()
 
 	local i, j
 	local pow = math.pow
-	
+
 	for i=1,0xff do
 		local actor = Actor.get(i)
 		if actor.obj_n == 0x177 and actor.alive then --slime
@@ -1284,7 +1284,7 @@ function slime_update_frames()
 			for j = 1,8,2 do
 				local tmp_actor = map_get_actor(actor.x + movement_offset_x_tbl[j], actor.y + movement_offset_y_tbl[j], actor.z)
 				if tmp_actor ~= nil and tmp_actor.obj_n == 0x177 and tmp_actor.alive then
-					new_frame_n = new_frame_n + pow(2,idx)	
+					new_frame_n = new_frame_n + pow(2,idx)
 				end
 				idx = idx + 1
 			end
@@ -1299,13 +1299,13 @@ function combat_range_check_target(actor_attacking)
 --[[ FIXME
       target = actor_attacking.target_obj
       if target ~= actor_attacking then
-      
+
          if target.obj_n ~= 0 and target.alive == true and target.asleep == false and target.paralysed == false and target.corpser_flag == false then
-         
+
             if abs(actor_attacking.x - target.x) < 2 then
-            
+
                if abs(actor_attacking.y - target.y) < 2 and (time_stop_spell_timer == 0 or target.in_party == true) then
-               
+
                   return false
                end
             end
@@ -1313,7 +1313,7 @@ function combat_range_check_target(actor_attacking)
       end
 --]]
    end
-   
+
 return true
 end
 
@@ -1351,16 +1351,16 @@ function actor_attack(attacker, target_x, target_y, target_z, weapon, foe)
 		print("\n"..attacker.name.." is try to attack itself. Report me!\n")  -- this shouldn't happen
 		return
 	end
-   
+
    if foe == nil then
       foe = map_get_obj(target_x, target_y, target_z);
    end
-   
+
    --dgb("\nactor_attack()\nrange = " .. get_attack_range(attacker.x,attacker.y, target_x, target_y).." weapon range="..get_weapon_range(weapon_obj_n))
    if weapon_obj_n ~= attacker.obj_n then
       --dgb("\nweapon = "..weapon.name.."obj_n = "..weapon_obj_n.."\n")
    end
-   
+
    if Actor.get_range(attacker, target_x, target_y) > get_weapon_range(weapon_obj_n) then
       return
    end
@@ -1375,7 +1375,7 @@ function actor_attack(attacker, target_x, target_y, target_z, weapon, foe)
    local x_diff = target_x - attacker.x
    local y_diff = target_y - attacker.y
    local attacker_direction
-   
+
    if abs(x_diff) <= abs(y_diff) then
      attacker_direction = (y_diff >= 0) and DIR_SOUTH or DIR_NORTH
    else
@@ -1406,7 +1406,7 @@ function actor_attack(attacker, target_x, target_y, target_z, weapon, foe)
       attacker.frame_n = (frame_n - (frame_n % 4)) + 2
    end
 
-   
+
    local is_range_weapon = false
 
    if weapon_obj_n ~= 40 and weapon_obj_n ~= 47 then -- morning star, halberd
@@ -1415,47 +1415,47 @@ function actor_attack(attacker, target_x, target_y, target_z, weapon, foe)
          if combat_range_check_target(attacker) == false then return 1 end
       end
    end
-     
+
    local dmg = get_weapon_dmg(weapon_obj_n)
    if dmg == nil then
       dmg = 1
    end
-   
+
    --FIXME run unknown func sub_1EABC here.
-   local player_loc = player_get_location()  
+   local player_loc = player_get_location()
 
    if weapon_obj_n == 0x150 or weapon_obj_n == 0x39 then --charge, spellbook
 
       if weapon_quality == 0x81 and actor_obj_n == 0x175 then -- special wisp magic (wisp teleport), wisp
-                  
+
          if toss_actor(attacker, player_loc.x, player_loc.y, player_loc.z) == true then
-         
+
             print("Wisp teleports!\n")
          end
 
          return
       end
-      
+
       local spell_retcode = 0
 
       magic_cast_spell(weapon_quality, attacker, {x = target_x, y = target_y, z = target_z})
-      
+
       if weapon_quality == 0x50 and spell_retcode == 0xfe then
          print("`"..foe.name .. " is charmed.\n")
       elseif weapon_quality == 0x45 and spell_retcode == 0 then
          print("`"..foe.name .. " is paralyzed.\n")
       end
-      
+
       return
    end
-   
+
 
    --weapon here.
 
    local hit_actor = actor_combat_hit_check(attacker, foe, weapon)
    local num_bolts
    local missed_target = false
-   
+
    if is_range_weapon == true then
       --FIXME might need to get new foe here.
       target_x, target_y = map_line_hit_check(attacker.x, attacker.y, target_x, target_y, attacker.z)
@@ -1479,13 +1479,13 @@ function actor_attack(attacker, target_x, target_y, target_z, weapon, foe)
             end
          end
       end
-      
+
       if weapon_obj_n == 0x32 then --triple crossbow
          num_bolts = Actor.inv_get_obj_total_qty(attacker, 0x38)
          --dgb("total num_bolts = "..num_bolts.."\n")
          if num_bolts > 3 then num_bolts = 3 end
       end
-      
+
       if failed_line_check == false then
       --FIXME might need to get new foe here.
       target_x, target_y = map_line_hit_check(attacker.x, attacker.y, target_x, target_y, attacker.z)
@@ -1495,25 +1495,25 @@ function actor_attack(attacker, target_x, target_y, target_z, weapon, foe)
          end
       end
       combat_range_weapon_1D5F9(attacker, target_x, target_y, target_z, foe, weapon)
-      
-      
+
+
    else --standard weapon
       if actor_find_max_xy_distance(attacker, player_loc.x, player_loc.y) < 6 then
          --play_sound_effect(0x11, 0);
          play_sfx(SFX_ATTACK_SWING, true)
       end
    end
-   
+
    if weapon_obj_n == 0x32 then --triple crossbow
 
       local off = ((attacker.y - target_y + 5) * 11) + (attacker.x - target_x + 5)
       local i
       for i=1,num_bolts do
-      
+
          if i > 1 then
             --dgb("num_bolts = "..num_bolts.." off = "..off.." target_x = "..target_x.." target_y = "..target_y.."attacker.x = "..attacker.x.." attacker.y = "..attacker.y.."\n\n")
             local t = g_projectile_offset_tbl[i-1][off+1]
-            
+
             foe = map_get_actor(target_x + movement_offset_x_tbl[t+1], target_y + movement_offset_y_tbl[t+1], player_loc.z)
             --dgb("new_x = "..target_x + movement_offset_x_tbl[t+1].." new_y = "..target_y + movement_offset_y_tbl[t+1].."\n");
             if failed_line_check == true then
@@ -1538,25 +1538,25 @@ function actor_attack(attacker, target_x, target_y, target_z, weapon, foe)
 
       end
    else
-   
+
       if hit_actor == true then
-      
+
          local actor_base = actor_tbl[foe.obj_n]
          if actor_base ~= nil and actor_base[14] == 1 -- takes half dmg
             and weapon_obj_n ~= 0x30 and weapon_obj_n ~= 0x32 and weapon_obj_n ~= 0x36 then --glass sword, triple crossbow, magic bow
             dmg = math.floor((dmg + 1) / 2)
          end
-         
+
          if weapon_obj_n ~= 0x5b then --Zu Ylem
             actor_take_hit(attacker, foe, dmg)
          end
-      
+
          if weapon_obj_n == 0x30 then
             print("Thy sword hath shattered!\n")
             Actor.inv_remove_obj(attacker, weapon)
          end
       end
-      
+
       if weapon_obj_n == 0x31 then --boomerang
          if attacker.x ~= 0 and attacker.y ~= 0 then --hack to stop return projectile if the avatar has died
          	projectile(projectile_weapon_tbl[weapon_obj_n][1], target_x, target_y, attacker.x, attacker.y, projectile_weapon_tbl[weapon_obj_n][3], projectile_weapon_tbl[weapon_obj_n][4])
@@ -1570,13 +1570,13 @@ function combat_range_weapon_1D5F9(attacker, target_x, target_y, target_z, foe,
 
    local weapon_obj_n = weapon.obj_n
    local random = math.random
-   
+
    if weapon_obj_n == 0x32 then --triple cross bow
       local index = ((attacker.y - target_y + 5) * 11) + (attacker.x - target_x + 5) + 1
       local triple_crossbow_targets = {
                       {x=target_x,
                        y=target_y,
-                       z=target_z}, 
+                       z=target_z},
                       {x=target_x + movement_offset_x_tbl[g_projectile_offset_tbl[1][index]+1],
                        y=target_y + movement_offset_y_tbl[g_projectile_offset_tbl[1][index]+1],
                        z=target_z},
@@ -1584,12 +1584,12 @@ function combat_range_weapon_1D5F9(attacker, target_x, target_y, target_z, foe,
                        y=target_y + movement_offset_y_tbl[g_projectile_offset_tbl[2][index]+1],
                        z=target_z}
                     }
-                    
+
       projectile_anim_multi(projectile_weapon_tbl[weapon_obj_n][1], attacker.x, attacker.y, triple_crossbow_targets, projectile_weapon_tbl[weapon_obj_n][3], 0, projectile_weapon_tbl[weapon_obj_n][2])
-   else    
+   else
       projectile(projectile_weapon_tbl[weapon_obj_n][1], attacker.x, attacker.y, target_x, target_y, projectile_weapon_tbl[weapon_obj_n][3], projectile_weapon_tbl[weapon_obj_n][4])
    end
-    
+
    if weapon_obj_n == 0x5b then
       --Zu Ylem
       if foe ~= nil and foe.obj_n ~= 0 then
@@ -1606,13 +1606,13 @@ function combat_range_weapon_1D5F9(attacker, target_x, target_y, target_z, foe,
       --flask of oil
 
       Actor.inv_remove_obj_qty(attacker, 0x53, 1)
-                  
+
       if map_is_water(target_x,target_y,target_z) == false then
 	      local obj = Obj.new(317); --fire field
           obj.temporary = true
 	      Obj.moveToMap(obj, target_x, target_y, target_z)
       end
-      
+
    elseif weapon_obj_n == 0x24 or weapon_obj_n == 0x25 or weapon_obj_n == 0x26 then
       --spear, throwing axe, dagger
 
@@ -1622,7 +1622,7 @@ function combat_range_weapon_1D5F9(attacker, target_x, target_y, target_z, foe,
 	      obj.temporary = true
 		  Obj.moveToMap(obj, target_x, target_y, target_z)
 	  end
-      	      
+
    elseif weapon_obj_n == 0x29 or weapon_obj_n == 0x2a or weapon_obj_n == 0x32 or weapon_obj_n == 0x36 then
       --bow, crossbow, triple crossbow, magic bow
       local projectile_obj = nil
@@ -1631,15 +1631,15 @@ function combat_range_weapon_1D5F9(attacker, target_x, target_y, target_z, foe,
       else
       	projectile_obj = 0x38 --bolt
       end
-      
+
       local qty = 1
       if weapon_obj_n == 0x32 then -- triple crossbow
       	qty = 3
       end
-      
+
       Actor.inv_remove_obj_qty(attacker, projectile_obj, qty)
    end
-   
+
    return 1
 end
 
@@ -1647,22 +1647,22 @@ end
 -- actor_get_weapon()
 --
 function actor_get_weapon(attacker, foe)
-   
+
    if foe == nil then return nil end
-   
+
    local in_party = attacker.in_party
    local range = Actor.get_range(attacker, foe.x, foe.y)
    --dgb("range = "..range.."\n")
    local max_dmg = 0
    local obj, weapon
-   
+
    for obj in actor_inventory(attacker) do
       if obj.obj_n == 336 and timer_get(TIMER_STORM) == 0 and math.random(0,3) == 0 and math.random(0, obj.quality) < 16 then --charge (spell)
          --dgb("magic object quality = "..obj.quality.."\n");
          return obj
       else
          if in_party == false or obj.readied == true then
-            local dmg = get_weapon_dmg(obj.obj_n)  
+            local dmg = get_weapon_dmg(obj.obj_n)
             if dmg ~= nil and dmg > max_dmg and get_weapon_range(obj.obj_n) >= range then
                max_dmg = dmg
                weapon = obj
@@ -1670,13 +1670,13 @@ function actor_get_weapon(attacker, foe)
          end
       end
    end
-   
+
    if weapon == nil then --attack with bare hands.
    	weapon = attacker
    end
-   
+
    --dgb("weapon: "..weapon.name.." dmg="..get_weapon_dmg(weapon.obj_n).."\n")
-      	
+
    return weapon
 end
 
@@ -1687,15 +1687,15 @@ function actor_calculate_avg_coords()
    local n = 0
    local avg_x = 0
    local avg_y = 0
-   
+
    local player_loc = player_get_location()
-   
+
    local player_x = player_loc.x
    local player_y = player_loc.y
-   
+
    local player = Actor.get_player_actor()
    local player_dir = player.direction
-      
+
    local actor
    for actor in party_members() do
       if actor.wt ~= WT_FLANK and actor.wt ~= WT_BERSERK then
@@ -1704,7 +1704,7 @@ function actor_calculate_avg_coords()
          avg_y = avg_y + actor.y
       end
    end
-   
+
    if n > 0 then
       party_avg_x = math.floor(avg_x / n)
       party_avg_y = math.floor(avg_y / n)
@@ -1712,17 +1712,17 @@ function actor_calculate_avg_coords()
       party_avg_x = player_x
       party_avg_y = player_y
    end
-  
+
    n = 0
    avg_x = 0
    avg_y = 0
-   
-   local i 
+
+   local i
    for i=0,0xff do
       actor = Actor.get(i)
-      
+
       if actor.obj_n ~= 0 and actor.alive then
-         
+
          if (actor.align == ALIGNMENT_EVIL or actor.align == ALIGNMENT_CHAOTIC) then
             if actor.wt ~= WT_RETREAT or (abs(actor.x -  player_x) <= 5 and abs(actor.y - player_y) <= 5) then
                if abs(actor.x - player_x) < 0x18 and abs(actor.y - player_y) < 0x18 then
@@ -1734,28 +1734,28 @@ function actor_calculate_avg_coords()
          end
       end
    end
-   
+
    wt_num_monsters_near = n
-         
+
    if n > 0 then
       combat_avg_x = math.floor((avg_x + n / 2) / n)
       combat_avg_y = math.floor((avg_y + n / 2) / n)
-      
+
       wt_rear_max_monster = nil
       wt_rear_min_monster = nil
       --wt_rear_max_party = nil
       --wt_rear_min_party = nil
-      
+
       local tmp_x = combat_avg_x - party_avg_x
       local tmp_y = combat_avg_y - party_avg_y
-      
+
       wt_front_target_actor = nil
       local min_m_pos = 0
       local max_m_pos = 0
       local min_p_pos = 0
       local max_p_pos = 0
       --var_16 = 0x8000
-      
+
       local var_A
       for i=0,0xff do
          actor = Actor.get(i)
@@ -1768,7 +1768,7 @@ function actor_calculate_avg_coords()
                if var_A > max_m_pos then max_m_pos, wt_rear_max_monster = var_A, actor end
                if var_A < min_m_pos then min_m_pos, wt_rear_min_monster = var_A, actor end
             else
-           --dgb("yup var_A["..i.."] = "..var_A.."\n") 
+           --dgb("yup var_A["..i.."] = "..var_A.."\n")
                if var_A > max_p_pos then
                	--dgb("var_A > max_p_pos\n")
                	max_p_pos, wt_rear_max_party = var_A, actor
@@ -1777,19 +1777,19 @@ function actor_calculate_avg_coords()
                 --dgb("var_A < min_p_pos\n")
                	min_p_pos, wt_rear_min_party = var_A, actor
                end
-               --if var_C > var_16 then var_16, unk_3DEAD = var_C, actor end           
+               --if var_C > var_16 then var_16, unk_3DEAD = var_C, actor end
             end
          end
       end
       --FIXME I'm not really sure what the original does when these aren't set
       if wt_rear_max_party == nil then wt_rear_max_party = player end
-      if wt_rear_min_party == nil then wt_rear_min_party = player end      
+      if wt_rear_min_party == nil then wt_rear_min_party = player end
    else
       --this is used by party members when in combat_front worktype.
       combat_avg_x = player_x + movement_offset_x_tbl[(player_dir*2) + 1]
-      combat_avg_y = player_y + movement_offset_y_tbl[(player_dir*2) + 1]            
+      combat_avg_y = player_y + movement_offset_y_tbl[(player_dir*2) + 1]
    end
-   
+
    if combat_avg_x == party_avg_x and combat_avg_y == party_avg_y then
       combat_avg_x = combat_avg_x + movement_offset_x_tbl[(player_dir*2) + 1]
       combat_avg_y = combat_avg_y + movement_offset_y_tbl[(player_dir*2) + 1]
@@ -1818,7 +1818,7 @@ function actor_update_all()
       return
    end
    g_time_stopped = is_time_stopped()
-   
+
    actor_calculate_avg_coords()
    local actor
    local selected_actor
@@ -1830,13 +1830,13 @@ function actor_update_all()
          local player_loc = player_get_location()
          local var_C = (player_loc.x - 16) - (player_loc.x - 16) % 8
          local var_A = (player_loc.y - 16) - (player_loc.y - 16) % 8
-         
+
          for actor in party_members() do
             if actor.wt == WT_FOLLOW and actor.mpts < 0 then
                actor.mpts = 0
             end
          end
-         
+
          local player_z = player_loc.z
          for i=0,0xff do
             local actor = Actor.get(i)
@@ -1858,14 +1858,14 @@ function actor_update_all()
                            -- actor_set_worktype_from_schedule(actor)
                            actor.wt = actor.sched_wt
                         end
-                        
+
                         local dx = (actor.mpts * dex_6) - actor.dex * di
                         if actor.mpts >= actor.dex or dx > 0 or dx == 0 and actor.dex > dex_6 then
                            selected_actor = actor
                            di = actor.mpts
                            dex_6 = actor.dex
                         end
-                        
+
                         if actor.mpts >= actor.dex then
                            break
                         end
@@ -1873,7 +1873,7 @@ function actor_update_all()
                   end
             end
          end
-         
+
          if di <= 0 then
             advance_time(1)
          end
@@ -1882,7 +1882,7 @@ function actor_update_all()
       if selected_actor.corpser_flag == true then
          actor_corpser_regurgitation(selected_actor)
       end
-      
+
       if selected_actor.corpser_flag == false then
          if selected_actor.wt ~= WT_PLAYER and selected_actor.wt ~= WT_FOLLOW then
             --dgb("perform_worktype("..selected_actor.name.."("..selected_actor.actor_num..") dex = "..selected_actor.dex.." mpts = "..selected_actor.mpts..").\n")
@@ -1892,18 +1892,18 @@ function actor_update_all()
                --FIXME targetting?? do *(&objlist_ptr_unk_18f1 + actor_num) = actor_num
             end
          end
-         
+
          --sub_4726()
       end
 
    until selected_actor.obj_n ~= 0 and selected_actor.wt == WT_PLAYER and selected_actor.corpser_flag == false
-   
+
    if selected_actor ~= nil then --swap player to next party member with 'command' combat worktype.
     local old_player = Actor.get_player_actor()
 	player_set_actor(selected_actor)
 	old_player.wt = WT_PLAYER --reset worktype to player as it gets changed to follow in Player::set_actor() :-(
    end
-   
+
 	if g_update_volcano == true then
 		local obj = find_volcano_near_player()
 		if obj ~= nil then
@@ -1917,7 +1917,7 @@ function actor_update_all()
 		end
 		g_update_volcano = false
 	end
-   
+
    display_prompt(true)
 end
 
@@ -1925,18 +1925,18 @@ function advance_time(num_turns)
 	local teleport = num_turns >= 60
 	--dgb("advance_time("..num_turns..")")
 	local time_stop_timer = timer_get(TIMER_TIME_STOP)
-	
+
 	if time_stop_timer ~= 0 then
 		if time_stop_timer > num_turns then
 			timer_set(TIMER_TIME_STOP, time_stop_timer - num_turns)
 			return
 		end
-		
+
 		timer_set(TIMER_TIME_STOP, 0)
 	end
-	
+
 	timer_update_all(num_turns)
-	
+
 	--update keg timer. explode kegs.
 	if g_keg_timer > 0 then
 		g_keg_timer = g_keg_timer - num_turns
@@ -1953,13 +1953,13 @@ function advance_time(num_turns)
 		local actor = Actor.get(i)
 
 		if actor.obj_n ~= 0 then
-		
+
 			if actor.mpts >= 0 then
 				m = actor.dex
 			else
 				m = actor.mpts + actor.dex
 			end
-		
+
 			actor.mpts = m
 			if actor.wt == WT_FOLLOW and actor.corpser_flag == true then
 				actor_corpser_regurgitation(actor) --hack the original does this in party_move() but we don't have that in script yet.
@@ -1997,7 +1997,7 @@ function advance_time(num_turns)
 								hp = max_hp
 							end
 							actor.hp = hp
-							
+
 							if random(0, 1000) == 734 then
 								obj_name = "ring"
 							end
@@ -2009,7 +2009,7 @@ function advance_time(num_turns)
 								cloak_readied = true
 							end
 						end
-						
+
 						if obj_name ~= nil then
 							Actor.inv_remove_obj(actor, obj)
 							print("A "..obj_name.." has vanished!\n")
@@ -2021,7 +2021,7 @@ function advance_time(num_turns)
 			for j=1,num_turns do
 				actor_update_flags(actor)
 			end
-			
+
 			actor_map_dmg(actor, actor.x, actor.y, actor.z)
 			actor.hit_flag = false
 		end
@@ -2032,16 +2032,16 @@ function advance_time(num_turns)
 	end
 
 	local minute = clock_get_minute()
-	
+
 	clock_inc(num_turns)
-	
+
 	if minute + num_turns >= 60 then
 
 		update_actor_schedules(teleport)
-		
+
 		--update magic points
 		local party_actor
-		for party_actor in party_members() do 
+		for party_actor in party_members() do
 			local max_magic = actor_get_max_magic_points(party_actor)
 			if max_magic ~= 0 then -- Avatar, Mage, Swashbuckler, Musician
 				local magic_pts = party_actor.magic + party_actor.level
@@ -2051,13 +2051,13 @@ function advance_time(num_turns)
 				party_actor.magic = magic_pts
 			end
 		end
-		
+
 		player_dec_alcohol(1)
 	end
 	if g_avatar_died == true then
 		actor_avatar_death()
 	end
-	
+
 	if random(0,7) == 0 then
 		g_update_volcano = true
 	end
@@ -2066,7 +2066,7 @@ end
 function actor_update_flags(actor)
 
 	local random = math.random
-		
+
 	if actor.alive then
 		local var_8 = 0 --FIXME get proper value for var_8.
 		if actor.visible == false and var_8 == 0 and random(0, 0x3f) == 0
@@ -2076,32 +2076,32 @@ function actor_update_flags(actor)
 				actor.visible = true
 			end
 		end
-		
+
 		if actor.protected == true and random(0, 0x3f) == 0 then
 			if actor_int_adj(actor) <= random(1, 0x1e) then
 				actor.protected = false
 			end
 		end
-		
+
 		if actor.cursed == true and random(0, 15) == 0 then
 			if actor_int_adj(actor) >= random(1, 0x1e) then
 				actor.cursed = false
 			end
 		end
-		
+
 		if actor.charmed == true and random(0, 7) == 0 then
 			if actor_int_adj(actor) >= random(1, 0x1e) then
 				actor_remove_charm(actor)
 			end
 		end
-		
+
 		if actor.paralyzed == true and random(0, 3) == 0 then
 			if actor_str_adj(actor) >= random(1, 0x1e) then
 				actor.paralyzed = false
 				party_update_leader()
 			end
 		end
-		
+
 		if actor.asleep == true and actor.wt ~= WT_SLEEP and random(0, 15) == 0 then
 			actor.asleep = false
 			actor.hit_flag = true
@@ -2110,7 +2110,7 @@ function actor_update_flags(actor)
 				party_update_leader()
 			end
 		end
-		
+
 		if actor.poisoned == true and actor.protected == false and random(0, 7) == 0 then
 			if map_is_on_screen(actor.x, actor.y, actor.z) == true then
 				actor_hit(actor, 1)
@@ -2125,14 +2125,14 @@ end
 function actor_corpser_regurgitation(actor)
    --dgb("actor_corpser_regurgitation("..actor.name..")\n");
    if actor.corpser_flag == false then return end
-   
+
    if actor.wt == WT_PLAYER then
       print("\n"..actor.name..":\nARGH!\n")
    end
-   
+
    local random = math.random
    local val = random(1, 0x1e)
-     
+
    if val < actor_str_adj(actor) then
       play_sfx(SFX_CORPSER_REGURGITATE, true)
       print("`"..actor.name.." regurgitated!\n")
@@ -2144,7 +2144,7 @@ function actor_corpser_regurgitation(actor)
       actor_hit(actor, random(1, 0xf))
       actor.mpts = 0
    end
-   
+
 end
 
 function actor_remove_charm(actor)
@@ -2152,7 +2152,7 @@ function actor_remove_charm(actor)
 	if actor.charmed == true then
 		actor.charmed = false;
 		actor.align = actor.old_align
-	
+
 		if actor.in_party == true then
 			actor.align = ALIGNMENT_GOOD
 		end
@@ -2170,7 +2170,7 @@ function actor_remove_charm(actor)
 		--]]
 		return true
 	end
-	
+
 	return false
 end
 
@@ -2184,7 +2184,7 @@ function actor_yell_for_help(attacking_actor, defending_actor, dmg)
       local actor_base = actor_tbl[defending_actor.obj_n]
 
       if attacking_actor.wt == WT_PLAYER and actor_base ~= nil then
-         if actor_base[7] ~= 0 and dmg > 0 then  --[7] == can_talk 
+         if actor_base[7] ~= 0 and dmg > 0 then  --[7] == can_talk
             print("`"..defending_actor.name.." yells for help!\n")
             activate_city_guards()
          end
@@ -2228,7 +2228,7 @@ function actor_get_obj(actor, obj)
 		print("\n\nNot possible.")
 		return false
 	end
-	
+
 	if Actor.can_carry_obj_weight(actor, obj) == false then
 		print("\n\nThe total is too heavy.")
 		return false
@@ -2252,12 +2252,12 @@ function actor_get_obj(actor, obj)
 				end
 			end
 		end
-		
+
 		if caught_stealing == false then
 			print("\n\nStealing!!!\n")
 		end
 	end
-	
+
 	obj.ok_to_take = true
 
    Obj.moveToInv(obj, actor.actor_num)
@@ -2270,19 +2270,19 @@ function activate_city_guards()
 --dgb("activate_city_guards()")
    local i
    local player_loc = player_get_location()
-   
+
    player_subtract_karma(5)
-   
+
    for i=1,0xff do
       local actor = Actor.get(i)
-   
+
       if actor.alive == true and actor.z == player_loc.z and actor.in_party == false and actor.align == ALIGNMENT_NEUTRAL then
          if actor.obj_n == 0x17e then -- guard
             if actor_find_max_xy_distance(actor, player_loc.x, player_loc.y) < 0x20 then
                actor.wt = WT_GUARD_ARREST_PLAYER
             end
          else
-            if actor.wt ~= WT_STATIONARY 
+            if actor.wt ~= WT_STATIONARY
              and actor.wt ~= WT_NOTHING
              and actor.wt ~= WT_PLAYER
              and actor.paralyzed == false
@@ -2314,10 +2314,10 @@ function actor_catch_up_to_party(actor)
    local party_actor
    local random = math.random
 
-   for party_actor in party_members() do 
+   for party_actor in party_members() do
 
       if party_actor.alive == true and actor_ok_to_attack(actor, party_actor) == true then
-   
+
          local party_actor_x = party_actor.x
          local party_actor_y = party_actor.y
          local var_4 = (party_actor_x - actor_x) * (party_actor_x - actor_x) + (party_actor_y - actor_y) * (party_actor_y - actor_y)
@@ -2330,7 +2330,7 @@ function actor_catch_up_to_party(actor)
 
    if target_actor == nil then
       actor_move_towards_loc(actor, party_avg_x, party_avg_y)
-      return false 
+      return false
    end
 
    actor_move_towards_loc(actor, target_actor.x, target_actor.y)
@@ -2345,68 +2345,68 @@ end
 function caught_by_guard(actor)
 
    local lord_british = Actor.get(6)
-   
+
    --FIXME we don't want people going to jail before they answer the copy protection questions.
    --if (objlist_talk_flags[5] & 0x80) == 0 then
    --   actor.wt = 0x81
    --   return
    --end
-   
+
    Actor.show_portrait(actor)
-   
+
    print("\n\"Thou art under arrest!\"\n\n\"Wilt thou come quietly?\"\n\n:")
-   
+
    local var_6 = input_select("yn", false)
-   
+
    actor.wt = 0x81
-   
+
    Actor.hide_portrait()
-   
+
    if var_6 == "Y" then
       print("es\n\nThe guard strikes thee unconscious!\n\nThou dost awaken to...\n")
       --sub_2ACA1()
-      
+
       fade_out()
-      
+
       if party_is_in_combat_mode() then
          party_set_combat_mode(false)
       end
-   
+
       player_move(0xe7, 0xba, 0, true)
-   
+
       local cur_hour = clock_get_hour()
       while cur_hour ~= 8 do
       	advance_time(60)
       	cur_hour = clock_get_hour()
       	--FIXME need to pause and update screen so player can see the sun-moon display move.
       end
-   
-      for party_actor in party_members() do 
+
+      for party_actor in party_members() do
          for var_4 in actor_inventory(party_actor, true) do -- recursively search containers in inventory.
             --if((*(var_4 + objlist_obj_flags) & 0x18) == 0 || sub_CC5E(var_4, *(di + objlist_party_roster)) == 0)
             --   break
-   
+
             if var_4.obj_n == 0x3f then --lockpick
                Actor.inv_remove_obj(party_actor, var_4)
             end
-   
+
             if var_4.obj_n == 0x40 and var_4.quality == 9 then --key
-            
+
                local obj = map_get_obj(0xeb, 0xb7, 0, 0xb1) --desk
                if obj ~= nil then
                   Obj.moveToCont(var_4, obj)
                end
-            end   
+            end
          end
       end
- 
+
       local obj = map_get_obj(0xe7, 0xb8, 0, 0x12c) --steal door
       if obj ~= nil then
          obj.frame_n = 9 --close and lock door.
       end
-      
+
       fade_in()
-      
+
    --[[
       word_31D08 = 1
       sub_E5F2()
@@ -2414,13 +2414,13 @@ function caught_by_guard(actor)
       ax = sub_46DC()
    --]]
    else
-   
+
       print("o\n\n\"Then defend thyself, rogue!\"\n")
       activate_city_guards()
       actor.wt = WT_ASSAULT
       actor.align = ALIGNMENT_EVIL
-   
-      local i 
+
+      local i
       for i=1,0xff do
          local a = Actor.get(i)
          if a.wt == WT_GUARD_ARREST_PLAYER then
@@ -2428,7 +2428,7 @@ function caught_by_guard(actor)
             a.align = ALIGNMENT_EVIL
          end
       end
-   
+
    end
 
    return
@@ -2445,7 +2445,7 @@ function move_tanglevine(actor, new_direction)
    local actor_x = actor.x
    local actor_y = actor.y
    local old_direction = actor.direction
-   
+
    if new_direction ~= direction_reverse(old_direction) then
 
       if actor_move(actor, new_direction, 1) ~= 0 then
@@ -2458,7 +2458,7 @@ function move_tanglevine(actor, new_direction)
          tangle_obj.quality = 0 --actor.id_n
 
          Obj.moveToMap(tangle_obj, actor_x, actor_y, player_loc.z)
-         
+
          actor.frame_n = tangle_vine_frame_n_tbl[new_direction * 4 + math.random(0, 3) + 1]
 
          return true
@@ -2471,7 +2471,7 @@ end
 function actor_wt_front(actor)
 	--dgb("actor_wt_front("..actor.name..")\n")
 	if actor_wt_front_1FB6E(actor) ~= 0 then
-		if actor.in_party == true then 
+		if actor.in_party == true then
 			actor_wt_attack(actor)
 		else
 			if actor_find_max_xy_distance(actor, party_avg_x, party_avg_y) >= 8 then
@@ -2488,10 +2488,10 @@ function actor_wt_front(actor)
 				end
 			end
 		end
-		
+
 		return
 	end
-	
+
 	return
 end
 
@@ -2501,13 +2501,13 @@ function actor_wt_front_1FB6E(actor)
       subtract_movement_pts(actor, 5)
       return 1
    end
-   
+
    local player_loc = player_get_location()
-   
+
    local centre_x,centre_y,diff_x,diff_y,var_1E,var_24,var_14,var_12,var_20,var_1C,var_10,target_x,target_y,var_E
    local actor_x = actor.x
    local actor_y = actor.y
-   if actor.in_party == false then 
+   if actor.in_party == false then
       centre_x = party_avg_x
       centre_y = party_avg_y
       diff_x = wt_front_target_actor.x - centre_x
@@ -2518,7 +2518,7 @@ function actor_wt_front_1FB6E(actor)
       diff_x = combat_avg_x - centre_x
       diff_y = combat_avg_y - centre_y
    end
-   
+
    --dgb("actor_wt_front_1FB6E() actor = ("..actor_x..","..actor_y..") centre = ("..centre_x..","..centre_y..") player = ("..player_loc.x..","..player_loc.y..")\n")
    var_1E = (actor_x - centre_x) * diff_y - (actor_y - centre_y) * diff_x
    if var_1E <= 0 then
@@ -2526,58 +2526,58 @@ function actor_wt_front_1FB6E(actor)
    else
       var_24 = 1
    end
-   
+
    if var_1E == 0 then
       var_24 = math.random(0, 1)
    end
-   
+
    if diff_y <= 0 then
       var_14 = -1
    else
       var_14 = 1
    end
-   
+
    if diff_x <= 0 then
       var_12 = 1
    else
       var_12 = -1
    end
-   
+
    if var_24 == 0 then
       var_14 = -var_14
       var_12 = -var_12
    end
-   
+
    local tmp_actor
    if actor.in_party == true then
       tmp_actor = Actor.get_player_actor()
    else
       tmp_actor = wt_front_target_actor
    end
-   
+
    --dgb("tmp_actor = "..tmp_actor.name.." at ("..tmp_actor.x..","..tmp_actor.y..")\n")
    var_20 = (tmp_actor.x - centre_x) * diff_x + (tmp_actor.y - centre_y) * diff_y
    if actor.in_party == true then
       var_20 = var_20 + abs(diff_x) + abs(diff_y)
    end
-   
+
    var_1C = diff_x * diff_x + diff_y * diff_y
    if var_1C == 0 then
       var_1C = 1
    end
-   
+
    --dgb("getting target var_20 = "..var_20.." diff_x = "..diff_x.." diff_y = "..diff_y.." var_1C = "..var_1C.."\n")
    target_x = math.floor((var_20 * diff_x) / var_1C) + centre_x
    target_y = math.floor((var_20 * diff_y) / var_1C) + centre_y
-   
+
    unk_30A72 = 0
-   
+
    local chunk_x = player_loc.x - 16
    chunk_x = chunk_x - (chunk_x % 8)
-   
+
    local chunk_y = player_loc.y - 16
    chunk_y = chunk_y - (chunk_y % 8)
-   
+
    local found_actor = false
    repeat
       if target_x < chunk_x or chunk_x + 0x27 < target_x or target_y < chunk_y or chunk_y + 0x27 < target_y or (actor_x == target_x and actor_y == target_y) then
@@ -2585,17 +2585,17 @@ function actor_wt_front_1FB6E(actor)
          --dgb("combat_front returned. too far away. actor=("..actor_x..","..actor_y..") target=("..target_x..","..target_y..") chunk=("..chunk_x..","..chunk_y..")\n")
          return 1
       end
-   
+
       if map_get_actor(target_x, target_y, player_loc.z) ~= nil then
          found_actor = true
       else
          found_actor = false
       end
-   
+
       if found_actor then
          var_10 = (target_x + var_14 - centre_x) * diff_x + (target_y - centre_y) * diff_y
          var_E = (target_x - centre_x) * diff_x + (target_y + var_12 - centre_y) * diff_y
-   
+
          if abs(var_10 - var_20) >= abs(var_E - var_20) then
             target_y = target_y + var_12
          else
@@ -2603,27 +2603,27 @@ function actor_wt_front_1FB6E(actor)
          end
       end
    until found_actor == false
-   
-   
+
+
    local mpts = actor.mpts
    if actor_move_towards_loc(actor, target_x, target_y) ~= 0 then
       if actor.in_party == false or actor.x == target_x and actor.y == target_y then
          return 0
       end
-   
+
       if wt_num_monsters_near == 0 then
          actor.mpts = mpts
       end
-   
+
       if actor_move_towards_loc(actor, target_x, target_y) ~= 0 then
          return 0
       end
    else
       actor.mpts = mpts
    end
-   
+
    actor_wt_attack(actor)
-   
+
    return 0
 end
 
@@ -2633,24 +2633,24 @@ function actor_wt_rear(actor)
    local player_loc = player_get_location()
    local var_2,var_4,avg_y,avg_x,dx,ax,avg_x_diff, avg_y_diff
    if actor.in_party == false then
-      
+
       if wt_num_monsters_near == 0 then subtract_movement_pts(actor, 5) return end
-      
+
       var_4 = wt_rear_min_monster
       var_2 = wt_rear_max_monster
-      
+
       if var_4 == nil then var_4 = actor end
       if var_2 == nil then var_2 = actor end
-      
+
       avg_x = combat_avg_x
       avg_y = combat_avg_y
       avg_x_diff = party_avg_x - combat_avg_x
       avg_y_diff = party_avg_y - combat_avg_y
-      
+
    else
-      
+
       if wt_num_monsters_near == 0 then actor_move_towards_loc(actor, player_loc.x, player_loc.y) return end
-      
+
       var_4 = wt_rear_max_party
       var_2 = wt_rear_min_party
       avg_x = party_avg_x
@@ -2658,67 +2658,67 @@ function actor_wt_rear(actor)
       avg_x_diff = combat_avg_x - party_avg_x
       avg_y_diff = combat_avg_y - party_avg_y
    end
-   
+
    local var_10 = 0x7fff
    local align = actor.align
    local i, var_12
    for i=0,0xff do
       local a = Actor.get(i)
-      
+
       if a.alive and a.wt == WT_FRONT and a.align == align then
-         
+
          var_12 = (a.x - avg_x) * avg_x_diff + (a.y - avg_y) * avg_y_diff
 
          if var_12 < var_10 then var_10 = var_12 end
-         
+
       end
-      
+
    end
-   
+
    var_12 = (actor.x - avg_x) * avg_x_diff + (actor.y - avg_y) * avg_y_diff
    local mpts = actor.mpts
-   local var_C 
+   local var_C
    if actor.in_party == false or actor_find_max_xy_distance(actor, player_loc.x, player_loc.y) <= 3 then
-      
+
       if var_12 < var_10 then
-         
+
          var_12 = (actor.x - avg_x) * avg_y_diff - (actor.y - avg_y) * avg_x_diff
-         
+
          dx = (var_4.x - avg_x) * avg_y_diff
          if dx - (var_4.y - avg_y) * avg_x_diff >= var_12 then
-            
+
             dx = (var_2.x - avg_x) * avg_y_diff
             ax = (var_2.y - avg_y) * avg_x_diff
             if dx - ax <= var_12 then
-               
+
                var_C = 1
-               
+
             else
-               
+
                ax = (actor_move_towards_loc(actor, actor.x + avg_y_diff, actor.y - avg_x_diff) and -1 or 0) + 1
                var_C = ax
             end
-            
+
          else
-            
+
             ax = (actor_move_towards_loc(actor, actor.x - avg_y_diff, actor.y + avg_x_diff) and -1 or 0) + 1
             var_C = ax
          end
-         
+
       else
-         
+
          ax = (actor_move_towards_loc(actor, actor.x - avg_x_diff, actor.y - avg_y_diff) and -1 or 0) + 1
          var_C = ax
       end
-      
+
    else
-      
+
       ax = (actor_move_towards_loc(actor, player_loc.x, player_loc.y) and -1 or 0) + 1
       var_C = ax
    end
-   
+
    if var_C ~= 0 then
-      
+
       actor.mpts = mpts
       actor_wt_attack(actor)
    end
@@ -2731,68 +2731,68 @@ function actor_wt_flank(actor)
    local player_loc = player_get_location()
    local player_x = player_loc.x
    local player_y = player_loc.y
-   
+
    local random = math.random
    local abs = abs
-   
+
    if wt_num_monsters_near == 0 or actor.in_party == false and actor_find_max_xy_distance(actor, player_x, player_y) > 7 then
-   
+
       if actor.in_party == true and actor_find_max_xy_distance(actor, player_x, player_y) > 2 then
          local mpts = actor.mpts
          actor_move_towards_loc(actor, player_x, player_y)
          actor.mpts = mpts
       end
-   
+
       subtract_movement_pts(actor, 5)
-      return 
+      return
    end
-   
+
    local actor_align = actor.align
    local actor_x = actor.x
    local actor_y = actor.y
    local tmp_x = combat_avg_x - party_avg_x
    local tmp_y = combat_avg_y - party_avg_y
    local var_20 = (actor_x - party_avg_x) * tmp_y - (actor_y - party_avg_y) * tmp_x
-   
+
    local var_1E, var_10, var_E
-   
+
    if var_20 <= 0 then
-   
+
       var_1E = 0
    else
-   
+
       var_1E = 1
    end
-   
+
    if var_20 == 0 then
-   
+
       var_1E = random(0, 1)
    end
    if var_1E == 0 then
-   
+
       var_10 = -tmp_y
       var_E = tmp_x
       var_20 = -var_20
    else
-   
+
       var_10 = tmp_y
       var_E = -tmp_x
    end
-   
+
    local var_1A = -0x8000
    local target_actor = nil
-   
+
    local i, tmp_actor
    for i=1,0xff do
       tmp_actor = Actor.get(i)
-   
+
       if tmp_actor ~= nil
        and tmp_actor.alive == true
        and tmp_actor.align ~= actor_align
        and actor_ok_to_attack(actor, tmp_actor) == true
        and (actor_align ~= ALIGNMENT_GOOD or alignment_is_evil(tmp_actor.align) == true)
        and (actor_align ~= ALIGNMENT_EVIL or tmp_actor.align == ALIGNMENT_GOOD or tmp_actor.align == ALIGNMENT_CHAOTIC) then
-      
+
          local target_x = tmp_actor.x
          local target_y = tmp_actor.y
 
@@ -2801,35 +2801,35 @@ function actor_wt_flank(actor)
 
             local var_1C = (target_x - party_avg_x) * tmp_y - (target_y - party_avg_y) * tmp_x
             if var_1E == 0 then
-            
+
                var_1C = -var_1C
             end
-   
+
             if var_1C > var_1A then
-            
+
                var_1A = var_1C
                target_actor = tmp_actor
             end
          end
       end
    end
-   
+
    if target_actor == nil then
       actor_move_towards_player(actor)
       return
    end
-   
+
    g_obj = target_actor
    tmp_x = target_actor.x
    tmp_y = target_actor.y
-   
+
    local should_move_actor = false
    local weapon_obj = actor_get_weapon(actor, target_actor)
    local weapon_range = get_weapon_range(weapon_obj.obj_n)
    local attack_range = Actor.get_range(actor, tmp_x, tmp_y)
-   
+
    if attack_range < 9 and attack_range <= weapon_range then
-   
+
       if map_can_reach_point(actor_x, actor_y, tmp_x, tmp_y, actor.z) == false then
          if random(0, 1) == 0 then
             tmp_x = target_actor.y - actor_y + actor_x
@@ -2844,15 +2844,15 @@ function actor_wt_flank(actor)
          subtract_movement_pts(actor, 10)
       end
    else
-   
+
       if var_10 <= 0 then
-      
+
          if var_10 < 0 then
-         
+
             tmp_x = tmp_x - 1
          end
       else
-      
+
          tmp_x = tmp_x + 1
       end
       if var_E <= 0 then
@@ -2864,18 +2864,18 @@ function actor_wt_flank(actor)
       end
       should_move_actor = true
    end
-   
+
    if should_move_actor == true then
-   
+
       local mpts = actor.mpts
       if actor_move_towards_loc(actor, tmp_x, tmp_y) == 0 then
-      
+
          actor.mpts = mpts
          actor_wt_attack(actor)
       end
    end
-   
-   return 
+
+   return
 end
 
 
@@ -2922,7 +2922,7 @@ function actor_wt_berserk(actor)
 
       --g_obj = target_actor
       if map_can_reach_point(actor_x, actor_y, target_x, target_y, actor.z) == false then
-      
+
          if math.random(0, 1) == 0 then
             target_x = target_actor.y - actor_y + actor_x
             target_y = actor_y - target_actor.x - actor_x
@@ -2958,7 +2958,7 @@ function actor_wt_combat_tanglevine(actor)
    local random = math.random
    local di
    local abs = abs
-   
+
    local target = actor_find_target(actor)
    if target ~= nil then
 
@@ -2967,34 +2967,34 @@ function actor_wt_combat_tanglevine(actor)
       local actor_x = actor.x
       local actor_y = actor.y
       if abs(target_x - actor_x) < 2 and abs(target_y - actor_y) < 2 and random(0, 1) ~= 0 then
-      
+
          actor_attack(actor, target_x, target_y, actor.z, actor, target)
          subtract_movement_pts(actor, 10)
          return
       end
 
       if abs(target_x - actor_x) < 5 and abs(target_y - actor_y) < 5 and random(0, 3) == 0 then
-      
+
          target_x = target_x - actor_x
          target_y = target_y - actor_y
 
          if abs(target_x) <= abs(target_y) then
-         
+
             di = (target_y <= 0) and DIR_NORTH or DIR_SOUTH
 
             if move_tanglevine(actor, di) == 0  then
-            
+
                di = (target_x <= 0) and DIR_WEST or DIR_EAST
                move_tanglevine(actor, di)
                return
             end
-         
+
          else
-         
+
             di = (target_x <= 0) and DIR_WEST or DIR_EAST
 
             if move_tanglevine(actor, di) == 0 then
-            
+
                di = (target_y <= 0) and DIR_NORTH or DIR_SOUTH
                move_tanglevine(actor, di)
                return
@@ -3007,9 +3007,9 @@ function actor_wt_combat_tanglevine(actor)
 
       di = random(0, 3) --random direction north south east west
       if actor.direction == di then
-      
+
          di = direction_reverse(di)
-      end 
+      end
 
       move_tanglevine(actor, di)
 
@@ -3017,7 +3017,7 @@ function actor_wt_combat_tanglevine(actor)
       actor.mpts = 0
    end
 
-   return 
+   return
 end
 
 
@@ -3039,7 +3039,7 @@ function actor_wt_combat_stationary(actor)
       local target_actor = map_get_actor(target_x, target_y, actor.z)
 
       if target_actor ~= nil and actor_ok_to_attack(actor, target_actor) == true and target_actor.alive == true and target_actor.align ~= align and target_actor.align ~= ALIGNMENT_NEUTRAL then
-      
+
          actor_attack(actor, target_x, target_y, actor.z, actor_get_weapon(actor, target_actor), target_actor)
          subtract_movement_pts(actor, 10)
          return
@@ -3048,17 +3048,17 @@ function actor_wt_combat_stationary(actor)
    end
 
    subtract_movement_pts(actor, 5)
-   
+
    return
 end
 
 function actor_wt_walk_straight(actor)
    if math.random(0, 1) == 0 then subtract_movement_pts(actor, 5) return end
-   
+
    local wt = actor.wt
    local sched = actor.sched_loc
    local dir
-   
+
    if wt < WT_WALK_NORTH_SOUTH or actor.x ~= sched.x or actor.y ~= sched.y then
       dir = actor.direction
    else
@@ -3068,7 +3068,7 @@ function actor_wt_walk_straight(actor)
       if wt == WT_WALK_WEST_EAST then dir = DIR_WEST end
       actor.direction = dir
    end
-   
+
    local mpts = actor.mpts
 
    if actor_move(actor, dir, 1) == 0 then
@@ -3079,7 +3079,7 @@ function actor_wt_walk_straight(actor)
       actor_move(actor, dir, 1)
       actor.direction = dir
    end
-   
+
 end
 
 function actor_wt_wander_around(actor)
@@ -3087,18 +3087,18 @@ function actor_wt_wander_around(actor)
    if rand(0, 7) ~= 0 then subtract_movement_pts(actor, 5) return end
 
    local random_wander_range = function ()
-      local i = 0 
+      local i = 0
       while rand(0, 1) ~= 0 do i = i + 1 end
       if rand(0, 1) ~= 0 then i = -i end
       return i
    end
-   
+
    local abs=abs
    local sched = actor.sched_loc
    local sched_x_offset = actor.x - sched.x;
    local sched_y_offset = actor.y - sched.y;
    local direction
-   
+
    if abs(sched_y_offset) - abs(sched_x_offset) >= random_wander_range() then
       direction = (random_wander_range() <= sched_y_offset) and DIR_NORTH or DIR_SOUTH
    else
@@ -3122,7 +3122,7 @@ if actor.wt ~= WT_STATIONARY then
          return
       end
    end
-      
+
    if rand(0, 7) == 0 then
       actor_move(actor, rand(0, 3), 1)
       return
@@ -3138,9 +3138,9 @@ function actor_wt_attack(actor)
    if g_obj ~= nil then
    	--dgb("target at ("..g_obj.x..","..g_obj.y..")\n")
    end
-   
+
    local weapon_obj = actor_get_weapon(actor, g_obj)
-   
+
    if g_obj ~= nil then
 
       local target_x = g_obj.x
@@ -3149,7 +3149,7 @@ function actor_wt_attack(actor)
       local actor_y = actor.y
       local weapon_range = get_weapon_range(weapon_obj.obj_n)
 
-      if abs(target_x - actor_x) < 8 and abs(target_y - actor_y) < 8 and 
+      if abs(target_x - actor_x) < 8 and abs(target_y - actor_y) < 8 and
        Actor.get_range(actor, target_x, target_y) <= weapon_range then
 
          if sub_1D59F(actor, target_x, target_y, weapon_range, 0) == true then
@@ -3159,12 +3159,12 @@ function actor_wt_attack(actor)
          end
 
          if math.random(0, 1) == 0 then
-         
+
             target_x = g_obj.y - actor_y + actor_x
             target_y = actor_y - g_obj.x - actor_x
-         
+
          else
-         
+
             target_x = actor_x - g_obj.y - actor_y
             target_y = g_obj.x - actor_x + actor_y
          end
@@ -3205,7 +3205,7 @@ function actor_wt_timid(actor)
 	else
 	   var_4 = 8
 	end
-	
+
 	if abs(diff_x) < var_4 and abs(diff_y) < var_4 then
 	   local var_2 = actor.mpts
 	   if actor_move_towards_loc(actor, actor.x - diff_x, actor.y - diff_y) == 0 then
@@ -3222,13 +3222,13 @@ function actor_wt_timid(actor)
 	      actor_move_towards_player(actor)
 	   end
 	end
-	
+
 	if actor.wt == WT_RETREAT then
 	   if math.random(0, 3) == 0 then
 	      if actor.level > actor.hp then
 	         actor.hp = actor.hp + 1
 	      end
-	
+
 	      if math.floor((actor.hp * 4) / actor.level) > 0 then
 	         actor.wt = actor.combat_mode
 	      end
@@ -3241,7 +3241,7 @@ function actor_wt_like(actor)
 	local actor_y = actor.y
 	local party_actor
 	local random = math.random
-	
+
 	for party_actor in party_members() do
 
 	   if abs(party_actor.x - actor_x) < 3 and abs(party_actor.y - actor_y) < 3 then
@@ -3249,11 +3249,11 @@ function actor_wt_like(actor)
 	         actor_move_towards_loc(actor, party_avg_x, party_avg_y)
 	         return
 	      end
-	
+
 	      break
 	   end
 	end
-	
+
 	if random(0, 1) == 0 then
 	   subtract_movement_pts(actor, 5)
 	else
@@ -3272,7 +3272,7 @@ function actor_wt_like(actor)
 	   end
 	   actor_move_towards_loc(actor, actor_x, actor_y)
 	end
-	
+
 	return
 end
 
@@ -3281,20 +3281,20 @@ function actor_wt_unfriendly(actor)
 	local actor_y = actor.y
 	local party_actor
 	local random = math.random
-	
+
 	for party_actor in party_members() do
 	   if abs(party_actor.x - actor_x) < 3 and abs(party_actor.y - actor_y) < 3 then
-	
+
 	      if random(0, 7) == 0 then
 	         actor.wt = WT_ASSAULT
 	         actor_wt_attack(actor)
-	         return 
+	         return
 	      end
-	
+
 	      break
 	   end
 	end
-	
+
 	if random(0, 1) == 0 then
 	   subtract_movement_pts(actor, 5)
 	else
@@ -3313,7 +3313,7 @@ function actor_wt_unfriendly(actor)
 	   end
 	   actor_move_towards_loc(actor, actor_x, actor_y)
 	end
-	
+
 	return
 end
 
@@ -3369,11 +3369,11 @@ function actor_wt_brawling(actor)
 			else
 				actor_move_towards_loc(actor, target.x, target.y)
 			end
-			
+
 			return
 		end
 	end
-	
+
 	actor_wt_wander_around(actor)
 end
 
@@ -3415,13 +3415,13 @@ wt_tbl = {
 function actor_ok_to_attack(actor, target_actor)
 
    if target_actor.visible == false and (target_actor.in_party == false or actor.in_party == false) then return false end
-   
+
    if target_actor.z ~= actor.z then return false end
-   
+
    if target_actor.obj_n == 0x165 and target_actor.frame_n == 0 then return false end --corpser underground
-   
+
    if target_actor.corpser_flag == true then return false end
-   
+
    --FIXME need to check tileflag3 bit 4 is not set. The Ignore flag.
    return true
 
@@ -3438,32 +3438,32 @@ function actor_find_target(actor)
    local player_loc = player_get_location()
    local player_x = player_loc.x
    local player_y = player_loc.y
-               
+
    for i=0,0xff do
 
       local tmp_actor = Actor.get(i)
 
       if tmp_actor.obj_n ~= 0 and tmp_actor.alive == true and tmp_actor.actor_num ~= actor.actor_num and actor_ok_to_attack(actor, tmp_actor) == true then
-      
+
          if actor.wt == WT_FLEE or
-            actor.wt == WT_MOUSE or 
+            actor.wt == WT_MOUSE or
             actor.wt == WT_UNK_13 or
             actor.wt == WT_RETREAT or
-            actor.wt == WT_BRAWLING or 
+            actor.wt == WT_BRAWLING or
             (align ~= ALIGNMENT_NEUTRAL or actor.wt == WT_ATTACK_PARTY and tmp_actor.align == ALIGNMENT_GOOD) and
             (align ~= ALIGNMENT_CHAOTIC or tmp_actor.align ~= ALIGNMENT_CHAOTIC) and
             tmp_actor.align ~= ALIGNMENT_NEUTRAL and
             (align ~= ALIGNMENT_GOOD or alignment_is_evil(tmp_actor.align) == true) and
             (align ~= ALIGNMENT_EVIL or tmp_actor.align == ALIGNMENT_GOOD or tmp_actor.align == ALIGNMENT_CHAOTIC) then
-         
+
             local target_x = tmp_actor.x
             local target_y = tmp_actor.y
 
             if actor_find_max_xy_distance(actor, target_x, target_y) <= 8 and (tmp_actor.wt ~= WT_RETREAT or abs(target_x - player_x) <= 5 and abs(target_y - player_y) <= 5) then
-            
-               local var_6 = (target_x - actor_x)^2 + (target_y - actor_y)^2 
+
+               local var_6 = (target_x - actor_x)^2 + (target_y - actor_y)^2
                if var_6 < var_2 or var_6 == var_2 and math.random(0, 1) ~= 0 then
-               
+
                   var_2 = var_6
                   target_actor = tmp_actor
                end
@@ -3484,32 +3484,32 @@ end
 
 
 function perform_worktype(actor)
-   
+
    if g_time_stopped == true then
       actor.mpts = 0
       return
    end
-   
+
    if wt_tbl[actor.wt] == nil then
       subtract_movement_pts(actor, 5)
       return
    end
-   
+
    --dgb("wt = "..wt_tbl[actor.wt][1].."\n")
-   
+
    if actor.mpts > 0 then
    	local func = wt_tbl[actor.wt][2]
    	func(actor)
    end
-   
+
    if actor.mpts == 0 then subtract_movement_pts(actor, 0xa) end
-   
+
 end
 
 function spell_put_actor_to_sleep(attacker, foe)
 
    --dgb("spell_put_actor_to_sleep("..attacker.name..",foe)\n")
-   
+
    local actor_base = actor_tbl[foe.obj_n]
    if actor_base == nil or actor_base[21] == 0 then -- 21 is immune to sleep
       if actor_int_check(foe, attacker) == false then
@@ -3520,43 +3520,43 @@ function spell_put_actor_to_sleep(attacker, foe)
          return 1
       end
    end
-   
+
    return 2
 end
 
 function spell_poison_actor(attacker, foe)
 	local actor_base = actor_tbl[foe.obj_n]
 	if actor_base == nil or actor_base[19] == 1 or foe.actor_num == 0 then return 2 end --immune to poison
-	
+
 	if math.floor((math.floor(actor_str_adj(foe) / 2) + 0x1e - actor_int_adj(attacker)) / 2) <= math.random(1, 0x1e) then
 		foe.poisoned = true
 		hit_anim(foe.x, foe.y)
 		return -1
 	end
-	
+
 	return 1
 end
 
 function spell_take_fire_dmg(attacker, foe)
    local actor_base = actor_tbl[foe.obj_n]
    if actor_base == nil or actor_base[18] == 1 then return end --immune to magic
-   
+
    local dmg = math.random(1, 0x14)
-   
+
    if actor_base == nil or actor_base[17] == 1 then dmg = dmg * 2 end --double dmg from fire
-   
+
    local exp = actor_hit(foe, dmg)
-   if exp ~= 0 then         
+   if exp ~= 0 then
       attacker.exp = attacker.exp + exp
    end
-   
+
    actor_yell_for_help(attacker, foe, 1)
    actor_hit_msg(foe)
 end
 
 function spell_charm_actor(attacker, foe)
 	if actor_int_check(foe, attacker) == true then return false end
-	
+
 	if foe.charmed == true then
 		actor_remove_charm(foe)
 	else
@@ -3569,24 +3569,24 @@ function spell_charm_actor(attacker, foe)
 			party_update_leader()
 		end
 	end
-	
+
 	return true
 end
 
 function spell_kill_actor(attacker, foe)
 	local actor_base = actor_tbl[foe.obj_n]
 	if actor_base ~= nil and actor_base[20] == 1 then return 2 end --immune to corp spells
-	
+
 	if actor_int_check(foe, attacker) == true then return 1 end
-	
+
 	local exp = actor_hit(foe, foe.hp)
-	if exp ~= 0 then         
+	if exp ~= 0 then
 		attacker.exp = attacker.exp + exp
 	end
-	
+
 	actor_yell_for_help(attacker, foe, 1)
 	actor_hit_msg(foe)
-	
+
 	return -1
 end
 
@@ -3595,7 +3595,7 @@ function spell_hit_actor(attacker, foe, spell_num)
 	if actor_int_check(foe, attacker) == true then return false end
 	local random = math.random
 	local dmg = 0
-	
+
 	if spell_num == 5 then
 		dmg = random(1, 0xa)
 	elseif spell_num == 0x62 then
@@ -3603,18 +3603,18 @@ function spell_hit_actor(attacker, foe, spell_num)
 	elseif spell_num == 0x32 then
 		dmg = foe.hp - 1
 	end
-	
+
 	print("\n")
-	
+
 	local exp = actor_hit(foe, dmg)
-	if exp ~= 0 then         
+	if exp ~= 0 then
 		attacker.exp = attacker.exp + exp
 	end
-	
+
 	actor_hit_msg(foe)
-	
+
 	actor_yell_for_help(attacker, foe, 1)
-	
+
 	return true
 end
 
@@ -3625,26 +3625,26 @@ function actor_use_effect(actor, effect)
 	if effect_type == 0 then
 		print("Acid!\n")
 		actor_hit(actor, random(1, 0x14))
-		
+
 	elseif effect_type == 1 then
 		print("Poison!\n")
 		actor.poisoned = true
 		hit_anim(actor.x, actor.y)
-		
+
 	elseif effect_type == 2 then
 		print("Bomb!\n")
 		local hit_items = explosion(0x17e, actor.x, actor.y)
-  
+
 		for k,v in pairs(hit_items) do
 			if v.luatype == "actor" then
 				actor_hit(v, random(1, 0x14))
 			end
 		end
-		
+
 	elseif effect_type == 3 then
 		print("Gas!\n")
 		local hit_items = explosion(0x17c, actor.x, actor.y)
-  
+
 		for k,v in pairs(hit_items) do
 			if v.luatype == "actor" then
 				v.poisoned = true
@@ -3672,7 +3672,7 @@ function get_LB_to_throne()
 end
 
 function actor_avatar_death()
-	
+
 	--FIXME the hit tile is displayed constantly while the death tune is playing.
 	g_avatar_died = false -- before get_LB_to_throne()
 	local avatar = Actor.get(1)
@@ -3711,7 +3711,7 @@ function actor_avatar_death()
 		end
 	end
 	avatar.mpts=1
-	
+
 	actor_resurrect(avatar)
 	party_set_combat_mode(false)
 	party_set_party_mode()
diff --git a/devtools/create_ultima/files/ultima6/scripts/u6/ending.lua b/devtools/create_ultima/files/ultima6/scripts/u6/ending.lua
index a7e33980a9..d87a6d0ef6 100644
--- a/devtools/create_ultima/files/ultima6/scripts/u6/ending.lua
+++ b/devtools/create_ultima/files/ultima6/scripts/u6/ending.lua
@@ -12,7 +12,7 @@ local function wait_for_input()
 			break
 		end
 	end
-	
+
 	return input
 end
 
@@ -63,7 +63,7 @@ local function play()
 	canvas_set_palette("endpal.lbm", 0)
 	canvas_set_update_interval(25)
 	sprite_new(g_img_tbl[7], 0, 0, true)--bg
-	
+
 	image_set_transparency_colour(g_img_tbl[0], 0)
 	star_field = sprite_new(image_new_starfield(114,94), 106, 0, false)
 	star_field.clip_x = 106
@@ -80,30 +80,30 @@ local function play()
 	moongate.clip_y = 0
 	moongate.clip_w = 320
 	moongate.clip_h = 0x7e
-	
+
 	local characters = sprite_new(g_img_tbl[8], 0, 0, false)
 	characters.clip_x = 0
 	characters.clip_y = 0
 	characters.clip_w = 160
 	characters.clip_h = 200
-		
+
 	local characters1 = sprite_new(g_img_tbl[9], 0, 0, false)
 	characters1.clip_x = 0
 	characters1.clip_y = 0
 	characters1.clip_w = 160
 	characters1.clip_h = 200
-		
+
 	local blue_lens = sprite_new(g_img_tbl[5], 0x49, 0x57, true)--lens
 	local red_lens = sprite_new(g_img_tbl[6], 0xda, 0x57, true)--lens
-	
+
 	local scroll_img = image_load("end.shp", 0xb)
 
 	image_print(scroll_img, "A glowing portal springs from the floor!", 7, 303, 34, 13, 0x3e)
 	local scroll = sprite_new(scroll_img, 1, 0xa0, true)
-	
+
 	local input
 	local i
-	
+
 	for i=0x7d,-0xc,-1  do
 		stones_rotate_palette()
 		moongate.y = i
@@ -114,25 +114,25 @@ local function play()
 			break
 		end
 	end
-	
+
 	rotate_and_wait()
-	
+
 	characters.visible = true
-	
+
 	scroll_img = image_load("end.shp", 0xa)
 	image_print(scroll_img, "From its crimson depths Lord British emerges, trailed by the mage Nystul. Anguish and disbelief prevail on the royal seer's face, but Lord British directs his stony gaze at you and speaks as if to a wayward child.", 8, 303, 7, 13, 0x3e)
 	scroll.image = scroll_img
 	scroll.x = 0x1
 	scroll.y = 0x85
-	
+
 	rotate_and_wait()
-	
+
 	scroll_img = image_load("end.shp", 0xc)
 	image_print(scroll_img, "\"Thou didst have just cause to burgle our Codex, I trust\127 His Majesty says. \"But for Virtue's sake...", 8, 303, 7, 12, 0x3e)
 	scroll.image = scroll_img
 	scroll.x = 0x1
 	scroll.y = 0x97
-	
+
 	for i=-0xc,0x7d,1  do
 		stones_rotate_palette()
 		moongate.y = i
@@ -143,46 +143,46 @@ local function play()
 			break
 		end
 	end
-	
+
 	moongate.visible = false
 	wait_for_input()
-		
+
 	scroll_img = image_load("end.shp", 0xb)
 	image_print(scroll_img, "\"WHAT HAST THOU DONE WITH IT?\127", 8, 303, 63, 13, 0x3e)
 	scroll.image = scroll_img
 	scroll.x = 0x0
 	scroll.y = 0xa0
 
-	
+
 	wait_for_input()
-	
+
 	scroll_img = image_load("end.shp", 0xa)
 	image_print(scroll_img, "You pick up the concave lens and pass it to the King. \"Was the book ever truly ours, Your Majesty? Was it written for Britannia alone? Thou dost no longer hold the Codex, but is its wisdom indeed lost? Look into the Vortex, and let the Codex answer for itself!\127", 8, 303, 7, 8, 0x3e)
 	scroll.image = scroll_img
 	scroll.x = 0x1
 	scroll.y = 0x85
-	
+
 	wait_for_input()
-	
+
 	blue_lens.visible = false
-	
+
 	characters.clip_x = 160
 	characters.clip_w = 160
 	characters.visible = false
-	
+
 	characters1.visible = true
-	 
+
 	wait_for_input()
-	
+
 	scroll_img = image_load("end.shp", 0xc)
 	image_print(scroll_img, "As Lord British holds the glass before the wall, the Codex of Ultimate Wisdom wavers into view against a myriad of swimming stars!", 8, 303, 7, 12, 0x3e)
 	scroll.image = scroll_img
 	scroll.x = 0x1
 	scroll.y = 0x97
-	
+
 	star_field.visible = true
 	wall_transparent.visible = true
-	
+
 	for i=0xff,0,-3  do
 		wall.opacity = i
 		image_update_effect(star_field.image)
@@ -209,26 +209,26 @@ local function play()
 	end
 
 	update_star_field_and_wait()
-	
+
 	scroll_img = image_load("end.shp", 0xb)
 	image_print(scroll_img, "Yet the book remains closed.", 8, 303, 70, 13, 0x3e)
 	scroll.image = scroll_img
 	scroll.x = 0x0
 	scroll.y = 0xa0
-	
+
 	update_star_field_and_wait()
-	
+
 	music_play("gargoyle.m")
 	scroll_img = image_load("end.shp", 0xb)
 	image_print(scroll_img, "And waves of heat shimmer in the air, heralding the birth of another red gate!", 8, 303, 7, 9, 0x3e)
 	scroll.image = scroll_img
 	scroll.x = 0x0
 	scroll.y = 0x98
-	
+
 	moongate.x = 0xe6
 	moongate.y = 0x7d
 	moongate.visible = true
-	
+
 	for i=0x7d,-0xc,-1  do
 		image_update_effect(star_field.image)
 		stones_rotate_palette()
@@ -240,25 +240,25 @@ local function play()
 			break
 		end
 	end
-	
+
 	rotate_and_wait()
-	
+
 	characters.visible = true
-	
+
 	scroll_img = image_load("end.shp", 0xa)
 	image_print(scroll_img, "King Draxinusom of the Gargoyles strides forward, flanked by a small army of wingless attendants. Like Lord British, he seems to suppress his rage only through a heroic effort of will. His scaly hand grasps your shoulder, and your Amulet of Submission grows very warm.", 8, 303, 7, 8, 0x3e)
 	scroll.image = scroll_img
 	scroll.x = 0x1
 	scroll.y = 0x85
-	
+
 	rotate_and_wait()
-	
+
 	scroll_img = image_load("end.shp", 0xb)
 	image_print(scroll_img, "\"Thy time hath come, Thief,\127 he says.", 8, 303, 46, 13, 0x3e)
 	scroll.image = scroll_img
 	scroll.x = 0x0
 	scroll.y = 0xa0
-	
+
 	for i=-0xc,0x7d,1  do
 		image_update_effect(star_field.image)
 		stones_rotate_palette()
@@ -272,9 +272,9 @@ local function play()
 	end
 
 	moongate.visible = false
-	
+
 	update_star_field_and_wait()
-	
+
 	scroll_img = image_load("end.shp", 0xb)
 	image_print(scroll_img, "Quickly you reach down to seize the convex lens...", 8, 310, 5, 13, 0x3e)
 	scroll.image = scroll_img
@@ -282,7 +282,7 @@ local function play()
 	scroll.y = 0x98
 
 	update_star_field_and_wait()
-	
+
 	scroll_img = image_load("end.shp", 0xc)
 	image_print(scroll_img, "...and you press it into the hand of the towering Gargoyle king, meeting his sunken eyes. \"Join my Lord in his search for peace, I beg thee.\127", 8, 303, 7, 12, 0x3e)
 	scroll.image = scroll_img
@@ -290,11 +290,11 @@ local function play()
 	scroll.y = 0x97
 
 	update_star_field_and_wait()
-	
+
 	characters.visible = false
 	characters1.clip_w = 320
 	red_lens.visible = false
-		
+
 	scroll_img = image_load("end.shp", 0xa)
 	image_print(scroll_img, "At your urging, King Draxinusom reluctantly raises his lens to catch the light. As Lord British holds up his own lens, every eye in the room, human and Gargoyle alike, fixes upon the image of the Codex which shines upon the wall.", 8, 303, 7, 13, 0x3e)
 	scroll.image = scroll_img
@@ -302,17 +302,17 @@ local function play()
 	scroll.y = 0x85
 
 	update_star_field_and_wait()
-	
+
 	music_play("end.m")
 	scroll_img = image_load("end.shp", 0xa)
 	image_print(scroll_img, "The ancient book opens. Both kings gaze upon its pages in spellbound silence, as the eloquence of Ultimate Wisdom is revealed in the tongues of each lord's domain. You, too, can read the answers the Codex gives...", 8, 303, 7, 13, 0x3e)
 	scroll.image = scroll_img
 	scroll.x = 0x1
 	scroll.y = 0x85
-	
+
 	codex_opened.opacity = 0
 	codex_opened.visible = true
-	
+
 	for i=0,0xff,3  do
 		codex_opened.opacity = i
 		image_update_effect(star_field.image)
@@ -324,19 +324,19 @@ local function play()
 		end
 	end
 	codex.visible = false
-	
+
 	update_star_field_and_wait()
-	
+
 	scroll_img = image_load("end.shp", 0xa)
 	image_print(scroll_img, "...and when its wisdom is gleaned, when Lord British and King Draxinusom turn to each other as friends, hating no longer, fearing no more, you know that your mission in Britannia has ended at last.", 8, 303, 7, 13, 0x3e)
 	scroll.image = scroll_img
 	scroll.x = 0x1
 	scroll.y = 0x85
-	
+
 	update_star_field_and_wait()
-	
+
 	scroll.visible = false
-	
+
 	for i=0xff,0,-3  do
 		codex_opened.opacity = i
 		image_update_effect(star_field.image)
@@ -347,9 +347,9 @@ local function play()
 			break
 		end
 	end
-	
+
 	codex_opened.visible = false
-	
+
 	wall.opacity = 0
 	wall.visible = true
 
@@ -363,16 +363,16 @@ local function play()
 			break
 		end
 	end
-	
+
 	star_field.visible=false
 	wait_for_input()
-	
+
 
 	for i=0xff,0,-3 do
 		canvas_set_opacity(i)
 		canvas_update()
 	end
-	
+
 	canvas_hide_all_sprites()
 	canvas_set_opacity(0xff)
 
@@ -418,25 +418,25 @@ local function play()
 	local current_days = year * 365 + month * 30 + day
 	local start_days = START_YEAR * 365 + START_MONTH * 30 + START_DAY
 	local time = current_days - start_days
-	
+
 	local years = math.floor(time / 365)
 	local months = math.floor((time - years * 365) / 30)
 	local days = time - (years * 365 + months * 30)
-	
+
 	local line1 = ""
-	
+
 	if years > 0 then
 		if years > 29 then
 			line1 = line1..years.." year"
 		else
 			line1 = line1..num_string[years+1].." year"
 		end
-		
+
 		if years > 1 then
 			line1 = line1.."s"
 		end
 	end
-	
+
 	if months > 0 then
 		if line1 ~= "" then
 			line1 = line1..", "
@@ -453,30 +453,30 @@ local function play()
 			line1 = line1..","
 			line2 = "and "
 		end
-		
+
 		line2 = line2..num_string[days+1].." day"
 		if days ~= 1 then
 			line2 = line2.."s"
 		end
 	end
-	
+
 	if line1 == "" then
 		line1 = "Prophet, in"
 	else
 		line1 = "Prophet, in "..line1
 	end
-	
+
 	if string.len(line1.." "..line2) <= 38 and line2 ~= "" then
 		line1 = line1.." "..line2
 		line2 = ""
 	end
-	
+
 	if line2 == "" then
 		line1 = line1.."."
 	else
 		line2 = line2.."."
 	end
-	
+
 	local x, y
 	y=9
 	scroll_img = image_load("end.shp", 0xa)
@@ -499,7 +499,7 @@ local function play()
 
 	scroll.opacity = 0
 	scroll.visible = true
-	
+
 	for i=0,0xff,3  do
 		scroll.opacity = i
 		canvas_update()
@@ -509,7 +509,7 @@ local function play()
 			break
 		end
 	end
-	
+
 	wait_for_input()
 
 end
diff --git a/devtools/create_ultima/files/ultima6/scripts/u6/init.lua b/devtools/create_ultima/files/ultima6/scripts/u6/init.lua
index 9e06b5b45b..db487332b7 100644
--- a/devtools/create_ultima/files/ultima6/scripts/u6/init.lua
+++ b/devtools/create_ultima/files/ultima6/scripts/u6/init.lua
@@ -68,7 +68,7 @@ function is_avatar_dead()
 end
 
 --used with triple crossbow and magic wind spells.
-g_projectile_offset_tbl = 
+g_projectile_offset_tbl =
 {
  {
   4,5,5,5,5,6,6,6,6,6,6,
@@ -109,7 +109,7 @@ g_moonstone_loc_tbl =
  {x=0x147, y=0x336, z=0},
  {x=0x17,  y=0x16,  z=1},
  {x=0x397, y=0x3A6, z=0}
-} 
+}
 
 g_show_stealing = config_get_boolean_value("config/ultima6/show_stealing")
 
@@ -125,7 +125,7 @@ end
 
 function alignment_is_evil(align)
    if align == ALIGNMENT_EVIL or align == ALIGNMENT_CHAOTIC then return true end
-   
+
    return false
 end
 
@@ -157,7 +157,7 @@ end
 
 function obj_new(obj_n, frame_n, status, qty, quality, x, y, z)
   local obj = {}
-  
+
   obj["obj_n"] = obj_n or 0
   obj["frame_n"] = frame_n or 0
   obj["status"] = status or 0
@@ -182,14 +182,14 @@ end
 
 function look_obj(obj)
    print("Thou dost see " .. obj.look_string);
-   local weight = obj.weight; --FIXME this could be a problem if we want to change Lua_number type to int. 
+   local weight = obj.weight; --FIXME this could be a problem if we want to change Lua_number type to int.
    if weight ~= 0 then
       if obj.qty > 1 and obj.stackable then
          print(". They weigh");
       else
          print(". It weighs");
       end
-      
+
       print(string.format(" %.1f", weight).." stones");
    end
 
@@ -198,7 +198,7 @@ function look_obj(obj)
       print("\n")
       return false
    end
-   
+
    local dmg = weapon_dmg_tbl[obj.obj_n];
    if dmg ~= nil then
       if weight ~= 0 then
@@ -206,13 +206,13 @@ function look_obj(obj)
       else
          print(". It")
       end
-      
+
       print(" can do "..dmg.." point")
       if dmg > 1 then print("s") end
       print(" of damage")
 
    end
-   
+
    local ac = armour_tbl[obj.obj_n]
    if ac ~= nil then
       if weight ~= 0 or dmg ~= 0 then
@@ -220,12 +220,12 @@ function look_obj(obj)
       else
          print(". It")
       end
-      
+
       print(" can absorb "..ac.." point")
       if ac > 1 then print("s") end
       print(" of damage")
    end
-   
+
    print(".\n");
    local player_loc = player_get_location();
    if g_show_stealing == true and obj.getable == true and player_loc.z == 0 and obj.ok_to_take == false then
@@ -235,14 +235,14 @@ function look_obj(obj)
         print("PRIVATE PROPERTY")
       end
    end
-   
+
    return true
 end
 
 function player_subtract_karma(k)
 	local karma = player_get_karma() - k
 	if karma < 0 then karma = 0 end
-	
+
 	player_set_karma(karma)
 end
 
@@ -257,7 +257,7 @@ function party_heal()
 	for actor in party_members() do
 		actor.asleep = false
 		actor.poisoned = false
-		actor.paralyzed = false	
+		actor.paralyzed = false
 		actor_remove_charm(actor)
 		actor.hp = actor.max_hp
 	end
@@ -271,20 +271,20 @@ end
 function projectile(tile_num, start_x, start_y, end_x, end_y, speed, spin)
 
 	if spin == nil then spin = 0 end
-	
+
 	local rotate_offset = 0
 	local src_tile_y_offset = 0
-	
+
 	if tile_num == 547 then --spear
 		rotate_offset = 45
 	elseif tile_num == 566 then --bow
 		rotate_offset = 90
 		src_tile_y_offset = 4
 	elseif tile_num == 567 then --crossbow
-		rotate_offset = 90 
+		rotate_offset = 90
 		src_tile_y_offset = 3
 	end
-	
+
 	play_sfx(SFX_MISSLE)
 	projectile_anim(tile_num, start_x, start_y, end_x, end_y, speed, false, rotate_offset, spin, src_tile_y_offset)
 end
@@ -344,7 +344,7 @@ function actor_is_readiable_obj(actor)
 	if g_readiable_objs_tbl[actor.tile_num] ~= nil then
 		return true
 	end
-	
+
 	return false
 end
 
@@ -358,7 +358,7 @@ end
 
 function is_time_stopped()
 	if timer_get(TIMER_TIME_STOP) ~= 0 then return true end
-	
+
 	return false
 end
 
@@ -372,15 +372,15 @@ function load_game()
 		frame_n = tmp_obj_dat - 1023
 		obj_n = tmp_obj_dat - frame_n
 	end
-	
+
 	g_vanish_obj.obj_n = obj_n
 	g_vanish_obj.frame_n = frame_n
 
 	--Load moonstone locations.
 	objlist_seek(OBJLIST_OFFSET_MOONSTONES)
-	
+
 	for i=1,8 do
-	
+
 		local x = objlist_read2()
 		local y = objlist_read2()
 		local z = objlist_read2()
@@ -396,7 +396,7 @@ end
 
 function save_game()
 	objlist_seek(OBJLIST_OFFSET_VANISH_OBJ)
-	
+
 	local tmp_obj_dat = g_vanish_obj.obj_n
 	local frame_n = g_vanish_obj.frame_n
 
@@ -405,17 +405,17 @@ function save_game()
 	end
 
 	objlist_write2(tmp_obj_dat)
-	
+
 	--Save moonstone locations
 	objlist_seek(OBJLIST_OFFSET_MOONSTONES)
-	
+
 	for i=1,8 do
 		local loc = g_moonstone_loc_tbl[i]
 		objlist_write2(loc.x)
 		objlist_write2(loc.y)
 		objlist_write2(loc.z)
 	end
-	
+
 	objlist_seek(OBJLIST_OFFSET_KEG_TIMER)
 	objlist_write2(g_keg_timer)
 end
@@ -429,7 +429,7 @@ end
 
 function moonstone_get_loc(phase)
 	if phase < 1 or phase > 8 then return nil end
-	
+
 	return g_moonstone_loc_tbl[phase]
 end
 
@@ -455,7 +455,7 @@ function use_keg(obj)
 		print("\nNo effect\n")
 		return
 	end
-	
+
 	if g_keg_timer > 0 then
 		print("\nNot now\n")
 	else
@@ -473,7 +473,7 @@ function explode_keg()
 			explode_obj(obj)
 		end
 	end
-	
+
 	--try to explode lit kegs in the party's inventory
 	local party_actor
 	for party_actor in party_members() do
@@ -487,7 +487,7 @@ end
 function explode_obj(obj, actor)
 	dbg("Exploding "..obj.name.."\n")
 	local x, y, z
-	
+
 	if actor ~= nil then
 		x = actor.x
 		y = actor.y
@@ -497,9 +497,9 @@ function explode_obj(obj, actor)
 		y = obj.y
 		z = obj.z
 	end
-	
+
 	Obj.removeFromEngine(obj)
-	
+
 	local hit_items = explosion(0x189, x, y)
 	local random = math.random
 	local k, v
@@ -513,11 +513,11 @@ function explode_obj(obj, actor)
 			return -- don't keep exploding once Avatar is dead
 		end
 	end
-	
+
 	explode_surrounding_objects(x, y, z)
 end
 
-function explode_surrounding_objects(x, y, z)	
+function explode_surrounding_objects(x, y, z)
 	--blow up doors and other kegs
 	for x = x - 2,x + 2 do
 		for y = y - 2,y + 2 do
@@ -525,7 +525,7 @@ function explode_surrounding_objects(x, y, z)
 			if map_obj ~= nil then
 				explode_obj(map_obj)
 			end
-			
+
 			map_obj = map_get_obj(x, y, z, 0x12c) --steel door
 			if map_obj == nil or map_obj.frame_n == 0xc then
 				map_obj = map_get_obj(x, y, z, 0x129) --oaken door
@@ -536,7 +536,7 @@ function explode_surrounding_objects(x, y, z)
 					end
 				end
 			end
-			
+
 			if map_obj ~= nil and map_obj.frame_n <= 0xc then
 				Obj.removeFromEngine(map_obj)
 				print("\nThe door is blown up!\n")
@@ -572,4 +572,3 @@ magic_init = nuvie_load("u6/magic.lua"); magic_init();
 usecode_init = nuvie_load("u6/usecode.lua"); usecode_init();
 
 player_init = nuvie_load("u6/player.lua"); player_init();
-
diff --git a/devtools/create_ultima/files/ultima6/scripts/u6/intro.lua b/devtools/create_ultima/files/ultima6/scripts/u6/intro.lua
index b15b963be9..4919d9df63 100644
--- a/devtools/create_ultima/files/ultima6/scripts/u6/intro.lua
+++ b/devtools/create_ultima/files/ultima6/scripts/u6/intro.lua
@@ -31,7 +31,7 @@ local function wait_for_input()
 				break
 			end
 	end
-	
+
 	return input
 end
 
@@ -43,7 +43,7 @@ local function should_exit(input)
 	if input ~=nil and input == 27 then
 		return true
 	end
-	
+
 	return false
 end
 
@@ -57,7 +57,7 @@ local function fade_out()
 			break
 		end
 	end
-	
+
 	return false
 end
 
@@ -68,7 +68,7 @@ local function fade_out_sprite(sprite, speed)
 	else
 		speed = -3
 	end
-	
+
 	for i=0xff,0,speed do
 		sprite.opacity = i
 		canvas_update()
@@ -132,17 +132,17 @@ local function display_clock()
 	local t = os.date("*t")
 	local hour = t.hour
 	local minute = t.min
-	
+
 	if hour > 12 then
 		hour = hour - 12
 	end
-	
+
 	if hour < 10 then
 		g_clock_tbl["h1"].image = g_img_tbl[12]
 	else
 		g_clock_tbl["h1"].image = g_img_tbl[3]
 	end
-	
+
 	if hour >= 10 then
 		hour = hour - 10
 	end
@@ -151,7 +151,7 @@ local function display_clock()
 
 	g_clock_tbl["m1"].image = g_img_tbl[math.floor(minute / 10) + 2]
 	g_clock_tbl["m2"].image = g_img_tbl[(minute % 10) + 2]
-		
+
 end
 
 g_lounge_tbl = {}
@@ -177,9 +177,9 @@ local function load_lounge()
 	end
 
 	g_lounge_tbl["finger"] = sprite_new(g_img_tbl[0xe], 143, 91, true)
-	
+
 	g_lounge_tbl["tv_static"] = image_new(57,37)
-	
+
 	load_clock()
 end
 
@@ -243,9 +243,9 @@ local function display_tv()
 	for i=1,5 do
 		g_lounge_tbl["tv"][i].visible = false
 	end
-	
+
 	g_lounge_tbl.finger.visible = false
-	
+
 	while should_exit == false do
 		local item = g_tv_programs[g_tv_cur_program][g_tv_cur_pos]
 		if item < 0x80 then
@@ -305,7 +305,7 @@ local function display_tv()
 				display_tv_sprite(s_idx, g_tv_pledge_image)
 				s_idx = s_idx + 1
 			end
-			
+
 			if g_tv_pledge_counter == 16 then
 				if g_tv_pledge_image == 37 then
 					g_tv_pledge_image = 38
@@ -322,12 +322,12 @@ local function display_tv()
 		elseif item == 0x8b then
 			canvas_rotate_palette(0xe0, 5)
 		end
-		
+
 		g_tv_cur_pos = g_tv_cur_pos + 1
 		if g_tv_programs[g_tv_cur_program][g_tv_cur_pos] == nil then
 			g_tv_cur_program = g_tv_cur_program + 1
 			g_tv_cur_pos = 1
-			
+
 			if g_tv_programs[g_tv_cur_program] == nil then
 				g_tv_cur_program = 1
 			end
@@ -400,11 +400,11 @@ local function lounge_sequence()
 		canvas_update()
 		input = input_poll()
 	end
-	
+
 	if should_exit(input) then
 		return false
 	end
-	
+
 	scroll_img = image_load("blocks.shp", 2)
 	x, y = image_print(scroll_img, "You have traded the Avatar's life of peril and adventure ", 7, 310, 7, 8, 0x3e)
 	x, y = image_print(scroll_img, "for the lonely serenity of a world at peace. But ", 7, 310, x, y, 0x3e)
@@ -422,7 +422,7 @@ local function lounge_sequence()
 		canvas_update()
 		input = input_poll()
 	end
-	
+
 	if should_exit(input) then
 		return false
 	end
@@ -453,10 +453,10 @@ local function lounge_sequence()
 	if should_exit(input) then
 		return false
 	end
-	
+
 	hide_lounge()
 	scroll.visible = false
-	
+
 	return true
 end
 
@@ -464,25 +464,25 @@ g_window_tbl = {}
 local function load_window()
 	local rand = math.random
 	g_window_tbl["cloud_x"] = -400
-	
+
 	g_window_tbl["sky"] = sprite_new(g_img_tbl[1], 0, 0, true)
 	g_window_tbl["cloud1"] = sprite_new(g_img_tbl[0], g_window_tbl["cloud_x"], -5, true)
 	g_window_tbl["cloud2"] = sprite_new(g_img_tbl[0], g_window_tbl["cloud_x"], -5, true)
 	g_window_tbl["clouds"] = {}
-	
+
 	local i
 	for i=1,5 do
 		table.insert(g_window_tbl["clouds"], sprite_new(g_img_tbl[rand(2,3)], rand(0,320) - 260, rand(0, 30), true))
 	end
-	
+
 	g_window_tbl["lightning"] = sprite_new(nil, 0, 0, false)
 	g_window_tbl["ground"] = sprite_new(g_img_tbl[10], 0, 0x4c, true)
 	g_window_tbl["trees"] = sprite_new(g_img_tbl[8], 0, 0, true)
 
 	g_window_tbl["strike"] = sprite_new(g_img_tbl[rand(19,23)], 158, 114, false)
-	
 
-	
+
+
 	--FIXME rain here.
 	local rain = {}
 	local i
@@ -490,17 +490,17 @@ local function load_window()
 		rain[i] = sprite_new(g_img_tbl[math.random(4,7)], math.random(0,320), math.random(0,200), false)
 	end
 	g_window_tbl["rain"] = rain
-	
-	g_window_tbl["frame"] = sprite_new(g_img_tbl[28], 0, 0, true)	
+
+	g_window_tbl["frame"] = sprite_new(g_img_tbl[28], 0, 0, true)
 	g_window_tbl["window"] = sprite_new(g_img_tbl[26], 0x39, 0, true)
 	g_window_tbl["door_left"] = sprite_new(g_img_tbl[24], 320, 0, true)
 	g_window_tbl["door_right"] = sprite_new(g_img_tbl[25], 573, 0, true)
-		
+
 	g_window_tbl["flash"] = 0
 	g_window_tbl["drops"] = 0
 	g_window_tbl["rain_delay"] = 20
 	g_window_tbl["lightning_counter"] = 0
-	
+
 end
 
 local function hide_window()
@@ -545,7 +545,7 @@ local function display_window()
 			cloud.x = rand(0, 320) - 320
 			cloud.y = rand(0, 30)
 		end
-		
+
 		cloud.x = cloud.x + 2
 	end
 
@@ -553,10 +553,10 @@ local function display_window()
 	if g_window_tbl["cloud_x"] == 320 then
 		g_window_tbl["cloud_x"] = 0
 	end
-	
+
 	g_window_tbl["cloud1"].x = g_window_tbl["cloud_x"]
 	g_window_tbl["cloud2"].x = g_window_tbl["cloud_x"] - 320
-	
+
 	if rand(0, 6) == 0 and g_window_tbl["lightning_counter"] == 0 then --fixme var_1a, var_14
 		g_window_tbl["lightning_counter"] = rand(1, 4)
 		g_window_tbl["lightning"].image = g_img_tbl[rand(11,18)]
@@ -579,11 +579,11 @@ local function display_window()
 		canvas_set_palette_entry(0x5a, 0x14,0x8c,0x74)
 		canvas_set_palette_entry(0x5c, 0x0c,0x74,0x68)
 	end
-	
+
 	if rand(0,1) == 0 then
 		g_window_tbl["strike"].image = g_img_tbl[rand(19,23)]
 	end
-	
+
 	if g_window_tbl["flash"] > 0 then
 		g_window_tbl["flash"] = g_window_tbl["flash"] - 1
 	else
@@ -609,7 +609,7 @@ local function display_window()
 			g_window_tbl["drops"] = i + 1
 		end
 	end
-	
+
 	for i = 0,g_window_tbl["drops"] do
 
 		if rain[i].visible == true then
@@ -625,7 +625,7 @@ local function display_window()
 			rain[i].x = rand(0,320)
 		end
 	end
-	
+
 	if g_window_tbl["lightning_counter"] > 0 then
 		g_window_tbl["lightning_counter"] = g_window_tbl["lightning_counter"] - 1
 	end
@@ -633,7 +633,7 @@ end
 
 local function window_update()
 	local input = input_poll()
-	
+
 	while input == nil do
 		display_window()
 		canvas_update()
@@ -649,11 +649,11 @@ end
 
 local function window_sequence()
 	load_images("intro_2.shp")
-	
+
 	load_window()
-	
+
 	canvas_set_palette("palettes.int", 2)
-	
+
 	local i = 0
 	local input
 	while i < 20 do
@@ -663,25 +663,25 @@ local function window_sequence()
 		if should_exit(input) then
 			return false
 		end
-		
+
 		i = i + 1
 		canvas_update()
 	end
-	
+
 	local scroll_img = image_load("blocks.shp", 1)
 	local scroll = sprite_new(scroll_img, 1, 0x98, true)
-	
+
 	local x, y = image_print(scroll_img, "...and in moments, the storm is upon you.", 8, 312, 36, 14, 0x3e)
 
 	if window_update() == true then
 		return false
 	end
-	
+
 	scroll_img = image_load("blocks.shp", 1)
 	x, y = image_print(scroll_img, "Tongues of lightning lash the sky, conducting an unceasing ", 8, 310, 8, 10, 0x3e)
 	image_print(scroll_img, "crescendo of thunder....", 8, 310, x, y, 0x3e)
 	scroll.image = scroll_img
-	
+
 	if window_update() == true then
 		return false
 	end
@@ -690,18 +690,18 @@ local function window_sequence()
 	x, y = image_print(scroll_img, "In a cataclysm of sound and light, a bolt of searing ", 8, 310, 8, 10, 0x3e)
 	image_print(scroll_img, "blue fire strikes the earth!", 8, 310, x, y, 0x3e)
 	scroll.image = scroll_img
-	
+
 	g_window_tbl["strike"].visible = true
-		
+
 	if window_update() == true then
 		return false
 	end
-	
+
 	scroll_img = image_load("blocks.shp", 1)
 	x, y = image_print(scroll_img, "Lightning among the stones!", 8, 310, 73, 10, 0x3e)
 	image_print(scroll_img, "Is this a sign from distant Britannia?", 8, 310, 41, 18, 0x3e)
 	scroll.image = scroll_img
-		
+
 	--scroll window.
 	i = 0
 	while i < 320 do
@@ -712,9 +712,9 @@ local function window_sequence()
 		if should_exit(input) then
 			return false
 		end
-	
+
 		canvas_update()
-	
+
 		g_window_tbl["window"].x = g_window_tbl["window"].x - 2
 		g_window_tbl["frame"].x = g_window_tbl["frame"].x - 2
 		g_window_tbl["door_left"].x = g_window_tbl["door_left"].x - 2
@@ -724,25 +724,25 @@ local function window_sequence()
 			g_window_tbl["strike"].visible = false
 		end
 	end
-	
+
 	if window_update() == true then
 		return false
 	end
-	
+
 	scroll.visible = false
 	i = 0
 	while i < 68 do
-	
+
 		display_window()
 		canvas_update()
 		input = input_poll()
 		if should_exit(input) then
 			return false
 		end
-	
+
 		canvas_update()
 		input = input_poll()
-	
+
 		g_window_tbl["door_left"].x = g_window_tbl["door_left"].x - 1
 		g_window_tbl["door_right"].x = g_window_tbl["door_right"].x + 1
 		i = i + 1
@@ -760,7 +760,7 @@ local function window_sequence()
 	end
 
 	scroll.visible = false
-	
+
 end
 
 local function stones_rotate_palette()
@@ -804,7 +804,7 @@ local function stones_shake_moongate()
 			break
 		end
 	end
-	
+
 	return should_exit(input)
 end
 
@@ -836,22 +836,22 @@ local function stones_sequence()
 	x, y = image_print(scroll_img, "in the air. In a frozen moment of lightning-struck ", 7, 303, x, y, 0x3e)
 	x, y = image_print(scroll_img, "daylight, you glimpse a tiny obsidian stone in the ", 7, 303, x, y, 0x3e)
 	x, y = image_print(scroll_img, "midst of the circle!", 7, 303, x, y, 0x3e)
-	
+
 	fade_in()
 
 	if stones_update() == true then
 		return false
 	end
-	
+
 	g_stones_tbl["stone_cover"].visible = true
 	g_stones_tbl["hand"].visible = true
-	
+
 	scroll_img = image_load("blocks.shp", 0)
 	image_print(scroll_img, "Wondering, you pick it up....", 8, 234, 0x2a, 8, 0x3e)
 	scroll.image = scroll_img
 	scroll.x = 0x21
 	scroll.y = 0x1e
-	
+
 	local i
 	for i=0xc7,0x54,-2  do
 		--		display_stones()
@@ -866,18 +866,18 @@ local function stones_sequence()
 	if stones_update() == true then
 		return false
 	end
-	
+
 	g_stones_tbl["bg"].image = g_img_tbl[5]
 	g_stones_tbl["stone_cover"].visible = false
 	g_stones_tbl["gate_cover"].visible = true
-	
+
 	scroll_img = image_load("blocks.shp", 1)
 	x, y = image_print(scroll_img, "...and from the heart of the stones, a softly glowing door ", 7, 303, 7, 10, 0x3e)
 	image_print(scroll_img, "ascends in silence!", 7, 303, x, y, 0x3e)
 	scroll.image = scroll_img
 	scroll.x = 0x1
 	scroll.y = 0xa0
-	
+
 	g_stones_tbl["moon_gate"].visible = true
 
 	for i=0x64,0x5,-1  do
@@ -901,18 +901,18 @@ local function stones_sequence()
 			return false
 		end
 	end
-	
+
 	g_stones_tbl["hand"].visible = false
-	
+
 	if stones_update() == true then
 		return false
 	end
-	
+
 	g_stones_tbl["hand"].image = g_img_tbl[6]
 	g_stones_tbl["hand"].x = 0x9b
 	g_stones_tbl["hand"].visible = true
 	scroll.visible = false
-	
+
 	for i=0xc7,0x44,-2  do
 		stones_rotate_palette()
 		g_stones_tbl["hand"].y = i
@@ -925,7 +925,7 @@ local function stones_sequence()
 			return false
 		end
 	end
-	
+
 	scroll_img = image_load("blocks.shp", 2)
 	x, y = image_print(scroll_img, "Exultant memories wash over you as you clutch the stone. ", 7, 303, 7, 8, 0x3e)
 	x, y = image_print(scroll_img, "When last you saw an orb such as this, it was cast down ", 7, 303, x, y, 0x3e)
@@ -934,13 +934,13 @@ local function stones_sequence()
 	scroll.x = 0x1
 	scroll.y = 0x98
 	scroll.visible = true
-	
+
 	if stones_update() == true then
 		return false
 	end
-	
+
 	scroll.visible = false
-	
+
 	for i=0x44,0xc7,2  do
 		stones_rotate_palette()
 		g_stones_tbl["hand"].y = i
@@ -953,50 +953,50 @@ local function stones_sequence()
 			return false
 		end
 	end
-	
+
 	g_stones_tbl["hand"].visible = false
-	
+
 	scroll_img = image_load("blocks.shp", 2)
 	image_print(scroll_img, "But your joy soon gives way to apprehension.", 7, 303, 16, 8, 0x3e)
 	image_print(scroll_img, "The gate to Britannia has always been blue...", 7, 303, 18, 24, 0x3e)
 	image_print(scroll_img, "as blue as the morning sky.", 7, 303, 76, 32, 0x3e)
 	scroll.image = scroll_img
 	scroll.visible = true
-		
+
 	if stones_update() == true then
 		return false
 	end
-	
+
 	scroll_img = image_load("blocks.shp", 1)
 	x,y = image_print(scroll_img, "Abruptly, the portal quivers and begins to sink ", 7, 303, 7, 10, 0x3e)
 	image_print(scroll_img, "into the ground.  Its crimson light wanes!", 7, 303, x, y, 0x3e)
 	scroll.image = scroll_img
 	scroll.x = 0x1
 	scroll.y = 0xa0
-	
+
 	if stones_shake_moongate() == true then
 		return false
 	end
-	
+
 	scroll_img = image_load("blocks.shp", 1)
 	x,y = image_print(scroll_img, "Desperation makes the decision an easy one.", 7, 303, 22, 14, 0x3e)
 	scroll.image = scroll_img
 	scroll.x = 0x1
 	scroll.y = 0xa0
-		
+
 	if stones_shake_moongate() == true then
 		return false
 	end
-	
+
 	scroll.visible = false
-	
+
 	g_stones_tbl["avatar"].visible = true
-	
+
 	canvas_set_palette_entry(0x19, 0, 0, 0)
-		
+
 	for i=0,19,1 do
 		g_stones_tbl["avatar"].image = g_img_tbl[7+i]
-		
+
 		local j
 		for j=0,4 do
 			canvas_update()
@@ -1004,7 +1004,7 @@ local function stones_sequence()
 			g_stones_tbl["moon_gate"].x = 0x7c + math.random(0, 1)
 			g_stones_tbl["moon_gate"].y = 5 + math.random(0, 3)
 		end
-						
+
 		g_stones_tbl["avatar"].y = g_stones_tbl["avatar"].y - 3
 
 		local input = input_poll()
@@ -1012,16 +1012,16 @@ local function stones_sequence()
 			return false
 		end
 	end
-	
-	
+
+
 	for i=0xff,0,-3 do
 		canvas_update()
 		stones_rotate_palette()
 		g_stones_tbl["moon_gate"].x = 0x7c + math.random(0, 1)
 		g_stones_tbl["moon_gate"].y = 5 + math.random(0, 3)
-		
+
 		g_stones_tbl["avatar"].opacity = i
-	
+
 		local input = input_poll()
 		if input ~= nil and should_exit(input) then
 			return false
@@ -1029,9 +1029,9 @@ local function stones_sequence()
 	end
 
 	canvas_set_palette_entry(0x19, 0x74, 0x74, 0x74)
-	
+
 	g_stones_tbl["moon_gate"].x = 0x7c
-	
+
 	for i=0x5,0x64,1  do
 		stones_rotate_palette()
 		g_stones_tbl["moon_gate"].y = i
@@ -1046,7 +1046,7 @@ local function stones_sequence()
 	g_stones_tbl["moon_gate"].visible = false
 	g_stones_tbl["gate_cover"].visible = false
 	g_stones_tbl["stone_cover"].visible = true
-	
+
 	if stones_update() == true then
 		return false
 	end
@@ -1112,7 +1112,7 @@ background.visible = false
 
 
 if lounge_sequence() == false then
-	return 
+	return
 end
 
 if window_sequence() == false then
@@ -1142,7 +1142,7 @@ local function gypsy_ab_select(question)
 	2, 2, 3, 3, 3, 3, 4, 4,
 	4, 5, 5, 6,
 	}
-	
+
 	local b_lookup_tbl = {
 	1, 2, 3, 4, 5, 6, 7, 2,
 	3, 4, 5, 6, 7, 3, 4, 5,
@@ -1229,7 +1229,7 @@ local gypsy_question_text = {
 	0x6E, 0x74, 0x79, 0x7D, 0x80, 0x82, -1, 0x84,
 	0x6F, 0x75, 0x7A, 0x7E, 0x81, 0x83, 0x84, -1,
 	}
-	
+
 	g_str = 0xf
 	g_dex = 0xf
 	g_int = 0xf
@@ -1239,27 +1239,27 @@ local gypsy_question_text = {
 local function shuffle_question_tbl(shuffle_len)
 	local random = math.random
 	local c = random(0, (shuffle_len * shuffle_len)-1) + shuffle_len
-	
+
 	for i=0,c,1 do
 		local j = random(1, shuffle_len)
 		local k = random(1, shuffle_len)
-	
+
 		local tmp = g_question_tbl[j]
-	
+
 		g_question_tbl[j] = g_question_tbl[k]
 		g_question_tbl[k] = tmp
 	end
-	
+
 end
 
-local function gypsy_start_pouring(vial_num, vial_level)	
-	local pour_img_tbl = 
+local function gypsy_start_pouring(vial_num, vial_level)
+	local pour_img_tbl =
 	{
 	 0x2B, 0x43, 0x56, 0x6B, 0x24, 0x74, 0x19, 0x2C,
 	 0x2C, 0x44, 0x57, 0x6C, 0x23, 0x73, 0x18, 0x2B,
 	 0x2E, 0x45, 0x58, 0x6D, 0x22, 0x72, 0x17, 0x2A,
 	}
-	
+
 	if vial_level <= 3 and vial_level > 0 then
 		g_gypsy_tbl["pour"].visible = true
 		local img1 = pour_img_tbl[(3 - vial_level) * 8 + vial_num]
@@ -1269,30 +1269,30 @@ local function gypsy_start_pouring(vial_num, vial_level)
 		else
 			img1 = img1 + 0x42
 		end
-		
+
 		g_gypsy_tbl["pour"].image = g_gypsy_img_tbl[img1]
-		
+
 		local pour_y_tbl = {0x32, 0x37, 0x40}
 		g_gypsy_tbl["pour"].y = pour_y_tbl[3 - vial_level + 1] - 20
-		
+
 		local pour_x_tbl =
 		{
 		 0x92, 0x92, 0x92, 0x92, 0x0A9, 0x0A9, 0x0A9, 0x0A9,
 		 0x91, 0x91, 0x91, 0x91, 0x0A9, 0x0A9, 0x0A9, 0x0A9,
 		 0x94, 0x94, 0x94, 0x94, 0x0AA, 0x0AA, 0x0AA, 0x0AA,
 		}
-		
+
 		g_gypsy_tbl["pour"].x = pour_x_tbl[(3 - vial_level) * 8 + vial_num]
 	end
-	
+
 	g_gypsy_tbl["jar_level"] = g_gypsy_tbl["jar_level"] + 1
-	
+
 	g_gypsy_tbl["jar_liquid"].visible = true
 	g_gypsy_tbl["jar_liquid"].image = g_gypsy_img_tbl[8 + g_gypsy_tbl["jar_level"]]
 	g_gypsy_tbl["jar_liquid"].y = g_gypsy_tbl["jar_liquid"].y - 1
 
 	local vial_colors = {239, 14, 231, 103, 228, 5, 15, 219}
-	
+
 	image_bubble_effect_add_color(vial_colors[vial_num])
 	g_gypsy_tbl["bubble_counter"] = 0
 
@@ -1305,16 +1305,16 @@ end
 local function gypsy_vial_anim_liquid(img_num, vial_num, vial_level, hand_x, hand_y)
 
 	--io.stderr:write(img_num..", "..vial_num..", "..vial_level..", "..hand_x..", "..hand_y.."\n")
-	
+
 	if vial_level == 3 then
 		vial_level = 2
 	end
-	
+
 	if vial_level <= 0 then
 		g_gypsy_tbl["vial_liquid"][vial_num].visible = false
 		return
 	end
-	
+
 	local si = 0
 	if img_num == 0xf then return end
 
@@ -1352,7 +1352,7 @@ local function gypsy_vial_anim_liquid(img_num, vial_num, vial_level, hand_x, han
 
 	end
 
-	local vial_liquid_tbl = { 
+	local vial_liquid_tbl = {
 	0x3A, 0x4F, 0x64, 0x7C, 0x28, 0x7E, 0x20, 0x34,
 	0x36, 0x4B, 0x60, 0x76, 0x26, 0x78, 0x1C, 0x30,
 	0x36, 0x4B, 0x60, 0x76, 0x26, 0x78, 0x1C, 0x30,
@@ -1368,23 +1368,23 @@ local function gypsy_vial_anim_liquid(img_num, vial_num, vial_level, hand_x, han
 	}
 
 	local img_offset
-	
+
 	if vial_num > 6 and si ~= 3 then
 		img_offset = 9
 	else
 		img_offset = 0x42
 	end
-	
+
 	--io.stderr:write("si ="..si.."\n")
-	
+
 	if vial_level > 0 and vial_level < 3 then
 		--vial_liquid_tbl[vial_level * 2 + si * 24 + vial_num] + img_offset
 		local img_idx = vial_liquid_tbl[(vial_level-1) * 8 + si * 24 + vial_num]
 		g_gypsy_tbl["vial_liquid"][vial_num].image = g_gypsy_img_tbl[img_idx + img_offset]
-		
+
 		local hand_y_tbl = {0x1B, 0x13, 0x13, 0x16, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x0B, 0x0B, 0x0B}
 		g_gypsy_tbl["vial_liquid"][vial_num].y = hand_y + hand_y_tbl[si * 3 + vial_level] - 20
-		
+
 		local hand_x_tbl =
 		{
 		0x4, 0x4, 0x4, 0x4, 0x14, 0x14, 0x14, 0x14,
@@ -1400,12 +1400,12 @@ local function gypsy_vial_anim_liquid(img_num, vial_num, vial_level, hand_x, han
 		0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3,
 		0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3,
 		}
-		
+
 		local hand_x_tbl1 = {10, 10, 10, 10, -13, -13, -13, -13}
 
 		g_gypsy_tbl["vial_liquid"][vial_num].x = hand_x + hand_x_tbl[si * 24 + (vial_level-1) * 8 + vial_num] + hand_x_tbl1[vial_num]
 	end
-	
+
 end
 
 local function gypsy_vial_anim(vial)
@@ -1414,31 +1414,31 @@ local function gypsy_vial_anim(vial)
 	local vial_img_off = {2, 5, 8, 0xB, 0x18, 0x1B, 0x1E, 0x21}
 
 	local vial_x_offset = {41, 62, 83, 104, 200, 221, 242, 263}
-	
+
 	local idx
-	
+
 	--g_gypsy_tbl["vial"][vial].visible = false
 	--g_gypsy_tbl["vial_liquid"][vial].visible = false
-	
-	
+
+
 	local arm_img_tbl = {0, 0, 0, 0, 5, 5, 5, 5}
 	local arm_img_tbl1 = {1, 1, 1, 1, 4, 4, 4, 4}
 	local arm_img_tbl2 = {2, 2, 2, 2, 3, 3, 3, 3}
-	
+
 	local hand_img_tbl = {12, 12, 12, 12, 13, 13, 13, 13}
 	local hand_img_tbl1 = {9, 9, 9, 9, 17, 17, 17, 17}
 	local hand_img_tbl2 = {10, 10, 10, 10, 18, 18, 18, 18}
 	local hand_img_tbl3 = {16, 16, 16, 16, 46, 46, 46, 46}
 	local hand_img_tbl4 = {15, 15, 15, 15, 37, 37, 37, 37}
-	
+
 	local arm_x_offset = {93, 93, 93, 93, 172, 172, 172, 172}
-	
+
 	local hand_x_offset = {29, 50, 71, 92, 202, 223, 244, 264}
 	local hand_x_offset1 = {107, 107, 107, 107, 170, 170, 170, 170}
 	local hand_x_offset2 = {109, 109, 109, 109, 168, 168, 168, 168}
 	local hand_x_offset3 = {112, 112, 112, 112, 165, 165, 165, 165}
 	local hand_x_offset4 = {10, 10, 10, 10, -13, -13, -13, -13}
-	
+
 	local hand_img_num
 	local should_update
 	for idx=0,16 do
@@ -1482,13 +1482,13 @@ local function gypsy_vial_anim(vial)
 			g_gypsy_tbl["hand"].image = g_gypsy_img_tbl[9 + hand_img_num]
 			g_gypsy_tbl["hand"].x = hand_x_offset[vial]
 			g_gypsy_tbl["hand"].y = 25
-			
+
 		elseif idx == 4 or idx == 12 then
 			--
 			g_gypsy_tbl["arm"].image = g_gypsy_img_tbl[1 + arm_img_tbl2[vial]]
 			g_gypsy_tbl["arm"].x = arm_x_offset[vial]
 			g_gypsy_tbl["arm"].y = 21
-		
+
 			hand_img_num = hand_img_tbl1[vial]
 			g_gypsy_tbl["hand"].image = g_gypsy_img_tbl[9 + hand_img_num]
 			g_gypsy_tbl["hand"].x = hand_x_offset1[vial]
@@ -1499,19 +1499,19 @@ local function gypsy_vial_anim(vial)
 			g_gypsy_tbl["arm"].image = g_gypsy_img_tbl[1 + arm_img_tbl2[vial]]
 			g_gypsy_tbl["arm"].x = arm_x_offset[vial]
 			g_gypsy_tbl["arm"].y = 21
-		
+
 			hand_img_num = hand_img_tbl2[vial]
 			g_gypsy_tbl["hand"].image = g_gypsy_img_tbl[9 + hand_img_num]
 			g_gypsy_tbl["hand"].x = hand_x_offset1[vial]
 			g_gypsy_tbl["hand"].y = 20
-		
+
 			if idx == 11 then
 				vial_level[vial] = vial_level[vial] - 1
 				if vial_level[vial] == 2 then
 					gypsy_stop_pouring()
 				end
 			end
-			
+
 			if vial_level[vial] == 3 then
 				gypsy_start_pouring(vial, vial_level[vial])
 			end
@@ -1523,12 +1523,12 @@ local function gypsy_vial_anim(vial)
 			g_gypsy_tbl["arm"].image = g_gypsy_img_tbl[1 + arm_img_tbl2[vial]]
 			g_gypsy_tbl["arm"].x = arm_x_offset[vial]
 			g_gypsy_tbl["arm"].y = 21
-		
+
 			hand_img_num = hand_img_tbl3[vial]
 			g_gypsy_tbl["hand"].image = g_gypsy_img_tbl[9 + hand_img_num]
 			g_gypsy_tbl["hand"].x = hand_x_offset2[vial]
 			g_gypsy_tbl["hand"].y = 21
-			
+
 			if vial_level[vial] == 2 then
 				if idx == 6 then
 					gypsy_start_pouring(vial, vial_level[vial])
@@ -1544,12 +1544,12 @@ local function gypsy_vial_anim(vial)
 			g_gypsy_tbl["arm"].image = g_gypsy_img_tbl[1 + arm_img_tbl2[vial]]
 			g_gypsy_tbl["arm"].x = arm_x_offset[vial]
 			g_gypsy_tbl["arm"].y = 21
-		
+
 			hand_img_num = hand_img_tbl4[vial]
 			g_gypsy_tbl["hand"].image = g_gypsy_img_tbl[9 + hand_img_num]
 			g_gypsy_tbl["hand"].x = hand_x_offset3[vial]
 			g_gypsy_tbl["hand"].y = 13
-			
+
 			if vial_level[vial] == 1 then
 				if idx == 7 then
 					gypsy_start_pouring(vial, vial_level[vial])
@@ -1563,13 +1563,13 @@ local function gypsy_vial_anim(vial)
 		--if idx > 3 and idx < 9 or idx > 8 and idx < 13 then
 		--	g_gypsy_tbl["hand"].x = g_gypsy_tbl["hand"].x - hand_x_offset4[vial]
 		--end
-		
+
 		--io.stderr:write("idx ="..idx.."\n")
 		if should_update == true then
 			gypsy_vial_anim_liquid(hand_img_num, vial, vial_level[vial], g_gypsy_tbl["hand"].x - hand_x_offset4[vial], g_gypsy_tbl["hand"].y + 20)
-		
+
 			--g_gypsy_tbl["hand"].x = g_gypsy_tbl["hand"].x + hand_x_offset4[vial]
-		
+
 			local j
 			for j = 1,8 do
 				if g_gypsy_tbl["jar_level"] > 0 then
@@ -1579,7 +1579,7 @@ local function gypsy_vial_anim(vial)
 				input_poll()
 			end
 		end
-	--[[						
+	--[[
 		local j
 		for j = 1,8 do
 			local img = g_gypsy_tbl["jar_liquid"].image
@@ -1593,41 +1593,41 @@ local function gypsy_vial_anim(vial)
 	end
 
 	g_gypsy_tbl["hand"].visible = false
-	
+
 	--io.stderr:write("vial #"..vial.." level="..vial_level[vial].."\n")
-	
 
-	
+
+
 	g_gypsy_tbl["hand"].visible = false
 	g_gypsy_tbl["arm"].visible = false
-			
+
 	g_gypsy_tbl["vial"][vial].visible = true
 	--g_gypsy_tbl["vial_liquid"][vial].visible = true
 end
 
 local function gypsy_ask_questions(num_questions, scroll)
-	
+
 	local strength_adjustment_tbl = { 0, 0, 2, 0, 1, 1, 1, 0 }
-	local dex_adjustment_tbl = { 0, 2, 0, 1, 1, 0, 1, 0 } 
+	local dex_adjustment_tbl = { 0, 2, 0, 1, 1, 0, 1, 0 }
 	local int_adjustment_tbl = { 2, 0, 0, 1, 0, 1, 1, 0 }
-	
+
 	for i=0,num_questions-1,1 do
 		local q = gypsy_questions[g_question_tbl[i*2+1]*8 + g_question_tbl[i*2+2] + 1]
-	
+
 		local scroll_img = image_load("blocks.shp", 3)
 		scroll.image = scroll_img
 		image_print(scroll_img, gypsy_question_text[q - 104], 7, 303, 8, 9, 0x3e)
-	
+
 		local vial = gypsy_ab_select(q)
-	
+
 		gypsy_vial_anim(vial)
-		
+
 		g_str = g_str + strength_adjustment_tbl[vial]
 		g_dex = g_dex + dex_adjustment_tbl[vial]
 		g_int = g_int + int_adjustment_tbl[vial]
-	
+
 		g_question_tbl[i+1] = vial-1
-	
+
 		--io.stderr:write(q.." "..vial.."("..g_str..","..g_dex..","..g_int..")\n")
 	end
 end
@@ -1707,11 +1707,11 @@ g_keycode_tbl =
 }
 local function create_character()
 	music_play("create.m")
-	
+
 	local bubbles = sprite_new(image_new(100,100, 0), 110, 30, false)
 	local bg = sprite_new(image_load("vellum1.shp", 0), 0x10, 0x50, true)
 	image_print(bg.image, "By what name shalt thou be called?", 7, 303, 36, 24, 0x48)
-	
+
 	local name = sprite_new(nil, 0x34, 0x78, true)
 	name.text = ""
 	local char_index = 0
@@ -1793,9 +1793,9 @@ local function create_character()
 			input = nil
 		end
 	end
-	
+
 	name.x = 0x10 + (284 - canvas_string_length(name.text)) / 2
-	
+
 	image_print(bg.image, "And art thou Male, or Female?", 7, 303, 52, 56, 0x48)
 	local gender_sprite = sprite_new(nil, 154, 152, true)
 	gender_sprite.text = ""
@@ -1829,23 +1829,23 @@ local function create_character()
 			elseif input == 13 and gender_sprite.text ~= "" then --return
 				break;
 			end
-			
+
 			input = nil
 		end
 	end
 	gender_sprite.visible = false
 	load_images("vellum1.shp")
 	bg.image = g_img_tbl[0]
-	
+
 	name.y = 0x59
-	
+
 	image_draw_line(bg.image, 14, 19, 277, 19, 0x48)
-	
-	local new_sex = sprite_new(g_img_tbl[3], 0x5e, 0x70, true)	
+
+	local new_sex = sprite_new(g_img_tbl[3], 0x5e, 0x70, true)
 	local new_portrait = sprite_new(g_img_tbl[0x12], 0x3e, 0x81, true)
 	local continue = sprite_new(g_img_tbl[0x10], 0x56, 0x92, true)
 	local esc_abort = sprite_new(g_img_tbl[4], 0x50, 0xa3, true)
-	
+
 	local montage_img_tbl = image_load_all("montage.shp")
 	local portrait_num = 0
 	local avatar = sprite_new(montage_img_tbl[gender*6+portrait_num], 0xc3, 0x76, true)
@@ -1884,7 +1884,7 @@ local function create_character()
 				else
 					portrait_num = portrait_num + 1
 				end
-				
+
 				avatar.image = montage_img_tbl[gender*6+portrait_num]
 			elseif input == 115 or input == 83 or (input == 13 and button_index == 0) then
 				if gender == 0 then
@@ -1966,23 +1966,23 @@ local function create_character()
 	mouse_cursor_visible(false)
 	fade_out()
 	canvas_hide_all_sprites()
-	
+
 	canvas_set_palette("palettes.int", 4)
 	local woods_img_tbl = image_load_all("woods.shp")
 	local woods = sprite_new(woods_img_tbl[0], 0, 0, true)
 	local woods1 = sprite_new(woods_img_tbl[1], 0x140, 0, true)
-	
+
 	fade_in()
-	
+
 	local scroll_img = image_load("blocks.shp", 1)
 	local scroll = sprite_new(scroll_img, 1, 0xa0, true)
-	
+
 	local x, y = image_print(scroll_img, "\"Welcome, O Seeker!\127", 7, 303, 96, 14, 0x3e)
-	
+
 	wait_for_input()
-	
+
 	scroll.visible = false
-	
+
 	input = nil
 	for i=0,0xbd,2 do
 		woods.x = woods.x - 2
@@ -1993,17 +1993,17 @@ local function create_character()
 			break
 		end
 	end
-	
+
 	woods.x = -190
 	woods1.x = 130
-	
+
 	scroll_img = image_load("blocks.shp", 2)
 	scroll.x = 1
 	scroll.y = 0x98
 	image_print(scroll_img, "A lonely stroll along an unfamiliar forest path brings you upon a curious gypsy wagon, its exotic colors dappled in the summer shade.", 7, 303, 8, 12, 0x3e)
 	scroll.image = scroll_img
 	scroll.visible = true
-		
+
 	wait_for_input()
 
 	scroll_img = image_load("blocks.shp", 2)
@@ -2012,22 +2012,22 @@ local function create_character()
 	image_print(scroll_img, "A woman's voice rings out with friendship, beckoning you into across the wagon's threshold and, as it happens, into another life....", 7, 303, 8, 12, 0x3e)
 	scroll.image = scroll_img
 	scroll.visible = true
-	
+
 	wait_for_input()
-	
+
 	scroll.visible = false
-	
+
 	fade_out()
 	canvas_hide_all_sprites()
 	canvas_set_palette("palettes.int", 5)
-	
+
 	g_gypsy_img_tbl = image_load_all("gypsy.shp")
-	
+
 	bg.image = g_gypsy_img_tbl[0]
 	bg.x = 0
 	bg.y = -20
 	bg.visible = true
-	
+
 	g_gypsy_tbl = {}
 	g_gypsy_tbl["arm"] = sprite_new(nil, 0, 0, false)
 	g_gypsy_tbl["pour"] = sprite_new(nil, 0, 0, false)
@@ -2039,16 +2039,16 @@ local function create_character()
 	g_gypsy_tbl["jar_liquid"].clip_y = 0
 	g_gypsy_tbl["jar_liquid"].clip_w = 320
 	g_gypsy_tbl["jar_liquid"].clip_h = 0x6d
-	
-	g_gypsy_tbl["jar"] = sprite_new(g_gypsy_img_tbl[16], 0x8e, 0x38, true)	
-	 	
+
+	g_gypsy_tbl["jar"] = sprite_new(g_gypsy_img_tbl[16], 0x8e, 0x38, true)
+
 	g_gypsy_tbl["bubble_counter"] = 0
 
 	g_gypsy_tbl["vial_level"] = {3,3,3,3,3,3,3,3}
 	local vial_level = g_gypsy_tbl["vial_level"]
-	
+
 	local vial_img_off = {2, 5, 8, 0xB, 0x18, 0x1B, 0x1E, 0x21}
-	
+
 	g_gypsy_tbl["vial_liquid"] = {
 		sprite_new(g_gypsy_img_tbl[0x42 + vial_img_off[1] + vial_level[1] - 3], 44, 0x4d, true),
 		sprite_new(g_gypsy_img_tbl[0x42 + vial_img_off[2] + vial_level[2] - 3], 65, 0x4d, true),
@@ -2059,9 +2059,9 @@ local function create_character()
 		sprite_new(g_gypsy_img_tbl[0x42 + vial_img_off[7] + vial_level[7] - 3], 245, 0x4d, true),
 		sprite_new(g_gypsy_img_tbl[0x42 + vial_img_off[8] + vial_level[8] - 3], 266, 0x4d, true),
 	}
-	
+
 	g_gypsy_tbl["hand"] = sprite_new(nil, 0, 0, false)
-		
+
 	g_gypsy_tbl["vial"] = {
 		sprite_new(g_gypsy_img_tbl[20], 41, 0x42, true),
 		sprite_new(g_gypsy_img_tbl[20], 62, 0x42, true),
@@ -2072,25 +2072,25 @@ local function create_character()
 		sprite_new(g_gypsy_img_tbl[23], 242, 0x42, true),
 		sprite_new(g_gypsy_img_tbl[23], 263, 0x42, true),
 	}
-	
+
 	fade_in()
-	
+
 	scroll.x = 1
 	scroll.y = 0x7c
 	scroll.visible = true
-		
+
 	local scroll_img = image_load("blocks.shp", 3)
 	scroll.image = scroll_img
 	x, y = image_print(scroll_img, "\"At last thou hast come to fulfill thy destiny,\127 the gypsy says. She smiles, as if in great relief.", 7, 303, 8, 19, 0x3e)
 	image_print(scroll_img, "\"Sit before me now, and I shall pour the light of Virtue into the shadows of thy future.\127", 7, 303, 8, y+16, 0x3e)
-	
+
 	wait_for_input()
-	
+
 	scroll_img = image_load("blocks.shp", 3)
 	scroll.image = scroll_img
 	x, y = image_print(scroll_img, "On a wooden table eight bottles stand, a rainbow of bubbling liquids.", 7, 303, 8, 19, 0x3e)
 	image_print(scroll_img, "\"Behold the Virtues of the Avatar,\127 the woman says. \"Let us begin the casting!\127", 7, 303, 8, y+16, 0x3e)
-	
+
 	wait_for_input()
 	canvas_set_palette_entry(19, 200, 200, 200) -- fix mouse cursor
 	canvas_set_palette_entry(27, 68, 68, 68) -- fix mouse cursor
@@ -2105,28 +2105,28 @@ local function create_character()
 	g_str = 0xf
 	g_dex = 0xf
 	g_int = 0xf
-	
 
-	
+
+
 	shuffle_question_tbl(8)
 	gypsy_ask_questions(4, scroll)
 
 	shuffle_question_tbl(4)
-	
+
 	gypsy_ask_questions(2, scroll)
 	gypsy_ask_questions(1, scroll)
-	
+
 	a_button.visible = false
 	b_button.visible = false
 	g_ab_highlight.visible = false
 	mouse_cursor_visible(false)
-	
+
 	scroll_img = image_load("blocks.shp", 3)
 	scroll.image = scroll_img
 	image_print(scroll_img, "\"The path of the Avatar lies beneath thy feet, worthy "..name.text..",\127 the gypsy intones. With a mysterious smile, she passes you the flask of shimmering liquids. \"Drink of these waters and go forth among our people, who shall receive thee in joy!\127", 7, 303, 8, 16, 0x3e)
-	
+
 	-- wait_for_input()
-	
+
 	input = nil
 	while input == nil do
 		gypsy_update_bubbles(g_gypsy_tbl["jar_liquid"].image)
@@ -2138,11 +2138,11 @@ local function create_character()
 	end
 
 	fade_out()
-	
+
 	canvas_hide_all_sprites()
 	canvas_set_palette("palettes.int", 6)
-	
-	
+
+
 	--local big_flask = sprite_new(g_gypsy_img_tbl[198], 0, 0, true)
 	bubbles.visible = true
 	bg.x = 0
@@ -2151,7 +2151,7 @@ local function create_character()
 	bg.image = g_gypsy_img_tbl[198]
 	g_gypsy_tbl["bubble_counter"] = 0
 	gypsy_update_bubbles(bubbles.image)
-	
+
 	fade_in()
 
 	scroll_img = image_load("blocks.shp", 2)
@@ -2160,7 +2160,7 @@ local function create_character()
 	scroll.y = 0x98
 	scroll.visible = true
 	image_print(scroll_img, "As you drink from the flask, vertigo overwhelms you. A soothing mist obscures the gypsy's face, and you sink without fear into an untroubled sleep.", 7, 303, 8, 8, 0x3e)
-	
+
 	--wait_for_input()
 
 	input = nil
@@ -2172,60 +2172,60 @@ local function create_character()
 			break
 		end
 	end
-	
+
 	scroll.visible = false
-		
+
 	canvas_set_bg_color(0x75)
 	fade_out()
-	
+
 	bubbles.visible = false
-	
+
 	bg.image = g_gypsy_img_tbl[199]
 	bg.x = 0
 	bg.y = 0
 	bg.visible = true
-		
+
 	scroll.visible = false
-	
+
 	fade_in()
-	
+
 	scroll_img = image_load("blocks.shp", 2)
 	scroll.image = scroll_img
 	scroll.visible = true
 	image_print(scroll_img, "You wake in a different time, upon another world's shore. Though the Avatar's quests bring you both triumph and tragedy, never do you stray from the path of the Eight Virtues.", 7, 303, 8, 8, 0x3e)
 
 	wait_for_input()
-	
+
 	scroll_img = image_load("blocks.shp", 2)
 	scroll.image = scroll_img
 	scroll.visible = true
 	image_print(scroll_img, "The sagas of Ultima IV and Ultima V chronicle your perilous travels, and your name and your deeds are written forever among Britannia's legends....", 7, 303, 8, 8, 0x3e)
-	
+
 	wait_for_input()
 
 	scroll_img = image_load("blocks.shp", 2)
 	scroll.image = scroll_img
 	scroll.visible = true
 	image_print(scroll_img, "Finally, tempered by your struggles against the enemies of Virtue, you are proven ready to answer the epic challenge of Ultima VI!", 7, 303, 8, 12, 0x3e)
-	
+
 	wait_for_input()
 	scroll.visible = false
-	
+
 	canvas_set_bg_color(0)
 	fade_out()
-	
+
 	config_set("config/newgame", true)
-	
+
 	config_set("config/newgamedata/name", name.text)
 	config_set("config/newgamedata/gender", gender)
 	config_set("config/newgamedata/portrait", portrait_num)
 	config_set("config/newgamedata/str", g_str)
 	config_set("config/newgamedata/dex", g_dex)
 	config_set("config/newgamedata/int", g_int)
-	
+
 	g_gypsy_img_tbl = nil
 	g_gypsy_tbl = nil
-	
+
 	return true
 end
 
@@ -2238,7 +2238,7 @@ end
 local function acknowledgements()
 
 	local bg = sprite_new(image_load("vellum1.shp", 0), 0x10, 0x50, true)
-	
+
 	ack_header(bg.image)
 
 	image_print(bg.image, "Produced by", 7, 303, 106, 32, 0xC)
@@ -2246,63 +2246,63 @@ local function acknowledgements()
 
 	image_print(bg.image, "Executive Producer", 7, 303, 82, 56, 0xC)
 	image_print(bg.image, "Dallas Snell", 7, 303, 106, 64, 0x48)
-	
+
 	image_print(bg.image, "Programming", 7, 303, 104, 80, 0xC)
 	image_print(bg.image, "Cheryl Chen    John Miles", 7, 303, 67, 88, 0x48)
 	image_print(bg.image, "Herman Miller    Gary Scott Smith", 7, 303, 40, 96, 0x48)
-	
+
 	fade_in_sprite(bg)
 	local input
-		
+
 	wait_for_input()
-		
+
 	bg.image = image_load("vellum1.shp", 0)
-	
+
 	ack_header(bg.image)
-	
+
 	image_print(bg.image, "Writing", 7, 303, 120, 47, 0xC)
 	image_print(bg.image, "Stephen Beeman    Dr. Cat    \39Manda Dee", 7, 303, 25, 55, 0x48)
 	image_print(bg.image, "Richard Garriott    Greg Malone", 7, 303, 46, 63, 0x48)
 	image_print(bg.image, "John Miles    Herman Miller", 7, 303, 61, 71, 0x48)
 	image_print(bg.image, "Todd Porter    Warren Spector", 7, 303, 50, 79, 0x48)
-							
+
 	wait_for_input()
-	
+
 	bg.image = image_load("vellum1.shp", 0)
-	
+
 	ack_header(bg.image)
-	
+
 	image_print(bg.image, "Art", 7, 303, 132, 31, 0xC)
 	image_print(bg.image, "Keith Berdak    Daniel Bourbonnais", 7, 303, 37, 39, 0x48)
 	image_print(bg.image, "Jeff Dee    \39Manda Dee", 7, 303, 75, 47, 0x48)
 	image_print(bg.image, "Glen Johnson    Denis Loubet", 7, 303, 56, 55, 0x48)
-		
+
 	image_print(bg.image, "Music", 7, 303, 126, 71, 0xC)
 	image_print(bg.image, "Ken Arnold    Iolo Fitzowen", 7, 303, 61, 79, 0x48)
 	image_print(bg.image, "Herman Miller    Todd Porter", 7, 303, 56, 87, 0x48)
-	
+
 	wait_for_input()
-	
+
 	bg.image = image_load("vellum1.shp", 0)
-	
+
 	ack_header(bg.image)
-		
+
 	image_print(bg.image, "Quality Assurance", 7, 303, 87, 31, 0xC)
 	image_print(bg.image, "Paul Malone    Mike Romero", 7, 303, 62, 39, 0x48)
 	image_print(bg.image, "", 7, 303, 49, 47, 0x48)
-	
+
 	image_print(bg.image, "Additional Support", 7, 303, 84, 63, 0xC)
 	image_print(bg.image, "Michelle Caddel    Melanie Fleming", 7, 303, 39, 71, 0x48)
 	image_print(bg.image, "Alan Gardner    Jeff Hillhouse", 7, 303, 51, 79, 0x48)
 	image_print(bg.image, "Sherry Hunter    Steve Muchow", 7, 303, 49, 87, 0x48)
 	image_print(bg.image, "Cheryl Neeld", 7, 303, 104, 95, 0x48)
-			
+
 	wait_for_input()
-						
+
 	fade_out_sprite(bg, 4)
-	
+
 	bg.visible = false
-	
+
 	return true
 end
 
@@ -2311,17 +2311,17 @@ local function intro_sway_gargs(sprite, idx, angry_flag)
 	if math.random(0, 3) == 0 then
 		return idx
 	end
-	
+
 	local movement_tbl = {1,1,1, -1,-1,-1,  -1,-1,-1,  1, 1, 1}
-	
+
 	if idx == 12 then
 		idx = 1
 	else
 		idx = idx + 1
 	end
-	
+
 	sprite.x = sprite.x + movement_tbl[idx]
-	
+
 	return idx
 end
 
@@ -2345,14 +2345,14 @@ local function intro_wait()
 		intro_exit()
 		return false
 	end
-		
+
 	return true
 end
 
 local function intro()
 	local input
 	local intro_img_tbl = image_load_all("intro.shp")
-	
+
 	local bg = sprite_new(intro_img_tbl[6], 0, 0, true)
 	local moongate = sprite_new(intro_img_tbl[7], 0x78, 0x3a, false)
 	local gargs_left = sprite_new(intro_img_tbl[3], -84, 0x6d, true)
@@ -2363,46 +2363,46 @@ local function intro()
 	local shamino = sprite_new(intro_img_tbl[2], 0x44, 0x7a, false)
 	local dupre = sprite_new(intro_img_tbl[0], -0x20, 0x7a, false)
 
-	local avatar = sprite_new(intro_img_tbl[9], 0x31, 0x44, false)	
+	local avatar = sprite_new(intro_img_tbl[9], 0x31, 0x44, false)
 	local alter = sprite_new(intro_img_tbl[5], 0, 0x70, true)
 	local ropes = sprite_new(intro_img_tbl[12], 0xd2, 0x84, false)
-			
+
 	canvas_set_palette("palettes.int", 7)
 	music_play("intro.m")
-					
+
 	fade_in()
-	
+
 	local scroll_img = image_load("blocks.shp", 2)
 	local scroll = sprite_new(scroll_img, 1, 0x98, true)
-	
+
 	image_print(scroll_img, "Dazed, you emerge from the portal to find yourself standing on a desolate plain. Nearby rests a massive rune-struck altar, shrouded in moonlit fog.", 7, 308, 8, 8, 0x3e)
 
 	if should_exit(wait_for_input()) == true then intro_exit() return end
-	
+
 	scroll_img = image_load("blocks.shp", 2)
 	scroll.image = scroll_img
 	image_print(scroll_img, "At first the plain is still. Then a hundred voices raise a slow, deathlike song, drawing closer and closer with each passing moment. You are seized by an urge to run...", 7, 308, 8, 8, 0x3e)
 
 	if intro_wait() == false then return end
-	
+
 	local l_move_tbl_x = {1, 1, 0, 1, 1, 1}
 	local l_move_tbl_y = {0, 0, -1, 0, 0, -1}
 
 	local r_move_tbl_x = {-1, -1, -1, -1, -1, -1}
 	local r_move_tbl_y = {-1, -1, 0, -1, -1, -1}
-	
+
 	scroll.visible = false
-	
+
 	local i
 	for i=0,95,1 do
 		gargs_left.x = gargs_left.x + l_move_tbl_x[(i%6)+1]
 		gargs_left.y = gargs_left.y + l_move_tbl_y[(i%6)+1]
-		
+
 		if i > 23 then
 			gargs_right.x = gargs_right.x + r_move_tbl_x[(i%6)+1] * 2
 			gargs_right.y = gargs_right.y + r_move_tbl_y[(i%6)+1] * 2
 		end
-		
+
 		input = input_poll()
 		if input ~= nil then
 			if should_exit(input) ==  true then
@@ -2414,13 +2414,13 @@ local function intro()
 			gargs_left.y = 77
 			gargs_right.x = 182
 			gargs_right.y = 79
-			
+
 			break
 		end
 		canvas_update()
 		canvas_update()
 	end
-	
+
 	scroll_img = image_load("blocks.shp", 0)
 	scroll.image = scroll_img
 	scroll.x = 0x21
@@ -2429,13 +2429,13 @@ local function intro()
 	image_print(scroll_img, "...but you have no place to go.", 7, 308, 35, 8, 0x3e)
 
 	if intro_wait() == false then return end
-	
+
 	scroll_img = image_load("blocks.shp", 2)
 	scroll.image = scroll_img
 	scroll.x = 0x1
 	scroll.y = 0x98
 	image_print(scroll_img, "Before you can offer a protest to the creatures who surround you, scaly claws grasp your body.", 7, 308, 8, 12, 0x3e)
-	
+
 	if intro_wait() == false then return end
 
 	scroll_img = image_load("blocks.shp", 1)
@@ -2443,19 +2443,19 @@ local function intro()
 	scroll.x = 0x1
 	scroll.y = 0xa0
 	image_print(scroll_img, "With unearthly strength, the monsters bind you to the altar stone!", 7, 308, 11, 10, 0x3e)
-	
+
 	avatar.visible = true
 	ropes.visible = true
-		
+
 	if intro_wait() == false then return end
-	
+
 	gargs_left.y = gargs_left.y + 4
 	gargs_right.y = gargs_right.y + 4
 	scroll.visible = false
-	
+
 	garg_body.visible = true
 	garg_head.visible = true
-	
+
 	for i=0,22,1 do
 		garg_body.x = garg_body.x - 3
 		garg_body.y = garg_body.y - 3
@@ -2494,12 +2494,12 @@ local function intro()
 			canvas_update()
 		end
 	end
-	
+
 	garg_body.x = 144
 	garg_body.y = 30
 	garg_head.x = 222
 	garg_head.y = 44
-		
+
 	scroll_img = image_load("blocks.shp", 1)
 	scroll.image = scroll_img
 	scroll.x = 0x1
@@ -2524,7 +2524,7 @@ local function intro()
 			end
 		canvas_update()
 	end
-	
+
 	scroll_img = image_load("blocks.shp", 2)
 	scroll.image = scroll_img
 	scroll.x = 0x1
@@ -2573,7 +2573,7 @@ local function intro()
 	scroll.x = 0x1
 	scroll.y = 0xa0
 	image_print(scroll_img, "You close your eyes. A dying scream, certainly your own, curdles the air.", 80, 228, 16, 10, 0x3e)
-	
+
 	moongate.visible = true
 	g_pal_counter = 0
 
@@ -2591,7 +2591,7 @@ local function intro()
 			break
 		end
 	end
-	
+
 	input = nil
 	while input == nil do
 		moongate_rotate_palette()
@@ -2605,59 +2605,59 @@ local function intro()
 			break
 		end
 	end
-	
+
 	for i=0xff,0,-3 do
 		moongate_rotate_palette()
 		canvas_set_opacity(i)
 		canvas_update()
 		input_poll()
 	end
-	
+
 	canvas_hide_all_sprites()
-	
+
 	scroll_img = image_load("blocks.shp", 1)
 	scroll.image = scroll_img
 	scroll.x = 0x1
 	scroll.y = 0x50
 	scroll.visible = true
 	image_print(scroll_img, "Catcalls, the dagger, a scream, Death....", 7, 308, 39, 14, 0x3e)
-	
+
 	fade_in()
-	
+
 	if intro_wait() == false then return end
 
 	fade_out()
-	
+
 	scroll_img = image_load("blocks.shp", 1)
 	scroll.image = scroll_img
 	image_print(scroll_img, "Pandemonium. Shrieks of rage, of terror.", 7, 308, 34, 14, 0x3e)
-		
+
 	fade_in()
-	
+
 	if intro_wait() == false then return end
 
 	fade_out()
-	
+
 	scroll_img = image_load("blocks.shp", 1)
 	scroll.image = scroll_img
 	image_print(scroll_img, "From the inevitable, an impossibility emerges.", 7, 308, 16, 14, 0x3e)
-	
+
 	fade_in()
-	
+
 	if intro_wait() == false then return end
-	
+
 	fade_out()
-	
+
 	scroll_img = image_load("blocks.shp", 1)
 	scroll.image = scroll_img
 	image_print(scroll_img, "You are still alive.", 7, 308, 101, 14, 0x3e)
-		
+
 	fade_in()
-		
+
 	if intro_wait() == false then return end
-	
+
 	fade_out()
-	
+
 	bg.visible = true
 	moongate.visible = true
 	gargs_left.visible = true
@@ -2669,7 +2669,7 @@ local function intro()
 	ropes.visible = true
 
 	scroll.visible = false
-	
+
 	for i=0,0xff,3 do
 		left_idx = intro_sway_gargs(gargs_left, left_idx, false)
 		right_idx = intro_sway_gargs(gargs_right, right_idx, false)
@@ -2678,7 +2678,7 @@ local function intro()
 		canvas_update()
 		input_poll()
 	end
-	
+
 	garg_head.image = intro_img_tbl[10]
 
 	scroll_img = image_load("blocks.shp", 2)
@@ -2687,7 +2687,7 @@ local function intro()
 	scroll.y = 0x98
 	scroll.visible = true
 	image_print(scroll_img, "Silent red light fills the darkness. There is the wooden clack of a crossbow, and a violet- fletched rose blooms in the priest\39s barren forehead.", 7, 308, 8, 8, 0x3e)
-	
+
 	input = nil
 	while input == nil do
 		left_idx = intro_sway_gargs(gargs_left, left_idx, false)
@@ -2705,18 +2705,18 @@ local function intro()
 	end
 
 	scroll.visible = false
-	
+
 	for i=0,42,1 do
 		left_idx = intro_sway_gargs(gargs_left, left_idx, false)
 		right_idx = intro_sway_gargs(gargs_right, right_idx, false)
 		moongate_rotate_palette()
-	
+
 		local x =  math.random(-1, 2)
 		garg_body.x = garg_body.x + x
 		garg_body.y = garg_body.y + 3
 		garg_head.x = garg_head.x + x
 		garg_head.y = garg_head.y + 3
-	
+
 		input = input_poll()
 		if input ~= nil then
 			if should_exit(input) ==  true then
@@ -2732,34 +2732,34 @@ local function intro()
 
 	garg_body.visible = false
 	garg_head.visible = false
-	
+
 	iolo.visible = true
 	dupre.visible = true
 	shamino.visible = true
-	
+
 	for i=0,82,1 do
 		left_idx = intro_sway_gargs(gargs_left, left_idx, false)
 		right_idx = intro_sway_gargs(gargs_right, right_idx, false)
 		moongate_rotate_palette()
-		
+
 
 		if i > 33 then
 			dupre.x = dupre.x + 2
 		else
 			dupre.x = dupre.x + 1
 		end
-		
+
 		dupre.y = dupre.y - 1
-		
+
 		if i > 13 then
 			if i > 36 then
 				shamino.x = shamino.x + 2
 			else
 				shamino.x = shamino.x + 1
-			end	
+			end
 			shamino.y = shamino.y - 1
 		end
-		
+
 		if i > 10 then
 			iolo.x = iolo.x + 1
 			if i > 14 then
@@ -2768,7 +2768,7 @@ local function intro()
 				iolo.y = iolo.y - 1
 			end
 		end
-		
+
 		input = input_poll()
 		if input ~= nil then
 			if should_exit(input) ==  true then
@@ -2785,14 +2785,14 @@ local function intro()
 		end
 		canvas_update()
 	end
-	
+
 	scroll_img = image_load("blocks.shp", 2)
 	scroll.image = scroll_img
 	scroll.x = 0x1
 	scroll.y = 0x98
 	scroll.visible = true
 	image_print(scroll_img, "Friendly faces vault from a newborn moongate, while a rain of quarrels holds the furious mob at bay. The knight Dupre\39s sword flashes twice in the darkness, slicing away your bonds!", 7, 308, 8, 8, 0x3e)
-		
+
 	input = nil
 	while input == nil do
 		left_idx = intro_sway_gargs(gargs_left, left_idx, false)
@@ -2811,7 +2811,7 @@ local function intro()
 
 	scroll.visible = false
 	ropes.visible = false
-	
+
 	for i=0,82,1 do
 		left_idx = intro_sway_gargs(gargs_left, left_idx, false)
 		right_idx = intro_sway_gargs(gargs_right, right_idx, false)
@@ -2826,7 +2826,7 @@ local function intro()
 
 		iolo.x = iolo.x - 1
 		iolo.y = iolo.y + 2
-		
+
 		avatar.y = avatar.y + 1
 
 		input = input_poll()
@@ -2848,7 +2848,7 @@ local function intro()
 	scroll.image = scroll_img
 	scroll.visible = true
 	image_print(scroll_img, "\"Quickly, old friend! To the gate!\127 Accompanied by the swordsman Shamino and a grinning, crossbow-wielding Iolo the Bard, Dupre thrusts a spare sword into your hand.", 7, 308, 8, 8, 0x3e)
-		
+
 	input = nil
 	while input == nil do
 		left_idx = intro_sway_gargs(gargs_left, left_idx, false)
@@ -2868,7 +2868,7 @@ local function intro()
 	scroll_img = image_load("blocks.shp", 2)
 	scroll.image = scroll_img
 	image_print(scroll_img, "Snatching the fallen priest\39s book, Iolo dives into the redness with Shamino at his heels. The howling throng surges forward, all of one terrible mind.", 7, 308, 8, 8, 0x3e)
-	
+
 	input = nil
 	while input == nil do
 		left_idx = intro_sway_gargs(gargs_left, left_idx, false)
@@ -2953,7 +2953,7 @@ local function intro()
 	end
 
 	scroll.visible = false
-		
+
 	intro_exit()
 end
 
@@ -2973,7 +2973,7 @@ g_menu_pal =
 g_menu_pal_idx = { 14, 33, 34, 35, 36 }
 local function main_menu_set_pal(idx)
 	local i
-	
+
 	for i = 1,5,1 do
 		local colour = g_menu_pal[5+(i-1)-idx]
 		canvas_set_palette_entry(g_menu_pal_idx[i], colour[1], colour[2], colour[3])
@@ -2987,20 +2987,20 @@ local function main_menu_load()
 
 	music_play("ultima.m")
 	g_menu = {}
-	
+
 	canvas_set_palette("palettes.int", 0)
-		
+
 	local title_img_tbl = image_load_all("titles.shp")
 	g_menu["title"] = sprite_new(title_img_tbl[0], 0x13, 0, true)
 	g_menu["subtitle"] = sprite_new(title_img_tbl[1], 0x3b, 0x2f, false)
 
 	g_menu["menu"] = sprite_new(image_load("mainmenu.shp", 0), 0x31, 0x53, false)
-	
+
 	fade_in()
-	
+
 	g_menu["subtitle"].visible = true
 	g_menu["menu"].visible = true
-	
+
 	fade_in_sprite(g_menu["menu"])
 	mouse_cursor_visible(true)
 end
@@ -3051,7 +3051,7 @@ local function main_menu()
 	g_menu["title"].visible = true
 	g_menu["subtitle"].visible = true
 	g_menu["menu"].visible = true
-	
+
 	local input
 
 	while true do
diff --git a/devtools/create_ultima/files/ultima6/scripts/u6/magic.lua b/devtools/create_ultima/files/ultima6/scripts/u6/magic.lua
index 59c680e1cd..7cca98bc7a 100644
--- a/devtools/create_ultima/files/ultima6/scripts/u6/magic.lua
+++ b/devtools/create_ultima/files/ultima6/scripts/u6/magic.lua
@@ -9,7 +9,7 @@ magic_invocations = {}
 function magic_print_invocation_string(spell_num)
 	local i
 	local invocation = magic_spell_invocation(spell_num)
-	
+
 	for i = 1,#invocation do
 		if i ~= 1 then
 			print(" ")
@@ -26,7 +26,7 @@ run_magic_script = function(invocation)
     end
 
 --io.stderr:write("Running script \"" .. magic_invocations[invocation].script .."\"\n");
-	
+
     --run_script(magic_invocations[invocation].script)
     magic_cast_spell(spell_num, nil, nil)
     return
@@ -54,7 +54,7 @@ function magic_spell_name(spell_num)
 	if magic[spell_num+1] ~= nil then
 		return magic[spell_num+1].name
 	end
-	
+
 	return "Unknown"
 end
 
@@ -73,12 +73,12 @@ function magic_get_spell_list()
 	for k,v in pairs(magic) do
 			insert(list, v)
 	end
-	
+
 	return list
 end
 
 magic_init = function(name, invocation, reagents, circle, num, script)
-	local spell_num = (circle-1) * 16 + (num-1); 
+	local spell_num = (circle-1) * 16 + (num-1);
     local spell = {name=name,invocation=invocation,reagents=reagents,circle=circle,spell_num=spell_num,script=script}
 
     magic[spell_num+1] = spell
@@ -100,16 +100,16 @@ end
 
 select_actor = function()
 	if g_magic_target ~= nil then return map_get_actor(g_magic_target) end
-	
+
 	print("On whom: ");
 
 	local loc = get_target()
 	local actor
-	
+
 	if loc ~= nil then
 		actor = map_get_actor(loc)
 	end
-	
+
 	if actor == nil then
 		print("nothing\n");
 	else
@@ -122,11 +122,11 @@ end
 
 select_obj = function()
 	if g_magic_target ~= nil then return map_get_obj(g_magic_target) end
-	
+
 	print("On what: ");
 
 	local obj = get_obj()
-	
+
 	if obj == nil then
 		print("nothing\n");
 	else
@@ -134,7 +134,7 @@ select_obj = function()
 		if obj.on_map and out_of_spell_range(obj.x, obj.y) then return end
 	end
 
-	return obj 
+	return obj
 end
 
 function select_actor_or_obj()
@@ -171,7 +171,7 @@ function select_actor_with_projectile(projectile_tile, caster)
 	if caster == nil then caster = magic_get_caster() end
 
 	local is_player = caster_is_player()
-	
+
 	local loc = select_location_with_prompt("On Whom: ")
 	local actor = map_get_actor(loc)
 	if actor == nil then
@@ -186,7 +186,7 @@ function select_actor_with_projectile(projectile_tile, caster)
 	elseif is_player == true then
 		print(actor.name.."\n")
 	end
-	
+
 	magic_casting_fade_effect(caster)
 	if loc == nil then magic_no_effect() return end
 	if out_of_spell_range(loc.x, loc.y) then return end
@@ -210,7 +210,7 @@ function select_actor_or_obj_with_projectile(projectile_tile, caster)
 	if item == nil then
 		item = map_get_obj(loc)
 	end
-	


Commit: f0d42d36fd9739baed4cafbfc4b8527a6d6bad4c
    https://github.com/scummvm/scummvm/commit/f0d42d36fd9739baed4cafbfc4b8527a6d6bad4c
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-04-09T23:32:46+02:00

Commit Message:
NUVIE: Fix regression in scripts when engine is requested to quit

Changed paths:
    devtools/create_ultima/files/ultima6/scripts/u6/intro.lua


diff --git a/devtools/create_ultima/files/ultima6/scripts/u6/intro.lua b/devtools/create_ultima/files/ultima6/scripts/u6/intro.lua
index 4919d9df63..893fb79fd7 100644
--- a/devtools/create_ultima/files/ultima6/scripts/u6/intro.lua
+++ b/devtools/create_ultima/files/ultima6/scripts/u6/intro.lua
@@ -2981,12 +2981,13 @@ local function main_menu_set_pal(idx)
 end
 
 local function main_menu_load()
+	g_menu = {}
+
 	if engine_should_quit() == 1 then
 		return
 	end
 
 	music_play("ultima.m")
-	g_menu = {}
 
 	canvas_set_palette("palettes.int", 0)
 




More information about the Scummvm-git-logs mailing list