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

mduggan noreply at scummvm.org
Sat Dec 9 04:02:34 UTC 2023


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

Summary:
ad7f203615 ULTIMA: NUVIE: Rename member to avoid name clash
b2326fae3e ULTIMA: NUVIE: Fix missing initializers identified by Coverity
578cfefd0a ULTIMA: NUVIE: Replace uses of NULL with nullptr
3738debab1 ULTIMA: NUVIE: Improve const correctness
db9edb80e3 ULTIMA: NUVIE: Use initializer list in more constructors
93f3e5b5a4 ULTIMA: NUVIE: Clean up brackets on return statements
a19279f90e ULTIMA: NUVIE: Further improve const correctness
4f3cb346d3 ULTIMA: NUVIE: Use initializer list in more constructors
112238ef18 ULTIMA: NUVIE: Remove redundant casts for new widgets
1103ee130d ULTIMA: NUVIE: Reduce use of #define for numeric consts
4182695bc7 ULTIMA: NUVIE: Remove some unused functions
424a674dcc ULTIMA: NUVIE: Remove some redundant casts
a2494e6525 ULTIMA: NUVIE: Remove some old sdl compat functions
69f3f9eff8 ULTIMA: NUVIE: Clear game ptr if load fails
e40737dbad ULTIMA: NUVIE: Avoid crashes on some corrupt data
1b0d284760 ULTIMA: NUVIE: Use an enum for compass directions
a7eabd18c7 ULTIMA: NUVIE: Replace more defines with const or enum
1af6406c92 ULTIMA: NUVIE: Fix crash if conversation active on quit
7755e3430b ULTIMA: NUVIE: Fix unused field warnings
e5b83a7942 ULTIMA: NUVIE: Improve constness of Configuration
724b048312 ULTIMA: NUVIE: Yet more const correctness
4493bdcf5c ULTIMA: NUVIE: Use foreach style loops for cleaner code
bfd975ed4d ULTIMA: NUVIE: Remove some unused util functions
02e75c657e ULTIMA: NUVIE: Use nullptr instead of 0 for pointers
d5b5c73149 ULTIMA: NUVIE: Clean up by reducing variable scope
3ec5733995 ULTIMA: NUVIE: Remove now-unused debug function
a7d6bbac50 ULTIMA: NUVIE: Small whitespace fixes
b9a9cfd806 ULTIMA: NUVIE: Add an asset viewer to assist debugging
bb6c14a007 ULTIMA: NUVIE: Add switch toggling for Martian Dreams UI
b4414af5aa ULTIMA: NUVIE: Remove nuvie-specific scaler code
d85afbefdf ULTIMA: NUVIE: Clean up more unused screen features
dca991cc54 ULTIMA: NUVIE: Remove thin SDL compat wrappers
12a47d956e ULTIMA: NUVIE: Add support for ScummVM keymapper
c33020fcd0 ULTIMA: NUVIE: Avoid crash if save file does not open


Commit: ad7f203615669a5b8a72afc61781ca001a582498
    https://github.com/scummvm/scummvm/commit/ad7f203615669a5b8a72afc61781ca001a582498
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2023-12-09T13:56:05+11:00

Commit Message:
ULTIMA: NUVIE: Rename member to avoid name clash

`error` is used in scummvm as a function to report errors.

Changed paths:
    engines/ultima/nuvie/gui/widgets/gui_widget.cpp
    engines/ultima/nuvie/gui/widgets/gui_widget.h


diff --git a/engines/ultima/nuvie/gui/widgets/gui_widget.cpp b/engines/ultima/nuvie/gui/widgets/gui_widget.cpp
index b1c6c7f6b6e..528bc173525 100644
--- a/engines/ultima/nuvie/gui/widgets/gui_widget.cpp
+++ b/engines/ultima/nuvie/gui/widgets/gui_widget.cpp
@@ -55,7 +55,7 @@ void GUI_Widget::Init(void *data, int x, int y, int w, int h) {
 	offset_x = x;
 	offset_y = y;
 	Show();
-	error = NULL;
+	errorptr = nullptr;
 	for (int n = 0; n < 3; ++n) {
 		pressed[n] = 0;
 	}
diff --git a/engines/ultima/nuvie/gui/widgets/gui_widget.h b/engines/ultima/nuvie/gui/widgets/gui_widget.h
index 3c7ea1c801a..2d7e4e0d574 100644
--- a/engines/ultima/nuvie/gui/widgets/gui_widget.h
+++ b/engines/ultima/nuvie/gui/widgets/gui_widget.h
@@ -62,7 +62,7 @@ protected:
 	Std::list<GUI_Widget *>children;
 	GUI_Widget *parent;
 
-	char *error;
+	char *errorptr;
 	char  errbuf[BUFSIZ];
 
 	GUI_DragManager *gui_drag_manager;
@@ -193,7 +193,7 @@ public:
 
 	/* Returns NULL if everything is okay, or an error message if not */
 	char *Error(void) {
-		return (error);
+		return (errorptr);
 	}
 
 	/* yields click state: none, pressed, intermediate */
@@ -219,7 +219,7 @@ protected:
 		va_start(ap, fmt);
 		Common::vsprintf_s(errbuf, fmt, ap);
 		va_end(ap);
-		error = errbuf;
+		errorptr = errbuf;
 	}
 
 	// SB-X


Commit: b2326fae3e2474fe46235c9cfe87189a407d06bd
    https://github.com/scummvm/scummvm/commit/b2326fae3e2474fe46235c9cfe87189a407d06bd
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2023-12-09T13:56:05+11:00

Commit Message:
ULTIMA: NUVIE: Fix missing initializers identified by Coverity

To make the result cleaner:
* Use initializer lists instead of assignment in constructors
* Replace NULL with nullptr in these places

Both of these need to be done more globally, but this change is
a starting point to address the Coverity items.

Changed paths:
    engines/ultima/nuvie/actors/actor.cpp
    engines/ultima/nuvie/core/anim_manager.cpp
    engines/ultima/nuvie/core/converse.cpp
    engines/ultima/nuvie/core/effect.cpp
    engines/ultima/nuvie/core/events.cpp
    engines/ultima/nuvie/core/events.h
    engines/ultima/nuvie/core/party.cpp
    engines/ultima/nuvie/gui/gui_area.cpp
    engines/ultima/nuvie/gui/gui_scroll_bar.cpp
    engines/ultima/nuvie/gui/gui_text.cpp
    engines/ultima/nuvie/gui/gui_text_input.cpp
    engines/ultima/nuvie/gui/widgets/background.cpp
    engines/ultima/nuvie/gui/widgets/command_bar.cpp
    engines/ultima/nuvie/gui/widgets/converse_gump.cpp
    engines/ultima/nuvie/gui/widgets/converse_gump_wou.cpp
    engines/ultima/nuvie/gui/widgets/map_window.cpp
    engines/ultima/nuvie/gui/widgets/msg_scroll.cpp
    engines/ultima/nuvie/gui/widgets/msg_scroll.h
    engines/ultima/nuvie/keybinding/keys.cpp
    engines/ultima/nuvie/nuvie.cpp
    engines/ultima/nuvie/screen/screen.cpp
    engines/ultima/nuvie/screen/surface.cpp
    engines/ultima/nuvie/script/script_cutscene.cpp
    engines/ultima/nuvie/sound/adplug/u6m.h
    engines/ultima/nuvie/sound/decoder/pc_speaker.cpp
    engines/ultima/nuvie/sound/decoder/pc_speaker_stream.cpp
    engines/ultima/nuvie/sound/sound_manager.cpp
    engines/ultima/nuvie/views/container_view_gump.cpp
    engines/ultima/nuvie/views/container_widget.cpp
    engines/ultima/nuvie/views/container_widget_gump.cpp
    engines/ultima/nuvie/views/doll_widget.cpp
    engines/ultima/nuvie/views/draggable_view.cpp
    engines/ultima/nuvie/views/inventory_widget.cpp
    engines/ultima/nuvie/views/map_editor_view.cpp
    engines/ultima/nuvie/views/portrait_view.cpp


diff --git a/engines/ultima/nuvie/actors/actor.cpp b/engines/ultima/nuvie/actors/actor.cpp
index 008c539a3e8..e3cd8ac4881 100644
--- a/engines/ultima/nuvie/actors/actor.cpp
+++ b/engines/ultima/nuvie/actors/actor.cpp
@@ -48,42 +48,17 @@ uint8 walk_frame_tbl[4] = {0, 1, 2, 1};
 class ActorManager;
 
 Actor::Actor(Map *m, ObjManager *om, GameClock *c)
-	: sched(NULL), obj_inventory(NULL) {
-	map = m;
-	obj_manager = om;
-	usecode = NULL;
+	: sched(nullptr), obj_inventory(nullptr), map(m), obj_manager(om),
+	  usecode(nullptr), pathfinder(nullptr), direction(0), walk_frame(0),
+	  ethereal(false), can_move(true), temp_actor(false), visible_flag(true),
+	  met_player(false), worktype(0), sched_pos(0), move_time(0), num_schedules(0),
+	  alignment(ACTOR_ALIGNMENT_NEUTRAL), moves(0), light(0), status_flags(0),
+	  talk_flags(0), obj_flags(0), body_armor_class(0), readied_armor_class(0),
+	  custom_tile_tbl(nullptr), id_n(0), x(0), y(0), z(0), obj_n(0), frame_n(0),
+	  base_obj_n(0), old_frame_n(0), movement_flags(0), strength(0), dex(0),
+	  intelligence(0), hp(0), level(0), magic(0), combat_mode(0) {
 	clock = c;
-	pathfinder = NULL;
-
-	direction = 0;
-	walk_frame = 0;
-	ethereal = false;
-	can_move = true;
-	temp_actor = false;
-	visible_flag = true;
-	met_player = false;
-// active = false;
-
-	worktype = 0;
-	sched_pos = 0;
-	move_time = 0;
-	num_schedules = 0;
-
-	alignment = ACTOR_ALIGNMENT_NEUTRAL;
-
 	memset(readied_objects, 0, sizeof(readied_objects));
-	moves = 0;
-	light = 0;
-
-	name = "";
-	status_flags = 0;
-	talk_flags = 0;
-	obj_flags = 0;
-	body_armor_class = 0;
-	readied_armor_class = 0;
-
-	custom_tile_tbl = NULL;
-
 	clear_error();
 }
 
diff --git a/engines/ultima/nuvie/core/anim_manager.cpp b/engines/ultima/nuvie/core/anim_manager.cpp
index daa5dd74659..ec14b7e461d 100644
--- a/engines/ultima/nuvie/core/anim_manager.cpp
+++ b/engines/ultima/nuvie/core/anim_manager.cpp
@@ -1186,8 +1186,8 @@ bool WingAnim::update() {
 	return (true);
 }
 
-HailstormAnim::HailstormAnim(MapCoord t) {
-	target = t;
+HailstormAnim::HailstormAnim(MapCoord t) : target(t) {
+	ARRAYCLEAR(hailstones);
 	hailstone_tile = Game::get_game()->get_tile_manager()->get_tile(0x18e); //hailstone tile.
 
 	num_active = 0;
diff --git a/engines/ultima/nuvie/core/converse.cpp b/engines/ultima/nuvie/core/converse.cpp
index 1ace4a410f7..21fa2845d31 100644
--- a/engines/ultima/nuvie/core/converse.cpp
+++ b/engines/ultima/nuvie/core/converse.cpp
@@ -44,34 +44,15 @@ namespace Nuvie {
 //#define CONVERSE_DEBUG
 
 
-Converse::Converse() {
-	config = NULL;
-	clock = NULL;
-	actors = NULL;
-	objects = NULL;
-	player = NULL;
-	views = NULL;
-	last_view = NULL;
-	scroll = NULL;
-
-	conv_i = NULL;
-	script = NULL;
-	npc = NULL;
-	npc_num = 0;
-	script_num = 0;
-	src = NULL;
-	src_num = 0;
-
-	allowed_input = NULL;
-
-	active = false;
-	variables = NULL;
-	party_all_the_time = false;
-	speech = NULL;
-	using_fmtowns = false;
-	need_input = false;
-	aname[15] = '\0';
-	gametype = NUVIE_GAME_NONE;
+Converse::Converse() : config(nullptr), actors(nullptr), objects(nullptr),
+		player(nullptr), views(nullptr), last_view(nullptr), scroll(nullptr),
+		conv_i(nullptr), script(nullptr), npc(nullptr), npc_num(0), script_num(0),
+		src(nullptr), src_num(0), allowed_input(nullptr), active(false),
+		variables(nullptr), party_all_the_time(false), speech(nullptr),
+		using_fmtowns(false), need_input(false), conversations_stop_music(false),
+		gametype(NUVIE_GAME_NONE) {
+	clock = nullptr;
+	ARRAYCLEAR(aname);
 }
 
 
diff --git a/engines/ultima/nuvie/core/effect.cpp b/engines/ultima/nuvie/core/effect.cpp
index 6f915317e42..bf3d09e3732 100644
--- a/engines/ultima/nuvie/core/effect.cpp
+++ b/engines/ultima/nuvie/core/effect.cpp
@@ -334,7 +334,9 @@ void TimedEffect::stop_timer() {
  * determines the speed of movement. An actor may be selected to keep the
  * MapWindow centered on after the Quake.
  */
-QuakeEffect::QuakeEffect(uint8 magnitude, uint32 duration, Actor *keep_on) {
+QuakeEffect::QuakeEffect(uint8 magnitude, uint32 duration, Actor *keep_on)
+		: strength(magnitude), orig_actor(keep_on), sx(0), sy(0),
+		  map_window(nullptr), stop_time(0) {
 	// single use only, so MapWindow doesn't keep moving away from center
 	// ...and do nothing if magnitude isn't usable
 	if (current_quake || magnitude == 0) {
@@ -345,14 +347,12 @@ QuakeEffect::QuakeEffect(uint8 magnitude, uint32 duration, Actor *keep_on) {
 
 	map_window = game->get_map_window();
 	stop_time = game->get_clock()->get_ticks() + duration;
-	strength = magnitude;
 
 	// get random direction (always move left-right more than up-down)
 	init_directions();
 
 	map_window->get_pos(&orig.x, &orig.y);
 	map_window->get_level(&orig.z);
-	orig_actor = keep_on;
 	map_window->set_freeze_blacking_location(true);
 
 	start_timer(strength * 5);
@@ -505,7 +505,7 @@ uint16 TextEffect::callback(uint16 msg, CallBack *caller, void *msg_data) {
 
 /*** ExplosiveEffect ***/
 ExplosiveEffect::ExplosiveEffect(uint16 x, uint16 y, uint32 size, uint16 dmg)
-	: start_at() {
+	: start_at(), anim(nullptr) {
 	start_at.x = x;
 	start_at.y = y;
 	radius = size;
diff --git a/engines/ultima/nuvie/core/events.cpp b/engines/ultima/nuvie/core/events.cpp
index 774627aa39a..09eba22f70d 100644
--- a/engines/ultima/nuvie/core/events.cpp
+++ b/engines/ultima/nuvie/core/events.cpp
@@ -73,7 +73,10 @@ void EventInput_s::set_loc(MapCoord c) {
 	loc = new MapCoord(c);
 }
 
-Events::Events(Shared::EventsCallback *callback, Configuration *cfg) : Shared::EventsManager(callback), config(cfg) {
+Events::Events(Shared::EventsCallback *callback, Configuration *cfg)
+		: Shared::EventsManager(callback), config(cfg), converse(nullptr),
+		  keybinder(nullptr), showingQuitDialog(false), fps_counter_widget(nullptr),
+		  cursor_mode(false){
 	g_events = this;
 	clear();
 }
@@ -91,28 +94,28 @@ void Events::clear() {
 	alt_code_input_num = 0;
 
 	game = Game::get_game();
-	gui = NULL;
-	obj_manager = NULL;
-	map_window = NULL;
-	scroll = NULL;
-	clock = NULL;
-	player = NULL;
-	view_manager = NULL;
-	usecode = NULL;
-	magic = NULL;
-	drop_obj = NULL;
+	gui = nullptr;
+	obj_manager = nullptr;
+	map_window = nullptr;
+	scroll = nullptr;
+	clock = nullptr;
+	player = nullptr;
+	view_manager = nullptr;
+	usecode = nullptr;
+	magic = nullptr;
+	drop_obj = nullptr;
 	ts = 0;
 	drop_qty = 0;
 	drop_x = drop_y = -1;
 	rest_time = 0;
 	rest_guard = 0;
-	push_obj = NULL;
-	push_actor = NULL;
+	push_obj = nullptr;
+	push_actor = nullptr;
 	drop_from_key = false;
 	move_in_inventory = false;
-	time_queue = game_time_queue = NULL;
+	time_queue = game_time_queue = nullptr;
 	showingDialog = false;
-	gamemenu_dialog = NULL;
+	gamemenu_dialog = nullptr;
 	ignore_timeleft = false;
 	in_control_cheat = false;
 	looking_at_spellbook = false;
@@ -126,7 +129,7 @@ void Events::clear() {
 	fps_timestamp = 0;
 	fps_counter = 0;
 
-	scriptThread = NULL;
+	scriptThread = nullptr;
 }
 
 bool Events::init(ObjManager *om, MapWindow *mw, MsgScroll *ms, Player *p, Magic *mg,
diff --git a/engines/ultima/nuvie/core/events.h b/engines/ultima/nuvie/core/events.h
index 17d08aa627e..e32d588eaac 100644
--- a/engines/ultima/nuvie/core/events.h
+++ b/engines/ultima/nuvie/core/events.h
@@ -163,9 +163,9 @@ struct EventInput_s {
 	Std::string *str; // ???
 //    };
 	void set_loc(MapCoord c);
-	EventInput_s() : loc(0), str(0), obj(0), actor(0), get_direction(false), get_text(false), target_init(0), select_from_inventory(false), select_range(0) {
-		spell_num = 0;
-		type = 0;
+	EventInput_s() : loc(0), str(0), obj(0), actor(0), get_direction(false), get_text(false),
+		target_init(0), select_from_inventory(false), select_range(0), key(Common::KEYCODE_INVALID),
+		action_key_type(ActionKeyType::CANCEL_ACTION_KEY), spell_num(0), type(0) {
 	}
 	~EventInput_s();
 
diff --git a/engines/ultima/nuvie/core/party.cpp b/engines/ultima/nuvie/core/party.cpp
index 62eeeb4c628..e2a12511565 100644
--- a/engines/ultima/nuvie/core/party.cpp
+++ b/engines/ultima/nuvie/core/party.cpp
@@ -43,23 +43,13 @@
 namespace Ultima {
 namespace Nuvie {
 
-Party::Party(Configuration *cfg) {
-	config = cfg;
-	game = NULL;
-	actor_manager = NULL;
-	map = NULL;
-	pathfinder = NULL;
-	rest_campfire = NULL;
-
-	formation = PARTY_FORM_STANDARD;
-	num_in_party = 0;
-	prev_leader_x = prev_leader_y = 0;
-	defer_removing_dead_members = false;
-	autowalk = false;
-	in_vehicle = false;
-	in_combat_mode = false;
-	lightsources = 0;
-
+Party::Party(Configuration *cfg) : config(cfg), game(nullptr),
+		actor_manager(nullptr), map(nullptr), pathfinder(nullptr),
+		rest_campfire(nullptr), formation(PARTY_FORM_STANDARD),
+		num_in_party(0), prev_leader_x(0), prev_leader_y(0),
+		defer_removing_dead_members(false), autowalk(false),
+		in_vehicle(false), in_combat_mode(false), lightsources(0),
+		combat_changes_music(false), vehicles_change_music(false) {
 	memset(&member, 0, sizeof member);
 }
 
diff --git a/engines/ultima/nuvie/gui/gui_area.cpp b/engines/ultima/nuvie/gui/gui_area.cpp
index d0f119afb3e..fd888c97c1c 100644
--- a/engines/ultima/nuvie/gui/gui_area.cpp
+++ b/engines/ultima/nuvie/gui/gui_area.cpp
@@ -27,30 +27,14 @@ namespace Ultima {
 namespace Nuvie {
 
 GUI_Area:: GUI_Area(int x, int y, int w, int h, uint8 r, uint8 g, uint8 b, int aShape)
-	: GUI_Widget(NULL, x, y, w, h) {
-	R = r;
-	G = g;
-	B = b;
-	color = 0;
-	useFrame = 0;
-	shape = aShape;
-	frameThickness = 0;
+	: GUI_Widget(NULL, x, y, w, h), R(r), G(g), B(b), color(0), useFrame(0), shape(aShape),
+	  frameThickness(0), fB(0), fG(0), fR(0), frameColor(0) {
 }
 
 GUI_Area:: GUI_Area(int x, int y, int w, int h, uint8 r, uint8 g, uint8 b,
 					uint8 fr, uint8 fg, uint8 fb, int fthick, int aShape)
-	: GUI_Widget(NULL, x, y, w, h) {
-	R = r;
-	G = g;
-	B = b;
-	color = 0;
-	useFrame = 1;
-	fR = fr;
-	fG = fg;
-	fB = fb;
-	frameColor = 0;
-	frameThickness = fthick;
-	shape = aShape;
+	: GUI_Widget(NULL, x, y, w, h), R(r), G(g), B(b), color(0), useFrame(1),
+	  fR(fr), fG(fg), fB(fb), frameColor(0), frameThickness(fthick), shape(aShape) {
 }
 
 /* Map the color to the display */
diff --git a/engines/ultima/nuvie/gui/gui_scroll_bar.cpp b/engines/ultima/nuvie/gui/gui_scroll_bar.cpp
index 7e6d535c634..dacddcf9399 100644
--- a/engines/ultima/nuvie/gui/gui_scroll_bar.cpp
+++ b/engines/ultima/nuvie/gui/gui_scroll_bar.cpp
@@ -53,9 +53,9 @@ namespace Nuvie {
 
 
 GUI_ScrollBar::GUI_ScrollBar(int x, int y, int h, GUI_CallBack *callback)
-	: GUI_Widget(NULL, x, y, SCROLLBAR_WIDTH, h) {
-	callback_object = callback;
-	drag = false;
+	: GUI_Widget(NULL, x, y, SCROLLBAR_WIDTH, h), callback_object(callback),
+	  drag(false), slider_highlight_c(0), slider_shadow_c(0), slider_base_c(0),
+	  track_border_c(0), track_base_c(0), slider_click_offset(0) {
 
 	loadButtons();
 
diff --git a/engines/ultima/nuvie/gui/gui_text.cpp b/engines/ultima/nuvie/gui/gui_text.cpp
index 6650c027cbe..d1dde09b8e5 100644
--- a/engines/ultima/nuvie/gui/gui_text.cpp
+++ b/engines/ultima/nuvie/gui/gui_text.cpp
@@ -39,23 +39,20 @@ GUI_Text:: GUI_Text(int x, int y, uint8 r, uint8 g, uint8 b, GUI_Font *gui_font,
 
 
 GUI_Text:: GUI_Text(int x, int y, uint8 r, uint8 g, uint8 b, const char *str, GUI_Font *gui_font, uint16 line_length)
-	: GUI_Widget(NULL, x, y, 0, 0) {
+	: GUI_Widget(nullptr, x, y, 0, 0) {
 	int w, h;
 
 	R = r;
 	G = g;
 	B = b;
-	text = NULL;
 	max_width = line_length;
 
 	font = gui_font;
 
 	text = scumm_strdup(str);
 
-	if (text == NULL) {
-		DEBUG(0, LEVEL_ERROR, "GUI_Text: failed to allocate memory for text\n");
-		return;
-	}
+	if (text == nullptr)
+		error("GUI_Text: failed to allocate memory for text\n");
 
 	font->textExtent(text, &w, &h, max_width);
 
diff --git a/engines/ultima/nuvie/gui/gui_text_input.cpp b/engines/ultima/nuvie/gui/gui_text_input.cpp
index b4dc1260fa8..dc8616f0618 100644
--- a/engines/ultima/nuvie/gui/gui_text_input.cpp
+++ b/engines/ultima/nuvie/gui/gui_text_input.cpp
@@ -30,18 +30,11 @@ namespace Nuvie {
 
 GUI_TextInput:: GUI_TextInput(int x, int y, uint8 r, uint8 g, uint8 b, const char *str,
 							  GUI_Font *gui_font, uint16 width, uint16 height, GUI_CallBack *callback)
-	: GUI_Text(x, y, r, g, b, gui_font, width) {
-	max_height = height;
-	callback_object = callback;
-	cursor_color = 0;
-	selected_bgcolor = 0;
-
+	: GUI_Text(x, y, r, g, b, gui_font, width), max_height(height), callback_object(callback),
+	  cursor_color(0), selected_bgcolor(0) {
 	text = (char *)malloc(max_width * max_height + 1);
-
-	if (text == NULL) {
-		DEBUG(0, LEVEL_ERROR, "GUI_TextInput failed to allocate memory for text\n");
-		return;
-	}
+	if (text == nullptr)
+		error("GUI_TextInput failed to allocate memory for text");
 
 	strncpy(text, str, max_width * max_height);
 
diff --git a/engines/ultima/nuvie/gui/widgets/background.cpp b/engines/ultima/nuvie/gui/widgets/background.cpp
index b712973f10c..c28487571d1 100644
--- a/engines/ultima/nuvie/gui/widgets/background.cpp
+++ b/engines/ultima/nuvie/gui/widgets/background.cpp
@@ -33,19 +33,14 @@
 namespace Ultima {
 namespace Nuvie {
 
-Background::Background(Configuration *cfg) : GUI_Widget(NULL) {
-	config = cfg;
+Background::Background(Configuration *cfg) : GUI_Widget(nullptr), config(cfg),
+		bg_w(0), bg_h(0), border_width(0), background(nullptr), right_bg_x_off(0),
+		left_bg_x_off(0) {
 	config->value("config/GameType", game_type);
-
-	bg_w = 0;
-	bg_h = 0;
-	border_width = 0;
-	background = NULL;
 	x_off = Game::get_game()->get_game_x_offset();
 	y_off = Game::get_game()->get_game_y_offset();
 
-
-	Init(NULL, 0, 0, Game::get_game()->get_screen()->get_width(), Game::get_game()->get_screen()->get_height());
+	Init(nullptr, 0, 0, Game::get_game()->get_screen()->get_width(), Game::get_game()->get_screen()->get_height());
 }
 
 Background::~Background() {
diff --git a/engines/ultima/nuvie/gui/widgets/command_bar.cpp b/engines/ultima/nuvie/gui/widgets/command_bar.cpp
index 56bd2644d1d..cb57401edcb 100644
--- a/engines/ultima/nuvie/gui/widgets/command_bar.cpp
+++ b/engines/ultima/nuvie/gui/widgets/command_bar.cpp
@@ -84,13 +84,14 @@ static Tile placeholder_tile = {
 	}
 };
 
-CommandBar::CommandBar() : GUI_Widget(NULL) {
-	selected_action = -1;
+CommandBar::CommandBar() : GUI_Widget(NULL), game(nullptr), event(nullptr),
+		background(nullptr), font(nullptr), selected_action(-1), offset(0),
+		combat_mode(false), bg_color(0), font_color(0) {
 }
 
-CommandBar::CommandBar(Game *g) : GUI_Widget(NULL) {
-	game = g;
-	background = NULL;
+CommandBar::CommandBar(Game *g) : GUI_Widget(NULL), game(g),
+		background(nullptr), combat_mode(false), bg_color(0),
+		font_color(0) {
 	Weather *weather;
 	uint16 x_off = game->get_game_x_offset();
 	uint16 y_off =  game->get_game_y_offset();
@@ -151,7 +152,7 @@ CommandBar::CommandBar(Game *g) : GUI_Widget(NULL) {
 		offset = OBJLIST_OFFSET_SE_COMMAND_BAR;
 	}
 
-	event = NULL; // it's not set yet
+	event = nullptr; // it's not set yet
 	font = game->get_font_manager()->get_font(0);
 
 	weather = game->get_weather();
diff --git a/engines/ultima/nuvie/gui/widgets/converse_gump.cpp b/engines/ultima/nuvie/gui/widgets/converse_gump.cpp
index 5ee29b80dc7..643a3d96f3b 100644
--- a/engines/ultima/nuvie/gui/widgets/converse_gump.cpp
+++ b/engines/ultima/nuvie/gui/widgets/converse_gump.cpp
@@ -113,6 +113,8 @@ ConverseGump::ConverseGump(Configuration *cfg, Font *f, Screen *s) {
 	cfg->value(config_get_game_key(config) + "/converse_bg_color", c, default_c);
 	if (c < 256)
 		converse_bg_color = (uint8)c;
+	else
+		converse_bg_color = 0;
 
 	cursor_position = 0;
 
diff --git a/engines/ultima/nuvie/gui/widgets/converse_gump_wou.cpp b/engines/ultima/nuvie/gui/widgets/converse_gump_wou.cpp
index 2a48a9f2203..c888fa0a3e5 100644
--- a/engines/ultima/nuvie/gui/widgets/converse_gump_wou.cpp
+++ b/engines/ultima/nuvie/gui/widgets/converse_gump_wou.cpp
@@ -48,7 +48,8 @@ namespace Nuvie {
 
 // ConverseGumpWOU Class
 
-ConverseGumpWOU::ConverseGumpWOU(Configuration *cfg, Font *f, Screen *s) {
+ConverseGumpWOU::ConverseGumpWOU(Configuration *cfg, Font *f, Screen *s)
+		: found_break_char(false), frame_h(0), frame_w(0), min_w(0) {
 // uint16 x, y;
 
 	init(cfg, f);
@@ -65,7 +66,7 @@ ConverseGumpWOU::ConverseGumpWOU(Configuration *cfg, Font *f, Screen *s) {
 	uint16 y_off = game->get_game_y_offset();
 
 	if (game_type == NUVIE_GAME_U6) {
-		GUI_Widget::Init(NULL, x_off + 8, y_off + 8, 160, 160);
+		GUI_Widget::Init(nullptr, x_off + 8, y_off + 8, 160, 160);
 		bg_color = converse_bg_color = 0x31; //17;
 		if (game->get_game_width() >= 335) {
 			Std::string imagefile;
@@ -74,14 +75,13 @@ ConverseGumpWOU::ConverseGumpWOU(Configuration *cfg, Font *f, Screen *s) {
 			NuvieBmpFile bmp;
 			bg_image = bmp.getSdlSurface32(imagefile);
 		} else
-			bg_image = NULL;
+			bg_image = nullptr;
 	} else { //MD and SE
-		bg_image = NULL;
-		GUI_Widget::Init(NULL, x_off + 8, y_off + 16, 160, 144);
+		bg_image = nullptr;
+		GUI_Widget::Init(nullptr, x_off + 8, y_off + 16, 160, 144);
 		bg_color = converse_bg_color = Game::get_game()->get_palette()->get_bg_color();
 	}
 
-	found_break_char = false;
 	left_margin = 8;
 	add_new_line();
 //DEBUG(0, LEVEL_DEBUGGING, "\nMin w = %d\n", frame_w + 12 + 210);
diff --git a/engines/ultima/nuvie/gui/widgets/map_window.cpp b/engines/ultima/nuvie/gui/widgets/map_window.cpp
index 03dd65bc0d7..8ab21ec58cb 100644
--- a/engines/ultima/nuvie/gui/widgets/map_window.cpp
+++ b/engines/ultima/nuvie/gui/widgets/map_window.cpp
@@ -105,54 +105,34 @@ static const Tile grid_tile = {
 	}
 };
 
-MapWindow::MapWindow(Configuration *cfg, Map *m): GUI_Widget(NULL, 0, 0, 0, 0) {
+MapWindow::MapWindow(Configuration *cfg, Map *m): GUI_Widget(nullptr, 0, 0, 0, 0), config(cfg),
+		map(m), anim_manager(nullptr), cur_x(0), cur_y(0), mousecenter_x(0),
+		mousecenter_y(0), cur_x_add(0), cur_y_add(0), vel_x(0), vel_y(0),
+		last_boundary_fill_x(0), last_boundary_fill_y(0), cursor_x(0), cursor_y(0),
+		show_cursor(false), show_use_cursor(false), show_grid(false), x_ray_view(X_RAY_OFF),
+		freeze_blacking_location(false), enable_blacking(true), new_thumbnail(false),
+		thumbnail(nullptr), overlay(nullptr), overlay_level(MAP_OVERLAY_DEFAULT),
+		cur_level(0), tmp_map_buf(nullptr), selected_obj(nullptr), look_obj(nullptr),
+		look_actor(nullptr), walking(false), looking(false),
+		original_obj_loc(MapCoord(0, 0, 0)), roof_tiles(nullptr),
+		draw_brit_lens_anim(false), draw_garg_lens_anim(false), window_updated(true),
+		roof_display(ROOF_DISPLAY_NORMAL), lighting_update_required(true), game(nullptr),
+		custom_actor_tiles(false), tmp_map_width(0), tmp_map_height(0), tile_manager(nullptr),
+		obj_manager(nullptr), actor_manager(nullptr), map_center_xoff(0), cursor_tile(nullptr),
+		use_tile(nullptr), win_width(0), win_height(0), border_width(0), hackmove(false),
+		wizard_eye_info({nullptr, 0, 0, 0, nullptr}) {
 
-	config = cfg;
 	config->value("config/GameType", game_type);
 
 	uint16 x_off = Game::get_game()->get_game_x_offset();
 	uint16 y_off = Game::get_game()->get_game_y_offset();
 
-	GUI_Widget::Init(NULL, x_off, y_off, 0, 0);
+	GUI_Widget::Init(nullptr, x_off, y_off, 0, 0);
 
-	map = m;
+	screen = nullptr;
 
-	screen = NULL;
-//surface = NULL;
-	anim_manager = NULL;
-
-	cur_x = 0;
-	mousecenter_x = 0;
-	cur_y = 0;
-	mousecenter_y = 0;
-	cur_x_add = cur_y_add = 0;
-	vel_x = vel_y = 0;
-	last_boundary_fill_x = last_boundary_fill_y = 0;
-
-	cursor_x = 0;
-	cursor_y = 0;
-	show_cursor = false;
-	show_use_cursor = false;
-	show_grid = false;
-	x_ray_view = X_RAY_OFF;
-	freeze_blacking_location = false;
-	enable_blacking = true;
-
-	new_thumbnail = false;
-	thumbnail = NULL;
-	overlay = NULL;
-	overlay_level = MAP_OVERLAY_DEFAULT;
-
-	cur_level = 0;
 	map_width = map->get_width(cur_level);
 
-	tmp_map_buf = NULL;
-
-	selected_obj = NULL;
-	look_obj = NULL;
-	look_actor = NULL;
-	walking = false;
-	looking = false;
 	config->value(config_get_game_key(config) + "/map_tile_lighting", using_map_tile_lighting, game_type == NUVIE_GAME_MD ? false : true);
 	config->value("config/input/enable_doubleclick", enable_doubleclick, true);
 	config->value("config/input/look_on_left_click", look_on_left_click, true);
@@ -160,18 +140,8 @@ MapWindow::MapWindow(Configuration *cfg, Map *m): GUI_Widget(NULL, 0, 0, 0, 0) {
 	config->value("config/input/walk_with_left_button", walk_with_left_button, true);
 	set_walk_button_mask();
 	config->value("config/cheats/min_brightness", min_brightness, 0);
-	original_obj_loc = MapCoord(0, 0, 0);
 
 	roof_mode = Game::get_game()->is_roof_mode();
-	roof_tiles = NULL;
-
-	draw_brit_lens_anim = false;
-	draw_garg_lens_anim = false;
-
-	window_updated = true;
-	roof_display = ROOF_DISPLAY_NORMAL;
-
-	lighting_update_required = true;
 
 	game_started = false;
 
diff --git a/engines/ultima/nuvie/gui/widgets/msg_scroll.cpp b/engines/ultima/nuvie/gui/widgets/msg_scroll.cpp
index df52a5416c3..e93f06d0ab3 100644
--- a/engines/ultima/nuvie/gui/widgets/msg_scroll.cpp
+++ b/engines/ultima/nuvie/gui/widgets/msg_scroll.cpp
@@ -187,7 +187,9 @@ void MsgScroll::init(Configuration *cfg, Font *f) {
 	}
 }
 
-MsgScroll::MsgScroll(Configuration *cfg, Font *f) : GUI_Widget(NULL, 0, 0, 0, 0) {
+MsgScroll::MsgScroll(Configuration *cfg, Font *f) : GUI_Widget(NULL, 0, 0, 0, 0),
+		input_mode(false), permit_input(nullptr), just_displayed_prompt(false),
+		permit_inputescape(false), screen_x(0), screen_y(0), keyword_highlight(false) {
 	uint16 x, y;
 
 	init(cfg, f);
diff --git a/engines/ultima/nuvie/gui/widgets/msg_scroll.h b/engines/ultima/nuvie/gui/widgets/msg_scroll.h
index 5f899d1ef8c..6d6391471df 100644
--- a/engines/ultima/nuvie/gui/widgets/msg_scroll.h
+++ b/engines/ultima/nuvie/gui/widgets/msg_scroll.h
@@ -131,77 +131,41 @@ private:
 	uint16 screen_x; //x offset to top left corner of MsgScroll
 	uint16 screen_y; //y offset to top left corner of MsgScroll
 
-
-
 	bool keyword_highlight;
 
-
-
-
 	MsgText prompt;
 	Std::list<MsgText *> holding_buffer;
 
-
 	bool show_cursor;
 	bool autobreak; // if true, a page break will be added when the scroll is full
 
-
-
-
-
-
 	bool scroll_updated;
 	uint8 cursor_char;
 	uint16 cursor_x, cursor_y;
 
-
-
-
 	uint16 line_count; // count the number of lines since last page break.
 
 	uint16 display_pos;
 
-
 	bool capitalise_next_letter;
 
-
-
-
 public:
 
 	MsgScroll(Configuration *cfg, Font *f);
-	MsgScroll() : GUI_Widget(NULL, 0, 0, 0, 0) {
-		config = NULL;
-		game_type = 0;
-		font = NULL;
-		scroll_height = 0;
-		scroll_width = 0;
-		callback_target = NULL;
-		callback_user_data = NULL;
-		input_mode = false;
-		permit_input = NULL;
-		page_break = false;
-		just_finished_page_break = false;
-		permit_inputescape = false;
-		cursor_wait = 0;
-		screen_x = 0;
-		screen_y = 0;
-		bg_color = 0;
-		keyword_highlight = true;
-		talking = false;
-		show_cursor = false;
-		autobreak = false;
-		scroll_updated = false;
-		cursor_char = 0;
-		cursor_x = 0;
-		cursor_y = 0;
-		line_count = 0;
-		display_pos = 0;
-		capitalise_next_letter = false;
-		just_displayed_prompt = false;
-		scrollback_height = MSGSCROLL_SCROLLBACK_HEIGHT;
-		discard_whitespace = false;
-		left_margin = 0;
+	MsgScroll() : GUI_Widget(nullptr, 0, 0, 0, 0),
+		config(nullptr), game_type(0), font(nullptr), scroll_height(0),
+		scroll_width(0), callback_target(nullptr), callback_user_data(nullptr),
+		input_mode(false), permit_input(nullptr), page_break(false),
+		just_finished_page_break(false), permit_inputescape(false),
+		cursor_wait(0), screen_x(0), screen_y(0), bg_color(0),
+		keyword_highlight(true), talking(false), show_cursor(false),
+		autobreak(false), scroll_updated(false), cursor_char(0),
+		cursor_x(0), cursor_y(0), line_count(0), display_pos(0),
+		capitalise_next_letter(false), just_displayed_prompt(false),
+		scrollback_height(MSGSCROLL_SCROLLBACK_HEIGHT), discard_whitespace(false),
+		left_margin(0), font_color(0), font_highlight_color(0), input_char(0),
+		yes_no_only(false), aye_nay_only(false), numbers_only(false),
+		using_target_cursor(false) {
 	}
 	~MsgScroll() override;
 
diff --git a/engines/ultima/nuvie/keybinding/keys.cpp b/engines/ultima/nuvie/keybinding/keys.cpp
index c9ff2cc9970..00bb4b20c7a 100644
--- a/engines/ultima/nuvie/keybinding/keys.cpp
+++ b/engines/ultima/nuvie/keybinding/keys.cpp
@@ -254,7 +254,7 @@ const KeycodeString StringTable[] = {
 
 const Action doNothingAction = { "DO_NOTHING", ActionDoNothing, "", Action::dont_show, true, OTHER_KEY };
 
-KeyBinder::KeyBinder(Configuration *config) {
+KeyBinder::KeyBinder(Configuration *config) : enable_joystick(false) {
 	FillParseMaps();
 
 	Std::string keyfilename, dir;
diff --git a/engines/ultima/nuvie/nuvie.cpp b/engines/ultima/nuvie/nuvie.cpp
index 11cf1e7ad57..4b07fb4b3cb 100644
--- a/engines/ultima/nuvie/nuvie.cpp
+++ b/engines/ultima/nuvie/nuvie.cpp
@@ -48,7 +48,8 @@ NuvieEngine *g_engine;
 
 NuvieEngine::NuvieEngine(OSystem *syst, const Ultima::UltimaGameDescription *gameDesc) :
 		Ultima::Shared::UltimaEngine(syst, gameDesc),  _config(nullptr), _savegame(nullptr),
-		_screen(nullptr), _script(nullptr), _game(nullptr), _soundManager(nullptr) {
+		_screen(nullptr), _script(nullptr), _game(nullptr), _soundManager(nullptr),
+		_events(nullptr) {
 	g_engine = this;
 }
 
@@ -111,10 +112,8 @@ bool NuvieEngine::initialize() {
 	// Setup screen
 	_screen = new Screen(_config);
 
-	if (_screen->init() == false) {
-		DEBUG(0, LEVEL_ERROR, "Initializing screen!\n");
-		return false;
-	}
+	if (_screen->init() == false)
+		error("Error initializing screen!");
 
 	GUI *gui = new GUI(_config, _screen);
 
diff --git a/engines/ultima/nuvie/screen/screen.cpp b/engines/ultima/nuvie/screen/screen.cpp
index 65aa564935e..fcf9a0f8edc 100644
--- a/engines/ultima/nuvie/screen/screen.cpp
+++ b/engines/ultima/nuvie/screen/screen.cpp
@@ -41,21 +41,12 @@ namespace Nuvie {
 static const sint32 globeradius[]   = { 36, 112, 148, 192, 448 };
 static const sint32 globeradius_2[] = { 18, 56, 74, 96, 224 };
 
-Screen::Screen(Configuration *cfg) {
-	config = cfg;
-
-	_rawSurface = NULL;
-	_renderSurface = NULL;
-	scaler = NULL;
-	shading_data = NULL;
-	scaler_index = 0;
-	scale_factor = 2;
-	doubleBuffer = false;
-	is_no_darkness = false;
-	non_square_pixels = false;
-	shading_ambient = 255;
-	width = 320;
-	height = 200;
+Screen::Screen(Configuration *cfg) : config(cfg), _rawSurface(nullptr),
+		_renderSurface(nullptr), scaler(nullptr), shading_data(nullptr),
+		scaler_index(0), scale_factor(2), doubleBuffer(false),
+		is_no_darkness(false), non_square_pixels(false), shading_ambient(255),
+		width(320), height(200) {
+	ARRAYCLEAR(shading_tile);
 
 	Std::string str_lighting_style;
 	config->value("config/general/lighting", str_lighting_style);
diff --git a/engines/ultima/nuvie/screen/surface.cpp b/engines/ultima/nuvie/screen/surface.cpp
index d12de057a4a..3afadeec474 100644
--- a/engines/ultima/nuvie/screen/surface.cpp
+++ b/engines/ultima/nuvie/screen/surface.cpp
@@ -82,8 +82,9 @@ RenderSurface::RenderSurface(Graphics::ManagedSurface *surf) :
 
 // Constructor for opengl surface
 RenderSurface::RenderSurface(OpenGL *ogl) : buffer(0), zbuffer_priv(0), _rawSurface(NULL),
-		opengl(ogl), bytes_per_pixel(0), bits_per_pixel(0), format_type(0), pixels(0),
-		zbuffer(0), w(0), h(0), pitch(0), gl(0), gr(0), gt(0), gb(0), lock_count(0) {
+		_disposeSurface(DisposeAfterUse::NO), opengl(ogl), bytes_per_pixel(0),
+		bits_per_pixel(0), format_type(0), pixels(0), zbuffer(0), w(0), h(0), pitch(0),
+		gl(0), gr(0), gt(0), gb(0), lock_count(0) {
 }
 
 RenderSurface::~RenderSurface() {
diff --git a/engines/ultima/nuvie/script/script_cutscene.cpp b/engines/ultima/nuvie/script/script_cutscene.cpp
index becdf4b374b..8cbfb2dcee5 100644
--- a/engines/ultima/nuvie/script/script_cutscene.cpp
+++ b/engines/ultima/nuvie/script/script_cutscene.cpp
@@ -1732,12 +1732,12 @@ void CSImage::setScale(uint16 percentage) {
 	return;
 }
 
-CSStarFieldImage::CSStarFieldImage(U6Shape *shape) : CSImage(shape) {
+CSStarFieldImage::CSStarFieldImage(U6Shape *shape) : CSImage(shape), w(0), h(0) {
 	shp->get_size(&w, &h);
 
 	for (int i = 0; i < STAR_FIELD_NUM_STARS; i++) {
 		stars[i].color = 2;
-		stars[i].line = NULL;
+		stars[i].line = nullptr;
 	}
 }
 
@@ -1747,7 +1747,7 @@ void CSStarFieldImage::updateEffect() {
 	memset(data, 0, w * h);
 
 	for (int i = 0; i < STAR_FIELD_NUM_STARS; i++) {
-		if (stars[i].line == NULL) {
+		if (stars[i].line == nullptr) {
 			switch (NUVIE_RAND() % 4) {
 			case 0 :
 				stars[i].line = new U6LineWalker(w / 2, h / 2, 0, NUVIE_RAND() % h);
diff --git a/engines/ultima/nuvie/sound/adplug/u6m.h b/engines/ultima/nuvie/sound/adplug/u6m.h
index 976aa64dd33..cb81812b489 100644
--- a/engines/ultima/nuvie/sound/adplug/u6m.h
+++ b/engines/ultima/nuvie/sound/adplug/u6m.h
@@ -33,7 +33,8 @@ public:
 	static CPlayer *factory(Copl *newopl);
 
 	Cu6mPlayer(Copl *newopl) : CPlayer(newopl), song_data(0), driver_active(0),
-		songend(0), song_pos(0), loop_position(0), read_delay(0) {
+		songend(0), song_pos(0), loop_position(0), read_delay(0), played_ticks(0) {
+		ARRAYCLEAR(channel_freq);
 	}
 
 	~Cu6mPlayer() override;
diff --git a/engines/ultima/nuvie/sound/decoder/pc_speaker.cpp b/engines/ultima/nuvie/sound/decoder/pc_speaker.cpp
index 89bd8341e65..be7ff0271f4 100644
--- a/engines/ultima/nuvie/sound/decoder/pc_speaker.cpp
+++ b/engines/ultima/nuvie/sound/decoder/pc_speaker.cpp
@@ -97,11 +97,9 @@ void PCSpeaker::SetFrequency(uint16 freq, float offset) {
 
 }
 
-PCSpeaker::PCSpeaker(uint32 mixer_rate) {
-	rate = mixer_rate;
-	cur_vol = 0.0f;
-	want_vol = 0.0f; //SPKR_VOLUME;
-	frequency = 0;
+PCSpeaker::PCSpeaker(uint32 mixer_rate) : rate(mixer_rate), cur_vol(0.0f), want_vol(0.0f),
+		frequency(0), half_period(0.0f), time_left(0.0f), osc_length(0),
+		osc_samples(0), wav_length(0) {
 }
 
 
diff --git a/engines/ultima/nuvie/sound/decoder/pc_speaker_stream.cpp b/engines/ultima/nuvie/sound/decoder/pc_speaker_stream.cpp
index c8770b463b0..98fad31e77c 100644
--- a/engines/ultima/nuvie/sound/decoder/pc_speaker_stream.cpp
+++ b/engines/ultima/nuvie/sound/decoder/pc_speaker_stream.cpp
@@ -154,9 +154,11 @@ int PCSpeakerSweepFreqStream::readBuffer(sint16 *buffer, const int numSamples) {
 
 //**************** PCSpeakerRandomStream
 
-PCSpeakerRandomStream::PCSpeakerRandomStream(uint freq, uint16 d, uint16 s) {
-	rand_value = 0x7664;
-	base_val = freq;
+PCSpeakerRandomStream::PCSpeakerRandomStream(uint freq, uint16 d, uint16 s)
+		: rand_value(0x7664), base_val(freq), duration(0), stepping(0),
+		  cur_step(0), sample_pos(0), num_steps(d / s),
+          samples_per_step(s * (SPKR_OUTPUT_RATE / 20 / 800)),
+          total_samples_played(0) {
 	/*
 	frequency = freq;
 
@@ -171,11 +173,6 @@ PCSpeakerRandomStream::PCSpeakerRandomStream(uint freq, uint16 d, uint16 s) {
 	pcspkr->SetOn();
 	pcspkr->SetFrequency(getNextFreqValue());
 
-	cur_step = 0;
-	sample_pos = 0;
-	num_steps = d / s;
-	samples_per_step = s * (SPKR_OUTPUT_RATE / 20 / 800); //1255);
-	total_samples_played = 0;
 	DEBUG(0, LEVEL_DEBUGGING, "num_steps = %d samples_per_step = %d\n", num_steps, samples_per_step);
 
 }
diff --git a/engines/ultima/nuvie/sound/sound_manager.cpp b/engines/ultima/nuvie/sound/sound_manager.cpp
index 8d19b341363..52c1586177f 100644
--- a/engines/ultima/nuvie/sound/sound_manager.cpp
+++ b/engines/ultima/nuvie/sound/sound_manager.cpp
@@ -81,26 +81,15 @@ void musicFinished() {
 	SoundManager::g_MusicFinished = true;
 }
 
-SoundManager::SoundManager(Audio::Mixer *mixer) : _mixer(mixer) {
-	m_pCurrentSong = NULL;
+SoundManager::SoundManager(Audio::Mixer *mixer) : _mixer(mixer),
+		m_pCurrentSong(nullptr), audio_enabled(false), music_enabled(false),
+		sfx_enabled(false), m_Config(nullptr), m_SfxManager(nullptr), opl(nullptr),
+		stop_music_on_group_change(true), speech_enabled(true), music_volume(0),
+		sfx_volume(0), game_type(NUVIE_GAME_NONE), _midiDriver(nullptr),
+		_mt32MidiDriver(nullptr), _midiParser(nullptr), _deviceType(MT_NULL),
+		_musicData(nullptr), _mt32InstrumentMapping(nullptr) {
 	m_CurrentGroup = "";
 	g_MusicFinished = true;
-
-	audio_enabled = false;
-	music_enabled = false;
-	sfx_enabled = false;
-
-	m_Config = NULL;
-	m_SfxManager = NULL;
-
-	opl = NULL;
-
-	_midiDriver = nullptr;
-	_mt32MidiDriver = nullptr;
-	_midiParser = nullptr;
-	_deviceType = MT_NULL;
-	_musicData = nullptr;
-	_mt32InstrumentMapping = nullptr;
 }
 
 SoundManager::~SoundManager() {
diff --git a/engines/ultima/nuvie/views/container_view_gump.cpp b/engines/ultima/nuvie/views/container_view_gump.cpp
index 821a7267c2f..472a613604d 100644
--- a/engines/ultima/nuvie/views/container_view_gump.cpp
+++ b/engines/ultima/nuvie/views/container_view_gump.cpp
@@ -40,18 +40,12 @@ namespace Nuvie {
 #define CONTAINER_WIDGET_OFFSET 29
 #define CHECK_X 0
 
-ContainerViewGump::ContainerViewGump(Configuration *cfg) : DraggableView(cfg) {
-	bg_image = NULL;
-	gump_button = NULL;
-	up_arrow_button = NULL;
-	down_arrow_button = NULL;
-	doll_button = NULL;
-	left_arrow_button = NULL;
-	right_arrow_button = NULL;
-	container_widget = NULL;
-	font = NULL;
-	actor = NULL;
-	container_obj = NULL;
+ContainerViewGump::ContainerViewGump(Configuration *cfg) : DraggableView(cfg),
+		gump_button(nullptr), up_arrow_button(nullptr), down_arrow_button(nullptr),
+		doll_button(nullptr), left_arrow_button(nullptr),
+		right_arrow_button(nullptr), container_widget(nullptr), font(nullptr),
+		actor(nullptr), container_obj(nullptr), container_widget_y_offset(0) {
+	bg_image = nullptr;
 }
 
 ContainerViewGump::~ContainerViewGump() {
diff --git a/engines/ultima/nuvie/views/container_widget.cpp b/engines/ultima/nuvie/views/container_widget.cpp
index fe7d56a58cc..c013700ba29 100644
--- a/engines/ultima/nuvie/views/container_widget.cpp
+++ b/engines/ultima/nuvie/views/container_widget.cpp
@@ -41,22 +41,13 @@
 namespace Ultima {
 namespace Nuvie {
 
-ContainerWidget::ContainerWidget(Configuration *cfg, GUI_CallBack *callback): GUI_Widget(NULL, 0, 0, 0, 0) {
-	config = cfg;
-	callback_object = callback;
-
-	container_obj = NULL;
-	tile_manager = NULL;
-	obj_manager = NULL;
-	selected_obj = NULL;
-	target_cont = NULL;
-	actor = NULL;
-	target_obj = NULL;
-	fill_bg = false;
-	empty_tile = NULL;
-	ready_obj = NULL; // FIXME: this is unused but I might need it again -- SB-X
-	row_offset = 0;
-
+ContainerWidget::ContainerWidget(Configuration *cfg, GUI_CallBack *callback)
+		: GUI_Widget(nullptr, 0, 0, 0, 0), config(cfg), callback_object(callback),
+		container_obj(nullptr), tile_manager(nullptr), obj_manager(nullptr),
+		selected_obj(nullptr), target_cont(nullptr), actor(nullptr),
+		target_obj(nullptr), fill_bg(false), empty_tile(nullptr), row_offset(0),
+		rows(0), cols(0), bg_color(0), obj_font_color(0) {
+	ready_obj = nullptr; // FIXME: this is unused but I might need it again -- SB-X
 	config->value("config/GameType", game_type);
 }
 
diff --git a/engines/ultima/nuvie/views/container_widget_gump.cpp b/engines/ultima/nuvie/views/container_widget_gump.cpp
index 204c3f14907..751d13d0208 100644
--- a/engines/ultima/nuvie/views/container_widget_gump.cpp
+++ b/engines/ultima/nuvie/views/container_widget_gump.cpp
@@ -68,15 +68,13 @@ static const Tile gump_empty_tile = {
 };
 
 
-ContainerWidgetGump::ContainerWidgetGump(Configuration *cfg, GUI_CallBack *callback) : ContainerWidget(cfg, callback) {
-	cursor_tile = NULL;
+ContainerWidgetGump::ContainerWidgetGump(Configuration *cfg, GUI_CallBack *callback)
+		: ContainerWidget(cfg, callback), cursor_tile(nullptr), check_x(0), check_y(0),
+		  cursor_x(0), cursor_y(0), show_cursor(true) {
 	empty_tile = &gump_empty_tile;
 	obj_font_color = 15;
 	bg_color = 0;
 	fill_bg = false;
-
-	cursor_x = cursor_y = 0;
-	show_cursor = true;
 }
 
 ContainerWidgetGump::~ContainerWidgetGump() {
diff --git a/engines/ultima/nuvie/views/doll_widget.cpp b/engines/ultima/nuvie/views/doll_widget.cpp
index bff68a5f00d..252b4439f2b 100644
--- a/engines/ultima/nuvie/views/doll_widget.cpp
+++ b/engines/ultima/nuvie/views/doll_widget.cpp
@@ -79,27 +79,14 @@ static const byte gump_empty_tile_data[] = {
 	170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170
 };
 
-DollWidget::DollWidget(Configuration *cfg, GUI_CallBack *callback): GUI_Widget(NULL, 0, 0, 0, 0) {
-	config = cfg;
-	callback_object = callback;
-
-	actor = NULL;
-	tile_manager = NULL;
-	selected_obj = NULL;
-	obj_manager = NULL;
-	unready_obj = NULL;
-	empty_tile = NULL;
-	blocked_tile = NULL;
-
+DollWidget::DollWidget(Configuration *cfg, GUI_CallBack *callback)
+		: GUI_Widget(nullptr, 0, 0, 0, 0), config(cfg), callback_object(callback),
+		actor(nullptr), tile_manager(nullptr), selected_obj(nullptr),
+		obj_manager(nullptr), unready_obj(nullptr), empty_tile(nullptr),
+		blocked_tile(nullptr), need_to_free_tiles(false), use_new_dolls(true),
+		old_use_new_dolls(true), actor_doll(nullptr), doll_bg(nullptr),
+		md_doll_shp(nullptr), is_in_portrait_view(false) {
 	bg_color = Game::get_game()->get_palette()->get_bg_color();
-	need_to_free_tiles = false;
-
-	use_new_dolls = true;
-	old_use_new_dolls = true;
-	actor_doll = NULL;
-	doll_bg = NULL;
-	md_doll_shp = NULL;
-
 	// Set up hit rects
 	item_hit_rects[0] = Common::Rect(24, 0,  24 + 16,  0 + 16); // ACTOR_HEAD
 	item_hit_rects[1] = Common::Rect(0, 8,   0 + 16,  8 + 16);  // ACTOR_NECK
diff --git a/engines/ultima/nuvie/views/draggable_view.cpp b/engines/ultima/nuvie/views/draggable_view.cpp
index fce5a8753a2..250b3ac288f 100644
--- a/engines/ultima/nuvie/views/draggable_view.cpp
+++ b/engines/ultima/nuvie/views/draggable_view.cpp
@@ -31,12 +31,9 @@
 namespace Ultima {
 namespace Nuvie {
 
-DraggableView::DraggableView(Configuration *cfg) : View(cfg) {
-	drag = false;
-	button_x = 0;
-	button_y = 0;
-	bg_image = NULL;
-	bg_color_key = 0;
+DraggableView::DraggableView(Configuration *cfg) : View(cfg),
+		drag(false), button_x(0), button_y(0), bg_image(nullptr),
+		bg_color_key(0), always_need_full_redraw_when_moved(false) {
 	Game *game = Game::get_game();
 	if (game->is_orig_style() || game->is_original_plus_cutoff_map()) {
 		need_full_redraw_when_moved = true;
diff --git a/engines/ultima/nuvie/views/inventory_widget.cpp b/engines/ultima/nuvie/views/inventory_widget.cpp
index 124a8653504..bfa74b86913 100644
--- a/engines/ultima/nuvie/views/inventory_widget.cpp
+++ b/engines/ultima/nuvie/views/inventory_widget.cpp
@@ -41,21 +41,14 @@
 namespace Ultima {
 namespace Nuvie {
 
-InventoryWidget::InventoryWidget(Configuration *cfg, GUI_CallBack *callback): GUI_Widget(NULL, 0, 0, 0, 0) {
-	config = cfg;
-	callback_object = callback;
-
-	container_obj = NULL;
-	tile_manager = NULL;
-	obj_manager = NULL;
-	selected_obj = NULL;
-	font = NULL;
-	actor = NULL;
-	target_obj = NULL;
-	target_cont = NULL;
-	empty_tile = NULL;
-	ready_obj = NULL; // FIXME: this is unused but I might need it again -- SB-X
-	row_offset = 0;
+InventoryWidget::InventoryWidget(Configuration *cfg, GUI_CallBack *callback)
+	: GUI_Widget(nullptr, 0, 0, 0, 0), config(cfg), callback_object(callback),
+      container_obj(nullptr), tile_manager(nullptr), obj_manager(nullptr),
+	  selected_obj(nullptr), font(nullptr), actor(nullptr), target_obj(nullptr),
+	  target_cont(nullptr), empty_tile(nullptr), row_offset(0), icon_x(0),
+	  bg_color(0), objlist_offset_x(0), objlist_offset_y(0), obj_font_color(0) {
+
+	ready_obj = nullptr; // FIXME: this is unused but I might need it again -- SB-X
 
 	config->value("config/GameType", game_type);
 
diff --git a/engines/ultima/nuvie/views/map_editor_view.cpp b/engines/ultima/nuvie/views/map_editor_view.cpp
index c17319887ca..9b1c87190cb 100644
--- a/engines/ultima/nuvie/views/map_editor_view.cpp
+++ b/engines/ultima/nuvie/views/map_editor_view.cpp
@@ -36,11 +36,9 @@ namespace Nuvie {
 #define TILES_W 5
 #define TILES_H 10
 
-MapEditorView::MapEditorView(Configuration *cfg) : View(cfg) {
-	roof_tiles = NULL;
-	map_window = NULL;
-	up_button = NULL;
-	down_button = NULL;
+MapEditorView::MapEditorView(Configuration *cfg) : View(cfg), roof_tiles(nullptr),
+		map_window(nullptr), up_button(nullptr), down_button(nullptr),
+		selectedTile(0), tile_offset(0) {
 }
 
 MapEditorView::~MapEditorView() {
diff --git a/engines/ultima/nuvie/views/portrait_view.cpp b/engines/ultima/nuvie/views/portrait_view.cpp
index 0f693b3174e..25241239d82 100644
--- a/engines/ultima/nuvie/views/portrait_view.cpp
+++ b/engines/ultima/nuvie/views/portrait_view.cpp
@@ -42,19 +42,13 @@
 namespace Ultima {
 namespace Nuvie {
 
-PortraitView::PortraitView(Configuration *cfg) : View(cfg) {
-	portrait_data = NULL;
-	portrait = NULL;
-	bg_data = NULL;
-	name_string = new string;
-	show_cursor = false;
-	doll_widget = NULL;
-	waiting = false;
-	display_doll = false;
-	cur_actor_num = 0;
+PortraitView::PortraitView(Configuration *cfg) : View(cfg),
+		portrait_data(nullptr), portrait(nullptr),	bg_data(nullptr),
+		name_string(new string), show_cursor(false), doll_widget(nullptr),
+		waiting(false), display_doll(false), cur_actor_num(0) {
 	gametype = get_game_type(cfg);
 
-//FIXME: Portraits in SE/MD are different size than in U6! 79x85 76x83
+	//FIXME: Portraits in SE/MD are different size than in U6! 79x85 76x83
 	switch (gametype) {
 	case NUVIE_GAME_U6:
 		portrait_width = 56;
@@ -68,6 +62,8 @@ PortraitView::PortraitView(Configuration *cfg) : View(cfg) {
 		portrait_width = 76;
 		portrait_height = 83;
 		break;
+	default:
+		error("Unsupported game type in PortraitView");
 	}
 }
 


Commit: 578cfefd0a524bef2bdb981ee33fb181f0f071c8
    https://github.com/scummvm/scummvm/commit/578cfefd0a524bef2bdb981ee33fb181f0f071c8
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2023-12-09T13:56:05+11:00

Commit Message:
ULTIMA: NUVIE: Replace uses of NULL with nullptr

nullptr keyword is preferred as it provides a little bit of type safety not
provided by NULL.

Changed paths:
    engines/ultima/nuvie/actors/actor.cpp
    engines/ultima/nuvie/actors/actor.h
    engines/ultima/nuvie/actors/actor_manager.cpp
    engines/ultima/nuvie/actors/actor_manager.h
    engines/ultima/nuvie/actors/u6_actor.cpp
    engines/ultima/nuvie/core/anim_manager.cpp
    engines/ultima/nuvie/core/anim_manager.h
    engines/ultima/nuvie/core/book.cpp
    engines/ultima/nuvie/core/converse.cpp
    engines/ultima/nuvie/core/converse.h
    engines/ultima/nuvie/core/converse_interpret.cpp
    engines/ultima/nuvie/core/converse_interpret.h
    engines/ultima/nuvie/core/converse_speech.cpp
    engines/ultima/nuvie/core/cursor.cpp
    engines/ultima/nuvie/core/debug.cpp
    engines/ultima/nuvie/core/effect.cpp
    engines/ultima/nuvie/core/effect.h
    engines/ultima/nuvie/core/effect_manager.cpp
    engines/ultima/nuvie/core/effect_manager.h
    engines/ultima/nuvie/core/egg_manager.cpp
    engines/ultima/nuvie/core/egg_manager.h
    engines/ultima/nuvie/core/events.cpp
    engines/ultima/nuvie/core/events.h
    engines/ultima/nuvie/core/game.cpp
    engines/ultima/nuvie/core/look.cpp
    engines/ultima/nuvie/core/magic.cpp
    engines/ultima/nuvie/core/magic.h
    engines/ultima/nuvie/core/map.cpp
    engines/ultima/nuvie/core/map.h
    engines/ultima/nuvie/core/obj.cpp
    engines/ultima/nuvie/core/obj.h
    engines/ultima/nuvie/core/obj_manager.cpp
    engines/ultima/nuvie/core/obj_manager.h
    engines/ultima/nuvie/core/party.cpp
    engines/ultima/nuvie/core/party.h
    engines/ultima/nuvie/core/player.cpp
    engines/ultima/nuvie/core/tile_manager.cpp
    engines/ultima/nuvie/core/timed_event.cpp
    engines/ultima/nuvie/core/timed_event.h
    engines/ultima/nuvie/core/weather.cpp
    engines/ultima/nuvie/core/weather.h
    engines/ultima/nuvie/files/nuvie_bmp_file.cpp
    engines/ultima/nuvie/files/nuvie_file_list.cpp
    engines/ultima/nuvie/files/nuvie_io.cpp
    engines/ultima/nuvie/files/tmx_map.cpp
    engines/ultima/nuvie/files/u6_bmp.cpp
    engines/ultima/nuvie/files/u6_lib_n.cpp
    engines/ultima/nuvie/files/u6_lib_n.h
    engines/ultima/nuvie/files/u6_lzw.cpp
    engines/ultima/nuvie/files/u6_shape.cpp
    engines/ultima/nuvie/fonts/bmp_font.cpp
    engines/ultima/nuvie/fonts/conv_font.cpp
    engines/ultima/nuvie/fonts/font_manager.cpp
    engines/ultima/nuvie/fonts/u6_font.cpp
    engines/ultima/nuvie/fonts/wou_font.cpp
    engines/ultima/nuvie/gui/gui.cpp
    engines/ultima/nuvie/gui/gui.h
    engines/ultima/nuvie/gui/gui_area.cpp
    engines/ultima/nuvie/gui/gui_button.cpp
    engines/ultima/nuvie/gui/gui_console.cpp
    engines/ultima/nuvie/gui/gui_dialog.cpp
    engines/ultima/nuvie/gui/gui_drag_manager.cpp
    engines/ultima/nuvie/gui/gui_font.cpp
    engines/ultima/nuvie/gui/gui_load_image.cpp
    engines/ultima/nuvie/gui/gui_scroll_bar.cpp
    engines/ultima/nuvie/gui/gui_scroller.cpp
    engines/ultima/nuvie/gui/gui_text.cpp
    engines/ultima/nuvie/gui/widgets/background.cpp
    engines/ultima/nuvie/gui/widgets/command_bar.cpp
    engines/ultima/nuvie/gui/widgets/command_bar_new_ui.cpp
    engines/ultima/nuvie/gui/widgets/console.cpp
    engines/ultima/nuvie/gui/widgets/converse_gump.cpp
    engines/ultima/nuvie/gui/widgets/converse_gump.h
    engines/ultima/nuvie/gui/widgets/converse_gump_wou.cpp
    engines/ultima/nuvie/gui/widgets/converse_gump_wou.h
    engines/ultima/nuvie/gui/widgets/fps_counter.cpp
    engines/ultima/nuvie/gui/widgets/gui_widget.cpp
    engines/ultima/nuvie/gui/widgets/gui_widget.h
    engines/ultima/nuvie/gui/widgets/map_window.cpp
    engines/ultima/nuvie/gui/widgets/map_window.h
    engines/ultima/nuvie/gui/widgets/msg_scroll.cpp
    engines/ultima/nuvie/gui/widgets/msg_scroll.h
    engines/ultima/nuvie/gui/widgets/msg_scroll_new_ui.cpp
    engines/ultima/nuvie/keybinding/key_actions.cpp
    engines/ultima/nuvie/menus/audio_dialog.cpp
    engines/ultima/nuvie/menus/gameplay_dialog.cpp
    engines/ultima/nuvie/menus/input_dialog.cpp
    engines/ultima/nuvie/menus/video_dialog.cpp
    engines/ultima/nuvie/misc/call_back.h
    engines/ultima/nuvie/misc/iavl_tree.cpp
    engines/ultima/nuvie/misc/map_entity.h
    engines/ultima/nuvie/misc/u6_list.cpp
    engines/ultima/nuvie/misc/u6_llist.h
    engines/ultima/nuvie/misc/u6_misc.cpp
    engines/ultima/nuvie/misc/u6_misc.h
    engines/ultima/nuvie/pathfinder/astar_path.cpp
    engines/ultima/nuvie/pathfinder/astar_path.h
    engines/ultima/nuvie/pathfinder/combat_path_finder.cpp
    engines/ultima/nuvie/pathfinder/path.cpp
    engines/ultima/nuvie/portraits/portrait.cpp
    engines/ultima/nuvie/portraits/portrait_md.cpp
    engines/ultima/nuvie/portraits/portrait_se.cpp
    engines/ultima/nuvie/portraits/portrait_u6.cpp
    engines/ultima/nuvie/save/save_game.cpp
    engines/ultima/nuvie/screen/dither.cpp
    engines/ultima/nuvie/screen/screen.cpp
    engines/ultima/nuvie/screen/screen.h
    engines/ultima/nuvie/screen/surface.cpp
    engines/ultima/nuvie/script/script.cpp
    engines/ultima/nuvie/script/script.h
    engines/ultima/nuvie/script/script_actor.cpp
    engines/ultima/nuvie/script/script_cutscene.cpp
    engines/ultima/nuvie/script/script_cutscene.h
    engines/ultima/nuvie/sound/adlib_sfx_manager.cpp
    engines/ultima/nuvie/sound/adplug/fm_opl.cpp
    engines/ultima/nuvie/sound/adplug/mid.cpp
    engines/ultima/nuvie/sound/adplug/opl_class.cpp
    engines/ultima/nuvie/sound/custom_sfx_manager.cpp
    engines/ultima/nuvie/sound/decoder/adlib_sfx_stream.h
    engines/ultima/nuvie/sound/decoder/fm_towns_decoder_stream.cpp
    engines/ultima/nuvie/sound/decoder/fm_towns_decoder_stream.h
    engines/ultima/nuvie/sound/decoder/random_collection_audio_stream.cpp
    engines/ultima/nuvie/sound/decoder/u6_adplug_decoder_stream.h
    engines/ultima/nuvie/sound/origin_fx_adib_driver.cpp
    engines/ultima/nuvie/sound/pc_speaker_sfx_manager.cpp
    engines/ultima/nuvie/sound/song.cpp
    engines/ultima/nuvie/sound/song_adplug.cpp
    engines/ultima/nuvie/sound/song_filename.cpp
    engines/ultima/nuvie/sound/sound_manager.cpp
    engines/ultima/nuvie/sound/towns_sfx_manager.cpp
    engines/ultima/nuvie/usecode/u6_usecode.cpp
    engines/ultima/nuvie/usecode/u6_usecode.h
    engines/ultima/nuvie/usecode/usecode.cpp
    engines/ultima/nuvie/usecode/usecode.h
    engines/ultima/nuvie/views/actor_view.cpp
    engines/ultima/nuvie/views/container_view_gump.cpp
    engines/ultima/nuvie/views/container_view_gump.h
    engines/ultima/nuvie/views/container_widget.cpp
    engines/ultima/nuvie/views/container_widget.h
    engines/ultima/nuvie/views/container_widget_gump.cpp
    engines/ultima/nuvie/views/container_widget_gump.h
    engines/ultima/nuvie/views/doll_view_gump.cpp
    engines/ultima/nuvie/views/doll_widget.cpp
    engines/ultima/nuvie/views/doll_widget.h
    engines/ultima/nuvie/views/draggable_view.cpp
    engines/ultima/nuvie/views/inventory_view.cpp
    engines/ultima/nuvie/views/inventory_widget.cpp
    engines/ultima/nuvie/views/inventory_widget.h
    engines/ultima/nuvie/views/md_sky_strip_widget.cpp
    engines/ultima/nuvie/views/party_view.cpp
    engines/ultima/nuvie/views/portrait_view.cpp
    engines/ultima/nuvie/views/portrait_view_gump.cpp
    engines/ultima/nuvie/views/scroll_view_gump.cpp
    engines/ultima/nuvie/views/scroll_widget_gump.cpp
    engines/ultima/nuvie/views/sign_view_gump.cpp
    engines/ultima/nuvie/views/spell_view.cpp
    engines/ultima/nuvie/views/spell_view_gump.cpp
    engines/ultima/nuvie/views/sun_moon_ribbon.cpp
    engines/ultima/nuvie/views/sun_moon_strip_widget.cpp
    engines/ultima/nuvie/views/view.cpp
    engines/ultima/nuvie/views/view_manager.cpp
    engines/ultima/nuvie/views/view_manager.h


diff --git a/engines/ultima/nuvie/actors/actor.cpp b/engines/ultima/nuvie/actors/actor.cpp
index e3cd8ac4881..f8fddd8032a 100644
--- a/engines/ultima/nuvie/actors/actor.cpp
+++ b/engines/ultima/nuvie/actors/actor.cpp
@@ -64,9 +64,9 @@ Actor::Actor(Map *m, ObjManager *om, GameClock *c)
 
 Actor::~Actor() {
 // free sched array
-	if (sched != NULL) {
+	if (sched != nullptr) {
 		Schedule **cursched = sched;
-		while (*cursched != NULL)
+		while (*cursched != nullptr)
 			free(*cursched++);
 
 		free(sched);
@@ -75,7 +75,7 @@ Actor::~Actor() {
 		delete pathfinder;
 
 	for (uint8 location = 0; location < ACTOR_MAX_READIED_OBJECTS; location++) {
-		if (readied_objects[location] != NULL) {
+		if (readied_objects[location] != nullptr) {
 			delete readied_objects[location];
 		}
 	}
@@ -315,7 +315,7 @@ const char *Actor::get_name(bool force_real_name) {
 	Converse *converse = Game::get_game()->get_converse();
 	Party *party = Game::get_game()->get_party();
 	//Actor *player = Game::get_game()->get_player()->get_actor();
-	const char *talk_name = NULL; // name from conversation script
+	const char *talk_name = nullptr; // name from conversation script
 	bool statue = (Game::get_game()->get_game_type() == NUVIE_GAME_U6 && id_n >= 189 && id_n <= 200);
 
 	if (is_alive() && is_in_party()) {
@@ -420,7 +420,6 @@ bool Actor::move(uint16 new_x, uint16 new_y, uint8 new_z, ActorMoveFlags flags)
 	bool ignore_danger = (bool)(flags & ACTOR_IGNORE_DANGER);
 // bool ignore_danger = true;
 	bool ignore_moves = (bool)(flags & ACTOR_IGNORE_MOVES);
-	Obj *obj = NULL;
 	MapCoord oldpos(x, y, z);
 
 	clear_error();
@@ -434,7 +433,7 @@ bool Actor::move(uint16 new_x, uint16 new_y, uint8 new_z, ActorMoveFlags flags)
 	}
 
 // blocking actors are checked for later
-	obj = obj_manager->get_obj(new_x, new_y, new_z, OBJ_SEARCH_TOP, OBJ_INCLUDE_IGNORED); //we include ignored objects here to pick up the sacred quest blocking object.
+	Obj *obj = obj_manager->get_obj(new_x, new_y, new_z, OBJ_SEARCH_TOP, OBJ_INCLUDE_IGNORED); //we include ignored objects here to pick up the sacred quest blocking object.
 	if (!force_move && !check_move(new_x, new_y, new_z, ACTOR_IGNORE_DANGER | ACTOR_IGNORE_OTHERS)) {
 		// open door
 		if (!(obj && usecode->is_unlocked_door(obj) && open_doors)
@@ -557,7 +556,7 @@ void Actor::pathfind_to(MapCoord &d) {
 
 // actor will take management of new_pf, and delete it when no longer needed
 void Actor::set_pathfinder(ActorPathFinder *new_pf, Path *path_type) {
-	if (pathfinder != NULL && pathfinder != new_pf)
+	if (pathfinder != nullptr && pathfinder != new_pf)
 		delete_pathfinder();
 	pathfinder = new_pf;
 	if (path_type != 0)
@@ -566,7 +565,7 @@ void Actor::set_pathfinder(ActorPathFinder *new_pf, Path *path_type) {
 
 void Actor::delete_pathfinder() {
 	delete pathfinder;
-	pathfinder = NULL;
+	pathfinder = nullptr;
 }
 
 void Actor::set_in_party(bool state) {
@@ -604,9 +603,9 @@ void Actor::set_in_party(bool state) {
 }*/
 
 Obj *Actor::get_weapon_obj(sint8 readied_obj_location) {
-	if (readied_obj_location != ACTOR_NO_READIABLE_LOCATION && readied_objects[readied_obj_location] && readied_objects[readied_obj_location]->obj != NULL)
+	if (readied_obj_location != ACTOR_NO_READIABLE_LOCATION && readied_objects[readied_obj_location] && readied_objects[readied_obj_location]->obj != nullptr)
 		return readied_objects[readied_obj_location]->obj;
-	return NULL;
+	return nullptr;
 }
 
 uint8 Actor::get_range(uint16 target_x, uint16 target_y) {
@@ -667,7 +666,7 @@ const CombatType *Actor::get_weapon(sint8 readied_obj_location) {
 	if (readied_objects[readied_obj_location])
 		return readied_objects[readied_obj_location]->combat_type;
 
-	return NULL;
+	return nullptr;
 }
 
 U6LList *Actor::get_inventory_list() {
@@ -690,7 +689,7 @@ uint32 Actor::inventory_count_objects(bool inc_readied_objects) {
 	if (inc_readied_objects) {
 		return inventory->count();
 	} else {
-		for (link = inventory->start(); link != NULL; link = link->next) {
+		for (link = inventory->start(); link != nullptr; link = link->next) {
 			obj = (Obj *)link->data;
 			if (!obj->is_readied())
 				count++;
@@ -710,7 +709,7 @@ uint32 Actor::inventory_count_object(uint16 objN) {
 	Obj *obj = 0;
 	U6LList *inv = get_inventory_list();
 
-	for (link = inv->start(); link != NULL; link = link->next) {
+	for (link = inv->start(); link != nullptr; link = link->next) {
 		obj = (Obj *)link->data;
 		if (obj)
 			qty += obj->get_total_qty(objN);
@@ -720,7 +719,7 @@ uint32 Actor::inventory_count_object(uint16 objN) {
 }
 
 
-/* Returns object descriptor of object in the actor's inventory, or NULL if no
+/* Returns object descriptor of object in the actor's inventory, or nullptr if no
  * matching object is found. */
 Obj *Actor::inventory_get_object(uint16 objN, uint8 qual, bool match_quality, uint8 frameN, bool match_frame_n) {
 	U6LList *inventory;
@@ -728,7 +727,7 @@ Obj *Actor::inventory_get_object(uint16 objN, uint8 qual, bool match_quality, ui
 	Obj *obj;
 
 	inventory = get_inventory_list();
-	for (link = inventory->start(); link != NULL; link = link->next) {
+	for (link = inventory->start(); link != nullptr; link = link->next) {
 		obj = (Obj *)link->data;
 		if (obj->obj_n == objN && (match_quality == false || obj->quality == qual)
 				&& (match_frame_n == false || obj->frame_n == frameN)) //FIXME should qual = 0 be an all quality search!?
@@ -739,28 +738,28 @@ Obj *Actor::inventory_get_object(uint16 objN, uint8 qual, bool match_quality, ui
 		}
 	}
 
-	return NULL;
+	return nullptr;
 }
 
 bool Actor::is_double_handed_obj_readied() {
-	if (readied_objects[ACTOR_ARM] != NULL && readied_objects[ACTOR_ARM]->double_handed == true)
+	if (readied_objects[ACTOR_ARM] != nullptr && readied_objects[ACTOR_ARM]->double_handed == true)
 		return true;
 
 	return false;
 }
 
 Obj *Actor::inventory_get_readied_object(uint8 location) {
-	if (readied_objects[location] != NULL)
+	if (readied_objects[location] != nullptr)
 		return readied_objects[location]->obj;
 
-	return NULL;
+	return nullptr;
 }
 
 const CombatType *Actor::inventory_get_readied_object_combat_type(uint8 location) {
-	if (readied_objects[location] != NULL)
+	if (readied_objects[location] != nullptr)
 		return readied_objects[location]->combat_type;
 
-	return NULL;
+	return nullptr;
 }
 
 
@@ -810,9 +809,9 @@ Obj *Actor::inventory_new_object(uint16 objN, uint32 qty, uint8 quality) {
 	obj->qty = obj_manager->is_stackable(obj) ? 1 : 0; // stackable objects must have a quantity
 	if (qty > 1) // this will combine with others, only if object is stackable
 		for (uint32 q = 1; q < qty; q++) {
-			inventory_add_object(obj_manager->copy_obj(obj), NULL);
+			inventory_add_object(obj_manager->copy_obj(obj), nullptr);
 		}
-	inventory_add_object(obj, NULL);
+	inventory_add_object(obj, nullptr);
 	return inventory_get_object(objN, quality);
 }
 
@@ -844,7 +843,7 @@ void Actor::inventory_del_all_objs() {
 		return;
 
 	U6Link *link = inventory->start();
-	for (; link != NULL;) {
+	for (; link != nullptr;) {
 		Obj *obj = (Obj *)link->data;
 		link = link->next;
 		inventory_remove_obj(obj);
@@ -855,7 +854,7 @@ void Actor::inventory_del_all_objs() {
 
 bool Actor::inventory_remove_obj(Obj *obj, bool run_usecode) {
 	U6LList *inventory;
-	Obj *container = NULL;
+	Obj *container = nullptr;
 
 	inventory = get_inventory_list();
 	if (obj->is_readied())
@@ -886,7 +885,7 @@ float Actor::get_inventory_weight() {
 
 	inventory = obj_manager->get_actor_inventory(id_n);
 
-	for (link = inventory->start(); link != NULL; link = link->next) {
+	for (link = inventory->start(); link != nullptr; link = link->next) {
 		obj = (Obj *)link->data;
 		weight += obj_manager->get_obj_weight(obj);
 	}
@@ -905,7 +904,7 @@ float Actor::get_inventory_equip_weight() {
 
 	inventory = obj_manager->get_actor_inventory(id_n);
 
-	for (link = inventory->start(); link != NULL; link = link->next) {
+	for (link = inventory->start(); link != nullptr; link = link->next) {
 		obj = (Obj *)link->data;
 		if (obj->is_readied()) //object readied
 			weight += obj_manager->get_obj_weight(obj);
@@ -961,7 +960,7 @@ void Actor::inventory_parse_readied_objects() {
 
 	inventory = obj_manager->get_actor_inventory(id_n);
 
-	for (link = inventory->start(); link != NULL;) {
+	for (link = inventory->start(); link != nullptr;) {
 		obj = (Obj *)link->data;
 		link = link->next;
 		obj->parent = (void *)this;
@@ -984,7 +983,7 @@ bool Actor::can_ready_obj(Obj *obj) {
 		return false;
 
 	case ACTOR_ARM :
-		if (readied_objects[ACTOR_ARM] != NULL) { //if full try other arm
+		if (readied_objects[ACTOR_ARM] != nullptr) { //if full try other arm
 			if (readied_objects[ACTOR_ARM]->double_handed)
 				return false;
 
@@ -993,18 +992,18 @@ bool Actor::can_ready_obj(Obj *obj) {
 		break;
 
 	case ACTOR_ARM_2 :
-		if (readied_objects[ACTOR_ARM] != NULL || readied_objects[ACTOR_ARM_2] != NULL)
+		if (readied_objects[ACTOR_ARM] != nullptr || readied_objects[ACTOR_ARM_2] != nullptr)
 			return false;
 		location = ACTOR_ARM;
 		break;
 
 	case ACTOR_HAND :
-		if (readied_objects[ACTOR_HAND] != NULL) // if full try other hand
+		if (readied_objects[ACTOR_HAND] != nullptr) // if full try other hand
 			location = ACTOR_HAND_2;
 		break;
 	}
 
-	if (readied_objects[location] != NULL)
+	if (readied_objects[location] != nullptr)
 		return false;
 
 	return true;
@@ -1022,7 +1021,7 @@ bool Actor::add_readied_object(Obj *obj) {
 		return false;
 
 	case ACTOR_ARM :
-		if (readied_objects[ACTOR_ARM] != NULL) { //if full try other arm
+		if (readied_objects[ACTOR_ARM] != nullptr) { //if full try other arm
 			if (readied_objects[ACTOR_ARM]->double_handed)
 				return false;
 
@@ -1031,19 +1030,19 @@ bool Actor::add_readied_object(Obj *obj) {
 		break;
 
 	case ACTOR_ARM_2 :
-		if (readied_objects[ACTOR_ARM] != NULL || readied_objects[ACTOR_ARM_2] != NULL)
+		if (readied_objects[ACTOR_ARM] != nullptr || readied_objects[ACTOR_ARM_2] != nullptr)
 			return false;
 		location = ACTOR_ARM;
 		double_handed = true;
 		break;
 
 	case ACTOR_HAND :
-		if (readied_objects[ACTOR_HAND] != NULL) // if full try other hand
+		if (readied_objects[ACTOR_HAND] != nullptr) // if full try other hand
 			location = ACTOR_HAND_2;
 		break;
 	}
 
-	if (readied_objects[location] != NULL)
+	if (readied_objects[location] != nullptr)
 		return false;
 
 	readied_objects[location] = new ReadiedObj;
@@ -1055,7 +1054,7 @@ bool Actor::add_readied_object(Obj *obj) {
 	readied_objects[location]->combat_type = get_object_combat_type(obj->obj_n);
 	readied_objects[location]->double_handed = double_handed;
 
-	if (readied_objects[location]->combat_type != NULL)
+	if (readied_objects[location]->combat_type != nullptr)
 		readied_armor_class += readied_objects[location]->combat_type->defence;
 
 	obj->readied(); //set object to readied status
@@ -1066,7 +1065,7 @@ void Actor::remove_readied_object(Obj *obj, bool run_usecode) {
 	uint8 location;
 
 	for (location = 0; location < ACTOR_MAX_READIED_OBJECTS; location++) {
-		if (readied_objects[location] != NULL && readied_objects[location]->obj == obj) {
+		if (readied_objects[location] != nullptr && readied_objects[location]->obj == obj) {
 			remove_readied_object(location, run_usecode);
 			break;
 		}
@@ -1086,19 +1085,19 @@ void Actor::remove_readied_object(uint8 location, bool run_usecode) {
 		if (obj_manager->get_usecode()->has_readycode(obj) && run_usecode)
 			obj_manager->get_usecode()->ready_obj(obj, this);
 		delete readied_objects[location];
-		readied_objects[location] = NULL;
+		readied_objects[location] = nullptr;
 		//ERIC obj->status ^= 0x18; // remove "readied" bit flag.
 		//ERIC obj->status |= OBJ_STATUS_IN_INVENTORY; // keep "in inventory"
 		obj->set_in_inventory();
 
-		if (location == ACTOR_ARM && readied_objects[ACTOR_ARM_2] != NULL) { //move contents of left hand to right hand.
+		if (location == ACTOR_ARM && readied_objects[ACTOR_ARM_2] != nullptr) { //move contents of left hand to right hand.
 			readied_objects[ACTOR_ARM] = readied_objects[ACTOR_ARM_2];
-			readied_objects[ACTOR_ARM_2] = NULL;
+			readied_objects[ACTOR_ARM_2] = nullptr;
 		}
 
-		if (location == ACTOR_HAND && readied_objects[ACTOR_HAND_2] != NULL) { //move contents of left hand to right hand.
+		if (location == ACTOR_HAND && readied_objects[ACTOR_HAND_2] != nullptr) { //move contents of left hand to right hand.
 			readied_objects[ACTOR_HAND] = readied_objects[ACTOR_HAND_2];
-			readied_objects[ACTOR_HAND_2] = NULL;
+			readied_objects[ACTOR_HAND_2] = nullptr;
 		}
 	}
 
@@ -1109,7 +1108,7 @@ void Actor::remove_all_readied_objects() {
 	uint8 location;
 
 	for (location = 0; location < ACTOR_MAX_READIED_OBJECTS; location++) {
-		if (readied_objects[location] != NULL)
+		if (readied_objects[location] != nullptr)
 			remove_readied_object(location);
 	}
 
@@ -1121,7 +1120,7 @@ bool Actor::has_readied_objects() {
 	uint8 location;
 
 	for (location = 0; location < ACTOR_MAX_READIED_OBJECTS; location++) {
-		if (readied_objects[location] != NULL)
+		if (readied_objects[location] != nullptr)
 			return true;
 	}
 
@@ -1130,8 +1129,8 @@ bool Actor::has_readied_objects() {
 }
 
 void Actor::inventory_drop_all() {
-	U6LList *inv = NULL;
-	Obj *obj = NULL;
+	U6LList *inv = nullptr;
+	Obj *obj = nullptr;
 
 	while (inventory_count_objects(true)) {
 		inv = get_inventory_list();
@@ -1165,7 +1164,7 @@ void Actor::all_items_to_container(Obj *container_obj, bool stack) {
 	if (!inventory)
 		return;
 
-	for (link = inventory->start(); link != NULL;) {
+	for (link = inventory->start(); link != nullptr;) {
 		obj = (Obj *)link->data;
 		link = link->next;
 
@@ -1212,7 +1211,7 @@ void Actor::loadSchedule(unsigned char *sched_data, uint16 num) {
 #endif
 	}
 
-	sched[i] = NULL;
+	sched[i] = nullptr;
 
 	return;
 }
@@ -1238,7 +1237,7 @@ bool Actor::updateSchedule(uint8 hour, bool teleport) {
 
 	sched_pos = new_pos;
 
-	if (sched[sched_pos] == NULL)
+	if (sched[sched_pos] == nullptr)
 		return false;
 
 // U6: temp. fix for walking statues; they shouldn't have schedules
@@ -1257,12 +1256,12 @@ bool Actor::updateSchedule(uint8 hour, bool teleport) {
 uint16 Actor::getSchedulePos(uint8 hour) {
 	uint16 i;
 
-	for (i = 0; sched[i] != NULL; i++) {
+	for (i = 0; sched[i] != nullptr; i++) {
 		if (sched[i]->hour > hour) {
 			if (i != 0)
 				return i - 1;
 			else // i == 0 this means we are in the last schedule entry
-				for (; sched[i + 1] != NULL;)
+				for (; sched[i + 1] != nullptr;)
 					i++;
 		}
 	}
@@ -1283,7 +1282,7 @@ uint16 Actor::getSchedulePos(uint8 hour, uint8 day_of_week)
 
  i = getSchedulePos(hour);
 
- for(j=i;sched[j] != NULL && sched[j]->hour == sched[i]->hour;j++)
+ for(j=i;sched[j] != nullptr && sched[j]->hour == sched[i]->hour;j++)
   {
    if(sched[j]->day_of_week > day_of_week)
 	 {
@@ -1291,7 +1290,7 @@ uint16 Actor::getSchedulePos(uint8 hour, uint8 day_of_week)
 		return j-1;
 	  else // hour is in the last schedule entry.
 		{
-		 for(;sched[j+1] != NULL && sched[j+1]->hour == sched[i]->hour;) // move to the last schedule entry.
+		 for(;sched[j+1] != nullptr && sched[j+1]->hour == sched[i]->hour;) // move to the last schedule entry.
 		  j++;
 		}
 	 }
@@ -1308,7 +1307,7 @@ inline uint16 Actor::getSchedulePos(uint8 hour)
  uint16 i;
  uint8 cur_hour;
 
- for(i=0;sched[i] != NULL;i++)
+ for(i=0;sched[i] != nullptr;i++)
   {
    if(sched[i]->hour > hour)
 	 {
@@ -1316,7 +1315,7 @@ inline uint16 Actor::getSchedulePos(uint8 hour)
 		return i-1;
 	  else // hour is in the last schedule entry.
 		{
-		 for(;sched[i+1] != NULL;) // move to the last schedule entry.
+		 for(;sched[i+1] != nullptr;) // move to the last schedule entry.
 		  i++;
 
 		 if(sched[i]->day_of_week > 0) //rewind to the start of the hour set.
@@ -1328,11 +1327,11 @@ inline uint16 Actor::getSchedulePos(uint8 hour)
 		}
 	 }
    else
-	  for(;sched[i+1] != NULL && sched[i+1]->hour == sched[i]->hour;) //skip to next hour set.
+	  for(;sched[i+1] != nullptr && sched[i+1]->hour == sched[i]->hour;) //skip to next hour set.
 		i++;
   }
 
- if(sched[i] != NULL && sched[i]->day_of_week > 0) //rewind to the start of the hour set.
+ if(sched[i] != nullptr && sched[i]->day_of_week > 0) //rewind to the start of the hour set.
    {
 	cur_hour = sched[i]->hour;
 	for(;i >= 1 && sched[i-1]->hour == cur_hour;)
@@ -1529,9 +1528,9 @@ void Actor::resurrect(MapCoord new_position, Obj *body_obj) {
 	U6Link *link;
 	bool remove_obj = false;
 
-	if (body_obj == NULL) {
+	if (body_obj == nullptr) {
 		body_obj = find_body();
-		if (body_obj != NULL)
+		if (body_obj != nullptr)
 			remove_obj = true;
 	}
 
@@ -1558,10 +1557,10 @@ void Actor::resurrect(MapCoord new_position, Obj *body_obj) {
 	if (is_in_party()) //actor in party
 		Game::get_game()->get_party()->add_actor(this);
 
-	if (body_obj != NULL) {
+	if (body_obj != nullptr) {
 		//add body container objects back into actor's inventory.
 		if (body_obj->has_container()) {
-			for (link = body_obj->container->start(); link != NULL;) {
+			for (link = body_obj->container->start(); link != nullptr;) {
 				Obj *inv_obj = (Obj *)link->data;
 				link = link->next;
 				inventory_add_object(inv_obj);
@@ -1692,8 +1691,8 @@ void Actor::set_error(ActorErrorCode err) {
 
 void Actor::clear_error() {
 	error_struct.err = ACTOR_NO_ERROR;
-	error_struct.blocking_obj = NULL;
-	error_struct.blocking_actor = NULL;
+	error_struct.blocking_obj = nullptr;
+	error_struct.blocking_actor = nullptr;
 }
 
 ActorError *Actor::get_error() {
@@ -1764,7 +1763,7 @@ void Actor::print() {
 	if (inv) {
 		DEBUG(1, LEVEL_INFORMATIONAL, "Inventory (+readied): %d objects\n", inv);
 		U6LList *inv_list = actor->get_inventory_list();
-		for (U6Link *link = inv_list->start(); link != NULL; link = link->next) {
+		for (U6Link *link = inv_list->start(); link != nullptr; link = link->next) {
 			Obj *obj = (Obj *)link->data;
 			DEBUG(1, LEVEL_INFORMATIONAL, " %24s (%03d:%d) status=%d qual=%d qty=%d    (weighs %f)\n",
 			      obj_manager->look_obj(obj), obj->obj_n, obj->frame_n, obj->status, obj->quality,
@@ -1865,7 +1864,7 @@ ActorList *Actor::find_enemies() {
 		else ++a;
 	if (actors->empty()) {
 		delete actors;
-		return NULL; // no enemies in range
+		return nullptr; // no enemies in range
 	}
 	return actors;
 }
@@ -1873,7 +1872,7 @@ ActorList *Actor::find_enemies() {
 Obj *Actor::find_body() {
 	Party *party;
 	Actor *actor;
-	Obj *body_obj = NULL;
+	Obj *body_obj = nullptr;
 	uint8 lvl;
 
 	party = Game::get_game()->get_party();
@@ -1883,7 +1882,7 @@ Obj *Actor::find_body() {
 		return actor->inventory_get_object(339, id_n, OBJ_MATCH_QUALITY);
 
 	// try to find on map.
-	for (lvl = 0; lvl < 5 && body_obj == NULL; lvl++)
+	for (lvl = 0; lvl < 5 && body_obj == nullptr; lvl++)
 		body_obj = obj_manager->find_obj(lvl, 339, id_n);
 
 	return body_obj;
@@ -1903,7 +1902,7 @@ bool Actor::morph(uint16 objN) {
 }
 
 bool Actor::get_schedule_location(MapCoord *loc) {
-	if (sched[sched_pos] == NULL)
+	if (sched[sched_pos] == nullptr)
 		return false;
 
 	loc->x = sched[sched_pos]->x;
@@ -1913,7 +1912,7 @@ bool Actor::get_schedule_location(MapCoord *loc) {
 }
 
 bool Actor::is_at_scheduled_location() {
-	if (sched[sched_pos] != NULL && x == sched[sched_pos]->x && y == sched[sched_pos]->y && z == sched[sched_pos]->z)
+	if (sched[sched_pos] != nullptr && x == sched[sched_pos]->x && y == sched[sched_pos]->y && z == sched[sched_pos]->z)
 		return true;
 
 	return false;
@@ -1921,7 +1920,7 @@ bool Actor::is_at_scheduled_location() {
 
 Schedule *Actor::get_schedule(uint8 index) {
 	if (index >= num_schedules)
-		return NULL;
+		return nullptr;
 
 	return sched[index];
 }
@@ -1936,7 +1935,7 @@ void Actor::cure() {
 }
 
 void Actor::set_custom_tile_num(uint16 obj_num, uint16 tile_num) {
-	if (custom_tile_tbl == NULL) {
+	if (custom_tile_tbl == nullptr) {
 		custom_tile_tbl = new Common::HashMap<uint16, uint16>();
 	}
 
diff --git a/engines/ultima/nuvie/actors/actor.h b/engines/ultima/nuvie/actors/actor.h
index ab6b072436c..8684ae8f0e7 100644
--- a/engines/ultima/nuvie/actors/actor.h
+++ b/engines/ultima/nuvie/actors/actor.h
@@ -563,7 +563,7 @@ public:
 	ActorError *get_error();
 
 	list<Obj *> *get_surrounding_obj_list() {
-		return surrounding_objects.empty() ? NULL : &surrounding_objects;
+		return surrounding_objects.empty() ? nullptr : &surrounding_objects;
 	}
 	void add_surrounding_obj(Obj *obj);
 	void unlink_surrounding_objects(bool make_objects_temporary = false);
@@ -592,7 +592,7 @@ public:
 // combat methods
 //void attack(MapCoord pos); // attack at a given map location
 	Obj *get_weapon_obj(sint8 readied_obj_location);
-	void attack(sint8 readied_obj_location, MapCoord target, Actor *foe = NULL);
+	void attack(sint8 readied_obj_location, MapCoord target, Actor *foe = nullptr);
 	const CombatType *get_weapon(sint8 readied_obj_location);
 	void attract_to(Actor *target);
 	void repel_from(Actor *target);
@@ -600,7 +600,7 @@ public:
 	void hit(uint8 dmg, bool force_hit = false);
 	void reduce_hp(uint8 amount);
 	virtual void die(bool create_body = true);
-	void resurrect(MapCoord new_position, Obj *body_obj = NULL);
+	void resurrect(MapCoord new_position, Obj *body_obj = nullptr);
 	uint8 get_range(uint16 target_x, uint16 target_y);
 	bool weapon_can_hit(const CombatType *weapon, uint16 target_x, uint16 target_y);
 	virtual bool weapon_can_hit(const CombatType *weapon, Actor *target, uint16 *hit_x, uint16 *hit_y) {
@@ -619,7 +619,7 @@ public:
 	bool is_double_handed_obj_readied();
 	Obj *inventory_get_readied_object(uint8 location);
 	sint16 inventory_get_readied_obj_n(uint8 location) {
-		return (inventory_get_readied_object(location) == NULL ? -1 : inventory_get_readied_object(location)->obj_n);
+		return (inventory_get_readied_object(location) == nullptr ? -1 : inventory_get_readied_object(location)->obj_n);
 	}
 	virtual Obj *inventory_get_food(Obj *container = 0) {
 		return 0;
@@ -647,7 +647,7 @@ public:
 
 	virtual uint8 get_object_readiable_location(Obj *obj);
 	virtual const CombatType *get_object_combat_type(uint16 objN) {
-		return NULL;
+		return nullptr;
 	}
 
 	bool can_ready_obj(Obj *obj);
@@ -692,7 +692,7 @@ protected:
 	void inventory_parse_readied_objects(); //this is used to initialise the readied_objects array on load.
 
 	virtual const CombatType *get_hand_combat_type() {
-		return NULL;
+		return nullptr;
 	}
 
 	virtual void set_ethereal(bool val) {
@@ -703,7 +703,7 @@ protected:
 		return;
 	}
 	virtual const char *get_worktype_string(uint32 wt) {
-		return NULL;
+		return nullptr;
 	}
 
 	Obj *find_body();
diff --git a/engines/ultima/nuvie/actors/actor_manager.cpp b/engines/ultima/nuvie/actors/actor_manager.cpp
index 0fe8291516a..75cc1269171 100644
--- a/engines/ultima/nuvie/actors/actor_manager.cpp
+++ b/engines/ultima/nuvie/actors/actor_manager.cpp
@@ -59,7 +59,7 @@ ActorManager::ActorManager(Configuration *cfg, Map *m, TileManager *tm, ObjManag
 	clock = c;
 
 	for (i = 0; i < ACTORMANAGER_MAX_ACTORS; i++)
-		actors[i] = NULL;
+		actors[i] = nullptr;
 	temp_actor_offset = 224;
 	init();
 }
@@ -91,7 +91,7 @@ void ActorManager::clean() {
 	for (i = 0; i < ACTORMANAGER_MAX_ACTORS; i++) {
 		if (actors[i]) {
 			delete actors[i];
-			actors[i] = NULL;
+			actors[i] = nullptr;
 		}
 	}
 
@@ -551,7 +551,7 @@ Actor *ActorManager::get_actor(uint16 x, uint16 y, uint8 z, bool inc_surrounding
 		return get_multi_tile_actor(x, y, z);
 	}
 
-	return NULL;
+	return nullptr;
 }
 
 Actor *ActorManager::get_multi_tile_actor(uint16 x, uint16 y, uint8 z) {
@@ -577,7 +577,7 @@ Actor *ActorManager::get_multi_tile_actor(uint16 x, uint16 y, uint8 z) {
 	}
 
 
-	return NULL;
+	return nullptr;
 }
 
 Actor *ActorManager::get_avatar() {
@@ -824,7 +824,7 @@ bool ActorManager::create_temp_actor(uint16 obj_n, uint8 obj_status, uint16 x, u
 		DEBUG(0, LEVEL_NOTIFICATION, "***All Temp Actor Slots Full***\n");
 
 	if (new_actor)
-		*new_actor = NULL;
+		*new_actor = nullptr;
 	return false;
 }
 
@@ -836,7 +836,7 @@ inline Actor *ActorManager::find_free_temp_actor() {
 			return actors[i];
 	}
 
-	return NULL;
+	return nullptr;
 }
 
 //FIX? should this be in Player??
@@ -909,7 +909,7 @@ inline void ActorManager::clean_temp_actor(Actor *actor) {
 }
 
 bool ActorManager::clone_actor(Actor *actor, Actor **new_actor, MapCoord new_location) {
-	if (actor == NULL)
+	if (actor == nullptr)
 		return false;
 
 	if (create_temp_actor(actor->obj_n, NO_OBJ_STATUS, new_location.x, new_location.y, new_location.z, actor->alignment, actor->worktype, new_actor) == false)
@@ -1060,7 +1060,7 @@ bool ActorManager::can_put_actor(MapCoord location) {
 	if (!map->is_passable(location.x, location.y, location.z))
 		return false;
 
-	if (get_actor(location.x, location.y, location.z) != NULL)
+	if (get_actor(location.x, location.y, location.z) != nullptr)
 		return false;
 
 	return true;
@@ -1137,11 +1137,11 @@ void ActorManager::loadAvatarTiles(Std::string datadir) {
 			continue;
 		}
 		Std::string num_str = filename.substr(7, 3);
-		uint8 portrait_num = (uint8)strtol(num_str.c_str(), NULL, 10);
+		uint8 portrait_num = (uint8)strtol(num_str.c_str(), nullptr, 10);
 
 		if (portrait_num == avatar_portrait) {
 			num_str = filename.substr(11, 4);
-			uint16 obj_n = (uint16)strtol(num_str.c_str(), NULL, 10);
+			uint16 obj_n = (uint16)strtol(num_str.c_str(), nullptr, 10);
 
 			Std::string path;
 			build_path(datadir, filename, path);
@@ -1166,10 +1166,10 @@ void ActorManager::loadNPCTiles(Std::string datadir) {
 			continue;
 		}
 		Std::string num_str = filename.substr(6, 3);
-		uint8 actor_num = (uint8)strtol(num_str.c_str(), NULL, 10);
+		uint8 actor_num = (uint8)strtol(num_str.c_str(), nullptr, 10);
 
 		num_str = filename.substr(10, 4);
-		uint16 obj_n = (uint16)strtol(num_str.c_str(), NULL, 10);
+		uint16 obj_n = (uint16)strtol(num_str.c_str(), nullptr, 10);
 
 		Std::string path;
 		build_path(datadir, filename, path);
diff --git a/engines/ultima/nuvie/actors/actor_manager.h b/engines/ultima/nuvie/actors/actor_manager.h
index 6f0079d218a..d055e0bf1b4 100644
--- a/engines/ultima/nuvie/actors/actor_manager.h
+++ b/engines/ultima/nuvie/actors/actor_manager.h
@@ -80,7 +80,7 @@ public:
 	ActorList *filter_party(ActorList *list);
 
 	Actor *get_actor(uint8 actor_num);
-	Actor *get_actor(uint16 x, uint16 y, uint8 z,  bool inc_surrounding_objs = true, Actor *excluded_actor = NULL);
+	Actor *get_actor(uint16 x, uint16 y, uint8 z,  bool inc_surrounding_objs = true, Actor *excluded_actor = nullptr);
 	Actor *get_actor_holding_obj(Obj *obj);
 
 	Actor *get_avatar();
@@ -109,7 +109,7 @@ public:
 
 	bool is_temp_actor(Actor *actor);
 	bool is_temp_actor(uint8 id_n);
-	bool create_temp_actor(uint16 obj_n, uint8 obj_status, uint16 x, uint16 y, uint8 z, uint8 alignment, uint8 worktype, Actor **new_actor = NULL);
+	bool create_temp_actor(uint16 obj_n, uint8 obj_status, uint16 x, uint16 y, uint8 z, uint8 alignment, uint8 worktype, Actor **new_actor = nullptr);
 	bool clone_actor(Actor *actor, Actor **new_actor, MapCoord new_location);
 	bool toss_actor(Actor *actor, uint16 xrange, uint16 yrange);
 	bool toss_actor_get_location(uint16 start_x, uint16 start_y, uint8 start_z, uint16 xrange, uint16 yrange, MapCoord *location);
diff --git a/engines/ultima/nuvie/actors/u6_actor.cpp b/engines/ultima/nuvie/actors/u6_actor.cpp
index a35adce5d7b..df0695284f9 100644
--- a/engines/ultima/nuvie/actors/u6_actor.cpp
+++ b/engines/ultima/nuvie/actors/u6_actor.cpp
@@ -46,8 +46,8 @@
 namespace Ultima {
 namespace Nuvie {
 
-U6Actor::U6Actor(Map *m, ObjManager *om, GameClock *c): Actor(m, om, c), actor_type(NULL),
-	base_actor_type(NULL) {
+U6Actor::U6Actor(Map *m, ObjManager *om, GameClock *c): Actor(m, om, c), actor_type(nullptr),
+	base_actor_type(nullptr) {
 	walk_frame_inc = 1;
 	current_movetype = MOVETYPE_U6_NONE;
 }
@@ -149,12 +149,12 @@ bool U6Actor::init_ship() {
 	}
 
 	obj = obj_manager->get_obj(obj1_x, obj1_y, z);
-	if (obj == NULL)
+	if (obj == nullptr)
 		return false;
 	add_surrounding_obj(obj);
 
 	obj = obj_manager->get_obj(obj2_x, obj2_y, z);
-	if (obj == NULL)
+	if (obj == nullptr)
 		return false;
 	add_surrounding_obj(obj);
 
@@ -281,7 +281,7 @@ bool U6Actor::init_silver_serpent() {
 
 	obj = obj_manager->get_obj_of_type_from_location(OBJ_U6_SILVER_SERPENT, 1, id_n, sx, sy, sz);
 
-	if (obj != NULL) //old snake
+	if (obj != nullptr) //old snake
 		gather_snake_objs_from_map(obj, x, y, z);
 	else { //new snake
 		//FIXME we need to make long, randomly layed out snakes here!
@@ -418,7 +418,7 @@ bool U6Actor::updateSchedule(uint8 hour, bool teleport) {
 	handle_lightsource(hour);
 
 	if ((ret = Actor::updateSchedule(hour, teleport)) == true) { //walk to next schedule location if required.
-		if (sched[sched_pos] != NULL && (sched[sched_pos]->x != x || sched[sched_pos]->y != y || sched[sched_pos]->z != z
+		if (sched[sched_pos] != nullptr && (sched[sched_pos]->x != x || sched[sched_pos]->y != y || sched[sched_pos]->z != z
 		                                 || worktype == WORKTYPE_U6_SLEEP)) { // needed to go underneath bed if teleporting
 			set_worktype(WORKTYPE_U6_WALK_TO_LOCATION);
 			MapCoord loc(sched[sched_pos]->x, sched[sched_pos]->y, sched[sched_pos]->z);
@@ -607,12 +607,12 @@ bool U6Actor::check_move(uint16 new_x, uint16 new_y, uint8 new_z, ActorMoveFlags
 	default :
 		if (map->is_passable(new_x, new_y, new_z) == false) {
 			if (obj_n == OBJ_U6_MOUSE // try to go through mousehole
-			        && (obj_manager->get_obj_of_type_from_location(OBJ_U6_MOUSEHOLE, new_x, new_y, new_z) != NULL
-			            || obj_manager->get_obj_of_type_from_location(OBJ_U6_BARS, new_x, new_y, new_z) != NULL
-			            || obj_manager->get_obj_of_type_from_location(OBJ_U6_PORTCULLIS, new_x, new_y, new_z) != NULL))
+			        && (obj_manager->get_obj_of_type_from_location(OBJ_U6_MOUSEHOLE, new_x, new_y, new_z) != nullptr
+			            || obj_manager->get_obj_of_type_from_location(OBJ_U6_BARS, new_x, new_y, new_z) != nullptr
+			            || obj_manager->get_obj_of_type_from_location(OBJ_U6_PORTCULLIS, new_x, new_y, new_z) != nullptr))
 				return (true);
 			if (obj_n == OBJ_U6_SILVER_SERPENT //silver serpents can crossover themselves
-			        && obj_manager->get_obj_of_type_from_location(OBJ_U6_SILVER_SERPENT, new_x, new_y, new_z) != NULL)
+			        && obj_manager->get_obj_of_type_from_location(OBJ_U6_SILVER_SERPENT, new_x, new_y, new_z) != nullptr)
 				return (true);
 
 			return false;
@@ -680,7 +680,7 @@ const CombatType *U6Actor::get_object_combat_type(uint16 objN) {
 			return &u6combat_objects[i];
 	}
 
-	return NULL;
+	return nullptr;
 }
 
 const CombatType *U6Actor::get_hand_combat_type() {
@@ -892,7 +892,7 @@ void U6Actor::pathfind_to(MapCoord &d) {
 }
 
 void U6Actor::setup_walk_to_location() {
-	if (sched[sched_pos] != NULL) {
+	if (sched[sched_pos] != nullptr) {
 		if (x == sched[sched_pos]->x && y == sched[sched_pos]->y
 		        && z == sched[sched_pos]->z) {
 			set_worktype(sched[sched_pos]->worktype);
@@ -932,7 +932,7 @@ void U6Actor::setup_walk_to_location() {
 	   case NUVIE_DIR_W : rel_x = -1; break;
 	  }
 
-	if(obj_manager->get_obj_of_type_from_location(OBJ_U6_FENCE,x + rel_x, y + rel_y, z) == NULL)
+	if(obj_manager->get_obj_of_type_from_location(OBJ_U6_FENCE,x + rel_x, y + rel_y, z) == nullptr)
 		{
 		 if(moveRelative(rel_x,rel_y))
 			set_direction(new_direction);
@@ -1424,10 +1424,10 @@ inline void U6Actor::init_surrounding_obj(uint16 x_, uint16 y_, uint8 z_, uint16
 	Obj *obj;
 
 	obj = obj_manager->get_obj_of_type_from_location(actor_obj_n, id_n, -1, x_, y_, z_);
-	if (obj == NULL)
+	if (obj == nullptr)
 		obj = obj_manager->get_obj_of_type_from_location(actor_obj_n, 0, -1, x_, y_, z_);
 
-	if (obj == NULL) {
+	if (obj == nullptr) {
 		obj = new Obj();
 		obj->x = x_;
 		obj->y = y_;
@@ -1530,9 +1530,9 @@ void U6Actor::print() {
 // might print U6Actor members here
 }
 
-/* Returns name of NPC worktype/activity (game specific) or NULL. */
+/* Returns name of NPC worktype/activity (game specific) or nullptr. */
 const char *U6Actor::get_worktype_string(uint32 wt) {
-	const char *wt_string = NULL;
+	const char *wt_string = nullptr;
 	if (wt == WORKTYPE_U6_MOTIONLESS) wt_string = "Motionless";
 	else if (wt == WORKTYPE_U6_PLAYER) wt_string = "Player";
 	else if (wt == WORKTYPE_U6_IN_PARTY) wt_string = "In Party";
@@ -1576,7 +1576,7 @@ Obj *U6Actor::inventory_get_food(Obj *container) {
 	U6LList *inv = container ? container->container : get_inventory_list();
 	U6Link *link = 0;
 	Obj *obj = 0;
-	for (link = inv->start(); link != NULL; link = link->next) {
+	for (link = inv->start(); link != nullptr; link = link->next) {
 		obj = (Obj *)link->data;
 		if (uc->is_food(obj))
 			return obj;
@@ -1598,7 +1598,7 @@ void U6Actor::inventory_make_all_objs_ok_to_take() {
 	if (!inventory)
 		return;
 
-	for (link = inventory->start(); link != NULL;) {
+	for (link = inventory->start(); link != nullptr;) {
 		obj = (Obj *)link->data;
 		link = link->next;
 
@@ -1632,10 +1632,10 @@ bool U6Actor::will_not_talk() {
 void U6Actor::handle_lightsource(uint8 hour) {
 	Obj *torch = inventory_get_readied_object(ACTOR_ARM);
 	if (torch && torch->obj_n != OBJ_U6_TORCH)
-		torch = NULL;
+		torch = nullptr;
 	Obj *torch2 = inventory_get_readied_object(ACTOR_ARM_2);
 	if (torch2 && torch2->obj_n != OBJ_U6_TORCH)
-		torch2 = NULL;
+		torch2 = nullptr;
 	if (torch || torch2) {
 		U6UseCode *useCode = (U6UseCode *)Game::get_game()->get_usecode();
 		if ((hour < 6 || hour > 18 || (z != 0 && z != 5)
diff --git a/engines/ultima/nuvie/core/anim_manager.cpp b/engines/ultima/nuvie/core/anim_manager.cpp
index ec14b7e461d..b6b88525d14 100644
--- a/engines/ultima/nuvie/core/anim_manager.cpp
+++ b/engines/ultima/nuvie/core/anim_manager.cpp
@@ -115,7 +115,7 @@ NuvieAnim *AnimManager::get_anim(uint32 anim_id) {
 	AnimIterator i = get_anim_iterator(anim_id);
 	if (i != anim_list.end())
 		return (*i);
-	return (NULL);
+	return (nullptr);
 }
 
 
@@ -163,7 +163,7 @@ sint32 AnimManager::new_anim(NuvieAnim *new_anim) {
 		new_anim->start();
 		return ((uint32)new_anim->id_n);
 	}
-	DEBUG(0, LEVEL_ERROR, "Anim: tried to add NULL anim\n");
+	DEBUG(0, LEVEL_ERROR, "Anim: tried to add nullptr anim\n");
 	return (-1);
 }
 
@@ -224,7 +224,7 @@ void AnimManager::drawTileAtWorldCoords(Tile *tile, uint16 wx, uint16 wy,
 
 /*** NuvieAnim ***/
 NuvieAnim::NuvieAnim() {
-	anim_manager = NULL;
+	anim_manager = nullptr;
 
 	id_n = 0;
 
@@ -412,7 +412,7 @@ void TileAnim::move_tile(PositionedTile *ptile, uint32 x, uint32 y) {
 /* Construct TimedEvent with effect duration as time.
  */
 HitAnim::HitAnim(MapCoord *loc) {
-	hit_actor = NULL;
+	hit_actor = nullptr;
 	add_tile(_mapWindow->get_tile_manager()->get_tile(257), // U6 HIT_EFFECT
 	         0, 0);
 	move(loc->x, loc->y);
@@ -655,7 +655,7 @@ void TossAnim::hit_target() {
 	assert(running == true);
 
 	stop();
-	message(MESG_ANIM_DONE, NULL);
+	message(MESG_ANIM_DONE, nullptr);
 }
 
 void TossAnim::hit_object(Obj *obj) {
@@ -811,7 +811,7 @@ void ExplosiveAnim::start() {
 
 		// rotate sprite
 		if (!(flame[t].direction.sx == 0 && flame[t].direction.sy == 0)) {
-			Tile *rot_tile = NULL;
+			Tile *rot_tile = nullptr;
 			rot_tile = tile_manager->get_rotated_tile(flame[t].tile->tile,
 			           get_relative_degrees(flame[t].direction.sx, flame[t].direction.sy));
 			flame[t].tile->tile = rot_tile;
@@ -1099,8 +1099,8 @@ bool ProjectileAnim::already_hit(MapEntity ent) {
 WingAnim::WingAnim(MapCoord t) {
 	TileManager *tile_manager = _mapWindow->get_tile_manager();
 
-	p_tile_top = NULL;
-	p_tile_bottom = NULL;
+	p_tile_top = nullptr;
+	p_tile_bottom = nullptr;
 	target = t;
 	y = target.y * 16;
 
@@ -1193,7 +1193,7 @@ HailstormAnim::HailstormAnim(MapCoord t) : target(t) {
 	num_active = 0;
 	for (int i = 0; i < HAILSTORM_ANIM_MAX_STONES; i++) {
 		hailstones[i].length_left = 0;
-		hailstones[i].p_tile = NULL;
+		hailstones[i].p_tile = nullptr;
 	}
 
 	num_hailstones_left = (NUVIE_RAND() % 20) + 10;
@@ -1239,7 +1239,7 @@ bool HailstormAnim::update() {
 			if (hailstones[i].length_left == 0) {
 				num_active--;
 				remove_tile(hailstones[i].p_tile);
-				hailstones[i].p_tile = NULL;
+				hailstones[i].p_tile = nullptr;
 
 				uint8 z = 0;
 				_mapWindow->get_level(&z);
@@ -1281,7 +1281,7 @@ sint8 HailstormAnim::find_free_hailstone() {
 TileFadeAnim::TileFadeAnim(MapCoord *loc, Tile *from, Tile *to, uint16 speed) {
 	init(speed);
 
-	if (from != NULL) {
+	if (from != nullptr) {
 		anim_tile = new Tile(*from);
 	} else {
 		anim_tile = new Tile();
@@ -1290,7 +1290,7 @@ TileFadeAnim::TileFadeAnim(MapCoord *loc, Tile *from, Tile *to, uint16 speed) {
 
 	anim_tile->transparent = true;
 
-	if (to == NULL) {
+	if (to == nullptr) {
 		to_tile = new Tile();
 		to_tile->transparent = true;
 		memset(to_tile->data, 0xff, TILE_DATA_SIZE);
diff --git a/engines/ultima/nuvie/core/anim_manager.h b/engines/ultima/nuvie/core/anim_manager.h
index 84bc94db92d..ebfdba2c9a5 100644
--- a/engines/ultima/nuvie/core/anim_manager.h
+++ b/engines/ultima/nuvie/core/anim_manager.h
@@ -65,7 +65,7 @@ class AnimManager {
 	AnimIterator get_anim_iterator(uint32 anim_id);
 
 public:
-	AnimManager(sint16 x, sint16 y, Screen *screen = NULL, Common::Rect *clipto = NULL);
+	AnimManager(sint16 x, sint16 y, Screen *screen = nullptr, Common::Rect *clipto = nullptr);
 	~AnimManager() {
 		destroy_all();
 	}
@@ -168,7 +168,7 @@ public:
 		updated = running = false;
 	}
 	virtual void start()                    { }
-	uint16 message(uint16 msg, void *msg_data = NULL, void *my_data = NULL) {
+	uint16 message(uint16 msg, void *msg_data = nullptr, void *my_data = nullptr) {
 		if (callback_target) return (CallBack::message(msg, msg_data, my_data));
 		else return (0);
 	}
@@ -246,18 +246,18 @@ protected:
 	TimedCallback *timer;
 public:
 	TimedAnim()  {
-		timer = NULL;
+		timer = nullptr;
 	}
 	~TimedAnim() override {
 		stop_timer();
 	}
 	void start_timer(uint32 delay) {
-		if (!timer) timer = new TimedCallback(this, NULL, delay, true);
+		if (!timer) timer = new TimedCallback(this, nullptr, delay, true);
 	}
 	void stop_timer()              {
 		if (timer) {
 			timer->clear_target();
-			timer = NULL;
+			timer = nullptr;
 		}
 	}
 
diff --git a/engines/ultima/nuvie/core/book.cpp b/engines/ultima/nuvie/core/book.cpp
index ad88cd1752e..f44e9d9039a 100644
--- a/engines/ultima/nuvie/core/book.cpp
+++ b/engines/ultima/nuvie/core/book.cpp
@@ -51,7 +51,7 @@ bool Book::init() {
 
 char *Book::get_book_data(uint16 num) {
 	if (num >= books->get_num_items())
-		return NULL;
+		return nullptr;
 
 	return reinterpret_cast<char *>(books->get_item(num));
 }
diff --git a/engines/ultima/nuvie/core/converse.cpp b/engines/ultima/nuvie/core/converse.cpp
index 21fa2845d31..42ca63a0738 100644
--- a/engines/ultima/nuvie/core/converse.cpp
+++ b/engines/ultima/nuvie/core/converse.cpp
@@ -100,19 +100,19 @@ Converse::~Converse() {
  */
 void Converse::reset() {
 	delete conv_i;
-	conv_i = NULL;
+	conv_i = nullptr;
 	set_input("");	// delete
 	set_output("");	// clear output
 	_name = "";		// clear name
 
 	if (script) {
 		delete script;
-		script = NULL;
+		script = nullptr;
 	}
 
 	if (allowed_input) {
 		free(allowed_input);
-		allowed_input = NULL;
+		allowed_input = nullptr;
 	}
 
 	player->set_quest_flag((uint8)get_var(U6TALK_VAR_QUESTF));
@@ -221,7 +221,7 @@ ConvScript *Converse::load_script(uint32 n) {
 	ConvScript *loaded = new ConvScript(src, n);
 	if (!loaded->loaded()) {
 		delete loaded;
-		loaded = NULL;
+		loaded = nullptr;
 	} else
 		DEBUG(0, LEVEL_INFORMATIONAL, "Read %s npc script (%s:%d)\n",
 		      loaded->compressed ? "encoded" : "unencoded", src_name(), (unsigned int)n);
@@ -238,7 +238,7 @@ void Converse::init_variables() {
 	variables = new converse_variables_s[U6TALK_VAR__LAST_ + 1];
 	for (uint32 v = 0; v <= U6TALK_VAR__LAST_; v++) {
 		variables[v].cv = 0;
-		variables[v].sv = NULL;
+		variables[v].sv = nullptr;
 	}
 	set_var(U6TALK_VAR_SEX, player->get_gender());
 	set_var(U6TALK_VAR_KARMA, player->get_karma());
@@ -261,7 +261,7 @@ void Converse::delete_variables() {
 		if (variables[v].sv)
 			free(variables[v].sv);
 	delete [] variables;
-	variables = NULL;
+	variables = nullptr;
 }
 
 
@@ -269,7 +269,7 @@ void Converse::delete_variables() {
  * Returns pointer to object which is derived from ConverseInterpret.
  */
 ConverseInterpret *Converse::new_interpreter() {
-	ConverseInterpret *ci = NULL;
+	ConverseInterpret *ci = nullptr;
 	switch (gametype) {
 	case NUVIE_GAME_U6:
 		ci = (ConverseInterpret *)new U6ConverseInterpret(this);
@@ -495,7 +495,7 @@ const char *Converse::npc_name(uint8 num) {
 		temp_script = new ConvScript(src, num);
 		s_pt = temp_script->get_buffer();
 		if (!s_pt)
-			return (NULL);
+			return (nullptr);
 
 		// read name up to LOOK section, convert "_" to "."
 		uint32 c;
@@ -515,8 +515,8 @@ const char *Converse::npc_name(uint8 num) {
 void Converse::poll_input(const char *allowed, bool nonblock) {
 	if (allowed_input)
 		free(allowed_input);
-	allowed_input = NULL;
-	allowed_input = (allowed && strlen(allowed)) ? scumm_strdup(allowed) : NULL;
+	allowed_input = nullptr;
+	allowed_input = (allowed && strlen(allowed)) ? scumm_strdup(allowed) : nullptr;
 
 	scroll->set_input_mode(true, allowed_input, nonblock);
 	need_input = true;
@@ -611,13 +611,13 @@ void Converse::continue_script() {
 /* Init. and read data from U6Lib.
  */
 ConvScript::ConvScript(U6Lib_n *s, uint32 idx) {
-	buf = NULL;
+	buf = nullptr;
 	buf_len = 0;
 	src = s;
 	src_index = idx;
 
 	ref = 0;
-	cpy = NULL;
+	cpy = nullptr;
 
 	read_script();
 
@@ -628,8 +628,8 @@ ConvScript::ConvScript(U6Lib_n *s, uint32 idx) {
 /* Init. and use data from another ConvScript.
  */
 ConvScript::ConvScript(ConvScript *orig) {
-	src = NULL;
-	buf = NULL;
+	src = nullptr;
+	buf = nullptr;
 	buf_len = 0;
 	src_index = 0;
 	compressed = false;
diff --git a/engines/ultima/nuvie/core/converse.h b/engines/ultima/nuvie/core/converse.h
index 45c36ec0123..fff6ff8fe01 100644
--- a/engines/ultima/nuvie/core/converse.h
+++ b/engines/ultima/nuvie/core/converse.h
@@ -142,7 +142,7 @@ public:
 	uint32 load_conv(uint8 a);
 	void unload_conv() {
 		delete src;
-		src = NULL;
+		src = nullptr;
 	}
 	ConvScript *load_script(uint32 n);
 	ConverseInterpret *new_interpreter();
@@ -161,12 +161,12 @@ public:
 		return scroll->get_page_break();
 	}
 	void unwait();
-	void poll_input(const char *allowed = NULL, bool nonblock = true);
+	void poll_input(const char *allowed = nullptr, bool nonblock = true);
 	bool override_input();
 	void collect_input();
 
 	bool input();
-	void print(const char *s = NULL);
+	void print(const char *s = nullptr);
 	const Std::string &get_input()  {
 		return in_str;
 	}
@@ -264,7 +264,7 @@ public:
 		return (((pos() + ptadd) >= buf_len));
 	}
 	convscript_buffer get_buffer(uint32 ptadd = 0) {
-		return ((!ptadd || (ptadd < buf_len)) ? buf + ptadd : NULL);
+		return ((!ptadd || (ptadd < buf_len)) ? buf + ptadd : nullptr);
 	}
 };
 
diff --git a/engines/ultima/nuvie/core/converse_interpret.cpp b/engines/ultima/nuvie/core/converse_interpret.cpp
index 59aaf9a243e..64e99c139a1 100644
--- a/engines/ultima/nuvie/core/converse_interpret.cpp
+++ b/engines/ultima/nuvie/core/converse_interpret.cpp
@@ -40,7 +40,7 @@ namespace Nuvie {
 
 ConverseInterpret::ConverseInterpret(Converse *owner) {
 	converse = owner;
-	b_frame = NULL;
+	b_frame = nullptr;
 	decl_v = decl_t = 0x00;
 	in_start = 0;
 
@@ -182,11 +182,11 @@ void ConverseInterpret::leave() {
 		DEBUG(1, LEVEL_DEBUGGING, "Converse: ...leave %02x...\n", fp->start_c);
 #endif
 		delete fp;
-		fp = NULL;
+		fp = nullptr;
 		b_frame->pop();
 		if (b_frame->empty()) {
 			delete b_frame;
-			b_frame = NULL;
+			b_frame = nullptr;
 		}
 	}
 }
@@ -290,10 +290,10 @@ string ConverseInterpret::get_formatted_text(const char *c_str) {
 				output.append(converse->get_svar(U6TALK_VAR_INPUT));
 			else if (symbol[0] == '$' // value of a string variable
 			         && Common::isDigit(symbol[1]))
-				output.append(converse->get_svar(strtol(&symbol[1], NULL, 10)));
+				output.append(converse->get_svar(strtol(&symbol[1], nullptr, 10)));
 			else if (symbol[0] == '#' // value of a variable
 			         && Common::isDigit(symbol[1])) {
-				last_value = converse->get_var(strtol(&symbol[1], NULL, 10));
+				last_value = converse->get_var(strtol(&symbol[1], nullptr, 10));
 				snprintf(intval, 16, "%u", last_value);
 
 				output.append((char *)intval);
@@ -312,7 +312,7 @@ string ConverseInterpret::get_formatted_text(const char *c_str) {
 			if (i + 3 <= len) {
 				i++;
 				if (c_str[i] == 'P')
-					converse->get_speech()->play_speech(converse->script_num, (int)strtol(&c_str[i + 1], NULL, 10));
+					converse->get_speech()->play_speech(converse->script_num, (int)strtol(&c_str[i + 1], nullptr, 10));
 
 				for (i++; Common::isDigit(c_str[i]) && i < len;)
 					i++;
@@ -483,7 +483,7 @@ bool MDTalkInterpret::op(Common::Stack<converse_value> &i) {
 
 bool ConverseInterpret::op_create_new(Common::Stack<converse_typed_value> &i) {
 	converse_value v[4];
-	Actor *cnpc = NULL;
+	Actor *cnpc = nullptr;
 
 	v[0] = pop_arg(i); // npc
 	v[1] = pop_arg(i); // obj
@@ -504,7 +504,7 @@ bool ConverseInterpret::op_create_new(Common::Stack<converse_typed_value> &i) {
 
 bool WOUConverseInterpret::op_create_new(Common::Stack<converse_typed_value> &i) {
 	converse_value v[4];
-	Actor *cnpc = NULL;
+	Actor *cnpc = nullptr;
 
 	v[0] = pop_arg(i); // npc
 	v[1] = pop_arg(i); // obj
@@ -531,8 +531,8 @@ bool ConverseInterpret::op(Common::Stack<converse_typed_value> &i) {
 	converse_value v[4] = { 0, 0, 0, 0 }; // args
 	converse_value inVal;
 	ConvScript *cs = converse->script;
-	Actor *cnpc = NULL;
-	Obj *cnpc_obj = NULL;
+	Actor *cnpc = nullptr;
+	Obj *cnpc_obj = nullptr;
 	Player *player = converse->player;
 //    converse_db_s *cdb;
 
@@ -708,7 +708,7 @@ bool ConverseInterpret::op(Common::Stack<converse_typed_value> &i) {
 				cnpc = converse->player->get_party()->who_has_obj(OBJ_U6_MOUSE, 0, false);
 			cnpc_obj = cnpc->inventory_get_object(OBJ_U6_MOUSE, 0, false);
 		}
-		if (cnpc_obj != NULL) {
+		if (cnpc_obj != nullptr) {
 			if (converse->actors->resurrect_actor(cnpc_obj, converse->player->get_actor()->get_location())) {
 				converse->objects->unlink_from_engine(cnpc_obj);
 				delete_obj(cnpc_obj);
@@ -818,8 +818,8 @@ bool ConverseInterpret::evop(Common::Stack<converse_typed_value> &i) {
 	converse_value v[4]; // input
 	converse_typed_value inVal;
 	converse_typed_value out;
-	Actor *cnpc = NULL;
-	Obj *cnpc_obj = NULL;
+	Actor *cnpc = nullptr;
+	Obj *cnpc_obj = nullptr;
 //    converse_db_s *cdb;
 	Player *player = converse->player;
 
@@ -1189,8 +1189,8 @@ uint8 ConverseInterpret::npc_num(uint32 n) {
  * asterisk (matching any input).
  */
 bool ConverseInterpret::check_keywords(string keystr, string instr) {
-	const char *strt_s = NULL;
-	char *tok_s = NULL, *cmp_s = NULL;
+	const char *strt_s = nullptr;
+	char *tok_s = nullptr, *cmp_s = nullptr;
 	if (keystr == "*")
 		return (true);
 	// check each comma-separated keyword
@@ -1227,7 +1227,7 @@ void ConverseInterpret::assign_input() {
 	// FIXME: Nuvie treats 0xF9-INPUTSTR & 0xFB-INPUT as identical, but in U6
 	//        0xFB-INPUT could not input strings.
 	if (decl_t == 0xb2)
-		converse->set_var(decl_v, strtol(converse->get_input().c_str(), NULL, 10));
+		converse->set_var(decl_v, strtol(converse->get_input().c_str(), nullptr, 10));
 	if (decl_t == 0xb3)
 		converse->set_svar(decl_v, converse->get_input().c_str());
 }
@@ -1241,15 +1241,15 @@ void ConverseInterpret::assign_input() {
 struct ConverseInterpret::converse_db_s *
 ConverseInterpret::get_db(uint32 loc, uint32 i) {
 	convscript_buffer db = converse->script->get_buffer(loc);
-	struct converse_db_s *item = NULL;
+	struct converse_db_s *item = nullptr;
 	uint32 d = 0, dbuf_len = 0, p = 0, e = 0;
 	if (!db)
-		return (NULL);
+		return (nullptr);
 
 //    item = (struct converse_db_s *)malloc(sizeof(struct converse_db_s));
 	item = new struct converse_db_s;
 	item->type = 0;
-	item->s = NULL;
+	item->s = nullptr;
 	item->i = 0;
 	while (e++ <= i) {
 		if (is_print(db[p]) && is_print(db[p + 1])) {
@@ -1276,20 +1276,20 @@ ConverseInterpret::get_db(uint32 loc, uint32 i) {
 
 
 /* Collect data from section at `loc', index `i', as a string.
- * Returns pointer to NEW data, or NULL if only integer data is found.
+ * Returns pointer to NEW data, or nullptr if only integer data is found.
  */
 char *ConverseInterpret::get_db_string(uint32 loc, uint32 i) {
 	convscript_buffer db = converse->script->get_buffer(loc);
-	char *item = NULL;
+	char *item = nullptr;
 	uint32 d = 0, dbuf_len = 0, /* string pointer & length */
 	       p = 0; /* pointer into db */
 	if (!db)
-		return (NULL);
+		return (nullptr);
 	/* skip to index */
 	uint32 e = 0;
 	while (e++ < i) {
 		if (db[p] == U6OP_ENDDATA)
-			return (NULL);
+			return (nullptr);
 		while (is_print(db[p++]));
 	}
 
@@ -1354,7 +1354,7 @@ void ConverseInterpret::set_db_integer(uint32 loc, uint32 i, converse_value val)
  */
 converse_value ConverseInterpret::find_db_string(uint32 loc, const char *dstring) {
 	convscript_buffer db = converse->script->get_buffer(loc);
-	char *item = NULL; /* item being checked */
+	char *item = nullptr; /* item being checked */
 	uint32 d = 0, dbuf_len = 0, /* string pointer & length */
 	       p = 0, /* pointer into db */
 	       i = 0; /* item index */
@@ -1363,7 +1363,7 @@ converse_value ConverseInterpret::find_db_string(uint32 loc, const char *dstring
 #endif
 	while ((converse_value)(db[p]) != U6OP_ENDDATA) {
 		if (is_print(db[p])) {
-			item = NULL;
+			item = nullptr;
 			d = 0;
 			dbuf_len = 0;
 			do {
diff --git a/engines/ultima/nuvie/core/converse_interpret.h b/engines/ultima/nuvie/core/converse_interpret.h
index 734248e7807..794fbae46a3 100644
--- a/engines/ultima/nuvie/core/converse_interpret.h
+++ b/engines/ultima/nuvie/core/converse_interpret.h
@@ -182,7 +182,7 @@ protected:
 		while (b_frame && !b_frame->empty()) leave();
 	}
 	struct convi_frame_s *top_frame() {
-		return ((b_frame && !b_frame->empty()) ? b_frame->top() : NULL);
+		return ((b_frame && !b_frame->empty()) ? b_frame->top() : nullptr);
 	}
 	void do_frame(converse_value c);
 
diff --git a/engines/ultima/nuvie/core/converse_speech.cpp b/engines/ultima/nuvie/core/converse_speech.cpp
index a76e60d48d9..7655d45ede5 100644
--- a/engines/ultima/nuvie/core/converse_speech.cpp
+++ b/engines/ultima/nuvie/core/converse_speech.cpp
@@ -32,7 +32,7 @@ namespace Ultima {
 namespace Nuvie {
 
 ConverseSpeech::ConverseSpeech() {
-	config = NULL;
+	config = nullptr;
 }
 
 
@@ -113,12 +113,12 @@ NuvieIOBuffer *ConverseSpeech::load_speech(Std::string filename, uint16 sample_n
 
 	sam_file.open(filename, 4);
 
-	compressed_data = sam_file.get_item(sample_num, NULL);
+	compressed_data = sam_file.get_item(sample_num, nullptr);
 	raw_audio = lzw.decompress_buffer(compressed_data, sam_file.get_item_size(sample_num), decomp_size);
 
 	free(compressed_data);
 
-	if (raw_audio != NULL) {
+	if (raw_audio != nullptr) {
 		wav_buffer = new NuvieIOBuffer();
 		upsampled_size = decomp_size + (int)floor((decomp_size - 1) / 4) * (2 + 2 + 2 + 1);
 
diff --git a/engines/ultima/nuvie/core/cursor.cpp b/engines/ultima/nuvie/core/cursor.cpp
index 90bd04de2ac..220ac2e8c71 100644
--- a/engines/ultima/nuvie/core/cursor.cpp
+++ b/engines/ultima/nuvie/core/cursor.cpp
@@ -40,12 +40,12 @@ using Std::vector;
 Cursor::Cursor() {
 	cursor_id = 0;
 	cur_x = cur_y = -1;
-	cleanup = NULL;
+	cleanup = nullptr;
 	cleanup_area = Common::Rect();
 	update_area = Common::Rect();
 	hidden = false;
-	screen = NULL;
-	config = NULL;
+	screen = nullptr;
+	config = nullptr;
 	screen_w = screen_h = 0;
 }
 
@@ -118,7 +118,7 @@ uint32 Cursor::load_all(Std::string filename, nuvie_game_t game_type) {
 	uint32 num_read = 0, num_total = pointer_list.get_num_items();
 	cursors.resize(num_total);
 	while (num_read < num_total) { // read each into a new MousePointer
-		MousePointer *ptr = NULL;
+		MousePointer *ptr = nullptr;
 		U6Shape *shape = new U6Shape;
 		unsigned char *data = pointer_list.get_item(num_read);
 		if (!shape->load(data)) {
@@ -198,7 +198,7 @@ bool Cursor::display(int px, int py) {
 void Cursor::clear() {
 	if (cleanup) {
 		screen->restore_area(cleanup, &cleanup_area);
-		cleanup = NULL;
+		cleanup = nullptr;
 //        screen->update(cleanup_area.left, cleanup_area.top, cleanup_area.w, cleanup_area.h);
 		add_update(cleanup_area.left, cleanup_area.top, cleanup_area.width(), cleanup_area.height());
 	}
@@ -228,7 +228,7 @@ inline void Cursor::fix_position(MousePointer *ptr, int &px, int &py) {
 void Cursor::save_backing(uint32 px, uint32 py, uint32 w, uint32 h) {
 	if (cleanup) {
 		free(cleanup);
-		cleanup = NULL;
+		cleanup = nullptr;
 	}
 
 	cleanup_area.left = px; // cursor must be drawn LAST for this to work
diff --git a/engines/ultima/nuvie/core/debug.cpp b/engines/ultima/nuvie/core/debug.cpp
index 8b1d511024f..0e555ced572 100644
--- a/engines/ultima/nuvie/core/debug.cpp
+++ b/engines/ultima/nuvie/core/debug.cpp
@@ -44,7 +44,7 @@ DebugLevelType debug(const char *func, const char *file, const int line, const b
 	static const char *DebugLevelNames[] = { "!", "A", "C", "E", "W", "N", "I", "D" };
 	static DebugLevelType CurrentDebugLevel = LEVEL_DEBUGGING;
 
-	if (format == NULL) {
+	if (format == nullptr) {
 		CurrentDebugLevel = level;
 		return CurrentDebugLevel;
 	}
@@ -95,11 +95,11 @@ DebugLevelType debug(const char *func, const char *file, const int line, const b
 /* test code / documentation.
 int main(char ** argv,int argc)
 {
-  DEBUG(0,LEVEL_EMERGENCY,NULL); // to set the debug cut-off rather high
+  DEBUG(0,LEVEL_EMERGENCY,nullptr); // to set the debug cut-off rather high
   DEBUG(0,LEVEL_EMERGENCY,"%d %c %s\n",1,'a',"aarrgghh..");
   DEBUG(1,LEVEL_EMERGENCY,"continuation of aarrgghh..");
   DEBUG(0,LEVEL_ALERT,"%d %c %s\n",1,'a',"RED"); // should be suppressed
-  DEBUG(0,LEVEL_DEBUGGING,NULL); // to allow all messages through.
+  DEBUG(0,LEVEL_DEBUGGING,nullptr); // to allow all messages through.
   DEBUG(0,LEVEL_DEBUGGING,"%d %c %s\n",1,'a',"debugging");
   return 1;
   }
diff --git a/engines/ultima/nuvie/core/effect.cpp b/engines/ultima/nuvie/core/effect.cpp
index bf3d09e3732..0d9eeeb5b0f 100644
--- a/engines/ultima/nuvie/core/effect.cpp
+++ b/engines/ultima/nuvie/core/effect.cpp
@@ -52,8 +52,8 @@ namespace Nuvie {
 
 #define EXP_EFFECT_TILE_NUM 382
 
-QuakeEffect *QuakeEffect::current_quake = NULL;
-FadeEffect *FadeEffect::current_fade = NULL;
+QuakeEffect *QuakeEffect::current_quake = nullptr;
+FadeEffect *FadeEffect::current_fade = nullptr;
 
 
 /* Add self to effect list (for future deletion).
@@ -124,7 +124,7 @@ void CannonballEffect::start_anim() {
 /* Handle messages from animation. Hit actors & walls. */
 uint16 CannonballEffect::callback(uint16 msg, CallBack *caller, void *msg_data) {
 	bool stop_effect = false;
-	Actor *hit_actor = NULL;
+	Actor *hit_actor = nullptr;
 
 	switch (msg) {
 	case MESG_ANIM_HIT_WORLD: {
@@ -193,8 +193,8 @@ ExpEffect::ExpEffect(uint16 tileNum, MapCoord location) {
 	start_loc = location;
 	finished_tiles = 0;
 	exp_tile_num = tileNum;
-	usecode = NULL;
-	obj = NULL;
+	usecode = nullptr;
+	obj = nullptr;
 
 	start_anim();
 }
@@ -317,14 +317,14 @@ uint16 ProjectileEffect::callback(uint16 msg, CallBack *caller, void *msg_data)
 /*** TimedEffect ***/
 void TimedEffect::start_timer(uint32 delay) {
 	if (!timer)
-		timer = new TimedCallback(this, NULL, delay, true);
+		timer = new TimedCallback(this, nullptr, delay, true);
 }
 
 
 void TimedEffect::stop_timer() {
 	if (timer) {
 		timer->clear_target();
-		timer = NULL;
+		timer = nullptr;
 	}
 }
 
@@ -394,7 +394,7 @@ uint16 QuakeEffect::callback(uint16 msg, CallBack *caller, void *msg_data) {
 /* Finish effect. Move map back to initial position.
  */
 void QuakeEffect::stop_quake() {
-	current_quake = NULL;
+	current_quake = nullptr;
 	map_window->set_freeze_blacking_location(false);
 	recenter_map();
 	delete_self();
@@ -576,9 +576,9 @@ bool UseCodeExplosiveEffect::hit_object(Obj *hit_obj) {
 		game->get_obj_manager()->remove_obj_from_map(hit_obj);
 		delete_obj(hit_obj);
 		if (obj) // pass our source obj on to next effect as original_obj
-			new UseCodeExplosiveEffect(NULL, x, y, 2, hit_damage, obj);
+			new UseCodeExplosiveEffect(nullptr, x, y, 2, hit_damage, obj);
 		else // pass original_obj on to next effect
-			new UseCodeExplosiveEffect(NULL, x, y, 2, hit_damage, original_obj);
+			new UseCodeExplosiveEffect(nullptr, x, y, 2, hit_damage, original_obj);
 	}
 	return (false);
 }
@@ -588,8 +588,8 @@ bool UseCodeExplosiveEffect::hit_object(Obj *hit_obj) {
 ThrowObjectEffect::ThrowObjectEffect() {
 	obj_manager = game->get_obj_manager();
 
-	anim = NULL;
-	throw_obj = NULL;
+	anim = nullptr;
+	throw_obj = nullptr;
 	throw_tile = 0;
 	throw_speed = 0;
 	degrees = 0;
@@ -623,7 +623,7 @@ void ThrowObjectEffect::hit_target() {
 
 
 /* The animation will travel from original object location to drop location if
- * NULL actor is specified.
+ * nullptr actor is specified.
  */
 DropEffect::DropEffect(Obj *obj, uint16 qty, Actor *actor, MapCoord *drop_loc) {
 	drop_from_actor = actor;
@@ -655,7 +655,7 @@ void DropEffect::get_obj(Obj *obj, uint16 qty) {
  * On ANIM_DONE: end
  */
 uint16 DropEffect::callback(uint16 msg, CallBack *caller, void *msg_data) {
-	// if throw_obj is NULL, object already hit target
+	// if throw_obj is nullptr, object already hit target
 	if (!throw_obj || (msg != MESG_ANIM_DONE && msg != MESG_ANIM_HIT_WORLD))
 		return (0);
 
@@ -687,7 +687,7 @@ void DropEffect::hit_target() {
 			// remove items from container if there is one
 			if (game->get_usecode()->is_container(throw_obj)) {
 				U6Link *link = throw_obj->container->start();
-				for (; link != NULL; link = throw_obj->container->start()) {
+				for (; link != nullptr; link = throw_obj->container->start()) {
 					Obj *obj = (Obj *)link->data;
 					obj_manager->moveto_map(obj, stop_at);
 				}
@@ -705,7 +705,7 @@ void DropEffect::hit_target() {
 		else
 			obj_manager->add_obj(throw_obj, OBJ_ADD_TOP);
 	}
-	throw_obj = NULL; // set as dropped
+	throw_obj = nullptr; // set as dropped
 
 	// not appropriate to do "Events::endAction(true)" from here to display
 	// prompt, as we MUST unpause_user() in ThrowObjectEffect::hit_target, and
@@ -838,7 +838,7 @@ void MissileEffect::hit_blocking() {
 /*** SleepEffect ***/
 /* The TimedAdvance is started after the fade-out completes. */
 SleepEffect::SleepEffect(Std::string until)
-	: timer(NULL),
+	: timer(nullptr),
 	  stop_hour(0),
 	  stop_minute(0),
 	  stop_time("") {
@@ -849,7 +849,7 @@ SleepEffect::SleepEffect(Std::string until)
 
 
 SleepEffect::SleepEffect(uint8 to_hour)
-	: timer(NULL),
+	: timer(nullptr),
 	  stop_hour(to_hour),
 	  stop_minute(0),
 	  stop_time("") {
@@ -868,7 +868,7 @@ SleepEffect::~SleepEffect() {
  */
 void SleepEffect::delete_self() {
 	//timer->clear_target(); // this will also stop/delete the TimedAdvance
-	//timer = NULL;
+	//timer = nullptr;
 	Effect::delete_self();
 }
 
@@ -882,7 +882,7 @@ uint16 SleepEffect::callback(uint16 msg, CallBack *caller, void *data) {
 
 	// waited for FadeEffect
 	if (msg == MESG_EFFECT_COMPLETE) {
-		if (timer == NULL) { // starting
+		if (timer == nullptr) { // starting
 			if (stop_time != "") { // advance to start time
 				timer = new TimedAdvance(stop_time, 360); // 6 hours per second FIXME: it isnt going anywhere near that fast
 				timer->set_target(this);
@@ -925,7 +925,7 @@ uint16 SleepEffect::callback(uint16 msg, CallBack *caller, void *data) {
 /*** FadeEffect ***/
 FadeEffect::FadeEffect(FadeType fade, FadeDirection dir, uint32 color, uint32 speed) {
 	speed = speed ? speed : game->get_map_window()->get_win_area() * 2116; // was 256000
-	init(fade, dir, color, NULL, 0, 0, speed);
+	init(fade, dir, color, nullptr, 0, 0, speed);
 }
 
 /* Takes an image to fade from/to. */
@@ -960,7 +960,7 @@ void FadeEffect::init(FadeType fade, FadeDirection dir, uint32 color, Graphics::
 	evtime = prev_evtime = 0;
 	fade_x = x;
 	fade_y = y;
-	fade_from = NULL;
+	fade_from = nullptr;
 	fade_iterations = 0;
 	if (capture) {
 		fade_from = new Graphics::ManagedSurface(capture->w, capture->h, capture->format);
@@ -983,11 +983,11 @@ void FadeEffect::delete_self() {
 	if (current_fade == this) { // these weren't init. if FadeEffect didn't start
 		delete viewport;
 		if (fade_dir == FADE_IN) // overlay should be empty now, so just delete it
-			map_window->set_overlay(NULL);
+			map_window->set_overlay(nullptr);
 		if (fade_from)
 			SDL_FreeSurface(fade_from);
 
-		current_fade = NULL;
+		current_fade = nullptr;
 	}
 
 	TimedEffect::delete_self();
@@ -997,23 +997,23 @@ void FadeEffect::delete_self() {
 void FadeEffect::init_pixelated_fade() {
 	int fillret = -1; // check error
 	overlay = map_window->get_overlay();
-	if (overlay != NULL) {
+	if (overlay != nullptr) {
 		pixel_count = fade_from ? (fade_from->w) * (fade_from->h)
 		              : (overlay->w - fade_x) * (overlay->h - fade_y);
 		// clear overlay to fill color or transparent
 		if (fade_dir == FADE_OUT) {
 			if (fade_from) { // fade from captured surface to transparent
 				// put surface on transparent background (not checked)
-				fillret = SDL_FillRect(overlay, NULL, uint32(TRANSPARENT_COLOR));
+				fillret = SDL_FillRect(overlay, nullptr, uint32(TRANSPARENT_COLOR));
 				Common::Rect overlay_rect(fade_x, fade_y, fade_x, fade_y);
-				fillret = SDL_BlitSurface(fade_from, NULL, overlay, &overlay_rect);
+				fillret = SDL_BlitSurface(fade_from, nullptr, overlay, &overlay_rect);
 			} else // fade from transparent to color
-				fillret = SDL_FillRect(overlay, NULL, uint32(TRANSPARENT_COLOR));
+				fillret = SDL_FillRect(overlay, nullptr, uint32(TRANSPARENT_COLOR));
 		} else {
 			if (fade_from) // fade from transparent to captured surface
-				fillret = SDL_FillRect(overlay, NULL, uint32(TRANSPARENT_COLOR));
+				fillret = SDL_FillRect(overlay, nullptr, uint32(TRANSPARENT_COLOR));
 			else // fade from color to transparent
-				fillret = SDL_FillRect(overlay, NULL, uint32(pixelated_color));
+				fillret = SDL_FillRect(overlay, nullptr, uint32(pixelated_color));
 		}
 	}
 	if (fillret == -1) {
@@ -1109,7 +1109,7 @@ inline uint32 FadeEffect::get_random_pixel(uint16 center_thresh) {
 bool FadeEffect::pixelated_fade_core(uint32 pixels_to_check, sint16 fade_to) {
 	Graphics::Surface s = overlay->getSubArea(Common::Rect(0, 0, overlay->w, overlay->h));
 	uint8 *pixels = (uint8 *)s.getPixels();
-	const uint8 *from_pixels = fade_from ? (const uint8 *)(fade_from->getPixels()) : NULL;
+	const uint8 *from_pixels = fade_from ? (const uint8 *)(fade_from->getPixels()) : nullptr;
 	uint32 p = 0; // scan counter
 	uint32 rnum = 0; // pixel index
 	uint32 colored = 0; // number of pixels that get colored
@@ -1117,7 +1117,7 @@ bool FadeEffect::pixelated_fade_core(uint32 pixels_to_check, sint16 fade_to) {
 	uint16 fade_height = fade_from ? fade_from->h : overlay->h - fade_y;
 	uint8 color = fade_to;
 
-	if (fade_to == -1 && fade_from == NULL) {
+	if (fade_to == -1 && fade_from == nullptr) {
 		return false;
 	}
 
@@ -1145,7 +1145,7 @@ bool FadeEffect::pixelated_fade_core(uint32 pixels_to_check, sint16 fade_to) {
 	// all but two lines colored
 	if (colored_total >= (pixel_count - fade_width * 2) || fade_iterations > FADE_EFFECT_MAX_ITERATIONS) { // fill the rest
 		if (fade_to >= 0)
-			SDL_FillRect(overlay, NULL, (uint32)fade_to);
+			SDL_FillRect(overlay, nullptr, (uint32)fade_to);
 		else { // Note: assert(fade_from) if(fade_to < 0)
 			Common::Rect fade_from_rect(fade_from->w, (int16)fade_from->h);
 			Common::Rect overlay_rect(fade_x, fade_y, fade_x + fade_from->w, fade_y + fade_from->h);
@@ -1295,10 +1295,10 @@ uint16 VanishEffect::callback(uint16 msg, CallBack *caller, void *data) {
 
 /* TileFadeEffect */
 TileFadeEffect::TileFadeEffect(MapCoord loc, Tile *from, Tile *to, FadeType type, uint16 speed) {
-	anim = NULL;
-	to_tile = NULL;
-	anim_tile = NULL;
-	actor = NULL;
+	anim = nullptr;
+	to_tile = nullptr;
+	anim_tile = nullptr;
+	actor = nullptr;
 	color_from = color_to = 0;
 	inc_reverse = false;
 	spd = 0;
@@ -1309,9 +1309,9 @@ TileFadeEffect::TileFadeEffect(MapCoord loc, Tile *from, Tile *to, FadeType type
 //Fade out actor.
 TileFadeEffect::TileFadeEffect(Actor *a, uint16 speed) {
 	inc_reverse = false;
-	anim = NULL;
-	to_tile = NULL;
-	anim_tile = NULL;
+	anim = nullptr;
+	to_tile = nullptr;
+	anim_tile = nullptr;
 	actor = a;
 	color_from = color_to = 0;
 	spd = speed;
@@ -1346,7 +1346,7 @@ void TileFadeEffect::add_obj_anim(Obj *obj) {
 }
 
 void TileFadeEffect::add_fade_anim(MapCoord loc, Tile *tile) {
-	add_anim(new TileFadeAnim(&loc, tile, NULL, spd));
+	add_anim(new TileFadeAnim(&loc, tile, nullptr, spd));
 	num_anim_running++;
 }
 
@@ -1419,8 +1419,8 @@ TileBlackFadeEffect::TileBlackFadeEffect(Obj *o, uint8 fade_color, uint16 speed)
 void TileBlackFadeEffect::init(uint8 fade_color, uint16 speed) {
 	fade_speed = speed;
 	color = fade_color;
-	actor = NULL;
-	obj = NULL;
+	actor = nullptr;
+	obj = nullptr;
 	reverse = false;
 
 	num_anim_running = 0;
@@ -1535,7 +1535,7 @@ uint16 XorEffect::callback(uint16 msg, CallBack *caller, void *data) {
 		stop_timer();
 		game->unpause_anims();
 		game->unpause_user();
-		map_window->set_overlay(NULL);
+		map_window->set_overlay(nullptr);
 		delete_self();
 	}
 	return 0;
@@ -1582,7 +1582,7 @@ uint16 U6WhitePotionEffect::callback(uint16 msg, CallBack *caller, void *data) {
 			start_timer(eff1_length);
 			state = 1;
 		} else if (state == 1) { // xor-effect
-			map_window->set_overlay(NULL);
+			map_window->set_overlay(nullptr);
 			start_timer(eff2_length);
 			state = 2;
 		} else if (state == 2) { // character outline
@@ -1696,13 +1696,13 @@ void PeerEffect::init_effect() {
 	map_window->set_overlay_level(MAP_OVERLAY_DEFAULT);
 	map_window->set_overlay(overlay);
 	assert(overlay->w % PEER_TILEW == 0); // overlay must be a multiple of tile size
-	SDL_FillRect(overlay, NULL, 0);
+	SDL_FillRect(overlay, nullptr, 0);
 
 	peer();
 }
 
 void PeerEffect::delete_self() {
-	map_window->set_overlay(NULL);
+	map_window->set_overlay(nullptr);
 	if (gem)
 		game->get_usecode()->message_obj(gem, MESG_EFFECT_COMPLETE, this);
 	else // FIXME: I don't want prompt display here, so it's also in UseCode,
diff --git a/engines/ultima/nuvie/core/effect.h b/engines/ultima/nuvie/core/effect.h
index cf66229c4f2..20c232045b7 100644
--- a/engines/ultima/nuvie/core/effect.h
+++ b/engines/ultima/nuvie/core/effect.h
@@ -180,10 +180,10 @@ protected:
 	TimedCallback *timer;
 public:
 	TimedEffect()                  {
-		timer = NULL;
+		timer = nullptr;
 	}
 	TimedEffect(uint32 delay)      {
-		timer = NULL;
+		timer = nullptr;
 		start_timer(delay);
 	}
 	~TimedEffect() override                 {
@@ -217,7 +217,7 @@ class QuakeEffect : public TimedEffect {
 	uint8 strength; // magnitude
 
 public:
-	QuakeEffect(uint8 magnitude, uint32 duration, Actor *keep_on = NULL);
+	QuakeEffect(uint8 magnitude, uint32 duration, Actor *keep_on = nullptr);
 	~QuakeEffect() override;
 	uint16 callback(uint16 msg, CallBack *caller, void *data) override;
 
@@ -278,11 +278,11 @@ public:
 /* Explosion that sends usecode event to an object on completion.
  */
 class UseCodeExplosiveEffect : public ExplosiveEffect {
-	Obj *obj; // explosion came from this object (can be NULL)
+	Obj *obj; // explosion came from this object (can be nullptr)
 	Obj *original_obj; // don't hit this object (chain-reaction avoidance hack)
 
 public:
-	UseCodeExplosiveEffect(Obj *src_obj, uint16 x, uint16 y, uint32 size, uint16 dmg = 0, Obj *dont_hit_me = NULL)
+	UseCodeExplosiveEffect(Obj *src_obj, uint16 x, uint16 y, uint32 size, uint16 dmg = 0, Obj *dont_hit_me = nullptr)
 		: ExplosiveEffect(x, y, size, dmg), obj(src_obj), original_obj(dont_hit_me) {
 	}
 	void delete_self() override;
@@ -426,7 +426,7 @@ protected:
 	FadeDirection fade_dir; // IN (removing color) or OUT (adding color)
 	uint32 fade_speed; // meaning of this depends on fade_type
 	uint8 pixelated_color; // color from palette that is being faded to/from
-	Graphics::ManagedSurface *fade_from; // image being faded from or to (or NULL if coloring)
+	Graphics::ManagedSurface *fade_from; // image being faded from or to (or nullptr if coloring)
 	uint16 fade_x, fade_y; // start fade from this point (to fade_from size)
 
 	uint32 evtime, prev_evtime; // time of last message to callback()
@@ -575,7 +575,7 @@ class U6WhitePotionEffect : public TimedEffect {
 
 public:
 	/* eff_ms=length of visual effect; delay_ms=length of x-ray effect */
-	U6WhitePotionEffect(uint32 eff_ms, uint32 delay_ms, Obj *callback_obj = NULL);
+	U6WhitePotionEffect(uint32 eff_ms, uint32 delay_ms, Obj *callback_obj = nullptr);
 	~U6WhitePotionEffect() override { }
 
 	/* Called by the timer between each effect stage. */
diff --git a/engines/ultima/nuvie/core/effect_manager.cpp b/engines/ultima/nuvie/core/effect_manager.cpp
index d4d7d7d54c3..7dcb8ee94f5 100644
--- a/engines/ultima/nuvie/core/effect_manager.cpp
+++ b/engines/ultima/nuvie/core/effect_manager.cpp
@@ -101,7 +101,7 @@ void EffectManager::unwatch_effect(CallBack *callback_target, Effect *watch) {
 		WatchIterator i = watched.begin();
 		while (i != watched.end())
 			if ((*i).watcher == callback_target
-			        && ((*i).effect == watch || watch == NULL)) {
+			        && ((*i).effect == watch || watch == nullptr)) {
 				i = watched.erase(i); // resume from next element
 			} else ++i;
 	}
@@ -113,12 +113,12 @@ void EffectManager::signal_watch(Effect *effect) {
 	EffectWatch *watch = find_effect_watch(effect);
 	if (watch) {
 		if (watch->watcher)
-			watch->watcher->callback(EFFECT_CB_COMPLETE, NULL, effect);
+			watch->watcher->callback(EFFECT_CB_COMPLETE, nullptr, effect);
 		unwatch_effect(watch->watcher, effect);
 	}
 }
 
-/* Returns watch for an effect. (or NULL)
+/* Returns watch for an effect. (or nullptr)
  */
 EffectManager::EffectWatch *EffectManager::find_effect_watch(Effect *effect) {
 	if (!watched.empty()) {
@@ -128,7 +128,7 @@ EffectManager::EffectWatch *EffectManager::find_effect_watch(Effect *effect) {
 				return (&(*i));
 			else ++i;
 	}
-	return (NULL);
+	return (nullptr);
 }
 
 } // End of namespace Nuvie
diff --git a/engines/ultima/nuvie/core/effect_manager.h b/engines/ultima/nuvie/core/effect_manager.h
index d8acf40d1ea..358b986538c 100644
--- a/engines/ultima/nuvie/core/effect_manager.h
+++ b/engines/ultima/nuvie/core/effect_manager.h
@@ -58,7 +58,7 @@ public:
 
 	bool has_effects();
 	void watch_effect(CallBack *callback_target, Effect *watch);
-	void unwatch_effect(CallBack *callback_target, Effect *watch = NULL);
+	void unwatch_effect(CallBack *callback_target, Effect *watch = nullptr);
 };
 
 } // End of namespace Nuvie
diff --git a/engines/ultima/nuvie/core/egg_manager.cpp b/engines/ultima/nuvie/core/egg_manager.cpp
index 352c143405a..2128dd4bdbd 100644
--- a/engines/ultima/nuvie/core/egg_manager.cpp
+++ b/engines/ultima/nuvie/core/egg_manager.cpp
@@ -52,8 +52,8 @@ EggManager::EggManager(Configuration *cfg, nuvie_game_t type, Map *m) {
 	config = cfg;
 	gametype = type;
 	map = m;
-	actor_manager = NULL;
-	obj_manager = NULL;
+	actor_manager = nullptr;
+	obj_manager = nullptr;
 	not_spawning_actors = false;
 }
 
@@ -80,7 +80,7 @@ void EggManager::clean(bool keep_obj) {
 void EggManager::add_egg(Obj *egg_obj) {
 	Egg *egg;
 
-	if (egg_obj == NULL)
+	if (egg_obj == nullptr)
 		return;
 
 	egg = new Egg();
@@ -175,13 +175,13 @@ bool EggManager::spawn_egg(Obj *egg, uint8 hatch_probability) {
 	if (period == EGG_HATCH_ALWAYS
 	        || (period == EGG_HATCH_DAY && hour >= EGG_DAY_HOUR && hour < EGG_NIGHT_HOUR)
 	        || (period == EGG_HATCH_NIGHT && !(hour >= EGG_DAY_HOUR && hour < EGG_NIGHT_HOUR))) {
-		if (egg->container == NULL) {
+		if (egg->container == nullptr) {
 			DEBUG(1, LEVEL_WARNING, " egg at (%x,%x,%x) does not contain any embryos!", egg->x, egg->y, egg->z);
 		}
 		// check random probability that the egg will hatch
 		if ((egg->qty == 100 || hatch_probability <= egg->qty) && egg->container) { // Hatch the egg.
 			assert(egg->container);
-			for (link = egg->container->start(); link != NULL; link = link->next) {
+			for (link = egg->container->start(); link != nullptr; link = link->next) {
 				obj = (Obj *)link->data;
 				qty = obj->qty;
 
@@ -198,7 +198,7 @@ bool EggManager::spawn_egg(Obj *egg, uint8 hatch_probability) {
 							break;
 						// group new actors randomly if egg space already occupied
 						Actor *prev_actor = actor_manager->get_actor(egg->x, egg->y, egg->z);
-						Actor *new_actor = NULL;
+						Actor *new_actor = nullptr;
 						MapCoord actor_loc = MapCoord(egg->x, egg->y, egg->z);
 						if (prev_actor) {
 							if (prev_actor->get_obj_n() != obj->obj_n
diff --git a/engines/ultima/nuvie/core/egg_manager.h b/engines/ultima/nuvie/core/egg_manager.h
index a47e2baf3ce..d71cc2b918a 100644
--- a/engines/ultima/nuvie/core/egg_manager.h
+++ b/engines/ultima/nuvie/core/egg_manager.h
@@ -33,7 +33,7 @@ struct Egg {
 	Obj *obj;
 	Egg() {
 		seen_egg = false;
-		obj = NULL;
+		obj = nullptr;
 	};
 };
 
diff --git a/engines/ultima/nuvie/core/events.cpp b/engines/ultima/nuvie/core/events.cpp
index 09eba22f70d..42418092440 100644
--- a/engines/ultima/nuvie/core/events.cpp
+++ b/engines/ultima/nuvie/core/events.cpp
@@ -150,7 +150,7 @@ bool Events::init(ObjManager *om, MapWindow *mw, MsgScroll *ms, Player *p, Magic
 	input.get_direction = false;
 	input.get_text = false;
 	cursor_mode = false;
-	input.target_init = NULL;
+	input.target_init = nullptr;
 
 	time_queue = new TimeQueue;
 	game_time_queue = new TimeQueue;
@@ -162,7 +162,7 @@ bool Events::init(ObjManager *om, MapWindow *mw, MsgScroll *ms, Player *p, Magic
 	fps_counter_widget = new FpsCounter(game);
 	gui->AddWidget(fps_counter_widget);
 	fps_counter_widget->Hide();
-	scriptThread = NULL;
+	scriptThread = nullptr;
 
 	return true;
 }
@@ -476,7 +476,7 @@ void Events::request_input(CallBack *caller, void *user_data) {
 
 // typically this will be coming from inventory
 bool Events::select_obj(Obj *obj, Actor *actor) {
-	if (looking_at_spellbook && view_manager->get_spell_view() != NULL) {
+	if (looking_at_spellbook && view_manager->get_spell_view() != nullptr) {
 		view_manager->get_spell_view()->close_look();
 		return false;
 	}
@@ -827,8 +827,8 @@ bool Events::get_start() {
 bool Events::push_start() {
 	if (game->user_paused())
 		return false;
-	push_obj = NULL;
-	push_actor = NULL;
+	push_obj = nullptr;
+	push_actor = nullptr;
 	if (game->get_script()->call_is_ranged_select(MOVE))
 		get_target("Move-");
 	else
@@ -910,7 +910,7 @@ bool Events::get(MapCoord coord) {
 		got_object = perform_get(obj, view_manager->get_inventory_view()->get_inventory_widget()->get_container(),
 		                         player->get_actor());
 	else
-		got_object = perform_get(obj, NULL, player->get_actor());
+		got_object = perform_get(obj, nullptr, player->get_actor());
 	view_manager->update(); //redraw views to show new item.
 	endAction();
 
@@ -937,7 +937,7 @@ bool Events::use(Obj *obj) {
 		        && !map_window->tile_is_black(obj->x, obj->y, bottom_obj))
 			obj = bottom_obj;
 		else
-			obj = NULL;
+			obj = nullptr;
 	}
 	if (!obj) {
 		scroll->display_string("nothing\n");
@@ -968,7 +968,7 @@ bool Events::use(Obj *obj) {
 		player->subtract_movement_points(MOVE_COST_USE);
 	}
 
-	if (mode == USE_MODE && usecode->get_running_script() == NULL) // check mode because UseCode may have changed it
+	if (mode == USE_MODE && usecode->get_running_script() == nullptr) // check mode because UseCode may have changed it
 		endAction(display_prompt);
 	return true;
 }
@@ -1032,7 +1032,7 @@ bool Events::use(MapCoord coord) {
 			        && !map_window->tile_is_black(obj->x, obj->y, bottom_obj))
 				obj = bottom_obj;
 			else
-				obj = NULL;
+				obj = nullptr;
 		}
 		bool visible_actor = actor && actor->is_visible();
 
@@ -1158,7 +1158,7 @@ bool Events::lookAtCursor(bool delayed, uint16 x, uint16 y, uint8 z, Obj *obj, A
 		        && !map_window->tile_is_black(x, y, bottom_obj))
 			obj = bottom_obj;
 		else
-			obj = NULL;
+			obj = nullptr;
 	}
 	if (game->user_paused())
 		return false;
@@ -1386,7 +1386,7 @@ bool Events::pushTo(sint16 rel_x, sint16 rel_y, bool push_from) {
 			                         LT_HitActors | LT_HitUnpassable,
 			                         lt,
 			                         0,
-			                         game->get_game_type() == NUVIE_GAME_U6 ? NULL
+			                         game->get_game_type() == NUVIE_GAME_U6 ? nullptr
 			                         : push_obj)) { //FIXME should we exclude push_obj for U6 too?
 				if (lt.hitObj) {
 					if (obj_manager->can_store_obj(lt.hitObj, push_obj)) { //if we are moving onto a container.
@@ -1465,14 +1465,14 @@ bool Events::pushFrom(MapCoord target) {
 	}
 	if (push_obj
 	        && (obj_manager->get_obj_weight(push_obj, OBJ_WEIGHT_EXCLUDE_CONTAINER_ITEMS) == 0))
-		push_obj = NULL;
+		push_obj = nullptr;
 
 	if (push_actor && push_actor->is_visible()) {
 		scroll->display_string(push_actor->get_name());
-		push_obj = NULL;
+		push_obj = nullptr;
 	} else if (push_obj) {
 		scroll->display_string(obj_manager->look_obj(push_obj));
-		push_actor = NULL;
+		push_actor = nullptr;
 	} else {
 		scroll->display_string("nothing.\n");
 		endAction(true);
@@ -1508,7 +1508,7 @@ bool Events::actor_exists(Actor *a) {
 /* Send input to active alt-code. */
 void Events::alt_code_input(const char *in) {
 	ActorManager *am = game->get_actor_manager();
-	Actor *a = am->get_actor((uint8) strtol(in, NULL, 10));
+	Actor *a = am->get_actor((uint8) strtol(in, nullptr, 10));
 	static string teleport_string = "";
 	static Obj obj;
 	uint8 a_num = 0;
@@ -1523,13 +1523,13 @@ void Events::alt_code_input(const char *in) {
 		break;
 
 	case 301: // Show Midgame graphics
-		game->get_script()->call_play_midgame_sequence((uint16) strtol(in, NULL, 10));
+		game->get_script()->call_play_midgame_sequence((uint16) strtol(in, nullptr, 10));
 		scroll->display_string("\n");
 		active_alt_code = 0;
 		break;
 
 	case 400: // talk to NPC (FIXME: get portrait and inventory too)
-		a_num = (uint8) strtol(in, NULL, 10);
+		a_num = (uint8) strtol(in, nullptr, 10);
 		if (a_num == 0 || !game->get_converse()->start(a_num)) {
 			scroll->display_string("\n");
 			scroll->display_prompt();
@@ -1554,13 +1554,13 @@ void Events::alt_code_input(const char *in) {
 				scroll->display_string("\n<uai>: ");
 			else
 				scroll->display_string("\ny: ");
-			get_scroll_input(NULL, true, false, false);
+			get_scroll_input(nullptr, true, false, false);
 		} else if (alt_code_input_num == 2) {
 			if (game->get_game_type() == NUVIE_GAME_U6)
 				scroll->display_string("\n<zi>: ");
 			else
 				scroll->display_string("\nz: ");
-			get_scroll_input(NULL, true, false, false);
+			get_scroll_input(nullptr, true, false, false);
 		} else {
 			alt_code_teleport(teleport_string.c_str());
 			scroll->display_string("\n");
@@ -1572,9 +1572,9 @@ void Events::alt_code_input(const char *in) {
 		break;
 
 	case 314: // teleport player & party to selected location
-		if (strtol(in, NULL, 10) != 0)
-			alt_code_teleport_menu((uint32) strtol(in, NULL, 10));
-		if (strtol(in, NULL, 10) == 0 || alt_code_input_num > 2) {
+		if (strtol(in, nullptr, 10) != 0)
+			alt_code_teleport_menu((uint32) strtol(in, nullptr, 10));
+		if (strtol(in, nullptr, 10) == 0 || alt_code_input_num > 2) {
 			scroll->display_string("\n");
 			scroll->display_prompt();
 			alt_code_input_num = 0;
@@ -1584,7 +1584,7 @@ void Events::alt_code_input(const char *in) {
 
 	case 414: // teleport player & party to NPC location
 		if (actor_exists(a))
-			alt_code_teleport_to_person((uint32) strtol(in, NULL, 10));
+			alt_code_teleport_to_person((uint32) strtol(in, nullptr, 10));
 		scroll->display_string("\n\n");
 		scroll->display_prompt();
 		active_alt_code = 0;
@@ -1647,7 +1647,7 @@ void Events::alt_code_input(const char *in) {
 	}
 	case 456: // polymorph
 		if (alt_code_input_num == 0) {
-			obj.obj_n = strtol(in, NULL, 10);
+			obj.obj_n = strtol(in, nullptr, 10);
 			scroll->display_string("\nNpc number? ");
 			get_scroll_input();
 			++alt_code_input_num;
@@ -1665,7 +1665,7 @@ void Events::alt_code_input(const char *in) {
 /* Get an alt-code from `cs' and use it.
  */
 void Events::alt_code(const char *cs) {
-	uint16 c = (uint16) strtol(cs, NULL, 10);
+	uint16 c = (uint16) strtol(cs, nullptr, 10);
 	switch (c) {
 	case 300: // display portrait by number
 		scroll->display_string("Portrait? ");
@@ -1744,7 +1744,7 @@ void Events::alt_code(const char *cs) {
 				scroll->display_string("\n<gotu eks>: ");
 			else
 				scroll->display_string("\ngoto x: ");
-			get_scroll_input(NULL, true, false, false);
+			get_scroll_input(nullptr, true, false, false);
 			active_alt_code = c;
 		}
 		break;
@@ -2479,14 +2479,14 @@ uint16 Events::callback(uint16 msg, CallBack *caller, void *data) {
 		widget->Delete();
 
 		showingDialog = false;
-		if (gamemenu_dialog != NULL)
+		if (gamemenu_dialog != nullptr)
 			gui->lock_input(gamemenu_dialog);
 		else
 			game->get_gui()->unlock_input();
 		return GUI_YUM;
 	case GAMEMENUDIALOG_CB_DELETE :
 		showingDialog = false;
-		gamemenu_dialog = NULL;
+		gamemenu_dialog = nullptr;
 		keybinder->set_enable_joy_repeat(true);
 		return GUI_YUM;
 	}
@@ -2660,7 +2660,7 @@ bool Events::unready(Obj *obj) {
 bool Events::drop_start() {
 	if (game->user_paused())
 		return false;
-	drop_obj = NULL;
+	drop_obj = nullptr;
 	drop_qty = 0;
 	drop_x = drop_y = -1;
 
@@ -2724,7 +2724,7 @@ bool Events::perform_drop() {
 	if (game->user_paused())
 		return false;
 	if (drop_x == -1 || drop_y == -1) {
-		if (input.loc == NULL) {
+		if (input.loc == nullptr) {
 			scroll->display_string("Not possible\n");
 			endAction(true);
 			return false;
@@ -2897,8 +2897,8 @@ void Events::walk_to_mouse_cursor(uint32 mx, uint32 my) {
  */
 void Events::multiuse(uint16 wx, uint16 wy) {
 	ActorManager *actor_manager = game->get_actor_manager();
-	Obj *obj = NULL;
-	Actor *actor = NULL, *player_actor = player->get_actor();
+	Obj *obj = nullptr;
+	Actor *actor = nullptr, *player_actor = player->get_actor();
 	bool using_actor = false; //, talking = false;
 	MapCoord player_location(player_actor->get_location());
 	MapCoord target(player_actor->get_location()); // changes to target location
@@ -2964,7 +2964,7 @@ void Events::multiuse(uint16 wx, uint16 wy) {
 		} else {
 			if (game->is_new_style() && actor == actor_manager->get_player()) {
 				//open inventory here.
-				view_manager->open_doll_view(in_control_cheat ? actor : NULL);
+				view_manager->open_doll_view(in_control_cheat ? actor : nullptr);
 			} else if (target == player_location)
 				using_actor = false;
 			else {
@@ -3035,7 +3035,7 @@ void Events::doAction() {
 	}
 
 	if (mode == LOOK_MODE) {
-		if (looking_at_spellbook && view_manager->get_spell_view() != NULL) {
+		if (looking_at_spellbook && view_manager->get_spell_view() != nullptr) {
 			view_manager->get_spell_view()->close_look();
 			return;
 		}
@@ -3064,7 +3064,7 @@ void Events::doAction() {
 
 		if (usecode) {
 			ScriptThread *usecode_script = usecode->get_running_script();
-			if (usecode_script != NULL) {
+			if (usecode_script != nullptr) {
 				uint8 script_state = usecode_script->get_state();
 				switch (script_state) {
 				case NUVIE_SCRIPT_GET_DIRECTION :
@@ -3105,7 +3105,7 @@ void Events::doAction() {
 			}
 
 			usecode_script = usecode->get_running_script();
-			if (usecode_script != NULL) {
+			if (usecode_script != nullptr) {
 				uint8 script_state = usecode_script->get_state();
 				switch (script_state) {
 				case NUVIE_SCRIPT_GET_DIRECTION :
@@ -3117,7 +3117,7 @@ void Events::doAction() {
 				}
 			}
 
-			if (mode == USE_MODE && (usecode_script == NULL || usecode_script->is_running() == false)) {
+			if (mode == USE_MODE && (usecode_script == nullptr || usecode_script->is_running() == false)) {
 				endAction(true);
 			}
 		}
@@ -3178,7 +3178,7 @@ void Events::doAction() {
 				scroll->display_string(buf);
 				drop_count(drop_obj->qty);
 			} else
-				drop_count(strtol(input.str->c_str(), NULL, 10));
+				drop_count(strtol(input.str->c_str(), nullptr, 10));
 		} else
 			perform_drop();
 	} else if (mode == REST_MODE) {
@@ -3197,7 +3197,7 @@ void Events::doAction() {
 				scroll->display_string("0");
 			rest_input(0);
 		} else
-			rest_input(strtol(input.str->c_str(), NULL, 10));
+			rest_input(strtol(input.str->c_str(), nullptr, 10));
 	} else if (mode == CAST_MODE || mode == SPELL_MODE) {
 		if (input.type == EVENTINPUT_MAPCOORD) {
 			if (magic->is_waiting_for_location())
@@ -3251,7 +3251,7 @@ void Events::doAction() {
 			set_mode(MOVE_MODE);
 			multiuse(input.loc->sx, input.loc->sy);
 		} else { // tryed on views/gumps
-			Obj *obj = input.obj; // newAction(USE_MODE) will NULL input.obj
+			Obj *obj = input.obj; // newAction(USE_MODE) will nullptr input.obj
 			if (!obj) { // not sure if this is needed
 				set_mode(MOVE_MODE);
 				return;
@@ -3278,7 +3278,7 @@ void Events::doAction() {
 		map_window->moveCursor(cursor_x, cursor_y);
 		select_target(loc.x, loc.y, loc.z); // the returned location
 	} else if (mode == SCRIPT_MODE) {
-		if (scriptThread != NULL) {
+		if (scriptThread != nullptr) {
 			uint8 script_state = scriptThread->get_state();
 			switch (script_state) {
 			case NUVIE_SCRIPT_GET_DIRECTION :
@@ -3307,7 +3307,7 @@ void Events::doAction() {
 
 			case NUVIE_SCRIPT_FINISHED:
 				delete scriptThread;
-				scriptThread = NULL;
+				scriptThread = nullptr;
 				endAction(true);
 				return;
 
@@ -3323,10 +3323,10 @@ void Events::doAction() {
 void Events::cancelAction() {
 	if (game->user_paused())
 		return;
-	if (view_manager->gumps_are_active() && (magic == NULL || !magic->is_waiting_for_inventory_obj()))
+	if (view_manager->gumps_are_active() && (magic == nullptr || !magic->is_waiting_for_inventory_obj()))
 		return close_gumps();
 	if (mode == INPUT_MODE) { // cancel action of previous mode
-		if (magic != NULL && magic->is_waiting_for_inventory_obj()) {
+		if (magic != nullptr && magic->is_waiting_for_inventory_obj()) {
 			if (!game->is_new_style() && game->get_party()->get_leader() != -1) {
 				view_manager->get_inventory_view()->release_focus();
 				view_manager->get_inventory_view()->set_party_member(game->get_party()->get_leader());
@@ -3378,13 +3378,13 @@ void Events::cancelAction() {
 
 		if (callback_target) {
 			message(CB_INPUT_CANCELED, (char *) &input);
-			callback_target = NULL;
-			callback_user_data = NULL;
+			callback_target = nullptr;
+			callback_user_data = nullptr;
 		}
 	} else if (mode == EQUIP_MODE) {
 		endAction();
 		return;
-	} else if (looking_at_spellbook && view_manager->get_spell_view() != NULL) {
+	} else if (looking_at_spellbook && view_manager->get_spell_view() != nullptr) {
 		view_manager->get_spell_view()->close_look();
 		return;
 	} else {
@@ -3417,7 +3417,7 @@ bool Events::newAction(EventMode new_mode) {
 		doAction();
 		return (mode == ATTACK_MODE);
 	}
-	if (looking_at_spellbook && view_manager->get_spell_view() != NULL) { // pushed L while looking at spell book
+	if (looking_at_spellbook && view_manager->get_spell_view() != nullptr) { // pushed L while looking at spell book
 		view_manager->get_spell_view()->close_look();
 		return false;
 	}
@@ -3446,7 +3446,7 @@ bool Events::newAction(EventMode new_mode) {
 			mode = MOVE_MODE;
 			scroll->display_prompt();
 		} else
-			key_redirect((CallBack *) magic, NULL);
+			key_redirect((CallBack *) magic, nullptr);
 		break;
 	case SPELL_MODE:
 		break;
@@ -3529,11 +3529,11 @@ void Events::endAction(bool prompt) {
 	}
 
 	if (mode == PUSH_MODE) {
-		push_obj = NULL;
-		push_actor = NULL;
+		push_obj = nullptr;
+		push_actor = nullptr;
 		map_window->reset_mousecenter();
 	} else if (mode == DROP_MODE) {
-		drop_obj = NULL;
+		drop_obj = nullptr;
 		drop_qty = 0;
 		drop_from_key = false;
 	} else if (mode == REST_MODE) {
@@ -3765,10 +3765,10 @@ bool Events::select_view_obj(Obj *obj, Actor *actor) {
 	        && !magic->is_waiting_for_obj() && !magic->is_waiting_for_inventory_obj())
 		cancelAction();
 	else {
-		if (!obj || push_actor != NULL)
+		if (!obj || push_actor != nullptr)
 			return false;
-		if (usecode->cannot_unready(obj) && ((last_mode == DROP_MODE && drop_obj == NULL)
-		                                     || (last_mode == PUSH_MODE && push_obj == NULL))) {
+		if (usecode->cannot_unready(obj) && ((last_mode == DROP_MODE && drop_obj == nullptr)
+		                                     || (last_mode == PUSH_MODE && push_obj == nullptr))) {
 			scroll->display_string(obj_manager->look_obj(obj, false));
 			scroll->display_string("\n");
 			usecode->ready_obj(obj, obj->get_actor_holding_obj());
diff --git a/engines/ultima/nuvie/core/events.h b/engines/ultima/nuvie/core/events.h
index e32d588eaac..633e0a3e839 100644
--- a/engines/ultima/nuvie/core/events.h
+++ b/engines/ultima/nuvie/core/events.h
@@ -235,7 +235,7 @@ private:
 protected:
 	inline uint32 TimeLeft();
 
-	uint16 callback(uint16 msg, CallBack *caller, void *data = NULL) override;
+	uint16 callback(uint16 msg, CallBack *caller, void *data = nullptr) override;
 	bool handleSDL_KEYDOWN(const Common::Event *event);
 	const char *print_mode(EventMode mode);
 	void try_next_attack();
@@ -276,14 +276,14 @@ public:
 	void update_timers();
 	bool update();
 	bool handleEvent(const Common::Event *event);
-	void request_input(CallBack *caller, void *user_data = NULL);
+	void request_input(CallBack *caller, void *user_data = nullptr);
 	void target_spell();
 	void close_spellbook();
 // Prompt for input.
 // obsolete:
-// void useselect_mode(Obj *src, const char *prompt = NULL); // deprecated
-// void freeselect_mode(Obj *src, const char *prompt = NULL); // deprecated
-	void get_scroll_input(const char *allowed = NULL, bool can_escape = true, bool using_target_cursor = false, bool set_numbers_only_to_true = true);
+// void useselect_mode(Obj *src, const char *prompt = nullptr); // deprecated
+// void freeselect_mode(Obj *src, const char *prompt = nullptr); // deprecated
+	void get_scroll_input(const char *allowed = nullptr, bool can_escape = true, bool using_target_cursor = false, bool set_numbers_only_to_true = true);
 	void get_inventory_obj(Actor *actor, bool getting_target = true);
 	void get_spell_num(Actor *caster, Obj *spell_container);
 // void get_amount();
@@ -292,7 +292,7 @@ public:
 	void get_target(const char *prompt);
 	void get_target(const MapCoord &init, const char *prompt);
 // void get_obj_from_inventory(Actor *actor, const char *prompt);
-	void display_portrait(Actor *actor, const char *name = NULL);
+	void display_portrait(Actor *actor, const char *name = nullptr);
 // Start a new action, setting a new mode and prompting for input.
 	bool newAction(EventMode new_mode);
 // void doAction(sint16 rel_x = 0, sint16 rel_y = 0);
@@ -301,14 +301,14 @@ public:
 	void cancelAction();
 	void endAction(bool prompt = false);
 // Send input back to Events, performing an action for the current mode.
-	bool select_obj(Obj *obj, Actor *actor = NULL);
+	bool select_obj(Obj *obj, Actor *actor = nullptr);
 	bool select_view_obj(Obj *obj, Actor *actor);
 	bool select_actor(Actor *actor);
 	bool select_direction(sint16 rel_x, sint16 rel_y);
 	bool select_target(uint16 x, uint16 y, uint8 z = 0);
 	bool select_party_member(uint8 num);
 	bool select_spell_num(sint16 spell_num);
-// bool select_obj(Obj *obj = NULL, Actor *actor = NULL);
+// bool select_obj(Obj *obj = nullptr, Actor *actor = nullptr);
 // bool select_obj(sint16 rel_x, sint16 rel_y);
 // There is no "select_text", as Events polls MsgScroll for new input.
 // Similiarly, a "select_key" is unnecessary. The following method
@@ -328,10 +328,10 @@ public:
 	bool get_start();
 	bool get(MapCoord coord);
 	bool get(sint16 rel_x, sint16 rel_y);
-	bool perform_get(Obj *obj, Obj *container_obj = NULL, Actor *actor = NULL);
+	bool perform_get(Obj *obj, Obj *container_obj = nullptr, Actor *actor = nullptr);
 
 	bool look_start();
-	bool lookAtCursor(bool delayed = false, uint16 x = 0, uint16 y  = 0,  uint8 z = 0, Obj *obj = NULL, Actor *actor = NULL);
+	bool lookAtCursor(bool delayed = false, uint16 x = 0, uint16 y  = 0,  uint8 z = 0, Obj *obj = nullptr, Actor *actor = nullptr);
 	bool look(Obj *obj);
 	bool look(Actor *actor);
 	bool search(Obj *obj);
@@ -355,7 +355,7 @@ public:
 	bool party_mode();
 	bool toggle_combat();
 
-	bool ready(Obj *obj, Actor *actor = NULL);
+	bool ready(Obj *obj, Actor *actor = nullptr);
 	bool unready(Obj *obj);
 
 	bool drop_start();
diff --git a/engines/ultima/nuvie/core/game.cpp b/engines/ultima/nuvie/core/game.cpp
index 9248f783ec4..d541ea7c5ce 100644
--- a/engines/ultima/nuvie/core/game.cpp
+++ b/engines/ultima/nuvie/core/game.cpp
@@ -70,7 +70,7 @@
 namespace Ultima {
 namespace Nuvie {
 
-Game *Game::game = NULL;
+Game *Game::game = nullptr;
 
 Game::Game(Configuration *cfg, Events *evt, Screen *scr, GUI *g, nuvie_game_t type, SoundManager *sm) {
 	game = this;
@@ -83,34 +83,34 @@ Game::Game(Configuration *cfg, Events *evt, Screen *scr, GUI *g, nuvie_game_t ty
 	game_type = type;
 	sound_manager = sm;
 
-	script = NULL;
-	background = NULL;
-	cursor = NULL;
-	dither = NULL;
-	tile_manager = NULL;
-	obj_manager = NULL;
-	palette = NULL;
-	font_manager = NULL;
-	scroll = NULL;
-	game_map = NULL;
-	map_window = NULL;
-	actor_manager = NULL;
-	player = NULL;
-	converse = NULL;
-	conv_gump = NULL;
-	command_bar = NULL;
-	new_command_bar = NULL;
-	clock = NULL;
-	party = NULL;
-	portrait = NULL;
-	view_manager = NULL;
-	egg_manager = NULL;
-	usecode = NULL;
-	effect_manager = NULL;
-	weather = NULL;
-	magic = NULL;
-	book = NULL;
-	keybinder = NULL;
+	script = nullptr;
+	background = nullptr;
+	cursor = nullptr;
+	dither = nullptr;
+	tile_manager = nullptr;
+	obj_manager = nullptr;
+	palette = nullptr;
+	font_manager = nullptr;
+	scroll = nullptr;
+	game_map = nullptr;
+	map_window = nullptr;
+	actor_manager = nullptr;
+	player = nullptr;
+	converse = nullptr;
+	conv_gump = nullptr;
+	command_bar = nullptr;
+	new_command_bar = nullptr;
+	clock = nullptr;
+	party = nullptr;
+	portrait = nullptr;
+	view_manager = nullptr;
+	egg_manager = nullptr;
+	usecode = nullptr;
+	effect_manager = nullptr;
+	weather = nullptr;
+	magic = nullptr;
+	book = nullptr;
+	keybinder = nullptr;
 
 	_playing = true;
 	converse_gump_type = CONVERSE_GUMP_DEFAULT;
@@ -209,8 +209,8 @@ bool Game::loadGame(Script *s) {
 	dither = new Dither(config);
 
 	script = s;
-	//sound_manager->LoadSongs(NULL);
-	//sound_manager->LoadObjectSamples(NULL);
+	//sound_manager->LoadSongs(nullptr);
+	//sound_manager->LoadObjectSamples(nullptr);
 
 	palette = new GamePalette(screen, config);
 
@@ -451,14 +451,14 @@ bool Game::using_new_converse_gump() {
 }
 
 void Game::delete_new_command_bar() {
-	if (new_command_bar == NULL)
+	if (new_command_bar == nullptr)
 		return;
 	new_command_bar->Delete();
-	new_command_bar = NULL;
+	new_command_bar = nullptr;
 }
 
 void Game::init_new_command_bar() {
-	if (new_command_bar != NULL)
+	if (new_command_bar != nullptr)
 		return;
 	new_command_bar = new CommandBarNewUI(this);
 	new_command_bar->Hide();
@@ -473,7 +473,7 @@ void Game::init_cursor() {
 		SDL_ShowCursor(false); // won't need the system default
 	else {
 		delete cursor;
-		cursor = NULL; // no game cursor
+		cursor = nullptr; // no game cursor
 	}
 }
 
diff --git a/engines/ultima/nuvie/core/look.cpp b/engines/ultima/nuvie/core/look.cpp
index 2e21a69df26..82c6783eadb 100644
--- a/engines/ultima/nuvie/core/look.cpp
+++ b/engines/ultima/nuvie/core/look.cpp
@@ -31,10 +31,10 @@ namespace Ultima {
 namespace Nuvie {
 
 Look::Look(Configuration *cfg)
-	: look_data(NULL), desc_buf(NULL) {
+	: look_data(nullptr), desc_buf(nullptr) {
 	config = cfg;
 
-	look_tbl[2047] = NULL;
+	look_tbl[2047] = nullptr;
 	max_len = 0;
 }
 
@@ -60,7 +60,7 @@ bool Look::init() {
 	case NUVIE_GAME_U6 :
 		config_get_path(config, "look.lzd", filename);
 		look_data = lzw.decompress_file(filename, decomp_size);
-		if (look_data == NULL)
+		if (look_data == nullptr)
 			return false;
 		break;
 	case NUVIE_GAME_MD :
@@ -104,7 +104,7 @@ bool Look::init() {
 
 // allocate space for description buffer
 	desc_buf = (char *)malloc(max_len + 1);
-	if (desc_buf == NULL)
+	if (desc_buf == nullptr)
 		return false;
 
 	return true;
@@ -118,7 +118,7 @@ const char *Look::get_description(uint16 tile_num, bool *plural) {
 	bool has_plural = false;
 
 	if (tile_num >= 2048)
-		return NULL;
+		return nullptr;
 
 	desc = look_tbl[tile_num];
 
@@ -157,7 +157,7 @@ bool Look::has_plural(uint16 tile_num) {
 
 	desc = look_tbl[tile_num];
 
-	if (desc == NULL)
+	if (desc == nullptr)
 		return false;
 
 	for (; *desc != '\0'; desc++) {
diff --git a/engines/ultima/nuvie/core/magic.cpp b/engines/ultima/nuvie/core/magic.cpp
index 9d456940e99..df1e17a5cf2 100644
--- a/engines/ultima/nuvie/core/magic.cpp
+++ b/engines/ultima/nuvie/core/magic.cpp
@@ -69,13 +69,13 @@ const int obj_n_reagent[8] = {OBJ_U6_MANDRAKE_ROOT, OBJ_U6_NIGHTSHADE, OBJ_U6_BL
 
 
 Magic::Magic() {
-	event = NULL;
-	target_object = NULL;
-	magic_script = NULL;
-	spellbook_obj = NULL;
+	event = nullptr;
+	target_object = nullptr;
+	magic_script = nullptr;
+	spellbook_obj = nullptr;
 	state = 0;
 
-	for (uint16 index = 0; index < 256; index++) spell[index] = NULL;
+	for (uint16 index = 0; index < 256; index++) spell[index] = nullptr;
 	clear_cast_buffer();
 }
 
@@ -94,7 +94,7 @@ bool Magic::read_spell_list() {
 
 Obj *Magic::book_equipped() {
 	// book(s) equipped? Maybe should check all locations?
-	Obj *obj = NULL;
+	Obj *obj = nullptr;
 	Actor *caster = event->player->get_actor();
 
 	obj = caster->inventory_get_readied_object(ACTOR_ARM);
@@ -106,7 +106,7 @@ Obj *Magic::book_equipped() {
 	if (obj && obj->obj_n == OBJ_U6_SPELLBOOK)
 		return obj;
 
-	return NULL;
+	return nullptr;
 }
 
 bool Magic::start_new_spell() {
@@ -114,7 +114,7 @@ bool Magic::start_new_spell() {
 
 	if (Game::get_game()->get_clock()->get_timer(GAMECLOCK_TIMER_U6_STORM) > 0 && !Game::get_game()->has_unlimited_casting()) {
 		event->scroll->display_string("No magic at this time!\n\n");
-	} else if (spellbook_obj != NULL) {
+	} else if (spellbook_obj != nullptr) {
 		state = MAGIC_STATE_SELECT_SPELL;
 		clear_cast_buffer();
 		event->close_gumps();
@@ -129,7 +129,7 @@ bool Magic::start_new_spell() {
 }
 
 bool Magic::cast() {
-	if (magic_script != NULL)
+	if (magic_script != nullptr)
 		return false;
 
 	Game::get_game()->get_view_manager()->close_spell_mode();
@@ -144,7 +144,7 @@ bool Magic::cast() {
 
 	if (cast_buffer_len != 0) {
 		for (index = 0; index < 256; index++) {
-			if (spell[index] == NULL) {
+			if (spell[index] == nullptr) {
 				continue;
 			}
 			if (!strcmp(spell[index]->invocation, cast_buffer_str)) {
@@ -164,7 +164,7 @@ bool Magic::cast() {
 		event->scroll->display_string("\nThat spell is not in thy spellbook!\n");
 		return false;
 	}
-//20110701 Pieter Luteijn: add an assert(spell[index]) to be sure it's not NULL?
+//20110701 Pieter Luteijn: add an assert(spell[index]) to be sure it's not nullptr?
 	if (cast_buffer_len != 0) {
 		event->scroll->display_string("\n(");
 		event->scroll->display_string(spell[index]->name);
@@ -205,19 +205,19 @@ bool Magic::cast() {
 	Obj *right = caster->inventory_get_readied_object(ACTOR_ARM);
 	Obj *left = caster->inventory_get_readied_object(ACTOR_ARM_2);
 	uint8 books = 0;
-	if (right != NULL && right->obj_n == OBJ_U6_SPELLBOOK) {
+	if (right != nullptr && right->obj_n == OBJ_U6_SPELLBOOK) {
 		books += 1;
 	};
-	if (left != NULL && left->obj_n == OBJ_U6_SPELLBOOK) {
+	if (left != nullptr && left->obj_n == OBJ_U6_SPELLBOOK) {
 		books += 2;
 	};
 
 	if (right && right->obj_n != OBJ_U6_SPELLBOOK)
-		right = NULL;
+		right = nullptr;
 	if (left && left->obj_n !=  OBJ_U6_SPELLBOOK)
-		left = NULL;
+		left = nullptr;
 
-	if (right == NULL && left == NULL) {
+	if (right == nullptr && left == nullptr) {
 		event->scroll->display_string("\nNo spellbook is readied.\n");
 		return false;
 	}
@@ -278,7 +278,7 @@ bool Magic::cast() {
 	for (uint8 shift = 0; shift < 8; shift++) {
 		if (1 << shift & spell[index]->reagents) {
 			// FIXME Although we just checked, maybe something is messed up, so we
-			// should probably check that we're not passing NULL to delete_obj
+			// should probably check that we're not passing nullptr to delete_obj
 			caster->inventory_del_object(obj_n_reagent[shift], 1, 0);
 		}
 	}
@@ -393,7 +393,7 @@ bool Magic::process_script_return(uint8 ret) {
 	Game::get_game()->get_view_manager()->close_all_gumps();
 	if (ret == NUVIE_SCRIPT_ERROR) {
 		delete magic_script;
-		magic_script = NULL;
+		magic_script = nullptr;
 		return false;
 	}
 
@@ -402,7 +402,7 @@ bool Magic::process_script_return(uint8 ret) {
 	switch (ret) {
 	case NUVIE_SCRIPT_FINISHED :
 		delete magic_script;
-		magic_script = NULL;
+		magic_script = nullptr;
 		state = MAGIC_STATE_READY;
 		break;
 	case NUVIE_SCRIPT_GET_TARGET :
@@ -445,7 +445,7 @@ Actor *Magic::get_actor_from_script() {
 	if (magic_script && (state == MAGIC_STATE_ACQUIRE_INV_OBJ || state == MAGIC_STATE_TALK_TO_ACTOR))
 		return Game::get_game()->get_actor_manager()->get_actor((uint8)magic_script->get_data());
 
-	return NULL;
+	return nullptr;
 }
 
 uint16 Magic::callback(uint16 msg, CallBack *caller, void *data) {
diff --git a/engines/ultima/nuvie/core/magic.h b/engines/ultima/nuvie/core/magic.h
index 4143f081742..f20b5b538d3 100644
--- a/engines/ultima/nuvie/core/magic.h
+++ b/engines/ultima/nuvie/core/magic.h
@@ -106,7 +106,7 @@ public:
 	bool cast();
 	void cast_spell_directly(uint8 spell_num);
 
-	uint16 callback(uint16 msg, CallBack *caller, void *data = NULL) override;
+	uint16 callback(uint16 msg, CallBack *caller, void *data = nullptr) override;
 	bool process_script_return(uint8 ret);
 	bool resume(MapCoord location);
 	bool resume(uint8 dir);
diff --git a/engines/ultima/nuvie/core/map.cpp b/engines/ultima/nuvie/core/map.cpp
index 382ed57a934..b08f08ab45a 100644
--- a/engines/ultima/nuvie/core/map.cpp
+++ b/engines/ultima/nuvie/core/map.cpp
@@ -39,12 +39,12 @@ namespace Nuvie {
 Map::Map(Configuration *cfg) {
 	config = cfg;
 
-	tile_manager = NULL;
-	obj_manager = NULL;
-	actor_manager = NULL;
-	surface = NULL;
-	roof_surface = NULL;
-	dungeons[4] = NULL;
+	tile_manager = nullptr;
+	obj_manager = nullptr;
+	actor_manager = nullptr;
+	surface = nullptr;
+	roof_surface = nullptr;
+	dungeons[4] = nullptr;
 
 	config->value(config_get_game_key(config) + "/roof_mode", roof_mode, false);
 }
@@ -52,7 +52,7 @@ Map::Map(Configuration *cfg) {
 Map::~Map() {
 	uint8 i;
 
-	if (surface == NULL)
+	if (surface == nullptr)
 		return;
 
 	free(surface);
@@ -70,7 +70,7 @@ unsigned char *Map::get_map_data(uint8 level) {
 		return surface;
 
 	if (level > 5)
-		return NULL;
+		return nullptr;
 
 	return dungeons[level - 1];
 }
@@ -79,7 +79,7 @@ uint16 *Map::get_roof_data(uint8 level) {
 	if (level == 0)
 		return roof_surface;
 
-	return NULL;
+	return nullptr;
 }
 
 Tile *Map::get_tile(uint16 x, uint16 y, uint8 level, bool original_tile) {
@@ -87,7 +87,7 @@ Tile *Map::get_tile(uint16 x, uint16 y, uint8 level, bool original_tile) {
 	uint8 *ptr;
 
 	if (level > 5)
-		return NULL;
+		return nullptr;
 
 	ptr = get_map_data(level);
 
@@ -247,7 +247,7 @@ bool Map::is_water(uint16 x, uint16 y, uint16 level, bool ignore_objects) {
 
 	if (!ignore_objects) {
 		obj = obj_manager->get_obj(x, y, level);
-		if (obj != NULL)
+		if (obj != nullptr)
 			return false;
 	}
 
@@ -312,9 +312,9 @@ uint8 Map::get_impedance(uint16 x, uint16 y, uint8 level, bool ignore_objects) {
 	if (!ignore_objects) {
 		U6LList *obj_list = obj_manager->get_obj_list(x, y, level);
 		if (obj_list) {
-			for (U6Link *link = obj_list->start(); link != NULL; link = link->next) {
+			for (U6Link *link = obj_list->start(); link != nullptr; link = link->next) {
 				Obj *obj = (Obj *)link->data;
-				if (obj != NULL) {
+				if (obj != nullptr) {
 					uint8 tile_flag = obj_manager->get_obj_tile(obj->obj_n, obj->frame_n)->flags1;
 					if ((tile_flag & TILEFLAG_BLOCKING) == 0) {
 						impedance += (tile_flag & TILEFLAG_IMPEDANCE) >> TILEFLAG_IMPEDANCE_SHIFT;
@@ -343,7 +343,7 @@ bool Map::actor_at_location(uint16 x, uint16 y, uint8 level, bool inc_surroundin
 	WRAP_COORD(x, level);
 	WRAP_COORD(y, level);
 	//check for blocking Actor at location.
-	if (actor_manager->get_actor(x, y, level, inc_surrounding_objs) != NULL)
+	if (actor_manager->get_actor(x, y, level, inc_surrounding_objs) != nullptr)
 		return true;
 
 	return false;
@@ -372,7 +372,7 @@ const char *Map::look(uint16 x, uint16 y, uint8 level) {
 	WRAP_COORD(x, level);
 	WRAP_COORD(y, level);
 	obj = obj_manager->get_obj(x, y, level);
-	if (obj != NULL && !(obj->status & OBJ_STATUS_INVISIBLE) //only show visible objects.
+	if (obj != nullptr && !(obj->status & OBJ_STATUS_INVISIBLE) //only show visible objects.
 	        && !Game::get_game()->get_map_window()->tile_is_black(obj->x, obj->y, obj)) {
 		//      tile = tile_manager->get_original_tile(obj_manager->get_obj_tile_num(obj->obj_n)+obj->frame_n);
 		//      tile_num = tile->tile_num;
@@ -406,17 +406,17 @@ bool Map::loadMap(TileManager *tm, ObjManager *om) {
 		return false;
 
 	map_data = map_file.readAll();
-	if (map_data == NULL)
+	if (map_data == nullptr)
 		return false;
 
 	chunk_data = chunks_file.readAll();
-	if (chunk_data == NULL)
+	if (chunk_data == nullptr)
 		return false;
 
 	map_ptr = map_data;
 
 	surface = (unsigned char *)malloc(1024 * 1024);
-	if (surface == NULL)
+	if (surface == nullptr)
 		return false;
 
 	for (i = 0; i < 64; i++) {
@@ -426,7 +426,7 @@ bool Map::loadMap(TileManager *tm, ObjManager *om) {
 
 	for (i = 0; i < 5; i++) {
 		dungeons[i] = (unsigned char *)malloc(256 * 256);
-		if (dungeons[i] == NULL)
+		if (dungeons[i] == nullptr)
 			return false;
 
 		insertDungeonSuperChunk(map_ptr, chunk_data, i);
@@ -516,7 +516,7 @@ void Map::set_roof_mode(bool roofs) {
 	} else {
 		if (roof_surface) {
 			free(roof_surface);
-			roof_surface = NULL;
+			roof_surface = nullptr;
 		}
 	}
 }
@@ -541,7 +541,7 @@ void Map::loadRoofData() {
 	} else {
 		if (roof_surface) {
 			free(roof_surface);
-			roof_surface = NULL;
+			roof_surface = nullptr;
 		}
 		roof_mode = false;
 	}
@@ -688,14 +688,14 @@ bool Map::testIntersection(int x, int y, uint8 level, uint8 flags, LineTestResul
 #if 0
 	if (flags & LT_HitUnpassable) {
 		if (!is_passable(x, y, level)) {
-			Result.init(x, y, level, NULL, obj_manager->get_obj(x, y, level, true));
+			Result.init(x, y, level, nullptr, obj_manager->get_obj(x, y, level, true));
 			return  true;
 		}
 	}
 
 	if (flags & LT_HitForcedPassable) {
 		if (obj_manager->is_forced_passable(x, y, level)) {
-			Result.init(x, y, level, NULL, obj_manager->get_obj(x, y, level, true));
+			Result.init(x, y, level, nullptr, obj_manager->get_obj(x, y, level, true));
 			return  true;
 		}
 	}
@@ -710,7 +710,7 @@ bool Map::testIntersection(int x, int y, uint8 level, uint8 flags, LineTestResul
 		if (!is_passable(x, y, level)) {
 			Obj *obj_hit = obj_manager->get_obj(x, y, level);
 			if (!obj_hit  || !excluded_obj || obj_hit  != excluded_obj) {
-				Result.init(x, y, level, NULL, obj_manager->get_obj(x, y, level, true));
+				Result.init(x, y, level, nullptr, obj_manager->get_obj(x, y, level, true));
 				return  true;
 			}
 		}
@@ -718,28 +718,28 @@ bool Map::testIntersection(int x, int y, uint8 level, uint8 flags, LineTestResul
 
 	if (flags & LT_HitMissileBoundary) {
 		if (is_missile_boundary(x, y, level, excluded_obj)) {
-			Result.init(x, y, level, NULL, obj_manager->get_obj(x, y, level, true));
+			Result.init(x, y, level, nullptr, obj_manager->get_obj(x, y, level, true));
 			return  true;
 		}
 	}
 
 	if (flags & LT_HitForcedPassable) {
 		if (obj_manager->is_forced_passable(x, y, level)) {
-			Result.init(x, y, level, NULL, obj_manager->get_obj(x, y, level, true));
+			Result.init(x, y, level, nullptr, obj_manager->get_obj(x, y, level, true));
 			return  true;
 		}
 	}
 
 	if (flags & LT_HitActors) {
 		if (actor_manager->get_actor(x, y, level)) {
-			Result.init(x, y, level, actor_manager->get_actor(x, y, level), NULL);
+			Result.init(x, y, level, actor_manager->get_actor(x, y, level), nullptr);
 			return  true;
 		}
 	}
 
 	if ((flags & LT_HitLocation) && Result.loc_to_hit) {
 		if (x == Result.loc_to_hit->x && y == Result.loc_to_hit->y) {
-			Result.init(x, y, level, NULL, NULL);
+			Result.init(x, y, level, nullptr, nullptr);
 			Result.loc_to_hit->z = level;
 			Result.hitLoc = Result.loc_to_hit;
 			return  true;
@@ -748,7 +748,7 @@ bool Map::testIntersection(int x, int y, uint8 level, uint8 flags, LineTestResul
 
 	if (flags & LT_HitObjects) {
 		if (obj_manager->get_obj(x, y, level)) {
-			Result.init(x, y, level, NULL, obj_manager->get_obj(x, y, level, true));
+			Result.init(x, y, level, nullptr, obj_manager->get_obj(x, y, level, true));
 			return  true;
 		}
 	}
diff --git a/engines/ultima/nuvie/core/map.h b/engines/ultima/nuvie/core/map.h
index 2032e1a9497..bca539abeb3 100644
--- a/engines/ultima/nuvie/core/map.h
+++ b/engines/ultima/nuvie/core/map.h
@@ -53,10 +53,10 @@ public:
 		hit_x = 0;
 		hit_y = 0;
 		hit_level = 0;
-		hitActor = NULL;
-		hitObj = NULL;
-		hitLoc = NULL;
-		loc_to_hit = NULL;
+		hitActor = nullptr;
+		hitObj = nullptr;
+		hitLoc = nullptr;
+		loc_to_hit = nullptr;
 	}
 	void    init(int x, int y, uint8 level, Actor *actorHit, Obj *objHit) {
 		hit_x = x;
@@ -172,7 +172,7 @@ public:
 	bool is_passable(uint16 x, uint16 y, uint8 level);
 	bool is_water(uint16 x, uint16 y, uint16 level, bool ignore_objects = false);
 	bool is_boundary(uint16 x, uint16 y, uint8 level);
-	bool is_missile_boundary(uint16 x, uint16 y, uint8 level, Obj *excluded_obj = NULL);
+	bool is_missile_boundary(uint16 x, uint16 y, uint8 level, Obj *excluded_obj = nullptr);
 	bool is_damaging(uint16 x, uint16 y, uint8 level, bool ignore_objects = false);
 	bool can_put_obj(uint16 x, uint16 y, uint8 level);
 	bool actor_at_location(uint16 x, uint16 y, uint8 level, bool inc_surrounding_objs = true);
@@ -187,9 +187,9 @@ public:
 	const char *look(uint16 x, uint16 y, uint8 level);
 
 	bool lineTest(int start_x, int start_y, int end_x, int end_y, uint8 level,
-	              uint8 flags, LineTestResult &Result, uint32 skip = 0, Obj *excluded_obj = NULL, bool want_screen_space = false); // excluded_obj only works for LT_HitUnpassable
+	              uint8 flags, LineTestResult &Result, uint32 skip = 0, Obj *excluded_obj = nullptr, bool want_screen_space = false); // excluded_obj only works for LT_HitUnpassable
 
-	bool testIntersection(int x, int y, uint8 level, uint8 flags, LineTestResult &Result, Obj *excluded_obj = NULL); // excluded_obj only works for LT_HitUnpassable
+	bool testIntersection(int x, int y, uint8 level, uint8 flags, LineTestResult &Result, Obj *excluded_obj = nullptr); // excluded_obj only works for LT_HitUnpassable
 
 	void saveRoofData();
 	Std::string getRoofTilesetFilename();
diff --git a/engines/ultima/nuvie/core/obj.cpp b/engines/ultima/nuvie/core/obj.cpp
index 17e8476fa36..f4bf7d23d62 100644
--- a/engines/ultima/nuvie/core/obj.cpp
+++ b/engines/ultima/nuvie/core/obj.cpp
@@ -34,8 +34,8 @@ Obj::Obj() {
 	frame_n = 0;
 	qty = 0;
 	quality = 0;
-	parent = NULL;
-	container = NULL;
+	parent = nullptr;
+	container = nullptr;
 	x = 0;
 	y = 0;
 	z = 0;
@@ -44,19 +44,19 @@ Obj::Obj() {
 Obj::Obj(Obj *sobj) {
 	memcpy(this, sobj, sizeof(Obj));
 
-	parent = NULL;
-	container = NULL;
+	parent = nullptr;
+	container = nullptr;
 }
 
 void Obj::make_container() {
-	if (container == NULL)
+	if (container == nullptr)
 		container = new U6LList();
 
 	return;
 }
 
 Obj *Obj::get_container_obj(bool recursive) {
-	Obj *obj = (is_in_container() ? (Obj *)parent : NULL);
+	Obj *obj = (is_in_container() ? (Obj *)parent : nullptr);
 
 	if (recursive) {
 		while (obj && obj->is_in_container())
@@ -107,7 +107,7 @@ void Obj::set_ok_to_take(bool flag, bool recursive) {
 		status ^= OBJ_STATUS_OK_TO_TAKE;
 
 	if (recursive && container) {
-		for (U6Link *link = container->start(); link != NULL; link = link->next) {
+		for (U6Link *link = container->start(); link != nullptr; link = link->next) {
 			Obj *obj = (Obj *)link->data;
 			obj->set_ok_to_take(flag, recursive);
 		}
@@ -129,7 +129,7 @@ void Obj::readied() { //set_readied() ??
 }
 
 void Obj::set_noloc() {
-	parent = NULL;
+	parent = nullptr;
 	nuvie_status &= NUVIE_OBJ_STATUS_LOC_MASK_SET; //clear location bits 0 = no loc
 
 	return;
@@ -188,12 +188,12 @@ Actor *Obj::get_actor_holding_obj() {
 		break;
 	}
 
-	return NULL;
+	return nullptr;
 }
 
 //Add child object into container, stacking if required
 void Obj::add(Obj *obj, bool stack, bool addAtTail) {
-	if (container == NULL)
+	if (container == nullptr)
 		make_container();
 
 	if (stack && Game::get_game()->get_obj_manager()->is_stackable(obj))
@@ -214,7 +214,7 @@ void Obj::add_and_stack(Obj *obj, bool addAtTail) {
 	Obj *cont_obj;
 
 	//should we recurse through nested containers?
-	for (link = container->start(); link != NULL;) {
+	for (link = container->start(); link != nullptr;) {
 		cont_obj = (Obj *)link->data;
 		link = link->next;
 		//match on obj_n, frame_n and quality.
@@ -237,7 +237,7 @@ void Obj::add_and_stack(Obj *obj, bool addAtTail) {
 
 //Remove child object from container.
 bool Obj::remove(Obj *obj) {
-	if (container == NULL)
+	if (container == nullptr)
 		return false;
 
 	if (container->remove(obj) == false)
@@ -259,17 +259,17 @@ Obj *Obj::find_in_container(uint16 objN, uint8 quality_, bool match_quality, uin
 	U6Link *link;
 	Obj *obj;
 
-	if (container == NULL)
-		return NULL;
+	if (container == nullptr)
+		return nullptr;
 
-	for (link = container->start(); link != NULL; link = link->next) {
+	for (link = container->start(); link != nullptr; link = link->next) {
 		obj = (Obj *)link->data;
 		if (obj) {
 			if (obj->obj_n == objN && (match_quality == false || obj->quality == quality_) && (match_frame_n == false || obj->frame_n == frameN)) {
-				if (prev_obj != NULL && obj == *prev_obj)
-					prev_obj = NULL;
+				if (prev_obj != nullptr && obj == *prev_obj)
+					prev_obj = nullptr;
 				else {
-					if (prev_obj == NULL || *prev_obj == NULL)
+					if (prev_obj == nullptr || *prev_obj == nullptr)
 						return obj;
 				}
 			}
@@ -282,7 +282,7 @@ Obj *Obj::find_in_container(uint16 objN, uint8 quality_, bool match_quality, uin
 		}
 	}
 
-	return NULL;
+	return nullptr;
 }
 
 uint32 Obj::get_total_qty(uint16 match_obj_n) {
@@ -297,8 +297,8 @@ uint32 Obj::get_total_qty(uint16 match_obj_n) {
 			total_qty += qty;
 	}
 
-	if (container != NULL) {
-		for (link = container->start(); link != NULL; link = link->next) {
+	if (container != nullptr) {
+		for (link = container->start(); link != nullptr; link = link->next) {
 			obj = (Obj *)link->data;
 			if (obj) {
 				if (obj->container)
@@ -320,8 +320,8 @@ uint32 Obj::container_count_objects() {
 	uint32 count = 0;
 	U6Link *link;
 
-	if (container != NULL) {
-		for (link = container->start(); link != NULL; link = link->next) {
+	if (container != nullptr) {
+		for (link = container->start(); link != nullptr; link = link->next) {
 			++count;
 		}
 	}
diff --git a/engines/ultima/nuvie/core/obj.h b/engines/ultima/nuvie/core/obj.h
index e92f49fdedc..2c46fddd36a 100644
--- a/engines/ultima/nuvie/core/obj.h
+++ b/engines/ultima/nuvie/core/obj.h
@@ -149,7 +149,7 @@ public:
 	}
 
 	bool has_container() {
-		return (container != NULL);
+		return (container != nullptr);
 	}
 	void make_container();
 	Obj *get_container_obj(bool recursive = false);
@@ -177,7 +177,7 @@ public:
 
 	bool remove(Obj *obj);
 
-	Obj *find_in_container(uint16 obj_n, uint8 quality, bool match_quality = OBJ_MATCH_QUALITY, uint8 frame_n = 0, bool match_frame_n = OBJ_NOMATCH_FRAME_N, Obj **prev_obj = NULL);
+	Obj *find_in_container(uint16 obj_n, uint8 quality, bool match_quality = OBJ_MATCH_QUALITY, uint8 frame_n = 0, bool match_frame_n = OBJ_NOMATCH_FRAME_N, Obj **prev_obj = nullptr);
 
 	uint32 get_total_qty(uint16 match_obj_n);
 
diff --git a/engines/ultima/nuvie/core/obj_manager.cpp b/engines/ultima/nuvie/core/obj_manager.cpp
index 6a9fb74aaac..cacfd3939be 100644
--- a/engines/ultima/nuvie/core/obj_manager.cpp
+++ b/engines/ultima/nuvie/core/obj_manager.cpp
@@ -56,7 +56,7 @@ ObjManager::ObjManager(Configuration *cfg, TileManager *tm, EggManager *em) {
 	config = cfg;
 	tile_manager = tm;
 	egg_manager = em;
-	usecode = NULL;
+	usecode = nullptr;
 	obj_save_count = 0;
 
 	load_basetile();
@@ -239,7 +239,7 @@ bool ObjManager::save_super_chunk(NuvieIO *save_buf, uint8 level, uint8 chunk_of
 	obj_save_count = 0;
 
 	for (; item;) {
-		for (link = item->obj_list->end(); link != NULL; link = link->prev) {
+		for (link = item->obj_list->end(); link != nullptr; link = link->prev) {
 			if (((Obj *)link->data)->obj_n != egg_type) // we don't save eggs here. They are saved in save_eggs()
 				save_obj(save_buf, (Obj *)link->data, obj_save_count);
 		}
@@ -298,8 +298,8 @@ bool ObjManager::save_inventories(NuvieIO *save_buf) {
 	obj_save_count = 0;
 
 	for (i = 0; i < 256; i++) {
-		if (actor_inventories[i] != NULL) {
-			for (link = actor_inventories[i]->start(); link != NULL; link = link->next) {
+		if (actor_inventories[i] != nullptr) {
+			for (link = actor_inventories[i]->start(); link != nullptr; link = link->next) {
 				save_obj(save_buf, (Obj *)link->data, obj_save_count);
 			}
 		}
@@ -382,7 +382,7 @@ bool ObjManager::save_obj(NuvieIO *save_buf, Obj *obj, uint16 parent_objblk_n) {
 	obj_save_count += 1;
 
 	if (obj->container) {
-		for (link = obj->container->start(); link != NULL; link = link->next)
+		for (link = obj->container->start(); link != nullptr; link = link->next)
 			save_obj(save_buf, (Obj *)link->data, objblk_n);
 	}
 
@@ -419,7 +419,7 @@ void ObjManager::clean_actor_inventories() {
 
 	for (i = 0; i < 256; i++) {
 		if (actor_inventories[i]) {
-			for (link = actor_inventories[i]->start(); link != NULL;) {
+			for (link = actor_inventories[i]->start(); link != nullptr;) {
 				Obj *obj = (Obj *)link->data;
 				link = link->next;
 				delete_obj(obj);
@@ -463,10 +463,10 @@ bool ObjManager::is_boundary(uint16 x, uint16 y, uint8 level, uint8 boundary_typ
 		for (i = x; i <= x + 1; i++) {
 			obj_list = get_obj_list(WRAPPED_COORD(i, level), WRAPPED_COORD(j, level), level);
 
-			if (obj_list != NULL) {
+			if (obj_list != nullptr) {
 				link = obj_list->end();
 
-				for (check_tile = false; link != NULL; link = link->prev) {
+				for (check_tile = false; link != nullptr; link = link->prev) {
 					obj = (Obj *)link->data;
 					if (obj == excluded_obj)
 						continue;
@@ -532,13 +532,13 @@ uint8 ObjManager::is_passable(uint16 x, uint16 y, uint8 level) {
 		for (j = y;; j = y2) { // only checks y and y2
 			obj_list = get_obj_list(i, j, level);
 			if (i == x && j == y && obj_list) {
-				if (obj_list->end() != NULL)
+				if (obj_list->end() != nullptr)
 					object_at_location = true;
 			}
-			if (obj_list != NULL) {
+			if (obj_list != nullptr) {
 				link = obj_list->end();
 
-				for (check_tile = false; link != NULL; link = link->prev) {
+				for (check_tile = false; link != nullptr; link = link->prev) {
 					obj = (Obj *)link->data;
 					tile_num = get_obj_tile_num(obj->obj_n) + obj->frame_n;
 					tile = tile_manager->get_original_tile(tile_num);
@@ -588,7 +588,7 @@ bool ObjManager::is_forced_passable(uint16 x, uint16 y, uint8 level) {
 	obj_list = get_obj_list(x, y, level);
 
 	if (obj_list) {
-		for (link = obj_list->start(); link != NULL; link = link->next) {
+		for (link = obj_list->start(); link != nullptr; link = link->next) {
 			obj = (Obj *)link->data;
 			tile = tile_manager->get_tile(get_obj_tile_num(obj->obj_n) + obj->frame_n);
 			if (tile->flags3 & TILEFLAG_FORCED_PASSABLE)
@@ -605,7 +605,7 @@ bool ObjManager::is_door(uint16 x, uint16 y, uint8 level) {
 	Obj *obj;
 
 	if (obj_list) {
-		for (link = obj_list->start(); link != NULL; link = link->next) {
+		for (link = obj_list->start(); link != nullptr; link = link->next) {
 			obj = (Obj *)link->data;
 			if (usecode->is_door(obj))
 				return true;
@@ -623,7 +623,7 @@ bool ObjManager::is_damaging(uint16 x, uint16 y, uint8 level) {
 	obj_list = get_obj_list(x, y, level);
 
 	if (obj_list) {
-		for (link = obj_list->start(); link != NULL; link = link->next) {
+		for (link = obj_list->start(); link != nullptr; link = link->next) {
 			obj = (Obj *)link->data;
 			tile = tile_manager->get_original_tile(get_obj_tile_num(obj->obj_n) + obj->frame_n); //get_tile(get_obj_tile_num(obj->obj_n)+obj->frame_n);
 			if (tile->flags1 & TILEFLAG_DAMAGING)
@@ -637,7 +637,7 @@ bool ObjManager::is_damaging(uint16 x, uint16 y, uint8 level) {
 bool ObjManager::is_stackable(Obj *obj) {
 // Tile *tile;
 
-	if (obj == NULL)
+	if (obj == nullptr)
 		return false;
 	if (obj->is_readied()) // readied objects cannot be stacked --SB-X
 		return false;
@@ -812,7 +812,7 @@ bool ObjManager::is_breakable(Obj *obj) {
 }
 
 bool ObjManager::can_store_obj(Obj *target, Obj *src) {
-	if (target == src || !can_get_obj(src) || target == NULL)
+	if (target == src || !can_get_obj(src) || target == nullptr)
 		return false;
 
 	if (game_type == NUVIE_GAME_U6) {
@@ -915,7 +915,7 @@ bool ObjManager::can_get_obj(Obj *obj) {
 	// excluding container items here, we just want the object itself to
 	// check if it weighs 0 or 255. no need to scale as we don't compare
 	// with other weights
-	if (obj == NULL)
+	if (obj == nullptr)
 		return false;
 	if (Game::get_game()->get_script()->call_can_get_obj_override(obj))
 		return true;
@@ -1036,7 +1036,7 @@ U6LList *ObjManager::get_obj_list(uint16 x, uint16 y, uint8 level) {
 	if (item)
 		return item->obj_list;
 
-	return NULL;
+	return nullptr;
 }
 
 Tile *ObjManager::get_obj_tile(uint16 obj_n, uint8 frame_n) {
@@ -1049,8 +1049,8 @@ Tile *ObjManager::get_obj_tile(uint16 x, uint16 y, uint8 level, bool top_obj) {
 	uint16 tile_num;
 
 	obj = get_obj(x, y, level, top_obj);
-	if (obj == NULL)
-		return NULL;
+	if (obj == nullptr)
+		return nullptr;
 
 	tile_num = get_obj_tile_num(obj->obj_n) + obj->frame_n;
 	tile = tile_manager->get_tile(tile_num);
@@ -1069,12 +1069,12 @@ Tile *ObjManager::get_obj_dmg_tile(uint16 x, uint16 y, uint8 level) {
 	Tile *tile;
 	U6LList *obj_list;
 	U6Link *link;
-	Obj *obj = NULL;
+	Obj *obj = nullptr;
 
 	obj_list = get_obj_list(x, y, level);
 
-	if (obj_list != NULL) {
-		for (link = obj_list->end(); link != NULL; link = link->prev) {
+	if (obj_list != nullptr) {
+		for (link = obj_list->end(); link != nullptr; link = link->prev) {
 			obj = (Obj *)link->data;
 			tile = tile_manager->get_original_tile(get_obj_tile_num(obj->obj_n) + obj->frame_n);
 
@@ -1083,7 +1083,7 @@ Tile *ObjManager::get_obj_dmg_tile(uint16 x, uint16 y, uint8 level) {
 		}
 	}
 
-	return NULL;
+	return nullptr;
 }
 
 bool ObjManager::obj_is_damaging(Obj *obj, Actor *actor) {
@@ -1111,32 +1111,32 @@ Obj *ObjManager::get_obj(uint16 x, uint16 y, uint8 level, bool top_obj, bool inc
 	Tile *tile;
 
 	obj = get_objBasedAt(x, y, level, top_obj, include_ignored_objects, excluded_obj);
-	if (obj != NULL)
+	if (obj != nullptr)
 		return obj;
 
 	obj = get_objBasedAt(x + 1, y + 1, level, top_obj, include_ignored_objects, excluded_obj);
-	if (obj != NULL) {
+	if (obj != nullptr) {
 		tile = tile_manager->get_tile(get_obj_tile_num(obj->obj_n) + obj->frame_n);
 		if (tile->dbl_width && tile->dbl_height)
 			return obj;
 	}
 
 	obj = get_objBasedAt(x, y + 1, level, top_obj, include_ignored_objects, excluded_obj);
-	if (obj != NULL) {
+	if (obj != nullptr) {
 		tile = tile_manager->get_tile(get_obj_tile_num(obj->obj_n) + obj->frame_n);
 		if (tile->dbl_height)
 			return obj;
 	}
 
 	obj = get_objBasedAt(x + 1, y, level, top_obj, include_ignored_objects, excluded_obj);
-	if (obj != NULL) {
+	if (obj != nullptr) {
 		tile = tile_manager->get_tile(get_obj_tile_num(obj->obj_n) + obj->frame_n);
 		if (tile->dbl_width)
 			return obj;
 	}
 
 
-	return NULL;
+	return nullptr;
 }
 
 Obj *ObjManager::get_obj_of_type_from_location_inc_multi_tile(uint16 obj_n, uint16 x, uint16 y, uint8 z) {
@@ -1148,31 +1148,31 @@ Obj *ObjManager::get_obj_of_type_from_location_inc_multi_tile(uint16 obj_n, sint
 	Tile *tile;
 
 	obj = get_obj_of_type_from_location(obj_n, quality, qty, x, y, z);
-	if (obj != NULL)
+	if (obj != nullptr)
 		return obj;
 
 	obj = get_obj_of_type_from_location(obj_n, quality, qty, x + 1, y + 1, z);
-	if (obj != NULL) {
+	if (obj != nullptr) {
 		tile = tile_manager->get_tile(get_obj_tile_num(obj->obj_n) + obj->frame_n);
 		if (tile->dbl_width && tile->dbl_height)
 			return obj;
 	}
 
 	obj = get_obj_of_type_from_location(obj_n, quality, qty, x, y + 1, z);
-	if (obj != NULL) {
+	if (obj != nullptr) {
 		tile = tile_manager->get_tile(get_obj_tile_num(obj->obj_n) + obj->frame_n);
 		if (tile->dbl_height)
 			return obj;
 	}
 
 	obj = get_obj_of_type_from_location(obj_n, quality, qty, x + 1, y, z);
-	if (obj != NULL) {
+	if (obj != nullptr) {
 		tile = tile_manager->get_tile(get_obj_tile_num(obj->obj_n) + obj->frame_n);
 		if (tile->dbl_width)
 			return obj;
 	}
 
-	return NULL;
+	return nullptr;
 }
 
 
@@ -1187,10 +1187,10 @@ Obj *ObjManager::get_obj_of_type_from_location(uint16 obj_n, sint16 quality, sin
 
 	obj_list = get_obj_list(x, y, z);
 
-	if (obj_list == NULL)
-		return NULL;
+	if (obj_list == nullptr)
+		return nullptr;
 // start from the top of the stack
-	for (link = obj_list->end(); link != NULL; link = link->prev) {
+	for (link = obj_list->end(); link != nullptr; link = link->prev) {
 		obj = (Obj *)link->data;
 		if (obj->obj_n == obj_n) {
 			if (quality != -1 && obj->quality != (uint8)quality)
@@ -1203,7 +1203,7 @@ Obj *ObjManager::get_obj_of_type_from_location(uint16 obj_n, sint16 quality, sin
 		}
 	}
 
-	return NULL;
+	return nullptr;
 }
 
 // x, y in world coords
@@ -1214,13 +1214,13 @@ Obj *ObjManager::get_objBasedAt(uint16 x, uint16 y, uint8 level, bool top_obj, b
 
 	obj_list = get_obj_list(x, y, level);
 
-	if (obj_list != NULL) {
+	if (obj_list != nullptr) {
 		if (top_obj)
 			link = obj_list->end();
 		else
 			link = obj_list->start();
 
-		while (link != NULL) {
+		while (link != nullptr) {
 			obj = (Obj *)link->data;
 
 			if (obj != excluded_obj) {
@@ -1239,7 +1239,7 @@ Obj *ObjManager::get_objBasedAt(uint16 x, uint16 y, uint8 level, bool top_obj, b
 		}
 	}
 
-	return NULL;
+	return nullptr;
 }
 
 // ObjManager keeps one instance of tile_obj per object.
@@ -1252,7 +1252,7 @@ Obj *ObjManager::get_tile_obj(uint16 obj_n) {
 	}
 	Obj *obj = new Obj();
 	obj->obj_n = obj_n;
-	obj->set_on_map(NULL);
+	obj->set_on_map(nullptr);
 	tile_obj_list.push_back(obj);
 	return obj;
 }
@@ -1272,7 +1272,7 @@ bool ObjManager::remove_obj_from_map(Obj *obj) {
 
 	obj_list = (U6LList *)obj->parent;
 
-	if (obj_list == NULL)
+	if (obj_list == nullptr)
 		return false;
 
 	obj_list->remove(obj);
@@ -1304,8 +1304,8 @@ bool ObjManager::remove_obj_type_from_location(uint16 obj_n, uint16 x, uint16 y,
 
 	obj_list = get_obj_list(x, y, z);
 
-	if (obj_list != NULL) {
-		for (link = obj_list->start(); link != NULL;) {
+	if (obj_list != nullptr) {
+		for (link = obj_list->start(); link != nullptr;) {
 			obj = (Obj *)link->data;
 			link = link->next;
 
@@ -1323,8 +1323,8 @@ bool ObjManager::remove_obj_type_from_location(uint16 obj_n, uint16 x, uint16 y,
 Obj *ObjManager::copy_obj(Obj *obj) {
 	Obj *new_obj;
 
-	if (obj == NULL)
-		return NULL;
+	if (obj == nullptr)
+		return nullptr;
 
 	new_obj = new Obj(*obj);
 	/* changed to direct copy in case we add new members to Obj --SB-X
@@ -1362,8 +1362,8 @@ bool ObjManager::move(Obj *obj, uint16 x, uint16 y, uint8 level) {
  */
 const char *ObjManager::look_obj(Obj *obj, bool show_prefix) {
 	const char *desc;
-	if (obj == NULL)
-		return NULL;
+	if (obj == nullptr)
+		return nullptr;
 
 	desc = tile_manager->lookAtTile(get_obj_tile_num(obj) + obj->frame_n, obj->qty, show_prefix);
 
@@ -1411,8 +1411,8 @@ float ObjManager::get_obj_weight(Obj *obj, bool include_container_items, bool sc
 		}
 	}
 
-	if (obj->container != NULL && include_container_items == OBJ_WEIGHT_INCLUDE_CONTAINER_ITEMS) {
-		for (link = obj->container->start(); link != NULL; link = link->next)
+	if (obj->container != nullptr && include_container_items == OBJ_WEIGHT_INCLUDE_CONTAINER_ITEMS) {
+		for (link = obj->container->start(); link != nullptr; link = link->next)
 			/* weight += get_obj_weight(reinterpret_cast<Obj*>(link->data), false);*/ //don't scale container objects yet.
 			weight += get_obj_weight(reinterpret_cast<Obj *>(link->data), OBJ_WEIGHT_INCLUDE_CONTAINER_ITEMS, OBJ_WEIGHT_DONT_SCALE); //don't scale container objects yet. luteijn: and use the right flag to do so!
 	}
@@ -1493,9 +1493,9 @@ void ObjManager::animate_backwards(Obj *obj, uint32 loop_count) {
 
 U6LList *ObjManager::get_actor_inventory(uint16 actor_num) {
 	if (actor_num >= 256)
-		return NULL;
+		return nullptr;
 
-	if (actor_inventories[actor_num] == NULL) {
+	if (actor_inventories[actor_num] == nullptr) {
 		actor_inventories[actor_num] = new U6LList();
 	}
 
@@ -1503,8 +1503,8 @@ U6LList *ObjManager::get_actor_inventory(uint16 actor_num) {
 }
 
 bool ObjManager::actor_has_inventory(uint16 actor_num) {
-	if (actor_inventories[actor_num] != NULL) {
-		if (actor_inventories[actor_num]->start() != NULL)
+	if (actor_inventories[actor_num] != nullptr) {
+		if (actor_inventories[actor_num]->start() != nullptr)
 			return true;
 	}
 
@@ -1512,8 +1512,8 @@ bool ObjManager::actor_has_inventory(uint16 actor_num) {
 }
 
 Obj *ObjManager::find_next_obj(uint8 level, Obj *prev_obj, bool match_frame_n, bool match_quality) {
-	if (prev_obj == NULL)
-		return NULL;
+	if (prev_obj == nullptr)
+		return nullptr;
 
 	Obj **p = &prev_obj;
 
@@ -1527,16 +1527,16 @@ Obj *ObjManager::find_obj(uint8 level, uint16 obj_n, uint8 quality, bool match_q
 	if (level == 0) {
 		for (i = 0; i < 64; i++) {
 			new_obj = find_obj_in_tree(obj_n, quality, match_quality, frame_n, match_frame_n, prev_obj, surface[i]);
-			if (new_obj != NULL)
+			if (new_obj != nullptr)
 				return new_obj;
 		}
 	} else {
 		new_obj = find_obj_in_tree(obj_n, quality, match_quality, frame_n, match_frame_n, prev_obj, dungeon[level - 1]);
-		if (new_obj != NULL)
+		if (new_obj != nullptr)
 			return new_obj;
 	}
 
-	return NULL;
+	return nullptr;
 }
 
 inline Obj *ObjManager::find_obj_in_tree(uint16 obj_n, uint8 quality, bool match_quality, uint8 frame_n, bool match_frame_n, Obj **prev_obj, iAVLTree *obj_tree) {
@@ -1547,20 +1547,20 @@ inline Obj *ObjManager::find_obj_in_tree(uint16 obj_n, uint8 quality, bool match
 
 	node = (ObjTreeNode *)iAVLFirst(&cursor, obj_tree);
 
-	for (; node != NULL;) {
+	for (; node != nullptr;) {
 		link = ((U6LList *)(node->obj_list))->start();
-		for (; link != NULL; link = link->next) {
+		for (; link != nullptr; link = link->next) {
 			new_obj = (Obj *)link->data;
 			if (new_obj->obj_n == obj_n && (match_quality == false || new_obj->quality == quality) && (match_frame_n == false || new_obj->frame_n == frame_n)) {
-				if (prev_obj != NULL && new_obj == *prev_obj)
-					*prev_obj = NULL;
+				if (prev_obj != nullptr && new_obj == *prev_obj)
+					*prev_obj = nullptr;
 				else {
-					if (prev_obj == NULL || *prev_obj == NULL)
+					if (prev_obj == nullptr || *prev_obj == nullptr)
 						return new_obj;
 				}
 			}
 			/* Don't search containers.
-			     if(prev_obj == NULL)
+			     if(prev_obj == nullptr)
 			     {
 			         new_obj = new_obj->find_in_container(obj_n, quality, match_quality, frame_n, match_frame_n, prev_obj);
 			         if(new_obj)
@@ -1572,7 +1572,7 @@ inline Obj *ObjManager::find_obj_in_tree(uint16 obj_n, uint8 quality, bool match
 		node = (ObjTreeNode *)iAVLNext(&cursor);
 	}
 
-	return NULL;
+	return nullptr;
 }
 
 bool ObjManager::add_obj(Obj *obj, bool addOnTop) {
@@ -1586,7 +1586,7 @@ bool ObjManager::add_obj(Obj *obj, bool addOnTop) {
 
 	node = (ObjTreeNode *)iAVLSearch(obj_tree, key);
 
-	if (node == NULL) {
+	if (node == nullptr) {
 		obj_list = new U6LList();
 
 		node = new ObjTreeNode;
@@ -1612,13 +1612,13 @@ bool ObjManager::add_obj(Obj *obj, bool addOnTop) {
 }
 bool ObjManager::addObjToContainer(U6LList *llist, Obj *obj) {
 	U6Link *link;
-	Obj *c_obj = NULL; //container object
+	Obj *c_obj = nullptr; //container object
 	uint16 index;
 
 	index = ((obj->y & 0x3f) << 10) + obj->x; //10 bits from x and 6 bits from y
 
 	link = llist->gotoPos(index);
-	if (link != NULL)
+	if (link != nullptr)
 		c_obj = (Obj *)link->data;
 
 	if (c_obj) { // we've found our container.
@@ -1645,10 +1645,10 @@ Obj *ObjManager::loadObj(NuvieIO *buf) {
 //set new nuvie location bits.
 	switch (obj->status & OBJ_STATUS_MASK_GET) {
 	case OBJ_STATUS_ON_MAP :
-		obj->set_on_map(NULL);
+		obj->set_on_map(nullptr);
 		break;//obj->nuvie_status |= OBJ_LOC_MAP; break;
 	case OBJ_STATUS_IN_CONTAINER :
-		obj->set_in_container(NULL);
+		obj->set_in_container(nullptr);
 		break;//obj->nuvie_status |= OBJ_LOC_CONT; break;
 	case OBJ_STATUS_IN_INVENTORY :
 		obj->set_in_inventory();
@@ -1696,7 +1696,7 @@ iAVLTree *ObjManager::get_obj_tree(uint16 x, uint16 y, uint8 level) {
 	}
 
 	if (level > 5)
-		return NULL;
+		return nullptr;
 
 	return dungeon[level - 1];
 }
@@ -1749,7 +1749,7 @@ void ObjManager::update(uint16 x, uint16 y, uint8 z, bool teleport) {
 }
 
 bool ObjManager::temp_obj_list_add(Obj *obj) {
-	if (obj == NULL)
+	if (obj == nullptr)
 		return false;
 
 	temp_obj_list.push_back(obj);
@@ -1860,9 +1860,9 @@ inline void ObjManager::print_egg_tree(iAVLTree *obj_tree) {
 
 	tree_node = (ObjTreeNode *)iAVLFirst(&cursor, obj_tree);
 
-	for (; tree_node != NULL; tree_node = (ObjTreeNode *)iAVLNext(&cursor)) {
+	for (; tree_node != nullptr; tree_node = (ObjTreeNode *)iAVLNext(&cursor)) {
 		obj_list = (U6LList *)tree_node->obj_list;
-		for (link = obj_list->start(); link != NULL; link = link->next) {
+		for (link = obj_list->start(); link != nullptr; link = link->next) {
 			obj = (Obj *)link->data;
 			if (obj->obj_n == 335) {
 				print_obj(obj, false);
@@ -1876,10 +1876,10 @@ inline void ObjManager::print_egg_tree(iAVLTree *obj_tree) {
 void ObjManager::print_obj(Obj *obj, bool in_container, uint8 indent) {
 	U6Link *link;
 	Obj *container_obj;
-	const CombatType *c_type = NULL;
+	const CombatType *c_type = nullptr;
 	Actor *a = Game::get_game()->get_player()->get_actor();
 
-	if (a != NULL)
+	if (a != nullptr)
 		c_type = a->get_object_combat_type(obj->obj_n);
 
 	DEBUG(1, LEVEL_INFORMATIONAL, "\n");
@@ -1987,7 +1987,7 @@ void ObjManager::print_obj(Obj *obj, bool in_container, uint8 indent) {
 	DEBUG(1, LEVEL_INFORMATIONAL, "Quantity: %d\n", obj->qty);
 	print_indent(LEVEL_INFORMATIONAL, indent);
 	DEBUG(1, LEVEL_INFORMATIONAL, "Quality: %d\n", obj->quality);
-	if (c_type != NULL) {
+	if (c_type != nullptr) {
 		DEBUG(1, LEVEL_INFORMATIONAL, "attack/damage = %d, defence/defense = %d\n", c_type->damage, c_type->defense); // FIXME add the rest of the combat values
 	}
 
@@ -1997,7 +1997,7 @@ void ObjManager::print_obj(Obj *obj, bool in_container, uint8 indent) {
 		print_indent(LEVEL_INFORMATIONAL, indent);
 		DEBUG(1, LEVEL_INFORMATIONAL, "---------");
 
-		for (link = obj->container->start(); link != NULL; link = link->next) {
+		for (link = obj->container->start(); link != nullptr; link = link->next) {
 			container_obj = (Obj *)link->data;
 			print_obj(container_obj, true, indent + 2);
 		}
@@ -2032,7 +2032,7 @@ void delete_obj(Obj *obj) {
 
 	if (obj->is_script_obj() == false) {
 		if (obj->container) {
-			for (link = obj->container->start(); link != NULL;) {
+			for (link = obj->container->start(); link != nullptr;) {
 				Obj *cont_obj = (Obj *)link->data;
 				link = link->next;
 
@@ -2065,7 +2065,7 @@ bool ObjManager::list_add_obj(U6LList *llist, Obj *obj, bool stack_objects, uint
 	assert(pos == 0 || pos < llist->count());
 
 	if (stack_objects && is_stackable(obj)) {
-		for (link = llist->start(); link != NULL;) {
+		for (link = llist->start(); link != nullptr;) {
 			stack_with = (Obj *)link->data;
 			link = link->next;
 
@@ -2112,9 +2112,9 @@ inline void ObjManager::start_obj_usecode(iAVLTree *obj_tree) {
 	Obj *obj;
 
 	tree_node = (ObjTreeNode *)iAVLFirst(&cursor, obj_tree);
-	for (; tree_node != NULL; tree_node = (ObjTreeNode *)iAVLNext(&cursor)) {
+	for (; tree_node != nullptr; tree_node = (ObjTreeNode *)iAVLNext(&cursor)) {
 		obj_list = (U6LList *)tree_node->obj_list;
-		for (link = obj_list->start(); link != NULL; link = link->next) {
+		for (link = obj_list->start(); link != nullptr; link = link->next) {
 			obj = (Obj *)link->data;
 			if (usecode->has_loadcode(obj))
 				usecode->load_obj(obj);
@@ -2145,7 +2145,7 @@ void clean_obj_tree_node(void *node) {
 	U6Link *link;
 	ObjTreeNode *obj_node = (ObjTreeNode *)node;
 
-	for (link = obj_node->obj_list->start(); link != NULL;) {
+	for (link = obj_node->obj_list->start(); link != nullptr;) {
 		Obj *obj = (Obj *)link->data;
 		link = link->next;
 
diff --git a/engines/ultima/nuvie/core/obj_manager.h b/engines/ultima/nuvie/core/obj_manager.h
index 81aa8363e9a..866c316b6cb 100644
--- a/engines/ultima/nuvie/core/obj_manager.h
+++ b/engines/ultima/nuvie/core/obj_manager.h
@@ -137,7 +137,7 @@ public:
 	}
 
 //U6LList *get_obj_superchunk(uint16 x, uint16 y, uint8 level);
-	bool is_boundary(uint16 x, uint16 y, uint8 level, uint8 boundary_type = TILEFLAG_BOUNDARY, Obj *excluded_obj = NULL);
+	bool is_boundary(uint16 x, uint16 y, uint8 level, uint8 boundary_type = TILEFLAG_BOUNDARY, Obj *excluded_obj = nullptr);
 //bool is_door(Obj * obj);
 	bool is_damaging(uint16 x, uint16 y, uint8 level);
 	uint8 is_passable(uint16 x, uint16 y, uint8 level);
@@ -151,7 +151,7 @@ public:
 		return has_reduced_weight(obj->obj_n);
 	}
 	bool has_toptile(Obj *obj);
-	bool obj_is_damaging(Obj *obj, Actor *actor = NULL); // if actor, it will damage and display text
+	bool obj_is_damaging(Obj *obj, Actor *actor = nullptr); // if actor, it will damage and display text
 	bool is_door(uint16 x, uint16 y, uint8 level);
 
 	U6LList *get_obj_list(uint16 x, uint16 y, uint8 level);
@@ -159,12 +159,12 @@ public:
 	Tile *get_obj_tile(uint16 obj_n, uint8 frame_n);
 	Tile *get_obj_tile(uint16 x, uint16 y, uint8 level, bool top_obj = true);
 	Tile *get_obj_dmg_tile(uint16 x, uint16 y, uint8 level);
-	Obj *get_obj(uint16 x, uint16 y, uint8 level, bool top_obj = OBJ_SEARCH_TOP, bool include_ignored_objects = OBJ_EXCLUDE_IGNORED, Obj *excluded_obj = NULL);
+	Obj *get_obj(uint16 x, uint16 y, uint8 level, bool top_obj = OBJ_SEARCH_TOP, bool include_ignored_objects = OBJ_EXCLUDE_IGNORED, Obj *excluded_obj = nullptr);
 	Obj *get_obj_of_type_from_location_inc_multi_tile(uint16 obj_n, uint16 x, uint16 y, uint8 z);
 	Obj *get_obj_of_type_from_location_inc_multi_tile(uint16 obj_n, sint16 quality, sint32 qty, uint16 x, uint16 y, uint8 z);
 	Obj *get_obj_of_type_from_location(uint16 obj_n, uint16 x, uint16 y, uint8 z);
 	Obj *get_obj_of_type_from_location(uint16 obj_n, sint16 quality, sint32 qty, uint16 x, uint16 y, uint8 z);
-	Obj *get_objBasedAt(uint16 x, uint16 y, uint8 level, bool top_obj, bool include_ignored_objects = true, Obj *excluded_obj = NULL);
+	Obj *get_objBasedAt(uint16 x, uint16 y, uint8 level, bool top_obj, bool include_ignored_objects = true, Obj *excluded_obj = nullptr);
 	Obj *get_tile_obj(uint16 obj_n);
 
 	uint16 get_obj_tile_num(uint16 obj_num);
@@ -176,7 +176,7 @@ public:
 	bool actor_has_inventory(uint16 actor_num);
 
 	Obj *find_next_obj(uint8 level, Obj *prev_obj, bool match_frame_n = OBJ_NOMATCH_FRAME_N, bool match_quality = OBJ_MATCH_QUALITY);
-	Obj *find_obj(uint8 level, uint16 obj_n, uint8 quality, bool match_quality = OBJ_MATCH_QUALITY, uint16 frame_n = 0, bool match_frame_n = OBJ_NOMATCH_FRAME_N,  Obj **prev_obj = NULL);
+	Obj *find_obj(uint8 level, uint16 obj_n, uint8 quality, bool match_quality = OBJ_MATCH_QUALITY, uint16 frame_n = 0, bool match_frame_n = OBJ_NOMATCH_FRAME_N,  Obj **prev_obj = nullptr);
 
 	bool move(Obj *obj, uint16 x, uint16 y, uint8 level);
 	bool add_obj(Obj *obj, bool addOnTop = false);
diff --git a/engines/ultima/nuvie/core/party.cpp b/engines/ultima/nuvie/core/party.cpp
index e2a12511565..848b8cdf172 100644
--- a/engines/ultima/nuvie/core/party.cpp
+++ b/engines/ultima/nuvie/core/party.cpp
@@ -260,7 +260,7 @@ uint8 Party::get_party_size() {
 Actor *Party::get_leader_actor() {
 	sint8 leader = get_leader();
 	if (leader < 0) {
-		return NULL;
+		return nullptr;
 	}
 
 	return get_actor(leader);
@@ -268,14 +268,14 @@ Actor *Party::get_leader_actor() {
 
 Actor *Party::get_actor(uint8 member_num) {
 	if (num_in_party <= member_num)
-		return NULL;
+		return nullptr;
 
 	return member[member_num].actor;
 }
 
 char *Party::get_actor_name(uint8 member_num) {
 	if (num_in_party <= member_num)
-		return NULL;
+		return nullptr;
 
 	return member[member_num].name;
 }
@@ -510,7 +510,7 @@ bool Party::has_obj(uint16 obj_n, uint8 quality, bool match_zero_qual) {
 	uint16 i;
 
 	for (i = 0; i < num_in_party; i++) {
-		if (member[i].actor->inventory_get_object(obj_n, quality, match_zero_qual) != NULL) // we got a match
+		if (member[i].actor->inventory_get_object(obj_n, quality, match_zero_qual) != nullptr) // we got a match
 			return true;
 	}
 
@@ -524,7 +524,7 @@ bool Party::remove_obj(uint16 obj_n, uint8 quality) {
 
 	for (i = 0; i < num_in_party; i++) {
 		obj = member[i].actor->inventory_get_object(obj_n, quality);
-		if (obj != NULL) {
+		if (obj != nullptr) {
 			if (member[i].actor->inventory_remove_obj(obj)) {
 				delete_obj(obj);
 				return true;
@@ -539,10 +539,10 @@ bool Party::remove_obj(uint16 obj_n, uint8 quality) {
 Actor *Party::who_has_obj(uint16 obj_n, uint8 quality, bool match_qual_zero) {
 	uint16 i;
 	for (i = 0; i < num_in_party; i++) {
-		if (member[i].actor->inventory_get_object(obj_n, quality, match_qual_zero) != NULL)
+		if (member[i].actor->inventory_get_object(obj_n, quality, match_qual_zero) != nullptr)
 			return (member[i].actor);
 	}
-	return NULL;
+	return nullptr;
 }
 
 Obj *Party::get_obj(uint16 obj_n, uint8 quality, bool match_qual_zero, uint8 frame_n, bool match_frame_n) {
@@ -552,7 +552,7 @@ Obj *Party::get_obj(uint16 obj_n, uint8 quality, bool match_qual_zero, uint8 fra
 		if (obj)
 			return obj;
 	}
-	return NULL;
+	return nullptr;
 }
 
 /* Is EVERYONE in the party at or near the coordinates?
@@ -608,7 +608,7 @@ void Party::set_in_combat_mode(bool value) {
 	}
 //  if(combat_changes_music)
 	update_music();
-	if (game->get_command_bar() != NULL) {
+	if (game->get_command_bar() != nullptr) {
 		game->get_command_bar()->set_combat_mode(in_combat_mode);
 	}
 }
diff --git a/engines/ultima/nuvie/core/party.h b/engines/ultima/nuvie/core/party.h
index 07d77d00dd0..8688471fa91 100644
--- a/engines/ultima/nuvie/core/party.h
+++ b/engines/ultima/nuvie/core/party.h
@@ -194,7 +194,7 @@ public:
 // Automatic-walking. These methods should be replaced with ActorActions.
 	void walk(MapCoord *walkto, MapCoord *teleport, uint32 step_delay = 0);
 	void walk(MapCoord *walkto, uint32 step_delay = 0) {
-		walk(walkto, NULL, step_delay);
+		walk(walkto, nullptr, step_delay);
 	}
 	void walk(Obj *moongate, MapCoord *teleport, uint32 step_delay = 0);
 	void enter_vehicle(Obj *ship_obj, uint32 step_delay = 0);
diff --git a/engines/ultima/nuvie/core/player.cpp b/engines/ultima/nuvie/core/player.cpp
index a5b43357d52..605a86e67a5 100644
--- a/engines/ultima/nuvie/core/player.cpp
+++ b/engines/ultima/nuvie/core/player.cpp
@@ -46,12 +46,12 @@ Player::Player(Configuration *cfg) {
 	config = cfg;
 	config->value("config/GameType", game_type);
 
-	clock = NULL;
-	party = NULL;
-	actor = NULL;
-	actor_manager = NULL;
-	obj_manager = NULL;
-	map_window = NULL;
+	clock = nullptr;
+	party = nullptr;
+	actor = nullptr;
+	actor_manager = nullptr;
+	obj_manager = nullptr;
+	map_window = nullptr;
 	karma = 0;
 	gender = 0;
 	questf = 0;
@@ -78,7 +78,7 @@ bool Player::init(ObjManager *om, ActorManager *am, MapWindow *mw, GameClock *c,
 }
 
 void Player::init() {
-	actor = NULL;
+	actor = nullptr;
 
 	party_mode = true;
 	mapwindow_centered = true;
@@ -194,11 +194,11 @@ void Player::set_mapwindow_centered(bool state) {
 
 void Player::set_actor(Actor *new_actor) {
 	MsgScroll *scroll = Game::get_game()->get_scroll();
-	if (new_actor == NULL) {
+	if (new_actor == nullptr) {
 		return;
 	}
 
-	if (actor != NULL) {
+	if (actor != nullptr) {
 		if (party->contains_actor(actor))
 			actor->set_worktype(0x01); //WT_U6_IN_PARTY
 		else
@@ -616,7 +616,7 @@ void Player::attack_select_init(bool use_attack_text) {
 	map_window->centerCursor();
 
 	CombatTarget target = party->get_combat_target(actor->id_n == 0 ? 0 : party->get_member_num(actor));
-	Actor *target_actor = NULL;
+	Actor *target_actor = nullptr;
 
 	switch (target.type) {
 	case TARGET_ACTOR :
diff --git a/engines/ultima/nuvie/core/tile_manager.cpp b/engines/ultima/nuvie/core/tile_manager.cpp
index b4bdc788330..909666d9004 100644
--- a/engines/ultima/nuvie/core/tile_manager.cpp
+++ b/engines/ultima/nuvie/core/tile_manager.cpp
@@ -89,15 +89,15 @@ static const Tile gump_cursor = {
 };
 
 TileManager::TileManager(Configuration *cfg)
-	: desc_buf(NULL) {
+	: desc_buf(nullptr) {
 	config = cfg;
-	look = NULL;
+	look = nullptr;
 	game_counter = rgame_counter = 0;
 	memset(tileindex, 0, sizeof(tileindex));
 	memset(tile, 0, sizeof(tile));
 	memset(&animdata, 0, sizeof animdata);
 
-	extendedTiles = NULL;
+	extendedTiles = nullptr;
 	numTiles = NUM_ORIGINAL_TILES;
 
 	config->value("config/GameType", game_type);
@@ -121,11 +121,11 @@ bool TileManager::loadTiles() {
 	U6Lzw *lzw;
 	uint32 tile_offset;
 
-	unsigned char *tile_data = NULL;
+	unsigned char *tile_data = nullptr;
 	uint32 maptiles_size = 0;
 	uint32 objtiles_size;
 
-	unsigned char *masktype = NULL;
+	unsigned char *masktype = nullptr;
 	uint32 masktype_size;
 	uint16 i;
 
@@ -142,13 +142,13 @@ bool TileManager::loadTiles() {
 	switch (game_type) {
 	case NUVIE_GAME_U6 :
 		tile_data = lzw->decompress_file(maptiles_path, maptiles_size);
-		if (tile_data == NULL) {
+		if (tile_data == nullptr) {
 			ConsoleAddError("Decompressing " + maptiles_path);
 			return false;
 		}
 
 		masktype = lzw->decompress_file(masktype_path, masktype_size);
-		if (masktype == NULL) {
+		if (masktype == nullptr) {
 			ConsoleAddError("Decompressing " + masktype_path);
 			return false;
 		}
@@ -175,12 +175,12 @@ bool TileManager::loadTiles() {
 		break;
 	}
 
-	if (tile_data == NULL) {
+	if (tile_data == nullptr) {
 		ConsoleAddError("Loading maptiles.vga");
 		return false;
 	}
 
-	if (masktype == NULL) {
+	if (masktype == nullptr) {
 		ConsoleAddError("Loading masktype.vga");
 		return false;
 	}
@@ -244,7 +244,7 @@ bool TileManager::loadTiles() {
 	}
 
 	desc_buf = (char *)malloc(look->get_max_len() + 6); // add space for "%03d \n\0" or "the \n\0"
-	if (desc_buf == NULL) {
+	if (desc_buf == nullptr) {
 		ConsoleAddError("Allocating desc_buf");
 		return false;
 	}
@@ -572,7 +572,7 @@ bool TileManager::loadAnimMask() {
 
 	animmask = lzw.decompress_file(filename, animmask_size);
 
-	if (animmask == NULL)
+	if (animmask == nullptr)
 		return false;
 
 	for (i = 0; i < 32; i++) { // Make the 32 tiles from index 16 onwards transparent with data from animmask.vga
@@ -756,7 +756,7 @@ Tile *TileManager::get_rotated_tile(Tile *tile, float rotate) {
 #endif
 
 Tile *TileManager::get_cursor_tile() {
-	Tile *cursor_tile = NULL;
+	Tile *cursor_tile = nullptr;
 	switch (game_type) {
 	case NUVIE_GAME_U6 :
 		cursor_tile = get_tile(365);
@@ -775,7 +775,7 @@ Tile *TileManager::get_cursor_tile() {
 }
 
 Tile *TileManager::get_use_tile() {
-	Tile *use_tile = NULL;
+	Tile *use_tile = nullptr;
 	switch (game_type) {
 	case NUVIE_GAME_U6 :
 		use_tile = get_tile(364);
@@ -801,7 +801,7 @@ Tile *TileManager::loadCustomTiles(const Std::string filename, bool overwrite_ti
 	NuvieBmpFile bmp;
 
 	if (bmp.load(filename) == false) {
-		return NULL;
+		return nullptr;
 	}
 
 	unsigned char *tile_data = bmp.getRawIndexedData();
@@ -811,7 +811,7 @@ Tile *TileManager::loadCustomTiles(const Std::string filename, bool overwrite_ti
 	uint16 pitch = w;
 
 	if (w % 16 != 0 || h % 16 != 0) {
-		return NULL;
+		return nullptr;
 	}
 
 	w = w / 16;
@@ -819,8 +819,8 @@ Tile *TileManager::loadCustomTiles(const Std::string filename, bool overwrite_ti
 
 	uint16 num_tiles = w * h;
 
-	Tile *newTilePtr = NULL;
-	Tile *origTile = NULL;
+	Tile *newTilePtr = nullptr;
+	Tile *origTile = nullptr;
 	if (overwrite_tiles) {
 		newTilePtr = get_original_tile(tile_num_start_offset);
 	} else {
@@ -873,7 +873,7 @@ void TileManager::copyTileMetaData(Tile *dest, Tile *src) {
 
 Tile *TileManager::addNewTiles(uint16 num_tiles) {
 	Tile *tileDataPtr = (Tile *)realloc(extendedTiles, sizeof(Tile) * (numTiles - NUM_ORIGINAL_TILES + num_tiles));
-	if (tileDataPtr != NULL) {
+	if (tileDataPtr != nullptr) {
 		extendedTiles = tileDataPtr;
 	}
 
@@ -892,7 +892,7 @@ Tile *TileManager::addNewTiles(uint16 num_tiles) {
 void TileManager::freeCustomTiles() {
 	if (extendedTiles) {
 		free(extendedTiles);
-		extendedTiles = NULL;
+		extendedTiles = nullptr;
 		numTiles = NUM_ORIGINAL_TILES;
 	}
 }
diff --git a/engines/ultima/nuvie/core/timed_event.cpp b/engines/ultima/nuvie/core/timed_event.cpp
index 79fef77cfd6..8b97fcac5fc 100644
--- a/engines/ultima/nuvie/core/timed_event.cpp
+++ b/engines/ultima/nuvie/core/timed_event.cpp
@@ -95,10 +95,10 @@ void TimeQueue::remove_timer(TimedEvent *tevent) {
 }
 
 
-/* Remove and return timed event at front of queue, or NULL if empty.
+/* Remove and return timed event at front of queue, or nullptr if empty.
  */
 TimedEvent *TimeQueue::pop_timer() {
-	TimedEvent *first = NULL;
+	TimedEvent *first = nullptr;
 	if (!empty()) {
 		first = tq.front();
 		tq.pop_front(); // remove it
@@ -162,7 +162,7 @@ bool TimeQueue::delete_timer(TimedEvent *tevent) {
 TimedEvent::TimedEvent(uint32 reltime, bool immediate, bool realtime)
 	: delay(reltime), repeat_count(0), ignore_pause(false),
 	  real_time(realtime), tq_can_delete(true), defunct(false) {
-	tq = NULL;
+	tq = nullptr;
 
 	if (immediate) // start now (useful if repeat is true)
 		time = 0;
@@ -175,7 +175,7 @@ TimedEvent::TimedEvent(uint32 reltime, bool immediate, bool realtime)
  */
 void TimedEvent::queue() {
 	Events *event = Game::get_game()->get_event();
-	if (tq == NULL) {
+	if (tq == nullptr) {
 		if (real_time)
 			tq = event->get_time_queue();
 		else
@@ -190,7 +190,7 @@ void TimedEvent::queue() {
 void TimedEvent::dequeue() {
 	if (tq) {
 		tq->remove_timer(this);
-		tq = NULL;
+		tq = nullptr;
 	}
 }
 
@@ -212,7 +212,7 @@ void TimedEvent::set_time() {
  */
 TimedPartyMove::TimedPartyMove(MapCoord *d, MapCoord *t, uint32 step_delay)
 	: TimedEvent(step_delay, true) {
-	init(d, t, NULL);
+	init(d, t, nullptr);
 }
 
 /* Movement through temporary moongate.
@@ -224,12 +224,12 @@ TimedPartyMove::TimedPartyMove(MapCoord *d, MapCoord *t, Obj *use_obj, uint32 st
 
 TimedPartyMove::TimedPartyMove(uint32 step_delay)
 	: TimedEvent(step_delay, true) {
-	map_window = NULL;
-	party = NULL;
-	dest = NULL;
-	target = NULL;
-	moongate = NULL;
-	actor_to_hide = NULL;
+	map_window = nullptr;
+	party = nullptr;
+	dest = nullptr;
+	target = nullptr;
+	moongate = nullptr;
+	actor_to_hide = nullptr;
 	moves_left = 0;
 	wait_for_effect = 0;
 	falling_in = false;
@@ -245,10 +245,10 @@ TimedPartyMove::~TimedPartyMove() {
 void TimedPartyMove::init(MapCoord *d, MapCoord *t, Obj *use_obj) {
 	map_window = Game::get_game()->get_map_window();
 	party = Game::get_game()->get_party();
-	target = NULL;
+	target = nullptr;
 	moves_left = party->get_party_size() * 2; // step timeout
 	wait_for_effect = 0;
-	actor_to_hide = NULL;
+	actor_to_hide = nullptr;
 	falling_in = false;
 
 	dest = new MapCoord(*d);
@@ -325,13 +325,13 @@ uint16 TimedPartyMove::callback(uint16 msg, CallBack *caller, void *data) {
  */
 bool TimedPartyMove::move_party() {
 	bool moving = false; // moving or waiting
-	Actor *used_gate = NULL; // someone just stepped into the gate (for effect)
+	Actor *used_gate = nullptr; // someone just stepped into the gate (for effect)
 
 	if (actor_to_hide) {
 		hide_actor(actor_to_hide);
 		moving = true; // allow at least one more tick so we see last actor hide
 	}
-	actor_to_hide = NULL;
+	actor_to_hide = nullptr;
 
 	for (uint32 a = 0; a < party->get_party_size(); a++) {
 		Actor *person = party->get_actor(a);
@@ -388,9 +388,9 @@ void TimedPartyMove::hide_actor(Actor *person) {
  */
 void TimedPartyMove::change_location() {
 	EffectManager *effect_mgr = Game::get_game()->get_effect_manager();
-	Graphics::ManagedSurface *mapwindow_capture = NULL;
+	Graphics::ManagedSurface *mapwindow_capture = nullptr;
 	if (wait_for_effect != 1) {
-		bool is_moongate = moongate != NULL;
+		bool is_moongate = moongate != nullptr;
 		if (moongate && moongate->obj_n == OBJ_U6_RED_GATE) { // leave blue moongates
 			// get image before deleting moongate
 			mapwindow_capture = map_window->get_sdl_surface();
@@ -445,7 +445,7 @@ bool TimedPartyMove::fall_in() {
  */
 TimedPartyMoveToVehicle::TimedPartyMoveToVehicle(MapCoord *d, Obj *obj,
 		uint32 step_delay)
-	: TimedPartyMove(d, NULL, step_delay) {
+	: TimedPartyMove(d, nullptr, step_delay) {
 	ship_obj = obj;
 }
 
@@ -491,7 +491,7 @@ TimedContainerSearch::TimedContainerSearch(Obj *obj) : TimedEvent(500, TIMER_DEL
 	om = game->get_obj_manager();
 
 	container_obj = obj;
-	prev_obj = NULL;
+	prev_obj = nullptr;
 
 	//game->set_pause_flags((GamePauseState)(game->get_pause_flags() | PAUSE_USER));
 	game->pause_user();
@@ -548,7 +548,7 @@ GameTimedCallback::GameTimedCallback(CallBack *t, void *d, uint32 wait_time, boo
 /*** TimedAdvance: Advance game time by rate until hours has passed. **/
 #define TIMEADVANCE_PER_SECOND 1000 /* frequency of timer calls */
 TimedAdvance::TimedAdvance(uint8 hours, uint16 r)
-	: TimedCallback(NULL, NULL, 1000 / TIMEADVANCE_PER_SECOND, true),
+	: TimedCallback(nullptr, nullptr, 1000 / TIMEADVANCE_PER_SECOND, true),
 	  _clock(Game::get_game()->get_clock()),
 	  minutes_this_hour(0), minutes(0) {
 	init(hours * 60, r);
@@ -558,7 +558,7 @@ TimedAdvance::TimedAdvance(uint8 hours, uint16 r)
 /* Advance to time indicated by timestring, of the format "HH:MM".
  */
 TimedAdvance::TimedAdvance(Std::string timestring, uint16 r)
-	: TimedCallback(NULL, NULL, 1000 / TIMEADVANCE_PER_SECOND, true),
+	: TimedCallback(nullptr, nullptr, 1000 / TIMEADVANCE_PER_SECOND, true),
 	  _clock(Game::get_game()->get_clock()),
 	  minutes_this_hour(0), minutes(0) {
 	uint8 hour = 0, minute = 0;
@@ -638,7 +638,7 @@ bool TimedAdvance::time_passed() {
 /* Set hour and minute from "HH:MM" string.
  */
 void TimedAdvance::get_time_from_string(uint8 &hour, uint8 &minute, Std::string timestring) {
-	char *hour_s = NULL, *minute_s = NULL;
+	char *hour_s = nullptr, *minute_s = nullptr;
 	hour_s = scumm_strdup(timestring.c_str());
 	for (uint32 c = 0; c < strlen(hour_s); c++)
 		if (hour_s[c] == ':') { // get minutes
@@ -648,11 +648,11 @@ void TimedAdvance::get_time_from_string(uint8 &hour, uint8 &minute, Std::string
 		}
 
 	if (hour_s) {
-		hour = strtol(hour_s, NULL, 10);
+		hour = strtol(hour_s, nullptr, 10);
 		free(hour_s);
 	}
 	if (minute_s) {
-		minute = strtol(minute_s, NULL, 10);
+		minute = strtol(minute_s, nullptr, 10);
 		free(minute_s);
 	}
 }
@@ -696,7 +696,7 @@ void TimedRestGather::check_campfire() {
 				for (int y = 0; y < 3; y++) {
 					if (x == 1 && y == 1)
 						continue;
-					if (actor_manager->get_actor(dest->x + x - 1, dest->y + y - 1, loc.z) == NULL) {
+					if (actor_manager->get_actor(dest->x + x - 1, dest->y + y - 1, loc.z) == nullptr) {
 						actor->move(dest->x + x - 1, dest->y + y - 1, loc.z);
 
 					}
diff --git a/engines/ultima/nuvie/core/timed_event.h b/engines/ultima/nuvie/core/timed_event.h
index 9ca15fed932..da79ad7ed4b 100644
--- a/engines/ultima/nuvie/core/timed_event.h
+++ b/engines/ultima/nuvie/core/timed_event.h
@@ -154,7 +154,7 @@ public:
 	void init(MapCoord *d, MapCoord *t, Obj *use_obj);
 	void timed(uint32 evtime) override;
 
-	uint16 callback(uint16 msg, CallBack *caller, void *data = NULL) override;
+	uint16 callback(uint16 msg, CallBack *caller, void *data = nullptr) override;
 
 protected:
 	bool move_party();
@@ -213,7 +213,7 @@ public:
 	~TimedCallback() override {  }
 	void timed(uint32 evtime) override;
 	void clear_target() {
-		set_target(NULL);
+		set_target(nullptr);
 	}
 };
 
diff --git a/engines/ultima/nuvie/core/weather.cpp b/engines/ultima/nuvie/core/weather.cpp
index 79f39f13212..d186d43f9f6 100644
--- a/engines/ultima/nuvie/core/weather.cpp
+++ b/engines/ultima/nuvie/core/weather.cpp
@@ -47,7 +47,7 @@ Weather::Weather(Configuration *cfg, GameClock *c, nuvie_game_t type) {
 	gametype = type;
 
 	wind_dir = NUVIE_DIR_NONE;
-	wind_timer = NULL;
+	wind_timer = nullptr;
 	string s;
 	config->value(config_get_game_key(config) + "/displayed_wind_dir", s, "from");
 	if (s == "to")
@@ -117,7 +117,7 @@ uint8 Weather::load_wind(NuvieIO *objlist) {
 void Weather::clear_wind() {
 	if (wind_timer) {
 		wind_timer->stop_timer();
-		wind_timer = NULL;
+		wind_timer = nullptr;
 	}
 
 
@@ -237,7 +237,7 @@ inline void Weather::set_wind_change_callback() {
 inline void Weather::send_wind_change_notification_callback() {
 	Std::list<CallBack *>::iterator cb_iter;
 	for (cb_iter = wind_change_notification_list.begin(); cb_iter != wind_change_notification_list.end(); cb_iter++)
-		(*cb_iter)->callback(WEATHER_CB_CHANGE_WIND_DIR, (CallBack *)this, NULL);
+		(*cb_iter)->callback(WEATHER_CB_CHANGE_WIND_DIR, (CallBack *)this, nullptr);
 }
 
 bool Weather::add_wind_change_notification_callback(CallBack *caller) {
@@ -252,7 +252,7 @@ uint16 Weather::callback(uint16 msg, CallBack *caller, void *data) {
 
 	switch (*cb_msgid) {
 	case WEATHER_CB_CHANGE_WIND_DIR :
-		wind_timer = NULL;
+		wind_timer = nullptr;
 		change_wind_dir();
 		break;
 	default :
diff --git a/engines/ultima/nuvie/core/weather.h b/engines/ultima/nuvie/core/weather.h
index 917f390ef4c..d4a9025e17a 100644
--- a/engines/ultima/nuvie/core/weather.h
+++ b/engines/ultima/nuvie/core/weather.h
@@ -78,7 +78,7 @@ public:
 	bool is_eclipse();
 	bool is_moon_visible();
 
-	uint16 callback(uint16 msg, CallBack *caller, void *data = NULL) override;
+	uint16 callback(uint16 msg, CallBack *caller, void *data = nullptr) override;
 
 protected:
 
diff --git a/engines/ultima/nuvie/files/nuvie_bmp_file.cpp b/engines/ultima/nuvie/files/nuvie_bmp_file.cpp
index 410bdf86ba9..18cad29cd4c 100644
--- a/engines/ultima/nuvie/files/nuvie_bmp_file.cpp
+++ b/engines/ultima/nuvie/files/nuvie_bmp_file.cpp
@@ -28,7 +28,7 @@ namespace Nuvie {
 #define NUVIEBMPFILE_MAGIC 0x4d42 // 'BM'
 
 NuvieBmpFile::NuvieBmpFile() {
-	data = NULL;
+	data = nullptr;
 	prev_width = 0;
 	prev_height = 0;
 	prev_bits = 0;
@@ -38,7 +38,7 @@ NuvieBmpFile::NuvieBmpFile() {
 }
 
 NuvieBmpFile::~NuvieBmpFile() {
-	if (data != NULL)
+	if (data != nullptr)
 		free(data);
 }
 
@@ -144,7 +144,7 @@ bool NuvieBmpFile::load(Std::string filename) {
 		bmp_line_width += (4 - (bmp_line_width % 4));
 	}
 
-	if (data == NULL || infoHeader.width != prev_width || infoHeader.height != prev_height || prev_bits != infoHeader.bits) {
+	if (data == nullptr || infoHeader.width != prev_width || infoHeader.height != prev_height || prev_bits != infoHeader.bits) {
 		if (data) {
 			free(data);
 		}
@@ -152,7 +152,7 @@ bool NuvieBmpFile::load(Std::string filename) {
 		prev_width = infoHeader.width;
 		prev_height = infoHeader.height;
 		prev_bits = infoHeader.bits;
-		if (data == NULL) {
+		if (data == nullptr) {
 			return handleError("allocating memory for image");
 		}
 	}
@@ -226,7 +226,7 @@ void NuvieBmpFile::write8BitData(NuvieIOFileWrite *file) {
 bool NuvieBmpFile::handleError(Std::string error) {
 	if (data) {
 		free(data);
-		data = NULL;
+		data = nullptr;
 	}
 
 	DEBUG(0, LEVEL_ERROR, error.c_str());
@@ -236,12 +236,12 @@ bool NuvieBmpFile::handleError(Std::string error) {
 
 Tile *NuvieBmpFile::getTile() {
 	if (infoHeader.width != 16 || infoHeader.height != 16 || infoHeader.bits != 8) {
-		return NULL;
+		return nullptr;
 	}
 
 	Tile *t = (Tile *)malloc(sizeof(Tile));
-	if (t == NULL) {
-		return NULL;
+	if (t == nullptr) {
+		return nullptr;
 	}
 	memset(t, 0, sizeof(Tile));
 	memcpy(t->data, data, 256);
@@ -251,20 +251,20 @@ Tile *NuvieBmpFile::getTile() {
 
 unsigned char *NuvieBmpFile::getRawIndexedData() {
 	if (infoHeader.bits != 8) {
-		return NULL;
+		return nullptr;
 	}
 
 	return data;
 }
 
 unsigned char *NuvieBmpFile::getRawIndexedDataCopy() {
-	if (data == NULL || infoHeader.bits != 8) {
-		return NULL;
+	if (data == nullptr || infoHeader.bits != 8) {
+		return nullptr;
 	}
 
 	unsigned char *copy = (unsigned char *)malloc(infoHeader.width * infoHeader.height);
-	if (copy == NULL) {
-		return NULL;
+	if (copy == nullptr) {
+		return nullptr;
 	}
 	memcpy(copy, data, infoHeader.width * infoHeader.height);
 	return copy;
@@ -276,8 +276,8 @@ Graphics::ManagedSurface *NuvieBmpFile::getSdlSurface32(Std::string filename) {
 }
 
 Graphics::ManagedSurface *NuvieBmpFile::getSdlSurface32() {
-	if (data == NULL) {
-		return NULL;
+	if (data == nullptr) {
+		return nullptr;
 	}
 
 	Graphics::ManagedSurface *surface = new Graphics::ManagedSurface(
diff --git a/engines/ultima/nuvie/files/nuvie_file_list.cpp b/engines/ultima/nuvie/files/nuvie_file_list.cpp
index 1518605e9c6..6f78bb466c4 100644
--- a/engines/ultima/nuvie/files/nuvie_file_list.cpp
+++ b/engines/ultima/nuvie/files/nuvie_file_list.cpp
@@ -80,7 +80,7 @@ Std::string *NuvieFileList::next() {
 		return filename;
 	}
 
-	return NULL;
+	return nullptr;
 }
 
 Std::string *NuvieFileList::get_latest() {
@@ -94,7 +94,7 @@ Std::string *NuvieFileList::get_latest() {
 		return filename;
 	}
 
-	return NULL;
+	return nullptr;
 }
 
 uint32 NuvieFileList::get_num_files() {
diff --git a/engines/ultima/nuvie/files/nuvie_io.cpp b/engines/ultima/nuvie/files/nuvie_io.cpp
index b68277cdef0..65dad37e3dc 100644
--- a/engines/ultima/nuvie/files/nuvie_io.cpp
+++ b/engines/ultima/nuvie/files/nuvie_io.cpp
@@ -44,15 +44,15 @@ unsigned char *NuvieIO::readBuf(uint32 read_size, uint32 *bytes_read) {
 	*bytes_read = 0;
 
 	if (pos + read_size > size)
-		return NULL;
+		return nullptr;
 
 	buf = (unsigned char *)malloc(read_size);
-	if (buf == NULL)
-		return NULL;
+	if (buf == nullptr)
+		return nullptr;
 
 	if (readToBuf(buf, read_size) == false) {
 		free(buf);
-		return NULL;
+		return nullptr;
 	}
 
 	*bytes_read = read_size;
@@ -64,7 +64,7 @@ unsigned char *NuvieIO::readBuf(uint32 read_size, uint32 *bytes_read) {
 // NuvieIOBuffer
 
 NuvieIOBuffer::NuvieIOBuffer() : NuvieIO() {
-	data = NULL;
+	data = nullptr;
 	copied_data = false;
 }
 
@@ -73,13 +73,13 @@ NuvieIOBuffer::~NuvieIOBuffer() {
 }
 
 bool NuvieIOBuffer::open(unsigned char *buf, uint32 buf_size, bool copy_buf) {
-	if (data != NULL)
+	if (data != nullptr)
 		return false;
 
 	if (copy_buf == NUVIE_BUF_COPY) {
 		copied_data = true;
 		data = (unsigned char *)malloc(buf_size);
-		if (data == NULL) {
+		if (data == nullptr) {
 			DEBUG(0, LEVEL_ERROR, "NuvieIOBuffer::open() allocating %d bytes.\n", buf_size);
 			return false;
 		}
@@ -97,10 +97,10 @@ void NuvieIOBuffer::close() {
 	size = 0;
 	pos = 0;
 
-	if (copied_data && data != NULL)
+	if (copied_data && data != nullptr)
 		free(data);
 
-	data = NULL;
+	data = nullptr;
 
 }
 
@@ -136,7 +136,7 @@ uint32 NuvieIOBuffer::read4() {
 }
 
 bool NuvieIOBuffer::readToBuf(unsigned char *buf, uint32 buf_size) {
-	if (pos + buf_size > size || buf == NULL)
+	if (pos + buf_size > size || buf == nullptr)
 		return false;
 
 	memcpy(buf, &data[pos], buf_size);
@@ -186,7 +186,7 @@ bool NuvieIOBuffer::write4(uint32 src) {
 }
 
 uint32 NuvieIOBuffer::writeBuf(const unsigned char *src, uint32 src_size) {
-	if (pos + src_size > size || src == NULL)
+	if (pos + src_size > size || src == nullptr)
 		return 0;
 
 	memcpy(&data[pos], src, src_size);
diff --git a/engines/ultima/nuvie/files/tmx_map.cpp b/engines/ultima/nuvie/files/tmx_map.cpp
index c9fa7261d0e..029ac92905a 100644
--- a/engines/ultima/nuvie/files/tmx_map.cpp
+++ b/engines/ultima/nuvie/files/tmx_map.cpp
@@ -32,7 +32,7 @@ TMXMap::TMXMap(TileManager *tm, Map *m, ObjManager *om) {
 	tile_manager = tm;
 	map = m;
 	obj_manager = om;
-	mapdata = NULL;
+	mapdata = nullptr;
 	game_type = NUVIE_GAME_NONE;
 }
 
@@ -59,7 +59,7 @@ bool TMXMap::exportTmxMapFiles(Std::string dir, nuvie_game_t type) {
 }
 
 void TMXMap::writeRoofTileset(uint8 level) {
-	if (map->get_roof_data(level) == NULL) {
+	if (map->get_roof_data(level) == nullptr) {
 		return;
 	}
 
@@ -153,7 +153,7 @@ void TMXMap::writeObjects(NuvieIOFileWrite *tmx, uint8 level, bool forceLower, b
 		for (uint16 x = 0; x < width; x++) {
 			U6LList *list = obj_manager->get_obj_list(x, y, level);
 			if (list) {
-				for (U6Link *link = list->start(); link != NULL; link = link->next) {
+				for (U6Link *link = list->start(); link != nullptr; link = link->next) {
 					Obj *obj = (Obj *)link->data;
 					Tile *t = tile_manager->get_original_tile(obj_manager->get_obj_tile_num(obj->obj_n) + obj->frame_n);
 					Std::string s;
@@ -210,7 +210,7 @@ bool TMXMap::exportMapLevel(uint8 level) {
 	          + "_tileset.bmp\" trans=\"00dffc\" width=\"512\" height=\"1024\"/>\n";
 	header += " </tileset>\n";
 
-	if (map->get_roof_data(level) != NULL) {
+	if (map->get_roof_data(level) != nullptr) {
 		header +=
 		    " <tileset firstgid=\"2048\" name=\"roof_tileset\" tilewidth=\"16\" tileheight=\"16\">\n";
 		header += "  <image source=\"" + savename + "_roof_tileset.bmp\" trans=\"0070fc\" width=\"80\" height=\"3264\"/>\n";
@@ -223,7 +223,7 @@ bool TMXMap::exportMapLevel(uint8 level) {
 
 	writeObjectLayer(&tmx, level);
 
-	if (map->get_roof_data(level) != NULL) {
+	if (map->get_roof_data(level) != nullptr) {
 		writeLayer(&tmx, width, "RoofLayer", 2047, 16, (const unsigned char *)map->get_roof_data(level));
 	}
 
diff --git a/engines/ultima/nuvie/files/u6_bmp.cpp b/engines/ultima/nuvie/files/u6_bmp.cpp
index d4bdc06cf19..15cffd43ac6 100644
--- a/engines/ultima/nuvie/files/u6_bmp.cpp
+++ b/engines/ultima/nuvie/files/u6_bmp.cpp
@@ -28,14 +28,14 @@ namespace Ultima {
 namespace Nuvie {
 
 U6Bmp::U6Bmp(): U6Shape() {
-	data = NULL;
+	data = nullptr;
 }
 
 U6Bmp::~U6Bmp() {
-	if (data != NULL)
+	if (data != nullptr)
 		free(data);
 
-	raw = NULL;
+	raw = nullptr;
 }
 
 
@@ -43,7 +43,7 @@ bool U6Bmp::load(Std::string filename) {
 	U6Lzw lzw;
 	uint32 data_size;
 
-	if (data != NULL)
+	if (data != nullptr)
 		return false;
 
 	if (filename.length() == 0)
@@ -51,7 +51,7 @@ bool U6Bmp::load(Std::string filename) {
 
 	data = lzw.decompress_file(filename, data_size);
 
-	if (data == NULL)
+	if (data == nullptr)
 		return false;
 
 	width = (data[0] + (data[1] << 8));
diff --git a/engines/ultima/nuvie/files/u6_lib_n.cpp b/engines/ultima/nuvie/files/u6_lib_n.cpp
index 1e7f69c6a6c..9ce39bed3f9 100644
--- a/engines/ultima/nuvie/files/u6_lib_n.cpp
+++ b/engines/ultima/nuvie/files/u6_lib_n.cpp
@@ -28,7 +28,7 @@
 namespace Ultima {
 namespace Nuvie {
 
-U6Lib_n::U6Lib_n() : num_offsets(0), items(NULL), data(NULL),
+U6Lib_n::U6Lib_n() : num_offsets(0), items(nullptr), data(nullptr),
 	del_data(false), filesize(0), game_type(NUVIE_GAME_U6), lib_size(0) {
 }
 
@@ -71,15 +71,15 @@ void U6Lib_n::close() {
 			delete items[i].name;
 		free(items);
 	}
-	items = NULL;
+	items = nullptr;
 
 	if (del_data) {
-		if (data != NULL)
+		if (data != nullptr)
 			data->close();
 		delete data;
 	}
 
-	data = NULL;
+	data = nullptr;
 	del_data = false;
 
 	num_offsets = 0;
@@ -130,14 +130,14 @@ unsigned char *U6Lib_n::get_item(uint32 item_number, unsigned char *ret_buf) {
 	unsigned char *buf, *lzw_buf;
 
 	if (item_number >= num_offsets)
-		return NULL;
+		return nullptr;
 
 	item = &items[item_number];
 
 	if (item->size == 0 || item->offset == 0)
-		return NULL;
+		return nullptr;
 
-	if (ret_buf == NULL)
+	if (ret_buf == nullptr)
 		buf = (unsigned char *)malloc(item->uncomp_size);
 	else
 		buf = ret_buf;
@@ -267,7 +267,7 @@ uint32 U6Lib_n::calculate_item_uncomp_size(U6LibItem *item) {
 	return uncomp_size;
 }
 
-// we need to handle NULL offsets at the start of the offset table in the converse.a file
+// we need to handle nullptr offsets at the start of the offset table in the converse.a file
 uint32 U6Lib_n::calculate_num_offsets(bool skip4) { //skip4 bytes of header.
 	uint32 i;
 	uint32 offset = 0;
@@ -327,7 +327,7 @@ void U6Lib_n::load_index(Common::ReadStream *index_f) {
 			name[oc++] = input[c];
 		name[oc] = '\0';
 		if (strlen(offset_str)) { // if line is not empty (!= zero entry)
-			uint32 offset32 = strtol(offset_str, NULL, 16);
+			uint32 offset32 = strtol(offset_str, nullptr, 16);
 			add_item(offset32, name);
 			++entry_count;
 		}
@@ -351,7 +351,7 @@ void U6Lib_n::add_item(uint32 offset32, const char *name) {
 	item->size = 0;
 	item->uncomp_size = 0;
 	item->flag = 0; // uncompressed
-	item->data = NULL;
+	item->data = nullptr;
 	++num_offsets;
 }
 
@@ -360,8 +360,8 @@ void U6Lib_n::add_item(uint32 offset32, const char *name) {
  */
 const char *U6Lib_n::get_item_name(uint32 item_number) {
 	if (item_number >= num_offsets)
-		return (NULL);
-	return (items[item_number].name ? items[item_number].name->c_str() : NULL);
+		return (nullptr);
+	return (items[item_number].name ? items[item_number].name->c_str() : nullptr);
 }
 
 
diff --git a/engines/ultima/nuvie/files/u6_lib_n.h b/engines/ultima/nuvie/files/u6_lib_n.h
index e5bb6125e8a..1378ebc448f 100644
--- a/engines/ultima/nuvie/files/u6_lib_n.h
+++ b/engines/ultima/nuvie/files/u6_lib_n.h
@@ -64,7 +64,7 @@ public:
 		return game_type;
 	}
 
-	unsigned char *get_item(uint32 item_number, unsigned char *buf = NULL); // read
+	unsigned char *get_item(uint32 item_number, unsigned char *buf = nullptr); // read
 	void set_item_data(uint32 item_number, unsigned char *src, uint32 src_len);
 
 	uint32 get_num_items();
@@ -73,7 +73,7 @@ public:
 	const char *get_item_name(uint32 item_number);
 	bool is_compressed(uint32 item_number);
 
-	void add_item(uint32 offset32, const char *name = NULL);
+	void add_item(uint32 offset32, const char *name = nullptr);
 	void write_item(uint32 item_number);
 	void write_items();
 
diff --git a/engines/ultima/nuvie/files/u6_lzw.cpp b/engines/ultima/nuvie/files/u6_lzw.cpp
index d89f8fea7cd..a2e5fdd8f60 100644
--- a/engines/ultima/nuvie/files/u6_lzw.cpp
+++ b/engines/ultima/nuvie/files/u6_lzw.cpp
@@ -58,7 +58,7 @@ unsigned char *U6Lzw::compress_buffer(unsigned char *src, uint32 src_len,
 	//         the uncompressed data
 	uint32 blocks = 0; //, block = 0, b = 0, d = 0, rshift = 0;
 	//uint16 val = 0;
-	//unsigned char *dest_pt = NULL;
+	//unsigned char *dest_pt = nullptr;
 	unsigned char *dest_buf = (unsigned char *)malloc(4);
 	// add 4 byte uncompressed length value
 	dest_len = 4;
@@ -162,7 +162,7 @@ unsigned char *U6Lzw::decompress_buffer(unsigned char *source, uint32 source_len
 
 	uncomp_size = this->get_uncompressed_buffer_size(source, source_length);
 	if (uncomp_size == -1)
-		return (NULL);
+		return (nullptr);
 	else
 		destination_length = uncomp_size;
 
@@ -170,7 +170,7 @@ unsigned char *U6Lzw::decompress_buffer(unsigned char *source, uint32 source_len
 
 	if (decompress_buffer(source, source_length, destination, destination_length) == false) {
 		free(destination);
-		return NULL;
+		return nullptr;
 	}
 
 	return destination;
@@ -275,7 +275,7 @@ unsigned char *U6Lzw::decompress_file(Std::string filename, uint32 &destination_
 
 	destination_length = 0;
 	if (input_file.open(filename) == false)
-		return NULL;
+		return nullptr;
 
 	if (this->is_valid_lzw_file(&input_file)) {
 		// determine the buffer sizes
diff --git a/engines/ultima/nuvie/files/u6_shape.cpp b/engines/ultima/nuvie/files/u6_shape.cpp
index 6b7f9db5bad..ba583220fed 100644
--- a/engines/ultima/nuvie/files/u6_shape.cpp
+++ b/engines/ultima/nuvie/files/u6_shape.cpp
@@ -86,7 +86,7 @@ namespace Nuvie {
  * Just intializes all structures to 0.
  */
 U6Shape::U6Shape() {
-	raw = NULL;
+	raw = nullptr;
 	hotx = hoty = 0;
 	width = height = 0;
 }
@@ -110,7 +110,7 @@ bool U6Shape::init(uint16 w, uint16 h, uint16 hx, uint16 hy) {
 	hoty = hy;
 	raw = (uint8 *)malloc(width * height);
 
-	if (raw == NULL) {
+	if (raw == nullptr) {
 		DEBUG(0, LEVEL_ERROR, "malloc failed to allocate space for shape\n");
 		return false;
 	}
@@ -128,7 +128,7 @@ bool U6Shape::load(U6Lib_n *file, uint32 index) {
 	unsigned char *buf;
 
 	buf = file->get_item(index);
-	if (buf != NULL) {
+	if (buf != nullptr) {
 		if (load(buf)) {
 			free(buf);
 			return true;
@@ -141,7 +141,7 @@ bool U6Shape::load(U6Lib_n *file, uint32 index) {
 
 bool U6Shape::load_from_lzc(Std::string filename, uint32 idx, uint32 sub_idx) {
 	U6Lib_n lib_n;
-	unsigned char *buf = NULL;
+	unsigned char *buf = nullptr;
 
 	if (!lib_n.open(filename, 4, NUVIE_GAME_MD)) {
 		return false;
@@ -151,7 +151,7 @@ bool U6Shape::load_from_lzc(Std::string filename, uint32 idx, uint32 sub_idx) {
 		return false;
 	}
 
-	buf = lib_n.get_item(idx, NULL);
+	buf = lib_n.get_item(idx, nullptr);
 	NuvieIOBuffer io;
 	io.open(buf, lib_n.get_item_size(idx), false);
 	U6Lib_n lib1;
@@ -185,7 +185,7 @@ bool U6Shape::load(unsigned char *buf) {
 	sint16 xpos, ypos;
 
 	/* A file already loaded. */
-	if (raw != NULL)
+	if (raw != nullptr)
 		return false;
 	/* NOT REACHED */
 
@@ -207,7 +207,7 @@ bool U6Shape::load(unsigned char *buf) {
 
 	/* Allocate memory for shape and make it all transperent. */
 	raw = (unsigned char *)malloc(width * height);
-	if (raw == NULL) {
+	if (raw == nullptr) {
 		DEBUG(0, LEVEL_ERROR, "malloc failed to allocate space for shape\n");
 		return false;
 	}
@@ -313,7 +313,7 @@ bool U6Shape::load_WoU_background(Configuration *config, nuvie_game_t game_type)
  *  unsigned char *U6Shape::get_data();
  * =====================================
  *
- * Returns raw data representing the shape or NULL on failure.
+ * Returns raw data representing the shape or nullptr on failure.
  */
 unsigned char *U6Shape::get_data() {
 	return raw;
@@ -325,12 +325,12 @@ unsigned char *U6Shape::get_data() {
  * ============================================
  *
  * Returns a Graphics::ManagedSurface representing the shape
- * or NULL on failure. NOTE! user must free this
+ * or nullptr on failure. NOTE! user must free this
  * data.
  */
 Graphics::ManagedSurface *U6Shape::get_shape_surface() {
-	if (raw == NULL)
-		return NULL;
+	if (raw == nullptr)
+		return nullptr;
 
 	// Create the surface
 	Graphics::ManagedSurface *surface = new Graphics::ManagedSurface(width, height,
@@ -352,7 +352,7 @@ Graphics::ManagedSurface *U6Shape::get_shape_surface() {
  * returns true or on failure just returns false.
  */
 bool U6Shape::get_hot_point(uint16 *x, uint16 *y) {
-	if (raw == NULL)
+	if (raw == nullptr)
 		return false;
 	/* NOT REACHED */
 
@@ -371,7 +371,7 @@ bool U6Shape::get_hot_point(uint16 *x, uint16 *y) {
  * returns true or on failure just returns false.
  */
 bool U6Shape::get_size(uint16 *w, uint16 *h) {
-	if (raw == NULL)
+	if (raw == nullptr)
 		return false;
 	/* NOT REACHED */
 
@@ -382,14 +382,14 @@ bool U6Shape::get_size(uint16 *w, uint16 *h) {
 }
 
 void U6Shape::draw_line(uint16 sx, uint16 sy, uint16 ex, uint16 ey, uint8 color) {
-	if (raw == NULL)
+	if (raw == nullptr)
 		return;
 
 	draw_line_8bit(sx, sy, ex, ey, color, raw, width, height);
 }
 
 bool U6Shape::blit(U6Shape *shp, uint16 x, uint16 y) {
-	if (shp == NULL)
+	if (shp == nullptr)
 		return false;
 
 	unsigned char *src_data = shp->get_data();
diff --git a/engines/ultima/nuvie/fonts/bmp_font.cpp b/engines/ultima/nuvie/fonts/bmp_font.cpp
index a510de8428e..0547406e7b6 100644
--- a/engines/ultima/nuvie/fonts/bmp_font.cpp
+++ b/engines/ultima/nuvie/fonts/bmp_font.cpp
@@ -34,8 +34,8 @@ BMPFont::BMPFont() {
 	offset = 0;
 	char_w = 0;
 	char_h = 0;
-	font_width_data = NULL;
-	sdl_font_data = NULL;
+	font_width_data = nullptr;
+	sdl_font_data = nullptr;
 	rune_mode = false;
 	dual_font_mode = false;
 }
diff --git a/engines/ultima/nuvie/fonts/conv_font.cpp b/engines/ultima/nuvie/fonts/conv_font.cpp
index 3bbcb880f29..178c5d2d0b6 100644
--- a/engines/ultima/nuvie/fonts/conv_font.cpp
+++ b/engines/ultima/nuvie/fonts/conv_font.cpp
@@ -31,8 +31,8 @@ ConvFont::ConvFont() {
 	data_offset = 0;
 	num_chars = 0;
 	offset = 0;
-	f_data = NULL;
-	f_w_data = NULL;
+	f_data = nullptr;
+	f_w_data = nullptr;
 }
 
 ConvFont::~ConvFont() {
@@ -59,7 +59,7 @@ uint16 ConvFont::drawChar(Screen *screen, uint8 char_num, uint16 x, uint16 y,
 						  uint8 color) {
 
 	unsigned char *buf = (unsigned char *)f_data + (data_offset * 64) + (char_num % 16) * 8 + (char_num / 16) * 128 * 8;
-	screen->blit(x, y, buf, 8, 8, 8, 128, true, NULL);
+	screen->blit(x, y, buf, 8, 8, 8, 128, true, nullptr);
 	return getCharWidth(char_num);
 }
 
diff --git a/engines/ultima/nuvie/fonts/font_manager.cpp b/engines/ultima/nuvie/fonts/font_manager.cpp
index 359f1a185d4..151b2905ecd 100644
--- a/engines/ultima/nuvie/fonts/font_manager.cpp
+++ b/engines/ultima/nuvie/fonts/font_manager.cpp
@@ -39,10 +39,10 @@ FontManager::FontManager(Configuration *cfg) {
 	config = cfg;
 	num_fonts = 0;
 
-	conv_font = NULL;
-	conv_garg_font = NULL;
-	conv_font_data = NULL;
-	conv_font_widths = NULL;
+	conv_font = nullptr;
+	conv_garg_font = nullptr;
+	conv_font_data = nullptr;
+	conv_font_widths = nullptr;
 }
 
 FontManager::~FontManager() {
@@ -87,7 +87,7 @@ bool FontManager::initU6() {
 		return false;
 
 	font_data = u6_ch.readAll();
-	if (font_data == NULL)
+	if (font_data == nullptr)
 		return false;
 
 // english font
@@ -199,7 +199,7 @@ Font *FontManager::get_font(uint16 font_number) {
 	if (num_fonts > 0 && font_number < num_fonts)
 		return fonts[font_number]; //fonts.at(font_number);
 
-	return NULL;
+	return nullptr;
 }
 
 } // End of namespace Nuvie
diff --git a/engines/ultima/nuvie/fonts/u6_font.cpp b/engines/ultima/nuvie/fonts/u6_font.cpp
index 8ca341fb357..df4d0ddb791 100644
--- a/engines/ultima/nuvie/fonts/u6_font.cpp
+++ b/engines/ultima/nuvie/fonts/u6_font.cpp
@@ -28,13 +28,13 @@ namespace Ultima {
 namespace Nuvie {
 
 U6Font::U6Font() {
-	font_data = NULL;
+	font_data = nullptr;
 	num_chars = 0;
 	offset = 0;
 }
 
 U6Font::~U6Font() {
-	if (font_data != NULL)
+	if (font_data != nullptr)
 		free(font_data);
 }
 
@@ -75,7 +75,7 @@ uint16 U6Font::drawChar(Screen *screen, uint8 char_num, uint16 x, uint16 y,
 		pixels += pitch;
 	}
 
-	screen->blit(x, y, buf, 8, 8, 8, 8, true, NULL);
+	screen->blit(x, y, buf, 8, 8, 8, 8, true, nullptr);
 	return 8;
 }
 
diff --git a/engines/ultima/nuvie/fonts/wou_font.cpp b/engines/ultima/nuvie/fonts/wou_font.cpp
index a993fd70269..f4d122d3fbb 100644
--- a/engines/ultima/nuvie/fonts/wou_font.cpp
+++ b/engines/ultima/nuvie/fonts/wou_font.cpp
@@ -31,8 +31,8 @@ namespace Ultima {
 namespace Nuvie {
 
 WOUFont::WOUFont() {
-	font_data = NULL;
-	char_buf = NULL;
+	font_data = nullptr;
+	char_buf = nullptr;
 	num_chars = 0;
 	offset = 0;
 	height = 0;
@@ -42,10 +42,10 @@ WOUFont::WOUFont() {
 }
 
 WOUFont::~WOUFont() {
-	if (font_data != NULL)
+	if (font_data != nullptr)
 		free(font_data);
 
-	if (char_buf != NULL)
+	if (char_buf != nullptr)
 		free(char_buf);
 }
 
@@ -90,14 +90,14 @@ bool WOUFont::initCharBuf() {
 		}
 	}
 	char_buf = (unsigned char *)malloc(max_width * height);
-	if (char_buf == NULL)
+	if (char_buf == nullptr)
 		return false;
 
 	return true;
 }
 
 uint16 WOUFont::getCharWidth(uint8 c) {
-	if (font_data == NULL)
+	if (font_data == nullptr)
 		return 0;
 
 	return font_data[0x4 + get_char_num(c)];
@@ -109,7 +109,7 @@ uint16 WOUFont::drawChar(Screen *screen, uint8 char_num, uint16 x, uint16 y,
 	unsigned char *pixels;
 	uint16 width;
 
-	if (font_data == NULL)
+	if (font_data == nullptr)
 		return false;
 
 	pixels = font_data + font_data[0x204 + char_num] * 256 + font_data[0x104 + char_num];
@@ -123,7 +123,7 @@ uint16 WOUFont::drawChar(Screen *screen, uint8 char_num, uint16 x, uint16 y,
 			char_buf[i] = color;
 	}
 
-	screen->blit(x, y, char_buf, 8, width, height, width, true, NULL);
+	screen->blit(x, y, char_buf, 8, width, height, width, true, nullptr);
 	return width;
 }
 
@@ -131,7 +131,7 @@ uint16 WOUFont::drawStringToShape(U6Shape *shp, const char *str, uint16 x, uint1
 	uint16 i;
 	uint16 string_len = strlen(str);
 
-	if (font_data == NULL)
+	if (font_data == nullptr)
 		return x;
 
 	for (i = 0; i < string_len; i++) {
diff --git a/engines/ultima/nuvie/gui/gui.cpp b/engines/ultima/nuvie/gui/gui.cpp
index a29c72b3276..f5711969ba0 100644
--- a/engines/ultima/nuvie/gui/gui.cpp
+++ b/engines/ultima/nuvie/gui/gui.cpp
@@ -36,7 +36,7 @@ const int GUI::mouseclick_delay = 300; /* SB-X */
 /* Number of widget elements to allocate at once */
 #define WIDGET_ARRAYCHUNK   32
 
-GUI *GUI::gui = NULL;
+GUI *GUI::gui = nullptr;
 
 GUI:: GUI(Configuration *c, Screen *s) {
 	Graphics::ManagedSurface *sdl_surface;
@@ -46,7 +46,7 @@ GUI:: GUI(Configuration *c, Screen *s) {
 	screen = s;
 	numwidgets = 0;
 	maxwidgets = 0;
-	widgets = NULL;
+	widgets = nullptr;
 	display = 1;
 	running = 0;
 
@@ -54,7 +54,7 @@ GUI:: GUI(Configuration *c, Screen *s) {
 
 	dragging = false;
 	full_redraw = true;
-	focused_widget = locked_widget = NULL;
+	focused_widget = locked_widget = nullptr;
 	block_input = false;
 
 	sdl_surface = screen->get_sdl_surface();
@@ -67,7 +67,7 @@ GUI:: GUI(Configuration *c, Screen *s) {
 }
 
 GUI:: ~GUI() {
-	if (widgets != NULL) {
+	if (widgets != nullptr) {
 		for (int i = 0; i < numwidgets; ++i) {
 			delete widgets[i];
 		}
@@ -102,7 +102,7 @@ GUI:: AddWidget(GUI_Widget *widget) {
 
 			maxarray = maxwidgets + WIDGET_ARRAYCHUNK;
 			if ((newarray = (GUI_Widget **)realloc(widgets,
-			                                       maxarray * sizeof(*newarray))) == NULL) {
+			                                       maxarray * sizeof(*newarray))) == nullptr) {
 				return (-1);
 			}
 			widgets = newarray;
@@ -335,7 +335,7 @@ void GUI::Run(GUI_IdleProc idle, int once, int multitaskfriendly) {
 	Common::Event event;
 
 	/* If there's nothing to do, return immediately */
-	if ((numwidgets == 0) && (idle == NULL)) {
+	if ((numwidgets == 0) && (idle == nullptr)) {
 		return;
 	}
 
@@ -353,7 +353,7 @@ void GUI::Run(GUI_IdleProc idle, int once, int multitaskfriendly) {
 		}
 
 ///////////////////////////////////////////////////////////////// Polling is time consuming - instead:
-		if (multitaskfriendly && (idle == NULL)) {
+		if (multitaskfriendly && (idle == nullptr)) {
 			SDL_WaitEvent(&event);
 			HandleEvent(&event);
 		} else
@@ -365,7 +365,7 @@ void GUI::Run(GUI_IdleProc idle, int once, int multitaskfriendly) {
 					HandleEvent(&event);
 				} while (SDL_PollEvent(&event));
 			} else {
-				if (idle != NULL) {
+				if (idle != nullptr) {
 					HandleStatus(idle());
 				}
 				for (i = numwidgets - 1; i >= 0; --i) {
diff --git a/engines/ultima/nuvie/gui/gui.h b/engines/ultima/nuvie/gui/gui.h
index ad98d94db3c..32109b81b03 100644
--- a/engines/ultima/nuvie/gui/gui.h
+++ b/engines/ultima/nuvie/gui/gui.h
@@ -116,12 +116,12 @@ public:
 	   function requests a quit, or the SDL window has been closed.
 	   If 'once' is non-zero, you need to display the GUI yourself,
 	   and the GUI event loop will run once and then return.
-	   If 'multitaskfriendly' is non-zero AND idle is NULL,
+	   If 'multitaskfriendly' is non-zero AND idle is nullptr,
 	   a 'WaitEvent' will be used instead of the CPU time
 	   consuming 'PollEvent'. CAVE: Any widget-'idle'-procs WON'T
 	   be executed then.
 	 */
-	void Run(GUI_IdleProc idle = NULL, int once = 0, int multitaskfriendly = 0);
+	void Run(GUI_IdleProc idle = nullptr, int once = 0, int multitaskfriendly = 0);
 
 	/* Run Idle() on all widgets. */
 	void Idle(); // SB-X
@@ -153,11 +153,11 @@ public:
 
 	bool set_focus(GUI_Widget *widget);
 	void clear_focus()  {
-		set_focus(NULL);
+		set_focus(nullptr);
 	}
 	void lock_input(GUI_Widget *widget);
 	void unlock_input() {
-		lock_input(NULL);
+		lock_input(nullptr);
 		unblock();
 	}
 	void block()   {
diff --git a/engines/ultima/nuvie/gui/gui_area.cpp b/engines/ultima/nuvie/gui/gui_area.cpp
index fd888c97c1c..22ea4dc4f15 100644
--- a/engines/ultima/nuvie/gui/gui_area.cpp
+++ b/engines/ultima/nuvie/gui/gui_area.cpp
@@ -27,13 +27,13 @@ namespace Ultima {
 namespace Nuvie {
 
 GUI_Area:: GUI_Area(int x, int y, int w, int h, uint8 r, uint8 g, uint8 b, int aShape)
-	: GUI_Widget(NULL, x, y, w, h), R(r), G(g), B(b), color(0), useFrame(0), shape(aShape),
+	: GUI_Widget(nullptr, x, y, w, h), R(r), G(g), B(b), color(0), useFrame(0), shape(aShape),
 	  frameThickness(0), fB(0), fG(0), fR(0), frameColor(0) {
 }
 
 GUI_Area:: GUI_Area(int x, int y, int w, int h, uint8 r, uint8 g, uint8 b,
 					uint8 fr, uint8 fg, uint8 fb, int fthick, int aShape)
-	: GUI_Widget(NULL, x, y, w, h), R(r), G(g), B(b), color(0), useFrame(1),
+	: GUI_Widget(nullptr, x, y, w, h), R(r), G(g), B(b), color(0), useFrame(1),
 	  fR(fr), fG(fg), fB(fb), frameColor(0), frameThickness(fthick), shape(aShape) {
 }
 
diff --git a/engines/ultima/nuvie/gui/gui_button.cpp b/engines/ultima/nuvie/gui/gui_button.cpp
index c4aed7b96ce..ea9d2a85a75 100644
--- a/engines/ultima/nuvie/gui/gui_button.cpp
+++ b/engines/ultima/nuvie/gui/gui_button.cpp
@@ -27,7 +27,7 @@ namespace Ultima {
 namespace Nuvie {
 
 /* the check marks bitmap */
-Graphics::ManagedSurface *checkmarks = NULL;
+Graphics::ManagedSurface *checkmarks = nullptr;
 
 
 GUI_Button:: GUI_Button(void *data, int x, int y, Graphics::ManagedSurface *image,
@@ -42,7 +42,7 @@ GUI_Button:: GUI_Button(void *data, int x, int y, Graphics::ManagedSurface *imag
 		pressed[i] = 0;
 	}
 	enabled = 1;
-	buttonFont = NULL;
+	buttonFont = nullptr;
 	freefont = 0;
 	flatbutton = 0;
 	is_checkable = 0;
@@ -55,14 +55,14 @@ GUI_Button:: GUI_Button(void *data, int x, int y, int w, int h,
 	: GUI_Widget(data, x, y, w, h) {
 	callback_object = callback;
 
-	button = NULL;
-	button2 = NULL;
+	button = nullptr;
+	button2 = nullptr;
 	freebutton = 0;
 	for (int i = 0; i < 3; ++i) {
 		pressed[i] = 0;
 	}
 	enabled = 1;
-	buttonFont = NULL;
+	buttonFont = nullptr;
 	freefont = 0;
 	flatbutton = 0;
 	is_checkable = 0;
@@ -76,7 +76,7 @@ GUI_Button::GUI_Button(void *data, int x, int y, int w, int h, const char *text,
 	: GUI_Widget(data, x, y, w, h) {
 	callback_object = callback;
 
-	if (font != NULL) {
+	if (font != nullptr) {
 		buttonFont = font;
 		freefont = 0;
 	} else {
@@ -85,14 +85,14 @@ GUI_Button::GUI_Button(void *data, int x, int y, int w, int h, const char *text,
 	}
 	flatbutton = flat;
 	freebutton = 1;
-	button = NULL;
-	button2 = NULL;
+	button = nullptr;
+	button2 = nullptr;
 
 	is_checkable = is_checkbutton;
 	checked = 0;
 	is_highlighted = false;
 	/*
-	  if (is_checkable &&(checkmarks==NULL))
+	  if (is_checkable &&(checkmarks==nullptr))
 	  {
 	    checkmarks=GUI_LoadImage(checker_w,checker_h,checker_pal,checker_data);
 	    SDL_SetColorKey(checkmarks,SDL_SRCCOLORKEY,0);
@@ -150,10 +150,10 @@ void GUI_Button:: Display(bool full_redraw) {
 	Common::Rect src, dest = area;
 
 	if (button) {
-		if ((button2 != NULL) && ((pressed[0]) == 1 || is_highlighted))
-			SDL_BlitSurface(button2, NULL, surface, &dest);
+		if ((button2 != nullptr) && ((pressed[0]) == 1 || is_highlighted))
+			SDL_BlitSurface(button2, nullptr, surface, &dest);
 		else
-			SDL_BlitSurface(button, NULL, surface, &dest);
+			SDL_BlitSurface(button, nullptr, surface, &dest);
 	}
 	if (is_checkable) {
 		src.left = 8 - (checked * 8);
@@ -270,8 +270,8 @@ Graphics::ManagedSurface *GUI_Button::CreateTextButtonImage(int style, const cha
 	Graphics::ManagedSurface *img = new Graphics::ManagedSurface(area.width(), area.height(),
 		Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0));
 
-	if (img == NULL)
-		return NULL;
+	if (img == nullptr)
+		return nullptr;
 
 	uint32 color1 = SDL_MapRGB(img->format, BL_R, BL_G, BL_B);
 	uint32 color2 = SDL_MapRGB(img->format, BS_R, BS_G, BS_B);
diff --git a/engines/ultima/nuvie/gui/gui_console.cpp b/engines/ultima/nuvie/gui/gui_console.cpp
index daf45259741..6a4ad5594ea 100644
--- a/engines/ultima/nuvie/gui/gui_console.cpp
+++ b/engines/ultima/nuvie/gui/gui_console.cpp
@@ -30,7 +30,7 @@ namespace Ultima {
 namespace Nuvie {
 
 GUI_Console::GUI_Console(uint16 x, uint16 y, uint16 w, uint16 h)
-	: GUI_Widget(NULL, x, y, w, h) {
+	: GUI_Widget(nullptr, x, y, w, h) {
 	bg_color = new GUI_Color(0, 0, 0);
 	font = new GUI_Font(1);
 	font->setColoring(0xff, 0xff, 0xff, 0, 0, 0);
diff --git a/engines/ultima/nuvie/gui/gui_dialog.cpp b/engines/ultima/nuvie/gui/gui_dialog.cpp
index b1a28284b9d..b56e2848b32 100644
--- a/engines/ultima/nuvie/gui/gui_dialog.cpp
+++ b/engines/ultima/nuvie/gui/gui_dialog.cpp
@@ -29,7 +29,7 @@ namespace Ultima {
 namespace Nuvie {
 
 GUI_Dialog::GUI_Dialog(int x, int y, int w, int h, uint8 r, uint8 g, uint8 b, bool is_moveable)
-	: GUI_Widget(NULL, x, y, w, h) {
+	: GUI_Widget(nullptr, x, y, w, h) {
 
 	R = r;
 	G = g;
@@ -39,7 +39,7 @@ GUI_Dialog::GUI_Dialog(int x, int y, int w, int h, uint8 r, uint8 g, uint8 b, bo
 	can_drag = is_moveable;
 	button_x = button_y = 0;
 	old_x = old_y = -1;
-	backingstore = NULL;
+	backingstore = nullptr;
 	backingstore_rect.setWidth(w);
 	backingstore_rect.setHeight(h);
 	loadBorderImages();
@@ -63,7 +63,7 @@ void GUI_Dialog::loadBorderImages() {
 		Common::sprintf_s(filename, "Border%s_%d.bmp", "U6", i + 1);
 		build_path(datadir, filename, imagefile);
 		border[i] = SDL_LoadBMP(imagefile.c_str());
-		if (border[i] == NULL) {
+		if (border[i] == nullptr) {
 			DEBUG(0, LEVEL_ERROR, "Failed to load %s from '%s' directory\n", filename, datadir.c_str());
 		}
 	}
@@ -84,7 +84,7 @@ GUI_Dialog:: Display(bool full_redraw) {
 
 	if (old_x != area.left || old_y != area.top) {
 		if (backingstore) {
-			screen->restore_area(backingstore, &backingstore_rect, NULL, NULL, false);
+			screen->restore_area(backingstore, &backingstore_rect, nullptr, nullptr, false);
 			screen->update(backingstore_rect.left, backingstore_rect.top,
 				backingstore_rect.width(), backingstore_rect.height());
 		}
@@ -105,25 +105,25 @@ GUI_Dialog:: Display(bool full_redraw) {
 	dst = area;
 	dst.setWidth(8);
 	dst.setHeight(8);
-	SDL_BlitSurface(border[0], NULL, surface, &dst);
+	SDL_BlitSurface(border[0], nullptr, surface, &dst);
 
 	dst.left = area.left + area.width() - 8;
 	dst.top = area.top;
 	dst.setWidth(8);
 	dst.setHeight(8);
-	SDL_BlitSurface(border[2], NULL, surface, &dst);
+	SDL_BlitSurface(border[2], nullptr, surface, &dst);
 
 	dst.left = area.left + area.width() - 8;
 	dst.top = area.top + area.height() - 8;
 	dst.setWidth(8);
 	dst.setHeight(8);
-	SDL_BlitSurface(border[4], NULL, surface, &dst);
+	SDL_BlitSurface(border[4], nullptr, surface, &dst);
 
 	dst.left = area.left;
 	dst.top = area.top + area.height() - 8;
 	dst.setWidth(8);
 	dst.setHeight(8);
-	SDL_BlitSurface(border[6], NULL, surface, &dst);
+	SDL_BlitSurface(border[6], nullptr, surface, &dst);
 
 // Draw top and bottom border lines
 
@@ -132,13 +132,13 @@ GUI_Dialog:: Display(bool full_redraw) {
 		dst.top = area.top;
 		dst.setWidth(16);
 		dst.setHeight(8);
-		SDL_BlitSurface(border[1], NULL, surface, &dst);
+		SDL_BlitSurface(border[1], nullptr, surface, &dst);
 
 		dst.left = i;
 		dst.top = area.top + area.height() - 8;
 		dst.setWidth(16);
 		dst.setHeight(8);
-		SDL_BlitSurface(border[5], NULL, surface, &dst);
+		SDL_BlitSurface(border[5], nullptr, surface, &dst);
 	}
 
 	if (i < area.left + area.width() - 8) { // draw partial border images
@@ -168,13 +168,13 @@ GUI_Dialog:: Display(bool full_redraw) {
 		dst.top = i;
 		dst.setWidth(8);
 		dst.setHeight(16);
-		SDL_BlitSurface(border[7], NULL, surface, &dst);
+		SDL_BlitSurface(border[7], nullptr, surface, &dst);
 
 		dst.left = area.left + area.width() - 8;
 		dst.top = i;
 		dst.setWidth(8);
 		dst.setHeight(16);
-		SDL_BlitSurface(border[3], NULL, surface, &dst);
+		SDL_BlitSurface(border[3], nullptr, surface, &dst);
 	}
 
 	if (i < area.top + area.height() - 8) { // draw partial border images
diff --git a/engines/ultima/nuvie/gui/gui_drag_manager.cpp b/engines/ultima/nuvie/gui/gui_drag_manager.cpp
index 9f8d479a226..00c8131cc1a 100644
--- a/engines/ultima/nuvie/gui/gui_drag_manager.cpp
+++ b/engines/ultima/nuvie/gui/gui_drag_manager.cpp
@@ -33,8 +33,8 @@ GUI_DragManager::GUI_DragManager(Screen *s) {
 	screen = s;
 
 	message = 0;
-	data = NULL;
-	drag_source = NULL;
+	data = nullptr;
+	drag_source = nullptr;
 	is_out_of_range = false;
 }
 
@@ -69,7 +69,7 @@ void GUI_DragManager::drop(GUI_DragArea *drag_target, int x, int y) {
 		drag_source->drag_drop_failed(x, y, message, data);
 
 
-	drag_source = NULL;
+	drag_source = nullptr;
 
 	return;
 }
diff --git a/engines/ultima/nuvie/gui/gui_font.cpp b/engines/ultima/nuvie/gui/gui_font.cpp
index 3f5b29bc438..54d35eaa2a5 100644
--- a/engines/ultima/nuvie/gui/gui_font.cpp
+++ b/engines/ultima/nuvie/gui/gui_font.cpp
@@ -32,7 +32,7 @@ namespace Nuvie {
 GUI_Font::GUI_Font(uint8 fontType) {
 	Graphics::ManagedSurface *temp;
 
-	_wData = NULL;
+	_wData = nullptr;
 
 	if (fontType == GUI_FONT_6X8)
 		temp = GUI_Font6x8();
@@ -53,7 +53,7 @@ GUI_Font::GUI_Font(uint8 fontType) {
 /* open named BMP file */
 GUI_Font::GUI_Font(char *name) {
 	_fontStore = SDL_LoadBMP(name);
-	if (_fontStore != NULL) {
+	if (_fontStore != nullptr) {
 		_charH = _fontStore->h / 16;
 		_charW = _fontStore->w / 16;
 		_disposeFont = DisposeAfterUse::YES;
@@ -62,12 +62,12 @@ GUI_Font::GUI_Font(char *name) {
 	}
 
 	setTransparency(true);
-	_wData = NULL;
+	_wData = nullptr;
 }
 
 /* use given YxY surface */
 GUI_Font::GUI_Font(Graphics::ManagedSurface *bitmap) {
-	if (bitmap == NULL)
+	if (bitmap == nullptr)
 		_fontStore = GUI_DefaultFont();
 	else
 		_fontStore = bitmap;
@@ -75,7 +75,7 @@ GUI_Font::GUI_Font(Graphics::ManagedSurface *bitmap) {
 	_charW = _fontStore->w / 16;
 	_disposeFont = DisposeAfterUse::NO;
 	setTransparency(true);
-	_wData = NULL;
+	_wData = nullptr;
 }
 
 /* copy constructor */
@@ -86,7 +86,7 @@ GUI_Font::GUI_Font(GUI_Font &font) {
 	_charW = _fontStore->w / 16;
 	_disposeFont = DisposeAfterUse::YES;
 	setTransparency(true);
-	_wData = NULL;
+	_wData = nullptr;
 }
 
 GUI_Font::~GUI_Font() {
diff --git a/engines/ultima/nuvie/gui/gui_load_image.cpp b/engines/ultima/nuvie/gui/gui_load_image.cpp
index d2f197ed2da..72f83b230fc 100644
--- a/engines/ultima/nuvie/gui/gui_load_image.cpp
+++ b/engines/ultima/nuvie/gui/gui_load_image.cpp
@@ -52,26 +52,26 @@ Graphics::ManagedSurface *GUI_LoadImage(int w, int h, uint8 *pal, uint8 *data) {
 /*                                                                      */
 /************************************************************************/
 
-static Graphics::ManagedSurface *the_font = NULL;
-static Graphics::ManagedSurface *the_font_6x8 = NULL;
-static Graphics::ManagedSurface *the_font_gump = NULL;
+static Graphics::ManagedSurface *the_font = nullptr;
+static Graphics::ManagedSurface *the_font_6x8 = nullptr;
+static Graphics::ManagedSurface *the_font_gump = nullptr;
 
 Graphics::ManagedSurface *GUI_DefaultFont(void) {
-	if (the_font == NULL) {
+	if (the_font == nullptr) {
 		the_font = GUI_LoadImage(font_w, font_h, font_pal, font_data);
 	}
 	return (the_font);
 }
 
 Graphics::ManagedSurface *GUI_Font6x8(void) {
-	if (the_font_6x8 == NULL) {
+	if (the_font_6x8 == nullptr) {
 		the_font_6x8 = GUI_LoadImage(font_6x8_w, font_6x8_h, font_pal, font_6x8_data);
 	}
 	return (the_font_6x8);
 }
 
 Graphics::ManagedSurface *GUI_FontGump(void) {
-	if (the_font_gump == NULL) {
+	if (the_font_gump == nullptr) {
 		the_font_gump = GUI_LoadImage(font_gump_w, font_gump_h, font_pal, font_gump_data);
 	}
 	return (the_font_gump);
diff --git a/engines/ultima/nuvie/gui/gui_scroll_bar.cpp b/engines/ultima/nuvie/gui/gui_scroll_bar.cpp
index dacddcf9399..174392d75b9 100644
--- a/engines/ultima/nuvie/gui/gui_scroll_bar.cpp
+++ b/engines/ultima/nuvie/gui/gui_scroll_bar.cpp
@@ -53,7 +53,7 @@ namespace Nuvie {
 
 
 GUI_ScrollBar::GUI_ScrollBar(int x, int y, int h, GUI_CallBack *callback)
-	: GUI_Widget(NULL, x, y, SCROLLBAR_WIDTH, h), callback_object(callback),
+	: GUI_Widget(nullptr, x, y, SCROLLBAR_WIDTH, h), callback_object(callback),
 	  drag(false), slider_highlight_c(0), slider_shadow_c(0), slider_base_c(0),
 	  track_border_c(0), track_base_c(0), slider_click_offset(0) {
 
@@ -76,7 +76,7 @@ void GUI_ScrollBar::loadButtons() {
 	build_path(datadir, "ScrollBarUp_2.bmp", imagefile);
 	image1 = SDL_LoadBMP(imagefile.c_str());
 
-	up_button = new GUI_Button(NULL, 0, 0, image, image1, this);
+	up_button = new GUI_Button(nullptr, 0, 0, image, image1, this);
 	this->AddWidget(up_button);
 
 	build_path(datadir, "ScrollBarDown_1.bmp", imagefile);
@@ -86,7 +86,7 @@ void GUI_ScrollBar::loadButtons() {
 
 	button_height = image->h;
 
-	down_button = new GUI_Button(NULL, 0, area.height() - button_height, image, image1, this);
+	down_button = new GUI_Button(nullptr, 0, area.height() - button_height, image, image1, this);
 	this->AddWidget(down_button);
 
 	return;
@@ -233,9 +233,9 @@ GUI_status GUI_ScrollBar::MouseDown(int x, int y, Shared::MouseButton button) {
 		slider_click_offset = y - area.top - button_height - slider_y;
 		grab_focus();
 	} else if (y < area.top + button_height + slider_y)
-		callback_object->callback(SCROLLBAR_CB_PAGE_UP, this, NULL);
+		callback_object->callback(SCROLLBAR_CB_PAGE_UP, this, nullptr);
 	else
-		callback_object->callback(SCROLLBAR_CB_PAGE_DOWN, this, NULL);
+		callback_object->callback(SCROLLBAR_CB_PAGE_DOWN, this, nullptr);
 
 	return GUI_YUM;
 }
@@ -291,11 +291,11 @@ void GUI_ScrollBar::send_slider_moved_msg() {
 }
 
 void GUI_ScrollBar::send_up_button_msg() {
-	callback_object->callback(SCROLLBAR_CB_UP_BUTTON, this, NULL);
+	callback_object->callback(SCROLLBAR_CB_UP_BUTTON, this, nullptr);
 }
 
 void GUI_ScrollBar::send_down_button_msg() {
-	callback_object->callback(SCROLLBAR_CB_DOWN_BUTTON, this, NULL);
+	callback_object->callback(SCROLLBAR_CB_DOWN_BUTTON, this, nullptr);
 }
 
 GUI_status GUI_ScrollBar::callback(uint16 msg, GUI_CallBack *caller, void *data) {
diff --git a/engines/ultima/nuvie/gui/gui_scroller.cpp b/engines/ultima/nuvie/gui/gui_scroller.cpp
index 816254aa1f7..6428603e042 100644
--- a/engines/ultima/nuvie/gui/gui_scroller.cpp
+++ b/engines/ultima/nuvie/gui/gui_scroller.cpp
@@ -31,7 +31,7 @@ namespace Ultima {
 namespace Nuvie {
 
 GUI_Scroller::GUI_Scroller(int x, int y, int w, int h, uint8 r, uint8 g, uint8 b, uint16 r_height)
-	: GUI_Widget(NULL, x, y, w, h) {
+	: GUI_Widget(nullptr, x, y, w, h) {
 
 	R = r;
 	G = g;
diff --git a/engines/ultima/nuvie/gui/gui_text.cpp b/engines/ultima/nuvie/gui/gui_text.cpp
index d1dde09b8e5..612d8ca74b4 100644
--- a/engines/ultima/nuvie/gui/gui_text.cpp
+++ b/engines/ultima/nuvie/gui/gui_text.cpp
@@ -27,11 +27,11 @@ namespace Ultima {
 namespace Nuvie {
 
 GUI_Text:: GUI_Text(int x, int y, uint8 r, uint8 g, uint8 b, GUI_Font *gui_font, uint16 line_length)
-	: GUI_Widget(NULL, x, y, 0, 0) {
+	: GUI_Widget(nullptr, x, y, 0, 0) {
 	R = r;
 	G = g;
 	B = b;
-	text = NULL;
+	text = nullptr;
 	max_width = line_length;
 
 	font = gui_font;
diff --git a/engines/ultima/nuvie/gui/widgets/background.cpp b/engines/ultima/nuvie/gui/widgets/background.cpp
index c28487571d1..69cb21c98dc 100644
--- a/engines/ultima/nuvie/gui/widgets/background.cpp
+++ b/engines/ultima/nuvie/gui/widgets/background.cpp
@@ -95,21 +95,21 @@ void Background::Display(bool full_redraw) {
 	if (full_redraw || update_display || Game::get_game()->is_original_plus_full_map()) {
 		if (Game::get_game()->is_original_plus()) {
 			if (Game::get_game()->is_original_plus_cutoff_map())
-				screen->clear(area.left, area.top, area.width(), area.height(), NULL);
+				screen->clear(area.left, area.top, area.width(), area.height(), nullptr);
 			else if (full_redraw || update_display) { // need to clear null background when we have a game size smaller than the screen
 				uint16 game_width = Game::get_game()->get_game_width();
 				uint16 game_height = Game::get_game()->get_game_height();
 				if (x_off > 0) { // centered
-					screen->clear(area.left, area.top, x_off, area.height(), NULL); // left side
-					screen->clear(x_off + game_width, area.top, x_off, area.height(), NULL); // right side
+					screen->clear(area.left, area.top, x_off, area.height(), nullptr); // left side
+					screen->clear(x_off + game_width, area.top, x_off, area.height(), nullptr); // right side
 				} else if (area.width() > game_width) { // upper_left position
-					screen->clear(game_width, area.top, area.width() - game_width, area.height(), NULL); // right side
+					screen->clear(game_width, area.top, area.width() - game_width, area.height(), nullptr); // right side
 				}
 				if (y_off > 0) { // centered
-					screen->clear(area.left, area.top, area.width(), y_off, NULL); // top
-					screen->clear(area.left, y_off + game_height, area.width(), y_off, NULL); // bottom
+					screen->clear(area.left, area.top, area.width(), y_off, nullptr); // top
+					screen->clear(area.left, y_off + game_height, area.width(), y_off, nullptr); // bottom
 				} else if (area.height() > game_height) { // upper_left position
-					screen->clear(area.left, game_height, area.width(), area.height() - game_height, NULL); // bottom
+					screen->clear(area.left, game_height, area.width(), area.height() - game_height, nullptr); // bottom
 				}
 			}
 			unsigned char *ptr = background->get_data();
@@ -124,7 +124,7 @@ void Background::Display(bool full_redraw) {
 				screen->blit(left_bg_x_off, y_off, ptr, 8, border_width, bg_h, bg_w, true);
 			}
 		} else {
-			screen->clear(area.left, area.top, area.width(), area.height(), NULL);
+			screen->clear(area.left, area.top, area.width(), area.height(), nullptr);
 			if (Game::get_game()->is_orig_style())
 				screen->blit(x_off, y_off, background->get_data(), 8,  bg_w, bg_h, bg_w, true);
 		}
diff --git a/engines/ultima/nuvie/gui/widgets/command_bar.cpp b/engines/ultima/nuvie/gui/widgets/command_bar.cpp
index cb57401edcb..e9366e2e318 100644
--- a/engines/ultima/nuvie/gui/widgets/command_bar.cpp
+++ b/engines/ultima/nuvie/gui/widgets/command_bar.cpp
@@ -84,12 +84,12 @@ static Tile placeholder_tile = {
 	}
 };
 
-CommandBar::CommandBar() : GUI_Widget(NULL), game(nullptr), event(nullptr),
+CommandBar::CommandBar() : GUI_Widget(nullptr), game(nullptr), event(nullptr),
 		background(nullptr), font(nullptr), selected_action(-1), offset(0),
 		combat_mode(false), bg_color(0), font_color(0) {
 }
 
-CommandBar::CommandBar(Game *g) : GUI_Widget(NULL), game(g),
+CommandBar::CommandBar(Game *g) : GUI_Widget(nullptr), game(g),
 		background(nullptr), combat_mode(false), bg_color(0),
 		font_color(0) {
 	Weather *weather;
@@ -117,12 +117,12 @@ CommandBar::CommandBar(Game *g) : GUI_Widget(NULL), game(g),
 			font_color = value;
 			y_off += game->get_game_height() - 29;
 			if (right_pos_cb && (game->get_game_height() > 228 || game->is_new_style())) // bottom right
-				Init(NULL, x_off + 159 + game->get_game_width() - 320, y_off, 0, 0);
+				Init(nullptr, x_off + 159 + game->get_game_width() - 320, y_off, 0, 0);
 			else // bottom left
-				Init(NULL, x_off, y_off, 0, 0);
+				Init(nullptr, x_off, y_off, 0, 0);
 		} else {
 			font_color = FONT_COLOR_U6_NORMAL;
-			Init(NULL, 8 + x_off, 168 + y_off, 0, 0);
+			Init(nullptr, 8 + x_off, 168 + y_off, 0, 0);
 		}
 		area.setWidth(16 * 10); // space for 10 icons
 		area.setHeight(24 + 1); // extra space for the underlined default action
@@ -132,11 +132,11 @@ CommandBar::CommandBar(Game *g) : GUI_Widget(NULL), game(g),
 			background->load_WoU_background(game->get_config(), game->get_game_type());
 			y_off += game->get_game_height() - 34;
 			if (right_pos_cb && (game->get_game_height() > 233 || game->is_new_style()))
-				Init(NULL, x_off + game->get_game_width() - 320 + 174, y_off, 146, 34);
+				Init(nullptr, x_off + game->get_game_width() - 320 + 174, y_off, 146, 34);
 			else
-				Init(NULL, 16 + x_off, y_off - 3, 146, 34);
+				Init(nullptr, 16 + x_off, y_off - 3, 146, 34);
 		} else
-			Init(NULL, 16 + x_off, 163 + y_off, 146, 34);
+			Init(nullptr, 16 + x_off, 163 + y_off, 146, 34);
 		offset = OBJLIST_OFFSET_MD_COMMAND_BAR;
 	} else { // SE
 		if (!game->is_orig_style()) {
@@ -144,11 +144,11 @@ CommandBar::CommandBar(Game *g) : GUI_Widget(NULL), game(g),
 			background->load_WoU_background(game->get_config(), game->get_game_type());
 			y_off += game->get_game_height() - 22;
 			if (right_pos_cb && (game->get_game_height() > 221 || game->is_new_style())) // bottom right
-				Init(NULL, x_off + 156 + game->get_game_width() - 320, y_off, 163, 19);
+				Init(nullptr, x_off + 156 + game->get_game_width() - 320, y_off, 163, 19);
 			else
-				Init(NULL, 8 + x_off, y_off, 1643, 19);
+				Init(nullptr, 8 + x_off, y_off, 1643, 19);
 		} else
-			Init(NULL, 8 + x_off, 178 + y_off, 163, 19);
+			Init(nullptr, 8 + x_off, 178 + y_off, 163, 19);
 		offset = OBJLIST_OFFSET_SE_COMMAND_BAR;
 	}
 
@@ -395,7 +395,7 @@ void CommandBar::Display(bool full_redraw) {
 			if (game->is_orig_style())
 				scr->fill(bg_color, area.left, area.top, area.width(), area.height());
 			else if (game->is_original_plus_cutoff_map() && area.left != game->get_game_x_offset()) // over null background so clear area where text is displayed
-				scr->clear(area.left + 2, area.top, area.width() - 2, area.height() - 16, NULL);
+				scr->clear(area.left + 2, area.top, area.width() - 2, area.height() - 16, nullptr);
 
 			display_information();
 			for (uint32 i = 0; i < 10; i++)
diff --git a/engines/ultima/nuvie/gui/widgets/command_bar_new_ui.cpp b/engines/ultima/nuvie/gui/widgets/command_bar_new_ui.cpp
index 326ef151e7d..4b5a13b67fe 100644
--- a/engines/ultima/nuvie/gui/widgets/command_bar_new_ui.cpp
+++ b/engines/ultima/nuvie/gui/widgets/command_bar_new_ui.cpp
@@ -59,7 +59,7 @@ static const char *mode_name_tbl[table_size_U6];
 
 CommandBarNewUI::CommandBarNewUI(Game *g) : CommandBar() {
 	game = g;
-	background = NULL;
+	background = nullptr;
 	Weather *weather;
 	uint16 x_off = game->get_game_x_offset();
 	uint16 y_off = game->get_game_y_offset();
@@ -108,11 +108,11 @@ CommandBarNewUI::CommandBarNewUI(Game *g) : CommandBar() {
 	uint8 command_width = btn_size * icon_w;
 	uint8 command_height = btn_size * icon_h + text_height;
 
-	Init(NULL, (map_width - command_width) / 2 + x_off, (map_height - command_height) / 2 + y_off, 0, 0);
+	Init(nullptr, (map_width - command_width) / 2 + x_off, (map_height - command_height) / 2 + y_off, 0, 0);
 	area.setWidth(command_width); // space for 5x3 icons
 	area.setHeight(command_height);
 
-	event = NULL; // it's not set yet
+	event = nullptr; // it's not set yet
 
 	weather = game->get_weather();
 
diff --git a/engines/ultima/nuvie/gui/widgets/console.cpp b/engines/ultima/nuvie/gui/widgets/console.cpp
index f46f9bd9411..6a5b09eff94 100644
--- a/engines/ultima/nuvie/gui/widgets/console.cpp
+++ b/engines/ultima/nuvie/gui/widgets/console.cpp
@@ -28,7 +28,7 @@
 namespace Ultima {
 namespace Nuvie {
 
-static Console *g_console = NULL;
+static Console *g_console = nullptr;
 
 Console::Console(Configuration *c, Screen *s, GUI *g, uint16 x, uint16 y, uint16 w, uint16 h)
 	: GUI_Console(x, y, w, h) {
@@ -59,7 +59,7 @@ void Console::AddLine(Std::string line) {
 }
 
 void ConsoleInit(Configuration *c, Screen *s, GUI *gui, uint16 w, uint16 h) {
-	assert(g_console == NULL);
+	assert(g_console == nullptr);
 
 	//uint16 x_off = config_get_video_x_offset(c);
 	//uint16 y_off = config_get_video_y_offset(c);
@@ -68,9 +68,9 @@ void ConsoleInit(Configuration *c, Screen *s, GUI *gui, uint16 w, uint16 h) {
 }
 
 void ConsoleDelete() {
-	if (g_console != NULL) {
+	if (g_console != nullptr) {
 		g_console->Delete();
-		g_console = NULL;
+		g_console = nullptr;
 	}
 }
 
@@ -82,14 +82,14 @@ void ConsoleAddInfo(const char *format, ...) {
 	vsnprintf(buf, 1024, format, args);
 	va_end(args);
 
-	if (g_console != NULL) {
+	if (g_console != nullptr) {
 		DEBUG(0, LEVEL_INFORMATIONAL, "%s\n", buf);
 		g_console->AddLine(buf);
 	}
 }
 
 void ConsoleAddError(Std::string s) {
-	if (g_console != NULL) {
+	if (g_console != nullptr) {
 		DEBUG(0, LEVEL_ERROR, "%s\n", s.c_str());
 		g_console->Show();
 		g_console->AddLine("Error: " + s);
@@ -97,14 +97,14 @@ void ConsoleAddError(Std::string s) {
 }
 
 void ConsoleAddWarning(Std::string s) {
-	if (g_console != NULL) {
+	if (g_console != nullptr) {
 		DEBUG(0, LEVEL_WARNING, "%s\n", s.c_str());
 		g_console->AddLine("Warning: " + s);
 	}
 }
 
 void ConsolePause() {
-	if (g_console == NULL)
+	if (g_console == nullptr)
 		return;
 
 	//pause here.
diff --git a/engines/ultima/nuvie/gui/widgets/converse_gump.cpp b/engines/ultima/nuvie/gui/widgets/converse_gump.cpp
index 643a3d96f3b..0e776596c3b 100644
--- a/engines/ultima/nuvie/gui/widgets/converse_gump.cpp
+++ b/engines/ultima/nuvie/gui/widgets/converse_gump.cpp
@@ -91,10 +91,10 @@ ConverseGump::ConverseGump(Configuration *cfg, Font *f, Screen *s) {
 		}
 	}
 
-	GUI_Widget::Init(NULL, x_off, y_off, game->get_converse_gump_width(), (uint16)gump_h);
-	npc_portrait = NULL;
-	avatar_portrait = NULL;
-	keyword_list = NULL;
+	GUI_Widget::Init(nullptr, x_off, y_off, game->get_converse_gump_width(), (uint16)gump_h);
+	npc_portrait = nullptr;
+	avatar_portrait = nullptr;
+	keyword_list = nullptr;
 
 	font = game->get_font_manager()->get_conv_font();
 
@@ -167,7 +167,7 @@ void ConverseGump::set_talking(bool state, Actor *actor) {
 
 		if (avatar_portrait) {
 			free(avatar_portrait);
-			avatar_portrait = NULL;
+			avatar_portrait = nullptr;
 		}
 
 		cursor_position = 0;
@@ -185,9 +185,9 @@ void ConverseGump::set_actor_portrait(Actor *a) {
 	if (Game::get_game()->get_portrait()->has_portrait(a))
 		npc_portrait = get_portrait_data(a);
 	else
-		npc_portrait = NULL;
+		npc_portrait = nullptr;
 
-	if (avatar_portrait == NULL) {
+	if (avatar_portrait == nullptr) {
 		Actor *p = Game::get_game()->get_player()->get_actor();
 		Actor *p1 = Game::get_game()->get_actor_manager()->get_actor(1);
 		avatar_portrait = get_portrait_data(p->get_actor_num() != 0 ? p : p1); // don't use portrait 0 when in a vehicle
@@ -397,7 +397,7 @@ void ConverseGump::parse_fm_towns_token(MsgText *token) {
 		char c = token->s[i];
 		if (i < len && Common::isDigit(c)) {
 			const char *c_str = token->s.c_str();
-			uint16 actor_num = (int)strtol(&c_str[i], NULL, 10);
+			uint16 actor_num = (int)strtol(&c_str[i], nullptr, 10);
 			if (actor_num < 256) {
 				Actor *actor = Game::get_game()->get_actor_manager()->get_actor(actor_num);
 				if (actor) {
@@ -495,7 +495,7 @@ Std::string ConverseGump::get_token_at_cursor() {
 
 bool ConverseGump::input_buf_add_char(char c) {
 	input_char = 0;
-	if (permit_input != NULL)
+	if (permit_input != nullptr)
 		input_buf_remove_char();
 	input_buf.push_back(c);
 	return true;
@@ -642,7 +642,7 @@ GUI_status ConverseGump::KeyDown(const Common::KeyState &keyState) {
 		}
 		break;
 	case Common::KEYCODE_RIGHT:
-		if (cursor_at_input_section() && input_char != 0 && permit_input == NULL)
+		if (cursor_at_input_section() && input_char != 0 && permit_input == nullptr)
 			input_buf_add_char(get_char_from_input_char());
 		else
 			cursor_position = (cursor_position + 1) % (keyword_list->size() + 1);
@@ -658,7 +658,7 @@ GUI_status ConverseGump::KeyDown(const Common::KeyState &keyState) {
 	case Common::KEYCODE_ESCAPE:
 		if (permit_inputescape) {
 			// reset input buffer
-			permit_input = NULL;
+			permit_input = nullptr;
 			if (input_mode)
 				set_input_mode(false);
 		}
@@ -688,7 +688,7 @@ GUI_status ConverseGump::KeyDown(const Common::KeyState &keyState) {
 	default: // alphanumeric characters
 		if (input_mode && Common::isPrint(ascii)) {
 			cursor_move_to_input();
-			if (permit_input == NULL) {
+			if (permit_input == nullptr) {
 				if (!numbers_only || Common::isDigit(ascii))
 					if (input_char != 0)
 						input_buf_add_char(get_char_from_input_char());
diff --git a/engines/ultima/nuvie/gui/widgets/converse_gump.h b/engines/ultima/nuvie/gui/widgets/converse_gump.h
index e2a6f28f96b..aaf7d057731 100644
--- a/engines/ultima/nuvie/gui/widgets/converse_gump.h
+++ b/engines/ultima/nuvie/gui/widgets/converse_gump.h
@@ -72,7 +72,7 @@ public:
 	bool parse_token(MsgText *token) override;
 	Std::string get_token_string_at_pos(uint16 x, uint16 y) override;
 	void display_string(Std::string s, Font *f, bool include_on_map_window) override;
-	void set_talking(bool state, Actor *actor = NULL) override;
+	void set_talking(bool state, Actor *actor = nullptr) override;
 	void set_font(uint8 font_type) override {}
 //bool get_solid_bg() { return solid_bg; }
 	void set_solid_bg(bool val) {
diff --git a/engines/ultima/nuvie/gui/widgets/converse_gump_wou.cpp b/engines/ultima/nuvie/gui/widgets/converse_gump_wou.cpp
index c888fa0a3e5..862b9615e1b 100644
--- a/engines/ultima/nuvie/gui/widgets/converse_gump_wou.cpp
+++ b/engines/ultima/nuvie/gui/widgets/converse_gump_wou.cpp
@@ -142,7 +142,7 @@ void ConverseGumpWOU::display_bg() {
 			dst.top = y_off;
 			dst.setWidth(176);
 			dst.setHeight(176);
-			SDL_BlitSurface(bg_image, NULL, game->get_screen()->get_sdl_surface(), &dst);
+			SDL_BlitSurface(bg_image, nullptr, game->get_screen()->get_sdl_surface(), &dst);
 			screen->update(x_off, y_off, 176, 176);
 		} else {
 			screen->blit(x_off, y_off, ptr, 8, 171, 200, bg_w, true); // main bg
diff --git a/engines/ultima/nuvie/gui/widgets/converse_gump_wou.h b/engines/ultima/nuvie/gui/widgets/converse_gump_wou.h
index f7e39ea329e..9d4b6750d48 100644
--- a/engines/ultima/nuvie/gui/widgets/converse_gump_wou.h
+++ b/engines/ultima/nuvie/gui/widgets/converse_gump_wou.h
@@ -53,7 +53,7 @@ public:
 	ConverseGumpWOU(Configuration *cfg, Font *f, Screen *s);
 	~ConverseGumpWOU() override;
 
-	void set_talking(bool state, Actor *actor = NULL) override;
+	void set_talking(bool state, Actor *actor = nullptr) override;
 	void set_font(uint8 font_type) override {}
 	void display_converse_prompt() override;
 
diff --git a/engines/ultima/nuvie/gui/widgets/fps_counter.cpp b/engines/ultima/nuvie/gui/widgets/fps_counter.cpp
index 9ee84962f66..62e1edf0e2f 100644
--- a/engines/ultima/nuvie/gui/widgets/fps_counter.cpp
+++ b/engines/ultima/nuvie/gui/widgets/fps_counter.cpp
@@ -33,14 +33,14 @@ namespace Nuvie {
 
 using Std::string;
 
-FpsCounter::FpsCounter(Game *g) : GUI_Widget(NULL) {
+FpsCounter::FpsCounter(Game *g) : GUI_Widget(nullptr) {
 	game = g;
 	font = game->get_font_manager()->get_conv_font();
 
 	uint16 x_off = game->get_game_x_offset();
 	uint16 y_off = game->get_game_y_offset();
 
-	Init(NULL, x_off + 280, y_off, 40, 10);
+	Init(nullptr, x_off + 280, y_off, 40, 10);
 
 	Common::strcpy_s(fps_string, "000.00");
 }
diff --git a/engines/ultima/nuvie/gui/widgets/gui_widget.cpp b/engines/ultima/nuvie/gui/widgets/gui_widget.cpp
index 528bc173525..29f2af50c60 100644
--- a/engines/ultima/nuvie/gui/widgets/gui_widget.cpp
+++ b/engines/ultima/nuvie/gui/widgets/gui_widget.cpp
@@ -47,10 +47,10 @@ GUI_Widget::~GUI_Widget() {
 
 void GUI_Widget::Init(void *data, int x, int y, int w, int h) {
 	focused = false;
-	gui_drag_manager = NULL; //set from placeOnScreen method
+	gui_drag_manager = nullptr; //set from placeOnScreen method
 	widget_data = data;
-	screen = NULL;
-	surface = NULL;
+	screen = nullptr;
+	surface = nullptr;
 	SetRect(0, 0, w, h);
 	offset_x = x;
 	offset_y = y;
@@ -59,7 +59,7 @@ void GUI_Widget::Init(void *data, int x, int y, int w, int h) {
 	for (int n = 0; n < 3; ++n) {
 		pressed[n] = 0;
 	}
-	parent = NULL;
+	parent = nullptr;
 
 	update_display = true;
 	set_accept_mouseclick(false); // initializes mouseclick time; SB-X
@@ -157,7 +157,7 @@ void GUI_Widget::moveToFront() {
 void GUI_Widget::PlaceOnScreen(Screen *s, GUI_DragManager *dm, int x, int y) {
 	Std::list<GUI_Widget *>::iterator child;
 
-	if (screen != NULL)
+	if (screen != nullptr)
 		return;
 
 	area.moveTo(x + offset_x, y + offset_y);
@@ -276,7 +276,7 @@ void GUI_Widget::Redraw(void) {
 
 	if (status == WIDGET_VISIBLE) {
 		update_display = true;
-		if (parent != NULL)
+		if (parent != nullptr)
 			parent->Redraw();
 		//Display();
 		//SDL_UpdateRects(screen,1,&area);
@@ -509,9 +509,9 @@ bool GUI_Widget::widget_has_focus() {
 
 	if (GUI::get_gui()->get_block_input())
 		return (false);
-	if (locked_widget != NULL && locked_widget != this)
+	if (locked_widget != nullptr && locked_widget != this)
 		return (false);
-	if (focused_widget != NULL && focused_widget != this)
+	if (focused_widget != nullptr && focused_widget != this)
 		return (false);
 	return (true);
 }
diff --git a/engines/ultima/nuvie/gui/widgets/gui_widget.h b/engines/ultima/nuvie/gui/widgets/gui_widget.h
index 2d7e4e0d574..14b698a2acc 100644
--- a/engines/ultima/nuvie/gui/widgets/gui_widget.h
+++ b/engines/ultima/nuvie/gui/widgets/gui_widget.h
@@ -191,7 +191,7 @@ public:
 	 */
 	virtual GUI_status HandleEvent(const Common::Event *event);
 
-	/* Returns NULL if everything is okay, or an error message if not */
+	/* Returns nullptr if everything is okay, or an error message if not */
 	char *Error(void) {
 		return (errorptr);
 	}
diff --git a/engines/ultima/nuvie/gui/widgets/map_window.cpp b/engines/ultima/nuvie/gui/widgets/map_window.cpp
index 8ab21ec58cb..d3052639ed9 100644
--- a/engines/ultima/nuvie/gui/widgets/map_window.cpp
+++ b/engines/ultima/nuvie/gui/widgets/map_window.cpp
@@ -149,7 +149,7 @@ MapWindow::MapWindow(Configuration *cfg, Map *m): GUI_Widget(nullptr, 0, 0, 0, 0
 }
 
 MapWindow::~MapWindow() {
-	set_overlay(NULL); // free
+	set_overlay(nullptr); // free
 	free(tmp_map_buf);
 	delete anim_manager;
 	if (roof_tiles) {
@@ -208,11 +208,11 @@ bool MapWindow::init(TileManager *tm, ObjManager *om, ActorManager *am) {
 // hide the window until game is fully loaded and does fade-in
 	get_overlay(); // this allocates `overlay`
 	overlay_level = MAP_OVERLAY_ONTOP;
-	assert(SDL_FillRect(overlay, NULL, game->get_palette()->get_bg_color()) == 0);
+	assert(SDL_FillRect(overlay, nullptr, game->get_palette()->get_bg_color()) == 0);
 
 	wizard_eye_info.eye_tile = tile_manager->get_tile(TILE_U6_WIZARD_EYE);
 	wizard_eye_info.moves_left = 0;
-	wizard_eye_info.caller = NULL;
+	wizard_eye_info.caller = nullptr;
 
 	if (roof_mode)
 		loadRoofTiles();
@@ -245,10 +245,10 @@ bool MapWindow::set_windowSize(uint16 width, uint16 height) {
 	tmp_map_height = win_height + (TMP_MAP_BORDER * 2);// + 1;
 
 	tmp_map_buf = (uint16 *)nuvie_realloc(tmp_map_buf, tmp_map_width * tmp_map_height * sizeof(uint16));
-	if (tmp_map_buf == NULL)
+	if (tmp_map_buf == nullptr)
 		return false;
 
-// if(surface != NULL)
+// if(surface != nullptr)
 //   delete surface;
 // surface = new Surface;
 
@@ -509,7 +509,7 @@ const char *MapWindow::look(uint16 x, uint16 y, bool show_prefix) {
 
 	uint16 wrapped_x = WRAPPED_COORD(cur_x + x, cur_level);
 	actor = actor_manager->get_actor(wrapped_x, cur_y + y, cur_level);
-	if (actor != NULL && actor->is_visible())
+	if (actor != nullptr && actor->is_visible())
 		return actor_manager->look_actor(actor, show_prefix);
 
 	return map->look(wrapped_x, cur_y + y, cur_level);
@@ -523,11 +523,11 @@ Obj *MapWindow::get_objAtCursor(bool for_use /* = false */) {
 
 Obj *MapWindow::get_objAtCoord(MapCoord coord, bool top_obj, bool include_ignored_objects, bool for_use /* = false */) {
 	if (tile_is_black(coord.x, coord.y))
-		return NULL; // nothing to see here. ;)
+		return nullptr; // nothing to see here. ;)
 
 	Obj *obj = obj_manager->get_obj(coord.x, coord.y, coord.z, top_obj, include_ignored_objects);
 	// Savage Empire Create Object from Tile
-	if (for_use && game_type == NUVIE_GAME_SE && obj == NULL) {
+	if (for_use && game_type == NUVIE_GAME_SE && obj == nullptr) {
 		Script *script = game->get_script();
 		uint16 map_win_x = WRAP_VIEWP(cur_x, coord.x, map_width);
 		uint16 map_win_y = coord.y - cur_y;
@@ -550,7 +550,7 @@ Actor *MapWindow::get_actorAtCursor() {
 //Actor *actor;
 
 	if (tmp_map_buf[(cursor_y + TMP_MAP_BORDER) * tmp_map_width + (cursor_x + TMP_MAP_BORDER)] == 0) //black area
-		return NULL; // nothing to see here. ;)
+		return nullptr; // nothing to see here. ;)
 
 	return actor_manager->get_actor(WRAPPED_COORD(cur_x + cursor_x, cur_level), cur_y + cursor_y, cur_level);
 }
@@ -748,7 +748,7 @@ void MapWindow::updateLighting() {
 
 					U6LList *obj_list = obj_manager->get_obj_list(cur_x - TMP_MAP_BORDER + x, cur_y - TMP_MAP_BORDER + y, cur_level); //FIXME wrapped coords.
 					if (obj_list) {
-						for (U6Link *link = obj_list->start(); link != NULL; link = link->next) {
+						for (U6Link *link = obj_list->start(); link != nullptr; link = link->next) {
 							Obj *obj = (Obj *)link->data;
 							tile = tile_manager->get_tile(obj_manager->get_obj_tile_num(obj) + obj->frame_n); //FIXME do we need to check the light for each tile in a multi-tile object.
 							if (GET_TILE_LIGHT_LEVEL(tile) > 0 && can_display_obj(x, y, obj))
@@ -1042,7 +1042,7 @@ void MapWindow::drawObjSuperBlock(bool draw_lowertiles, bool toptile) {
 		for (x = cur_x + win_width; x >= stop_x; x--) {
 			obj_list = obj_manager->get_obj_list(x, y, cur_level);
 			if (obj_list) {
-				for (link = obj_list->start(); link != NULL; link = link->next) {
+				for (link = obj_list->start(); link != nullptr; link = link->next) {
 					obj = (Obj *)link->data;
 					drawObj(obj, draw_lowertiles, toptile);
 				}
@@ -1682,7 +1682,7 @@ bool MapWindow::tmpBufTileIsWall(uint16 x, uint16 y, uint8 direction) {
 //  return true;
 
 	tile = obj_manager->get_obj_tile(WRAPPED_COORD(cur_x - TMP_MAP_BORDER + x, cur_level), WRAPPED_COORD(cur_y - TMP_MAP_BORDER + y, cur_level), cur_level, false);
-	if (tile != NULL) {
+	if (tile != nullptr) {
 		if (tile->flags2 & TILEFLAG_BOUNDARY) {
 			if (tile->flags1 & mask)
 				return true;
@@ -1713,7 +1713,7 @@ CanDropOrMoveMsg MapWindow::can_drop_or_move_obj(uint16 x, uint16 y, Actor *acto
 	if (actor_manager->get_actor(x, y, actor_loc.z))
 		return MSG_NOT_POSSIBLE;
 
-	Obj *dest_obj = NULL;
+	Obj *dest_obj = nullptr;
 	if (game_type == NUVIE_GAME_U6) {
 		dest_obj = obj_manager->get_obj(x, y, actor_loc.z); //FIXME this might not be right. We might want to exclude obj.
 	} else {
@@ -2050,15 +2050,15 @@ GUI_status MapWindow::MouseDelayed(int x, int y, Shared::MouseButton button) {
 	Events *event = game->get_event();
 	if (!looking || game->user_paused() || event->cursor_mode
 	        || (event->get_mode() != MOVE_MODE && event->get_mode() != EQUIP_MODE)) {
-		look_obj = NULL;
-		look_actor = NULL;
+		look_obj = nullptr;
+		look_actor = nullptr;
 		return (GUI_PASS);
 	}
 	game->get_scroll()->display_string("Look-");
 	event->set_mode(LOOK_MODE);
 	event->lookAtCursor(true, original_obj_loc.x, original_obj_loc.y, original_obj_loc.z, look_obj, look_actor);
-	look_obj = NULL;
-	look_actor = NULL;
+	look_obj = nullptr;
+	look_actor = nullptr;
 
 	return (MouseUp(x, y, button)); // do MouseUp so selected_obj is cleared
 }
@@ -2183,7 +2183,7 @@ GUI_status MapWindow::MouseDown(int x, int y, Shared::MouseButton button) {
 GUI_status MapWindow::MouseUp(int x, int y, Shared::MouseButton button) {
 	// cancel dragging and movement no matter what button is released
 	if (selected_obj) {
-		selected_obj = NULL;
+		selected_obj = nullptr;
 	}
 	walking = false;
 	dragging = false;
@@ -2202,7 +2202,7 @@ GUI_status  MapWindow::MouseMotion(int x, int y, uint8 state) {
 //	if(selected_obj) // We don't want to walk if we are selecting an object to move.
 //		walking = false;
 	if (walking) { // No, we don't want to select an object to move if we are walking.
-		selected_obj = NULL;
+		selected_obj = nullptr;
 		dragging = false;
 	}
 
@@ -2244,14 +2244,14 @@ void    MapWindow::drag_drop_success(int x, int y, int message, void *data) {
 //	if (selected_obj)
 //		obj_manager->remove_obj (selected_obj);
 
-	selected_obj = NULL;
+	selected_obj = nullptr;
 	Redraw();
 }
 
 void    MapWindow::drag_drop_failed(int x, int y, int message, void *data) {
 	DEBUG(0, LEVEL_DEBUGGING, "MapWindow::drag_drop_failed\n");
 	dragging = false;
-	selected_obj = NULL;
+	selected_obj = nullptr;
 }
 
 // this does nothing
@@ -2491,7 +2491,7 @@ GUI_status MapWindow::MouseLeave(uint8 state) {
 
 byte *MapWindow::make_thumbnail() {
 	if (thumbnail)
-		return NULL;
+		return nullptr;
 
 	new_thumbnail = true;
 
@@ -2517,7 +2517,7 @@ void MapWindow::create_thumbnail() {
 void MapWindow::free_thumbnail() {
 	if (thumbnail) {
 		delete[] thumbnail;
-		thumbnail = NULL;
+		thumbnail = nullptr;
 	}
 
 	return;
@@ -2530,7 +2530,7 @@ Graphics::ManagedSurface *MapWindow::get_sdl_surface() {
 }
 
 Graphics::ManagedSurface *MapWindow::get_sdl_surface(uint16 x, uint16 y, uint16 w, uint16 h) {
-	Graphics::ManagedSurface *new_surface = NULL;
+	Graphics::ManagedSurface *new_surface = nullptr;
 	byte *screen_area;
 	Common::Rect copy_area(area.left + x, area.top + y, area.left + x + w, area.top + y + h);
 
@@ -2603,7 +2603,7 @@ void MapWindow::wizard_eye_update() {
 	if (wizard_eye_info.moves_left == 0) {
 		set_x_ray_view(X_RAY_OFF);
 		moveMap(wizard_eye_info.prev_x, wizard_eye_info.prev_y, cur_level);
-		wizard_eye_info.caller->callback(EFFECT_CB_COMPLETE, (CallBack *)this, NULL);
+		wizard_eye_info.caller->callback(EFFECT_CB_COMPLETE, (CallBack *)this, nullptr);
 		release_focus();
 	}
 }
@@ -2618,7 +2618,7 @@ void MapWindow::set_roof_mode(bool roofs) {
 	} else {
 		if (roof_tiles) {
 			SDL_FreeSurface(roof_tiles);
-			roof_tiles = NULL;
+			roof_tiles = nullptr;
 		}
 	}
 }
diff --git a/engines/ultima/nuvie/gui/widgets/map_window.h b/engines/ultima/nuvie/gui/widgets/map_window.h
index 24b2ef7b0a1..66308c7a8bd 100644
--- a/engines/ultima/nuvie/gui/widgets/map_window.h
+++ b/engines/ultima/nuvie/gui/widgets/map_window.h
@@ -242,7 +242,7 @@ public:
 		return look_on_left_click;
 	}
 	bool is_on_screen(uint16 x, uint16 y, uint8 z);
-	bool tile_is_black(uint16 x, uint16 y, Obj *obj = NULL); // subtracts cur_x and cur_y
+	bool tile_is_black(uint16 x, uint16 y, Obj *obj = nullptr); // subtracts cur_x and cur_y
 	const char *look(uint16 x, uint16 y, bool show_prefix = true);
 	const char *lookAtCursor(bool show_prefix = true) {
 		return (look(cursor_x, cursor_y, show_prefix));
@@ -256,7 +256,7 @@ public:
 	void teleport_to_cursor();
 	void select_target(int x, int y);
 	void mouseToWorldCoords(int mx, int my, int &wx, int &wy);
-	void get_movement_direction(uint16 mx, uint16 my, sint16 &rel_x, sint16 &rel_y, uint8 *mptr = NULL);
+	void get_movement_direction(uint16 mx, uint16 my, sint16 &rel_x, sint16 &rel_y, uint8 *mptr = nullptr);
 
 	TileManager *get_tile_manager() {
 		return tile_manager;
@@ -270,7 +270,7 @@ public:
 	Graphics::ManagedSurface *get_overlay();
 
 	void get_level(uint8 *level);
-	void get_pos(uint16 *x, uint16 *y, uint8 *px = NULL, uint8 *py = NULL);
+	void get_pos(uint16 *x, uint16 *y, uint8 *px = nullptr, uint8 *py = nullptr);
 	void get_velocity(sint16 *vx, sint16 *vy) {
 		*vx = vel_x;
 		*vy = vel_y;
diff --git a/engines/ultima/nuvie/gui/widgets/msg_scroll.cpp b/engines/ultima/nuvie/gui/widgets/msg_scroll.cpp
index e93f06d0ab3..cc5535a8116 100644
--- a/engines/ultima/nuvie/gui/widgets/msg_scroll.cpp
+++ b/engines/ultima/nuvie/gui/widgets/msg_scroll.cpp
@@ -38,7 +38,7 @@ namespace Nuvie {
 
 // MsgText Class
 MsgText::MsgText() {
-	font = NULL;
+	font = nullptr;
 	color = 0;
 }
 
@@ -81,7 +81,7 @@ MsgLine::~MsgLine() {
 }
 
 void MsgLine::append(MsgText *new_text) {
-	MsgText *msg_text = NULL;
+	MsgText *msg_text = nullptr;
 
 	if (text.size() > 0)
 		msg_text = text.back();
@@ -129,7 +129,7 @@ MsgText *MsgLine::get_text_at_pos(uint16 pos) {
 	Std::list<MsgText *>::iterator iter;
 
 	if (pos > total_length)
-		return NULL;
+		return nullptr;
 
 	for (i = 0, iter = text.begin(); iter != text.end(); iter++) {
 		if (i + (*iter)->s.length() >= pos)
@@ -138,7 +138,7 @@ MsgText *MsgLine::get_text_at_pos(uint16 pos) {
 		i += (*iter)->s.length();
 	}
 
-	return NULL;
+	return nullptr;
 }
 
 uint16 MsgLine::get_display_width() {
@@ -173,8 +173,8 @@ void MsgScroll::init(Configuration *cfg, Font *f) {
 	just_finished_page_break = false;
 	using_target_cursor = false;
 
-	callback_target = NULL;
-	callback_user_data = NULL;
+	callback_target = nullptr;
+	callback_user_data = nullptr;
 
 	scrollback_height = MSGSCROLL_SCROLLBACK_HEIGHT;
 	capitalise_next_letter = false;
@@ -187,7 +187,7 @@ void MsgScroll::init(Configuration *cfg, Font *f) {
 	}
 }
 
-MsgScroll::MsgScroll(Configuration *cfg, Font *f) : GUI_Widget(NULL, 0, 0, 0, 0),
+MsgScroll::MsgScroll(Configuration *cfg, Font *f) : GUI_Widget(nullptr, 0, 0, 0, 0),
 		input_mode(false), permit_input(nullptr), just_displayed_prompt(false),
 		permit_inputescape(false), screen_x(0), screen_y(0), keyword_highlight(false) {
 	uint16 x, y;
@@ -223,7 +223,7 @@ MsgScroll::MsgScroll(Configuration *cfg, Font *f) : GUI_Widget(NULL, 0, 0, 0, 0)
 	uint16 x_off = Game::get_game()->get_game_x_offset();
 	uint16 y_off = Game::get_game()->get_game_y_offset();
 
-	GUI_Widget::Init(NULL, x + x_off, y + y_off, scroll_width * 8, scroll_height * 8);
+	GUI_Widget::Init(nullptr, x + x_off, y + y_off, scroll_width * 8, scroll_height * 8);
 
 	cursor_char = 0;
 	cursor_x = 0;
@@ -297,7 +297,7 @@ int MsgScroll::print_internal(const Std::string *format, ...) {
 	static char *buffer = (char *) malloc(bufsize); // static so we don't have to reallocate all the time.
 
 	while (1) {
-		if (buffer == NULL) {
+		if (buffer == nullptr) {
 			DEBUG(0, LEVEL_ALERT, "MsgScroll::printf: Couldn't allocate %d bytes for buffer\n", bufsize);
 			/* try to shrink the buffer to at least have a change next time,
 			 * but if we're low on memory probably have worse issues...
@@ -373,7 +373,7 @@ void MsgScroll::display_string(Std::string s, Font *f, uint8 color, bool include
 	if (s.empty())
 		return;
 
-	if (f == NULL)
+	if (f == nullptr)
 		f = font;
 
 	msg_text = new MsgText(s, f);
@@ -394,7 +394,7 @@ void MsgScroll::process_holding_buffer() {
 	if (!page_break) {
 		token = holding_buffer_get_token();
 
-		for (; token != NULL && !page_break;) {
+		for (; token != nullptr && !page_break;) {
 			parse_token(token);
 			delete token;
 			scroll_updated = true;
@@ -410,15 +410,15 @@ MsgText *MsgScroll::holding_buffer_get_token() {
 	int i;
 
 	if (holding_buffer.empty())
-		return NULL;
+		return nullptr;
 
 	input = holding_buffer.front();
 
-	if (input->font == NULL) {
+	if (input->font == nullptr) {
 		line_count = 0;
 		holding_buffer.pop_front();
 		delete input;
-		return NULL;
+		return nullptr;
 	}
 
 	i = input->s.findFirstOf(" \t\n*<>`", 0);
@@ -438,7 +438,7 @@ MsgText *MsgScroll::holding_buffer_get_token() {
 		return token;
 	}
 
-	return NULL;
+	return nullptr;
 }
 
 bool MsgScroll::can_fit_token_on_msgline(MsgLine *msg_line, MsgText *token) {
@@ -450,7 +450,7 @@ bool MsgScroll::can_fit_token_on_msgline(MsgLine *msg_line, MsgText *token) {
 }
 
 bool MsgScroll::parse_token(MsgText *token) {
-	MsgLine *msg_line = NULL;
+	MsgLine *msg_line = nullptr;
 
 	if (!(token && token->s.length()))
 		return true;
@@ -504,7 +504,7 @@ bool MsgScroll::parse_token(MsgText *token) {
 				capitalise_next_letter = false;
 			}
 
-			if (msg_line == NULL) {
+			if (msg_line == nullptr) {
 				msg_line = add_new_line();
 			}
 
@@ -627,7 +627,7 @@ void MsgScroll::set_permitted_input(const char *allowed) {
 }
 
 void MsgScroll::clear_permitted_input() {
-	permit_input = NULL;
+	permit_input = nullptr;
 	yes_no_only = false;
 	numbers_only = false;
 	aye_nay_only = false;
@@ -657,7 +657,7 @@ void MsgScroll::set_input_mode(bool state, const char *allowed, bool can_escape,
 		if (callback_target)
 			do_callback = true; // **DELAY until end-of-method so callback can set_input_mode() again**
 	}
-	Game::get_game()->get_gui()->lock_input((input_mode && !using_target_cursor) ? this : NULL);
+	Game::get_game()->get_gui()->lock_input((input_mode && !using_target_cursor) ? this : nullptr);
 
 // send whatever input was collected to target that requested it
 	if (do_callback) {
@@ -793,7 +793,7 @@ GUI_status MsgScroll::KeyDown(const Common::KeyState &keyState) {
 	case Common::KEYCODE_ESCAPE:
 		if (permit_inputescape) {
 			// reset input buffer
-			permit_input = NULL;
+			permit_input = nullptr;
 			if (input_mode)
 				set_input_mode(false);
 		}
@@ -808,7 +808,7 @@ GUI_status MsgScroll::KeyDown(const Common::KeyState &keyState) {
 		}
 		return (GUI_YUM);
 	case Common::KEYCODE_RIGHT:
-		if (input_char != 0 && permit_input == NULL)
+		if (input_char != 0 && permit_input == nullptr)
 			input_buf_add_char(get_char_from_input_char());
 		break;
 	case Common::KEYCODE_DOWN:
@@ -832,7 +832,7 @@ GUI_status MsgScroll::KeyDown(const Common::KeyState &keyState) {
 		return (GUI_YUM);
 	default: // alphanumeric characters
 		if (input_mode && is_printable) {
-			if (permit_input == NULL) {
+			if (permit_input == nullptr) {
 				if (!numbers_only || Common::isDigit(ascii)) {
 					if (input_char != 0)
 						input_buf_add_char(get_char_from_input_char());
@@ -886,7 +886,7 @@ GUI_status MsgScroll::MouseUp(int x, int y, Shared::MouseButton button) {
 	if (button == 1) { // left click == select word
 		if (input_mode) {
 			token_str = get_token_string_at_pos(x, y);
-			if (permit_input != NULL && token_str.length()) {
+			if (permit_input != nullptr && token_str.length()) {
 				if (strchr(permit_input, token_str[0])
 				        || strchr(permit_input, tolower(token_str[0]))) {
 					input_buf_add_char(token_str[0]);
@@ -917,7 +917,7 @@ GUI_status MsgScroll::MouseUp(int x, int y, Shared::MouseButton button) {
 Std::string MsgScroll::get_token_string_at_pos(uint16 x, uint16 y) {
 	uint16 i;
 	sint32 buf_x, buf_y;
-	MsgText *token = NULL;
+	MsgText *token = nullptr;
 	Std::list<MsgLine *>::iterator iter;
 
 	buf_x = (x - area.left) / 8;
@@ -953,7 +953,7 @@ Std::string MsgScroll::get_token_string_at_pos(uint16 x, uint16 y) {
 void MsgScroll::Display(bool full_redraw) {
 	uint16 i;
 	Std::list<MsgLine *>::iterator iter;
-	MsgLine *msg_line = NULL;
+	MsgLine *msg_line = nullptr;
 
 
 
@@ -1045,7 +1045,7 @@ void MsgScroll::set_page_break() {
 bool MsgScroll::input_buf_add_char(char c) {
 	MsgText token;
 	input_char = 0;
-	if (permit_input != NULL)
+	if (permit_input != nullptr)
 		input_buf_remove_char();
 	input_buf.push_back(c);
 	scroll_updated = true;
@@ -1093,7 +1093,7 @@ Std::string MsgScroll::get_input() {
 }
 
 void MsgScroll::clear_page_break() {
-	MsgText *msg_text = new MsgText("", NULL);
+	MsgText *msg_text = new MsgText("", nullptr);
 	holding_buffer.push_back(msg_text);
 
 	process_holding_buffer();
@@ -1108,7 +1108,7 @@ void MsgScroll::request_input(CallBack *caller, void *user_data) {
 
 // 0 is no char, 1 - 26 is alpha, 27 is space, 28 - 37 is numbers
 void MsgScroll::increase_input_char() {
-	if (permit_input != NULL && strcmp(permit_input, "\n") == 0) // blame hacky PauseEffect
+	if (permit_input != nullptr && strcmp(permit_input, "\n") == 0) // blame hacky PauseEffect
 		return;
 	if (yes_no_only)
 		input_char = input_char == 25 ? 14 : 25;
@@ -1118,12 +1118,12 @@ void MsgScroll::increase_input_char() {
 		input_char = (input_char == 0 || input_char == 37) ? 28 : input_char + 1;
 	else
 		input_char = (input_char + 1) % 38;
-	if (permit_input != NULL && !strchr(permit_input, get_char_from_input_char())) // might only be needed for the teleport cheat menu
+	if (permit_input != nullptr && !strchr(permit_input, get_char_from_input_char())) // might only be needed for the teleport cheat menu
 		increase_input_char();
 }
 
 void MsgScroll::decrease_input_char() {
-	if (permit_input != NULL && strcmp(permit_input, "\n") == 0) // blame hacky PauseEffect
+	if (permit_input != nullptr && strcmp(permit_input, "\n") == 0) // blame hacky PauseEffect
 		return;
 	if (yes_no_only)
 		input_char = input_char == 25 ? 14 : 25;
@@ -1133,7 +1133,7 @@ void MsgScroll::decrease_input_char() {
 		input_char = input_char == 1 ? 14 : 1;
 	else
 		input_char = input_char == 0 ? 37 : input_char - 1;
-	if (permit_input != NULL && !strchr(permit_input, get_char_from_input_char())) // might only be needed for the teleport cheat menu
+	if (permit_input != nullptr && !strchr(permit_input, get_char_from_input_char())) // might only be needed for the teleport cheat menu
 		decrease_input_char();
 }
 
diff --git a/engines/ultima/nuvie/gui/widgets/msg_scroll.h b/engines/ultima/nuvie/gui/widgets/msg_scroll.h
index 6d6391471df..7d151037875 100644
--- a/engines/ultima/nuvie/gui/widgets/msg_scroll.h
+++ b/engines/ultima/nuvie/gui/widgets/msg_scroll.h
@@ -211,16 +211,16 @@ public:
 		display_prompt();
 	}
 
-	bool set_prompt(const char *new_prompt, Font *f = NULL);
+	bool set_prompt(const char *new_prompt, Font *f = nullptr);
 	virtual void display_prompt();
 	virtual void display_converse_prompt();
 
 	void set_keyword_highlight(bool state);
 
-	void set_input_mode(bool state, const char *allowed = NULL,
+	void set_input_mode(bool state, const char *allowed = nullptr,
 	                    bool can_escape = true, bool use_target_cursor = false,
 	                    bool set_numbers_only_to_true = false);
-	virtual void set_talking(bool state,  Actor *actor = NULL) {
+	virtual void set_talking(bool state,  Actor *actor = nullptr) {
 		talking = state;
 		input_char = 0;
 	}
@@ -267,7 +267,7 @@ public:
 	const char *peek_at_input();
 	void request_input(CallBack *caller, void *user_data);
 	void cancel_input_request() {
-		request_input(NULL, NULL);
+		request_input(nullptr, nullptr);
 	}
 	void clear_scroll();
 
diff --git a/engines/ultima/nuvie/gui/widgets/msg_scroll_new_ui.cpp b/engines/ultima/nuvie/gui/widgets/msg_scroll_new_ui.cpp
index 9e793fb82a9..681c0967982 100644
--- a/engines/ultima/nuvie/gui/widgets/msg_scroll_new_ui.cpp
+++ b/engines/ultima/nuvie/gui/widgets/msg_scroll_new_ui.cpp
@@ -78,11 +78,11 @@ MsgScrollNewUI::MsgScrollNewUI(Configuration *cfg, Screen *s) {
 	uint16 x_off = Game::get_game()->get_game_x_offset();
 	uint16 y_off = Game::get_game()->get_game_y_offset();
 // need to accept clicks on whole game area
-	GUI_Widget::Init(NULL, x_off, y_off, Game::get_game()->get_game_width(), Game::get_game()->get_game_height());
+	GUI_Widget::Init(nullptr, x_off, y_off, Game::get_game()->get_game_width(), Game::get_game()->get_game_height());
 
 	cursor_wait = 0;
 
-	timer = NULL;
+	timer = nullptr;
 
 	position = 0;
 }
@@ -127,7 +127,7 @@ void MsgScrollNewUI::display_string(Std::string s, Font *f, bool include_on_map_
 				position += count_empty_lines(s) - 1;
 			}
 		}
-		timer = new TimedCallback(this, NULL, 2000);
+		timer = new TimedCallback(this, nullptr, 2000);
 
 		MsgScroll::display_string(s, f, include_on_map_window);
 	}
@@ -163,17 +163,17 @@ bool MsgScrollNewUI::is_garg_font() {
 }
 
 uint16 MsgScrollNewUI::callback(uint16 msg, CallBack *caller, void *data) {
-	if (msg == CB_TIMED && (timer == NULL || timer == caller)) {
-		timer = NULL;
+	if (msg == CB_TIMED && (timer == nullptr || timer == caller)) {
+		timer = nullptr;
 		if (input_mode) {
-			new TimedCallback(this, NULL, 100);
+			new TimedCallback(this, nullptr, 100);
 		} else {
 			//roll up the message scroll so it's out of the way.
 			if (position < msg_buf.size()) {
 				if ((uint16)(position + 1) < msg_buf.size()
 				        || msg_buf.back()->total_length > 0) { //don't advance if on second last line and the last line is empty.
 					position++;
-					new TimedCallback(this, NULL, 50);
+					new TimedCallback(this, nullptr, 50);
 				}
 			}
 
@@ -264,21 +264,21 @@ GUI_status MsgScrollNewUI::scroll_movement_event(MsgScrollEventType event) {
 	switch (event) {
 	case SCROLL_UP :
 		if (position > 0) {
-			timer = new TimedCallback(this, NULL, 2000);
+			timer = new TimedCallback(this, nullptr, 2000);
 			position--;
 			grab_focus();
 		}
 		return GUI_YUM;
 
 	case SCROLL_DOWN :
-		timer = new TimedCallback(this, NULL, 2000);
+		timer = new TimedCallback(this, nullptr, 2000);
 		if (position < msg_buf.size())
 			position++;
 		return (GUI_YUM);
 
 	default :
 		release_focus();
-		new TimedCallback(this, NULL, 50);
+		new TimedCallback(this, nullptr, 50);
 		break;
 	}
 
diff --git a/engines/ultima/nuvie/keybinding/key_actions.cpp b/engines/ultima/nuvie/keybinding/key_actions.cpp
index fa68df4ce3c..89f560575fe 100644
--- a/engines/ultima/nuvie/keybinding/key_actions.cpp
+++ b/engines/ultima/nuvie/keybinding/key_actions.cpp
@@ -174,14 +174,14 @@ void ActionDollGump(int const *params) {
 		if (party_member)
 			VIEW_MANAGER->open_doll_view(party_member);
 	} else
-		VIEW_MANAGER->open_doll_view(NULL);
+		VIEW_MANAGER->open_doll_view(nullptr);
 }
 
 void ActionShowStats(int const *params) {
 	if (EVENT->using_control_cheat())
 		return;
 	Actor *party_member = PARTY->get_actor(params[0] - 1);
-	if (party_member == NULL)
+	if (party_member == nullptr)
 		return;
 	if (!GAME->is_new_style()) {
 		ACTOR_VIEW->set_party_member(params[0] - 1);
@@ -403,7 +403,7 @@ void ActionToggleOriginalStyleCommandBar(int const *params) {
 	bool hide = cb->Status() == WIDGET_VISIBLE;
 	if (hide) {
 		cb->Hide();
-		GAME->get_screen()->clear(cb->X(), cb->Y(), cb->W(), cb->H(), NULL); // can be over null background so need to not leave corruption
+		GAME->get_screen()->clear(cb->X(), cb->Y(), cb->W(), cb->H(), nullptr); // can be over null background so need to not leave corruption
 		GAME->get_screen()->update(cb->X(), cb->Y(), cb->W(), cb->H());
 	} else {
 		cb->Show();
diff --git a/engines/ultima/nuvie/menus/audio_dialog.cpp b/engines/ultima/nuvie/menus/audio_dialog.cpp
index a8beb037ee4..163fd60fa2f 100644
--- a/engines/ultima/nuvie/menus/audio_dialog.cpp
+++ b/engines/ultima/nuvie/menus/audio_dialog.cpp
@@ -162,7 +162,7 @@ bool AudioDialog::init() {
 		AddWidget(speech_b);
 		button_index[last_index += 1] = speech_b;
 	} else
-		speech_b = NULL;
+		speech_b = nullptr;
 	cancel_button = new GUI_Button(this, 80, AD_HEIGHT - 20, 54, height, "Cancel", font, BUTTON_TEXTALIGN_CENTER, 0, this, 0);
 	AddWidget(cancel_button);
 	button_index[last_index += 1] = cancel_button;
@@ -233,7 +233,7 @@ GUI_status AudioDialog::callback(uint16 msg, GUI_CallBack *caller, void *data) {
 		if (music_selection != 11) {
 			uint8 musicVol = music_selection * 25.5;
 			sm->set_music_volume(musicVol);
-			if (sm->get_m_pCurrentSong() != NULL)
+			if (sm->get_m_pCurrentSong() != nullptr)
 				sm->get_m_pCurrentSong()->SetVolume(musicVol);
 			config->set("config/music_volume", musicVol);
 		}
diff --git a/engines/ultima/nuvie/menus/gameplay_dialog.cpp b/engines/ultima/nuvie/menus/gameplay_dialog.cpp
index ce34b7b21f5..6dc32171ba3 100644
--- a/engines/ultima/nuvie/menus/gameplay_dialog.cpp
+++ b/engines/ultima/nuvie/menus/gameplay_dialog.cpp
@@ -113,7 +113,7 @@ bool GameplayDialog::init() {
 		AddWidget(stealing_button);
 		button_index[last_index += 1] = stealing_button;
 	} else {
-		stealing_button = NULL;
+		stealing_button = nullptr;
 	}
 	if (!Game::get_game()->is_new_style()) {
 // Use text gump
@@ -130,19 +130,19 @@ bool GameplayDialog::init() {
 		old_converse_gump_type = game->get_converse_gump_type();
 		button_index[last_index += 1] = converse_gump_button;
 	} else {
-		text_gump_button = NULL;
-		converse_gump_button = NULL;
+		text_gump_button = nullptr;
+		converse_gump_button = nullptr;
 	}
 	if (!game->is_forcing_solid_converse_bg()) {
 // converse solid bg
 		widget = (GUI_Widget *) new GUI_Text(colX[0], textY += row_h, 0, 0, 0, "Converse gump has solid bg:", font);
 		AddWidget(widget);
-		config->value(key + "/converse_solid_bg", solid_bg, false); // need to check cfg since converse_gump may be NULL
+		config->value(key + "/converse_solid_bg", solid_bg, false); // need to check cfg since converse_gump may be nullptr
 		converse_solid_bg_button = new GUI_TextToggleButton(this, colX[2], buttonY += row_h, yesno_width, height, yesno_text, 2, solid_bg, font, BUTTON_TEXTALIGN_CENTER, this, 0);
 		AddWidget(converse_solid_bg_button);
 		button_index[last_index += 1] = converse_solid_bg_button;
 	} else
-		converse_solid_bg_button = NULL;
+		converse_solid_bg_button = nullptr;
 
 
 // following require restart
diff --git a/engines/ultima/nuvie/menus/input_dialog.cpp b/engines/ultima/nuvie/menus/input_dialog.cpp
index 65676aae185..e5b2e5494ff 100644
--- a/engines/ultima/nuvie/menus/input_dialog.cpp
+++ b/engines/ultima/nuvie/menus/input_dialog.cpp
@@ -139,13 +139,13 @@ bool InputDialog::init() {
 		AddWidget(balloon_button);
 		button_index[last_index += 1] = balloon_button;
 	} else
-		balloon_button = NULL;
+		balloon_button = nullptr;
 	if (!Game::get_game()->is_new_style()) {
 		open_container_button = new GUI_TextToggleButton(this, colX[1], buttonY += row_h, yesno_width, height, yesno_text, 2, game->doubleclick_opens_containers(), font, BUTTON_TEXTALIGN_CENTER, this, 0);
 		AddWidget(open_container_button);
 		button_index[last_index += 1] = open_container_button;
 	}
-	command_button = new GUI_TextToggleButton(this, colX[1], buttonY += row_h, yesno_width, height, yesno_text, 2, game->get_new_command_bar() != NULL, font, BUTTON_TEXTALIGN_CENTER, this, 0);
+	command_button = new GUI_TextToggleButton(this, colX[1], buttonY += row_h, yesno_width, height, yesno_text, 2, game->get_new_command_bar() != nullptr, font, BUTTON_TEXTALIGN_CENTER, this, 0);
 	AddWidget(command_button);
 	button_index[last_index += 1] = command_button;
 
@@ -156,7 +156,7 @@ bool InputDialog::init() {
 		AddWidget(party_targeting_button);
 		button_index[last_index += 1] = party_targeting_button;
 	} else
-		open_container_button = party_targeting_button = NULL;
+		open_container_button = party_targeting_button = nullptr;
 	cancel_button = new GUI_Button(this, 83, ID_HEIGHT - 20, 54, height, "Cancel", font, BUTTON_TEXTALIGN_CENTER, 0, this, 0);
 	AddWidget(cancel_button);
 	button_index[last_index += 1] = cancel_button;
diff --git a/engines/ultima/nuvie/menus/video_dialog.cpp b/engines/ultima/nuvie/menus/video_dialog.cpp
index 77bbcbea318..6b606f6d141 100644
--- a/engines/ultima/nuvie/menus/video_dialog.cpp
+++ b/engines/ultima/nuvie/menus/video_dialog.cpp
@@ -51,7 +51,7 @@ VideoDialog::VideoDialog(GUI_CallBack *callback)
 	             Game::get_game()->get_game_y_offset() + (Game::get_game()->get_game_height() - VD_HEIGHT) / 2,
 	             VD_WIDTH, VD_HEIGHT, 244, 216, 131, GUI_DIALOG_UNMOVABLE) {
 	callback_object = callback;
-	non_square_pixels_button = NULL;
+	non_square_pixels_button = nullptr;
 	init();
 	grab_focus();
 }
@@ -74,8 +74,8 @@ bool VideoDialog::init() {
 	const char *const yesno_text[] = { "no", "yes" };
 #define SCALER_AND_SCALE_CANNOT_BE_CHANGED 1 // FIXME need to be able to change these in game -- they also haven't been updated for keyboard controls and the size of the gump isn't right
 #if SCALER_AND_SCALE_CANNOT_BE_CHANGED
-	only2x_button = NULL;
-	scale_button = scaler_button = scale_win_button = scaler_win_button = NULL;
+	only2x_button = nullptr;
+	scale_button = scaler_button = scale_win_button = scaler_win_button = nullptr;
 
 	no_fullscreen = false;
 
@@ -149,9 +149,9 @@ bool VideoDialog::init() {
 		}
 	}
 	if (no_fullscreen) {
-		scale_button = NULL;
+		scale_button = nullptr;
 		scaler_button->Delete();
-		scaler_button = NULL;
+		scaler_button = nullptr;
 	} else {
 		scale_button = new GUI_TextToggleButton(this, colX[4], buttonY[1], yesno_width, height, scale_text, num_scale, scale_selection, font, BUTTON_TEXTALIGN_CENTER, this, 0);
 		AddWidget(scale_button);
@@ -202,7 +202,7 @@ bool VideoDialog::init() {
 
 		first_index = false;
 	} else
-		fullscreen_button = NULL;
+		fullscreen_button = nullptr;
 #endif
 
 	Configuration *config = Game::get_game()->get_config();
@@ -215,7 +215,7 @@ bool VideoDialog::init() {
 	button_index[(last_index += first_index ? 0 : 1)] = roof_button;
 // use_new_dolls
 	if (game->is_new_style()) {
-		doll_button = NULL;
+		doll_button = nullptr;
 		old_use_new_dolls = true;
 	} else {
 		widget = (GUI_Widget *) new GUI_Text(colX[0], textY += row_h, 0, 0, 0, "Use new actor dolls:", gui->get_font());
diff --git a/engines/ultima/nuvie/misc/call_back.h b/engines/ultima/nuvie/misc/call_back.h
index 23659c34260..0a6e3b90386 100644
--- a/engines/ultima/nuvie/misc/call_back.h
+++ b/engines/ultima/nuvie/misc/call_back.h
@@ -54,18 +54,18 @@ protected:
 
 public:
 	CallBack()  {
-		callback_user_data = NULL;
-		callback_target = NULL;
+		callback_user_data = nullptr;
+		callback_target = nullptr;
 	}
 	virtual ~CallBack() { }
 
 	// receive message
-	virtual uint16 callback(uint16 msg, CallBack *caller, void *data = NULL) {
+	virtual uint16 callback(uint16 msg, CallBack *caller, void *data = nullptr) {
 		DEBUG(0, LEVEL_WARNING, "Unhandled callback. msg (%x)\n", msg);
 		return 0;
 	}
 	// send message
-	uint16 message(uint16 msg, void *msg_data = NULL, void *my_data = NULL) {
+	uint16 message(uint16 msg, void *msg_data = nullptr, void *my_data = nullptr) {
 		if (my_data)
 			set_user_data(my_data);
 		callback_target->set_user_data(callback_user_data);
diff --git a/engines/ultima/nuvie/misc/iavl_tree.cpp b/engines/ultima/nuvie/misc/iavl_tree.cpp
index 2c7ed70c45a..5a6bf3db743 100644
--- a/engines/ultima/nuvie/misc/iavl_tree.cpp
+++ b/engines/ultima/nuvie/misc/iavl_tree.cpp
@@ -45,16 +45,16 @@ static void iAVLFillVacancy(iAVLTree *avltree,
  * that tree.  The getkey function should take an item and return an
  * AVLKey that is to be used for indexing this object in the AVL tree.
  * On success, a pointer to the malloced AVLTree is returned.  If there
- * was a malloc failure, then NULL is returned.
+ * was a malloc failure, then nullptr is returned.
  */
 iAVLTree *iAVLAllocTree(iAVLKey(*getkey)(void const *item)) {
 	iAVLTree *rc;
 
 	rc = (iAVLTree *)malloc(sizeof(iAVLTree));
-	if (rc == NULL)
-		return NULL;
+	if (rc == nullptr)
+		return nullptr;
 
-	rc->top = NULL;
+	rc->top = nullptr;
 	rc->count = 0;
 	rc->getkey = getkey;
 	return rc;
@@ -63,7 +63,7 @@ iAVLTree *iAVLAllocTree(iAVLKey(*getkey)(void const *item)) {
 
 /*
  * AVLFreeTree:
- * Free all memory used by this AVL tree.  If freeitem is not NULL, then
+ * Free all memory used by this AVL tree.  If freeitem is not nullptr, then
  * it is assumed to be a destructor for the items reference in the AVL
  * tree, and they are deleted as well.
  */
@@ -76,7 +76,7 @@ void iAVLCleanTree(iAVLTree *avltree, void (freeitem)(void *item)) {
 	if (avltree->top)
 		iAVLFreeBranch(avltree->top, freeitem);
 
-	avltree->top = NULL;
+	avltree->top = nullptr;
 	avltree->count = 0;
 }
 
@@ -95,17 +95,17 @@ int iAVLInsert(iAVLTree *avltree, void *item) {
 	iAVLNode *nextbalnode;
 
 	newnode = (iAVLNode *)malloc(sizeof(iAVLNode));
-	if (newnode == NULL)
+	if (newnode == nullptr)
 		return -1;
 
 	newnode->key = avltree->getkey(item);
 	newnode->item = item;
 	newnode->depth = 1;
-	newnode->left = NULL;
-	newnode->right = NULL;
-	newnode->parent = NULL;
+	newnode->left = nullptr;
+	newnode->right = nullptr;
+	newnode->parent = nullptr;
 
-	if (avltree->top != NULL) {
+	if (avltree->top != nullptr) {
 		node = iAVLCloseSearchNode(avltree, newnode->key);
 
 		if (!iAVLKey_cmp(avltree, node->key, newnode->key)) {
@@ -143,7 +143,7 @@ int iAVLInsert(iAVLTree *avltree, void *item) {
 /*
  * iAVLSearch:
  * Return a pointer to the item with the given key in the AVL tree.  If
- * no such item is in the tree, then NULL is returned.
+ * no such item is in the tree, then nullptr is returned.
  */
 void *iAVLSearch(iAVLTree const *avltree, iAVLKey key) {
 	iAVLNode *node;
@@ -153,7 +153,7 @@ void *iAVLSearch(iAVLTree const *avltree, iAVLKey key) {
 	if (node && !iAVLKey_cmp(avltree, node->key, key))
 		return node->item;
 
-	return NULL;
+	return nullptr;
 }
 
 
@@ -169,7 +169,7 @@ int iAVLDelete(iAVLTree *avltree, iAVLKey key) {
 	iAVLNode **superparent;
 
 	avlnode = iAVLCloseSearchNode(avltree, key);
-	if (avlnode == NULL || iAVLKey_cmp(avltree, avlnode->key, key))
+	if (avlnode == nullptr || iAVLKey_cmp(avltree, avlnode->key, key))
 		return -1;
 
 	origparent = avlnode->parent;
@@ -200,13 +200,13 @@ void *iAVLFirst(iAVLCursor *avlcursor, iAVLTree const *avltree) {
 
 	avlcursor->avltree = avltree;
 
-	if (avltree->top == NULL) {
-		avlcursor->curnode = NULL;
-		return NULL;
+	if (avltree->top == nullptr) {
+		avlcursor->curnode = nullptr;
+		return nullptr;
 	}
 
 	for (avlnode = avltree->top;
-	        avlnode->left != NULL;
+	        avlnode->left != nullptr;
 	        avlnode = avlnode->left);
 	avlcursor->curnode = avlnode;
 	return avlnode->item;
@@ -224,9 +224,9 @@ void *iAVLNext(iAVLCursor *avlcursor) {
 
 	avlnode = avlcursor->curnode;
 
-	if (avlnode->right != NULL) {
+	if (avlnode->right != nullptr) {
 		for (avlnode = avlnode->right;
-		        avlnode->left != NULL;
+		        avlnode->left != nullptr;
 		        avlnode = avlnode->left);
 		avlcursor->curnode = avlnode;
 		return avlnode->item;
@@ -236,9 +236,9 @@ void *iAVLNext(iAVLCursor *avlcursor) {
 		avlnode = avlnode->parent;
 	}
 
-	if (avlnode->parent == NULL) {
-		avlcursor->curnode = NULL;
-		return NULL;
+	if (avlnode->parent == nullptr) {
+		avlcursor->curnode = nullptr;
+		return nullptr;
 	}
 
 	avlcursor->curnode = avlnode->parent;
@@ -249,7 +249,7 @@ void *iAVLNext(iAVLCursor *avlcursor) {
 /*
  * iAVLCloseSearchNode:
  * Return a pointer to the node closest to the given key.
- * Returns NULL if the AVL tree is empty.
+ * Returns nullptr if the AVL tree is empty.
  */
 iAVLNode *iAVLCloseSearchNode(iAVLTree const *avltree, iAVLKey key) {
 	iAVLNode *node;
@@ -257,7 +257,7 @@ iAVLNode *iAVLCloseSearchNode(iAVLTree const *avltree, iAVLKey key) {
 	node = avltree->top;
 
 	if (!node)
-		return NULL;
+		return nullptr;
 
 	for (;;) {
 		if (!iAVLKey_cmp(avltree, node->key, key))
@@ -313,11 +313,11 @@ void iAVLRebalanceNode(iAVLTree *avltree, iAVLNode *avlnode) {
 
 		if (L_DEPTH(child) >= R_DEPTH(child)) {
 			avlnode->left = child->right;
-			if (avlnode->left != NULL)
+			if (avlnode->left != nullptr)
 				avlnode->left->parent = avlnode;
 			avlnode->depth = CALC_DEPTH(avlnode);
 			child->right = avlnode;
-			if (child->right != NULL)
+			if (child->right != nullptr)
 				child->right->parent = child;
 			child->depth = CALC_DEPTH(child);
 			*superparent = child;
@@ -327,18 +327,18 @@ void iAVLRebalanceNode(iAVLTree *avltree, iAVLNode *avlnode) {
 		else {
 			gchild = child->right;
 			avlnode->left = gchild->right;
-			if (avlnode->left != NULL)
+			if (avlnode->left != nullptr)
 				avlnode->left->parent = avlnode;
 			avlnode->depth = CALC_DEPTH(avlnode);
 			child->right = gchild->left;
-			if (child->right != NULL)
+			if (child->right != nullptr)
 				child->right->parent = child;
 			child->depth = CALC_DEPTH(child);
 			gchild->right = avlnode;
-			if (gchild->right != NULL)
+			if (gchild->right != nullptr)
 				gchild->right->parent = gchild;
 			gchild->left = child;
-			if (gchild->left != NULL)
+			if (gchild->left != nullptr)
 				gchild->left->parent = gchild;
 			gchild->depth = CALC_DEPTH(gchild);
 			*superparent = gchild;
@@ -351,11 +351,11 @@ void iAVLRebalanceNode(iAVLTree *avltree, iAVLNode *avlnode) {
 
 		if (R_DEPTH(child) >= L_DEPTH(child)) {
 			avlnode->right = child->left;
-			if (avlnode->right != NULL)
+			if (avlnode->right != nullptr)
 				avlnode->right->parent = avlnode;
 			avlnode->depth = CALC_DEPTH(avlnode);
 			child->left = avlnode;
-			if (child->left != NULL)
+			if (child->left != nullptr)
 				child->left->parent = child;
 			child->depth = CALC_DEPTH(child);
 			*superparent = child;
@@ -365,18 +365,18 @@ void iAVLRebalanceNode(iAVLTree *avltree, iAVLNode *avlnode) {
 		else {
 			gchild = child->left;
 			avlnode->right = gchild->left;
-			if (avlnode->right != NULL)
+			if (avlnode->right != nullptr)
 				avlnode->right->parent = avlnode;
 			avlnode->depth = CALC_DEPTH(avlnode);
 			child->left = gchild->right;
-			if (child->left != NULL)
+			if (child->left != nullptr)
 				child->left->parent = child;
 			child->depth = CALC_DEPTH(child);
 			gchild->left = avlnode;
-			if (gchild->left != NULL)
+			if (gchild->left != nullptr)
 				gchild->left->parent = gchild;
 			gchild->right = child;
-			if (gchild->right != NULL)
+			if (gchild->right != nullptr)
 				gchild->right->parent = gchild;
 			gchild->depth = CALC_DEPTH(gchild);
 			*superparent = gchild;
@@ -393,7 +393,7 @@ void iAVLRebalanceNode(iAVLTree *avltree, iAVLNode *avlnode) {
 /*
  * iAVLFreeBranch:
  * Free memory used by this node and its item.  If the freeitem argument
- * is not NULL, then that function is called on the items to free their
+ * is not nullptr, then that function is called on the items to free their
  * memory as well.  In other words, the freeitem function is a
  * destructor for the items in the tree.
  */
@@ -402,7 +402,7 @@ void iAVLFreeBranch(iAVLNode *avlnode, void (freeitem)(void *item)) {
 		iAVLFreeBranch(avlnode->left, freeitem);
 	if (avlnode->right)
 		iAVLFreeBranch(avlnode->right, freeitem);
-	if (freeitem != NULL)
+	if (freeitem != nullptr)
 		freeitem(avlnode->item);
 	free(avlnode);
 }
@@ -420,7 +420,7 @@ void iAVLFillVacancy(iAVLTree *avltree,
 	iAVLNode *balnode;
 	iAVLNode *nextbalnode;
 
-	if (left == NULL) {
+	if (left == nullptr) {
 		if (right)
 			right->parent = origparent;
 
@@ -429,21 +429,21 @@ void iAVLFillVacancy(iAVLTree *avltree,
 	}
 
 	else {
-		for (avlnode = left; avlnode->right != NULL; avlnode = avlnode->right);
+		for (avlnode = left; avlnode->right != nullptr; avlnode = avlnode->right);
 
 		if (avlnode == left) {
 			balnode = avlnode;
 		} else {
 			balnode = avlnode->parent;
 			balnode->right = avlnode->left;
-			if (balnode->right != NULL)
+			if (balnode->right != nullptr)
 				balnode->right->parent = balnode;
 			avlnode->left = left;
 			left->parent = avlnode;
 		}
 
 		avlnode->right = right;
-		if (right != NULL)
+		if (right != nullptr)
 			right->parent = avlnode;
 		*superparent = avlnode;
 		avlnode->parent = origparent;
diff --git a/engines/ultima/nuvie/misc/map_entity.h b/engines/ultima/nuvie/misc/map_entity.h
index 7febeb9181f..6870be0a61d 100644
--- a/engines/ultima/nuvie/misc/map_entity.h
+++ b/engines/ultima/nuvie/misc/map_entity.h
@@ -52,7 +52,7 @@ typedef struct MapEntity_s {
 	};
 	MapEntity_s()             {
 		entity_type = ENT_NOTHING;
-		data = NULL;
+		data = nullptr;
 	}
 	MapEntity_s(Actor *a)     {
 		entity_type = ENT_ACTOR;
diff --git a/engines/ultima/nuvie/misc/u6_list.cpp b/engines/ultima/nuvie/misc/u6_list.cpp
index a07212f34bb..f9f07526605 100644
--- a/engines/ultima/nuvie/misc/u6_list.cpp
+++ b/engines/ultima/nuvie/misc/u6_list.cpp
@@ -45,15 +45,15 @@ inline void deleteU6Link(U6Link *link) {
 		delete link;
 	else {
 		link->ref_count--;
-		link->data = NULL;
-		link->prev = link->next = NULL;
+		link->data = nullptr;
+		link->prev = link->next = nullptr;
 	}
 }
 
 U6LList::U6LList() {
-	head = NULL;
-	tail = NULL;
-	cur = NULL;
+	head = nullptr;
+	tail = nullptr;
+	cur = nullptr;
 }
 
 U6LList::~U6LList() {
@@ -64,10 +64,10 @@ bool U6LList::add(void *data) {
 	U6Link *link;
 
 	link = new U6Link;
-	if (link == NULL)
+	if (link == nullptr)
 		return false;
 
-	if (tail == NULL)
+	if (tail == nullptr)
 		head = tail = link;
 	else {
 		link->prev = tail;
@@ -85,21 +85,21 @@ bool U6LList::addAtPos(uint32 pos, void *data) {
 	U6Link *link, *prev, *new_link;
 
 	new_link = new U6Link;
-	if (new_link == NULL)
+	if (new_link == nullptr)
 		return false;
 
 	new_link->data = data;
 
-	if (pos == 0 || head == NULL) { // pos at head or list empty
-		if (head != NULL)
+	if (pos == 0 || head == nullptr) { // pos at head or list empty
+		if (head != nullptr)
 			head->prev = new_link;
 		new_link->next = head;
 		head = new_link;
-		if (tail == NULL)
+		if (tail == nullptr)
 			tail = head;
 	} else {
-		prev = NULL;
-		for (link = head, i = 0; link != NULL && i < pos; i++) {
+		prev = nullptr;
+		for (link = head, i = 0; link != nullptr && i < pos; i++) {
 			prev = link;
 			link = link->next;
 		}
@@ -122,7 +122,7 @@ uint32 U6LList::findPos(void *data) {
 	U6Link *link;
 	uint32 pos;
 
-	for (pos = 0, link = start(); link != NULL; link = link->next, pos++) {
+	for (pos = 0, link = start(); link != nullptr; link = link->next, pos++) {
 		if (link->data == data)
 			return pos;
 	}
@@ -134,7 +134,7 @@ uint32 U6LList::findPos(void *data) {
 bool U6LList::replace(void *old_data, void *new_data) {
 	U6Link *link;
 
-	for (link = start(); link != NULL; link = link->next) {
+	for (link = start(); link != nullptr; link = link->next) {
 		if (link->data == old_data) {
 			link->data = new_data;
 			return true;
@@ -148,23 +148,23 @@ bool U6LList::remove(void *data) {
 	U6Link *link;
 	U6Link *prev;
 
-	if (head == NULL)
+	if (head == nullptr)
 		return false;
 
 	if (head->data == data) { // remove head
 		link = head;
 		head = head->next;
-		if (head == NULL) // empty list
-			tail = NULL;
+		if (head == nullptr) // empty list
+			tail = nullptr;
 		else
-			head->prev = NULL;
+			head->prev = nullptr;
 
 		deleteU6Link(link);
 
 		return true;
 	}
 
-	for (link = prev = head; link != NULL;) {
+	for (link = prev = head; link != nullptr;) {
 		if (link->data == data) {
 			prev->next = link->next;
 
@@ -191,16 +191,16 @@ bool U6LList::remove(void *data) {
 bool U6LList::removeAll() {
 	U6Link *tmp_link, *link;
 
-	for (link = head; link != NULL;) {
+	for (link = head; link != nullptr;) {
 		tmp_link = link;
 		link = link->next;
 
 		deleteU6Link(tmp_link);
 	}
 
-	head = NULL;
-	tail = NULL;
-	cur = NULL;
+	head = nullptr;
+	tail = nullptr;
+	cur = nullptr;
 
 	return true;
 }
@@ -211,7 +211,7 @@ uint32 U6LList::count() {
 	uint32 i;
 	U6Link *link;
 
-	for (i = 0, link = head; link != NULL; link = link->next) {
+	for (i = 0, link = head; link != nullptr; link = link->next) {
 		i++;
 	}
 
@@ -232,7 +232,7 @@ U6Link *U6LList::end() {
 
 U6Link *U6LList::next() {
 	if (cur == tail)
-		return NULL;
+		return nullptr;
 
 	cur = cur->next;
 
@@ -241,7 +241,7 @@ U6Link *U6LList::next() {
 
 U6Link *U6LList::prev() {
 	if (cur == head)
-		return NULL;
+		return nullptr;
 
 	cur = cur->prev;
 
@@ -252,7 +252,7 @@ U6Link *U6LList::gotoPos(uint32 pos) {
 	U6Link *link;
 	uint32 i;
 
-	for (link = head, i = 0; link != NULL && i < pos; i++)
+	for (link = head, i = 0; link != nullptr && i < pos; i++)
 		link = link->next;
 
 	return link;
diff --git a/engines/ultima/nuvie/misc/u6_llist.h b/engines/ultima/nuvie/misc/u6_llist.h
index b3c9d345699..64471a6fec7 100644
--- a/engines/ultima/nuvie/misc/u6_llist.h
+++ b/engines/ultima/nuvie/misc/u6_llist.h
@@ -33,9 +33,9 @@ struct U6Link {
 	void *data;
 	uint8 ref_count;
 	U6Link() {
-		next = NULL;
-		prev = NULL;
-		data = NULL;
+		next = nullptr;
+		prev = nullptr;
+		data = nullptr;
 		ref_count = 1;
 	}
 };
diff --git a/engines/ultima/nuvie/misc/u6_misc.cpp b/engines/ultima/nuvie/misc/u6_misc.cpp
index 3c415417c50..da677a3483c 100644
--- a/engines/ultima/nuvie/misc/u6_misc.cpp
+++ b/engines/ultima/nuvie/misc/u6_misc.cpp
@@ -130,10 +130,10 @@ bool find_path(Std::string path, Std::string &dir_str) {
 	struct dirent *item;
 
 	dir = opendir(path.c_str());
-	if (dir == NULL)
+	if (dir == nullptr)
 		return false;
 
-	for (item = readdir(dir); item != NULL; item = readdir(dir)) {
+	for (item = readdir(dir); item != nullptr; item = readdir(dir)) {
 		debug("trying %s, want %s", item->d_name, dir_str.c_str());
 		if (strlen(item->d_name) == dir_str.length() && Common::scumm_stricmp(item->d_name, dir_str.c_str()) == 0) {
 			dir_str = item->d_name;
@@ -196,7 +196,7 @@ int mkdir_recursive(Std::string path, int mode) {
 
 //return the uint8 game_type from a char string
 uint8 get_game_type(const char *string) {
-	if (string != NULL && strlen(string) >= 2) {
+	if (string != nullptr && strlen(string) >= 2) {
 		if (strcmp("md", string) == 0 || strcmp("martian", string) == 0)
 			return NUVIE_GAME_MD;
 		if (strcmp("se", string) == 0 || strcmp("savage", string) == 0)
@@ -726,7 +726,7 @@ void scale_rect_8bit(unsigned char *Source, unsigned char *Target, int SrcWidth,
 	int IntPart = (SrcHeight / TgtHeight) * SrcWidth;
 	int FractPart = SrcHeight % TgtHeight;
 	int E = 0;
-	unsigned char *PrevSource = NULL;
+	unsigned char *PrevSource = nullptr;
 
 	while (NumPixels-- > 0) {
 		if (Source == PrevSource) {
diff --git a/engines/ultima/nuvie/misc/u6_misc.h b/engines/ultima/nuvie/misc/u6_misc.h
index 04c71592180..f2270ad3c72 100644
--- a/engines/ultima/nuvie/misc/u6_misc.h
+++ b/engines/ultima/nuvie/misc/u6_misc.h
@@ -88,7 +88,7 @@ inline bool line_in_rect(uint16 x1, uint16 y1, uint16 x2, uint16 y2, Common::Rec
 /* Measure a timeslice for a single function-call. (last_time must be static)
  * Returns fraction of a second between this_time and last_time.
  */
-inline uint32 divide_time(uint32 this_time, uint32 &last_time, uint32 *passed_time = NULL) {
+inline uint32 divide_time(uint32 this_time, uint32 &last_time, uint32 *passed_time = nullptr) {
 	uint32 ms_passed = (this_time - last_time) > 0 ? (this_time - last_time) : 1;
 	uint32 fraction = 1000 / ms_passed; // % of second
 	last_time = this_time;
diff --git a/engines/ultima/nuvie/pathfinder/astar_path.cpp b/engines/ultima/nuvie/pathfinder/astar_path.cpp
index 331bd0ad699..0d7c083100d 100644
--- a/engines/ultima/nuvie/pathfinder/astar_path.cpp
+++ b/engines/ultima/nuvie/pathfinder/astar_path.cpp
@@ -143,14 +143,14 @@ sint32 AStarPath::step_cost(MapCoord &c1, MapCoord &c2) {
 	for (n = closed_nodes.begin(); n != closed_nodes.end(); n++)
 		if ((*n)->loc == ncmp->loc)
 			return (*n);
-	return (NULL);
+	return (nullptr);
 }/* Return an item in the list of closed nodes whose location matches `ncmp'.
  */astar_node *AStarPath::find_open_node(astar_node *ncmp) {
 	Std::list<astar_node *>::iterator n;
 	for (n = open_nodes.begin(); n != open_nodes.end(); n++)
 		if ((*n)->loc == ncmp->loc)
 			return (*n);
-	return (NULL);
+	return (nullptr);
 }/* Add new node pointer to the list of open nodes (sorting by score).
  */void AStarPath::push_open_node(astar_node *node) {
 	Std::list<astar_node *>::iterator n, next;
diff --git a/engines/ultima/nuvie/pathfinder/astar_path.h b/engines/ultima/nuvie/pathfinder/astar_path.h
index 5c537338679..d9c77f60862 100644
--- a/engines/ultima/nuvie/pathfinder/astar_path.h
+++ b/engines/ultima/nuvie/pathfinder/astar_path.h
@@ -36,7 +36,7 @@ typedef struct astar_node_s {
 	uint32 len; // number of nodes before this one, regardless of score
 	struct astar_node_s *parent;
 	astar_node_s() : loc(0, 0, 0), to_start(0), to_goal(0), score(0), len(0),
-		parent(NULL) { }
+		parent(nullptr) { }
 } astar_node;
 /* Provides A* search and cost methods for PathFinder and subclasses.
  */class AStarPath: public Path {
diff --git a/engines/ultima/nuvie/pathfinder/combat_path_finder.cpp b/engines/ultima/nuvie/pathfinder/combat_path_finder.cpp
index fb45fa77e12..232d685ce6f 100644
--- a/engines/ultima/nuvie/pathfinder/combat_path_finder.cpp
+++ b/engines/ultima/nuvie/pathfinder/combat_path_finder.cpp
@@ -29,7 +29,7 @@ CombatPathFinder::CombatPathFinder(Actor *a)
 	: ActorPathFinder(a, a->get_location()) {
 	target_mode = PATHFINDER_NONE;
 	max_dist = 0;
-	target = NULL;
+	target = nullptr;
 }
 
 /* Without a mode set, CombatPathFinder is identical to ActorPathFinder. */
diff --git a/engines/ultima/nuvie/pathfinder/path.cpp b/engines/ultima/nuvie/pathfinder/path.cpp
index 069d9858875..a460f30408c 100644
--- a/engines/ultima/nuvie/pathfinder/path.cpp
+++ b/engines/ultima/nuvie/pathfinder/path.cpp
@@ -66,7 +66,7 @@ uint32 Path::path_cost_est(MapCoord &s, MapCoord &g) {
 void Path::delete_path() {
 	if (path)
 		free(path);
-	path = NULL;
+	path = nullptr;
 	step_count = 0;
 	path_size = 0;
 }
diff --git a/engines/ultima/nuvie/portraits/portrait.cpp b/engines/ultima/nuvie/portraits/portrait.cpp
index 09db9940202..0aafa960331 100644
--- a/engines/ultima/nuvie/portraits/portrait.cpp
+++ b/engines/ultima/nuvie/portraits/portrait.cpp
@@ -58,7 +58,7 @@ Portrait *newPortrait(nuvie_game_t gametype, Configuration *cfg) {
 		return (Portrait *) new PortraitSE(cfg);
 		break;
 	}
-	return NULL;
+	return nullptr;
 }
 
 
@@ -84,12 +84,12 @@ unsigned char *Portrait::get_wou_portrait_data(U6Lib_n *lib, uint8 num) {
 	uint16 portrait_w;
 	uint16 portrait_h;
 
-	shp_data = lib->get_item(num, NULL);
+	shp_data = lib->get_item(num, nullptr);
 	shp_buf.open(shp_data, lib->get_item_size(num), NUVIE_BUF_NOCOPY);
 
 	if (shp_buf.get_size() == 0) { // no portrait at that index
 		free(shp_data);
-		return (NULL);
+		return (nullptr);
 	}
 	shp = new U6Shape();
 	shp_lib.open(&shp_buf, 4, NUVIE_GAME_SE);
diff --git a/engines/ultima/nuvie/portraits/portrait_md.cpp b/engines/ultima/nuvie/portraits/portrait_md.cpp
index 708981cca2f..fb0fd982de7 100644
--- a/engines/ultima/nuvie/portraits/portrait_md.cpp
+++ b/engines/ultima/nuvie/portraits/portrait_md.cpp
@@ -65,7 +65,7 @@ bool PortraitMD::load(NuvieIO *objlist) {
 }
 
 uint8 PortraitMD::get_portrait_num(Actor *actor) {
-	if (actor == NULL)
+	if (actor == nullptr)
 		return NO_PORTRAIT_FOUND;
 
 	uint8 num = Game::get_game()->get_script()->call_get_portrait_number(actor);
@@ -77,13 +77,13 @@ uint8 PortraitMD::get_portrait_num(Actor *actor) {
 unsigned char *PortraitMD::get_portrait_data(Actor *actor) {
 	uint8 num = get_portrait_num(actor);
 	if (num == NO_PORTRAIT_FOUND)
-		return NULL;
+		return nullptr;
 
 	U6Shape *bg_shp = get_background_shape(num);
 
 	unsigned char *temp_buf = faces.get_item(num);
 	if (!temp_buf)
-		return NULL;
+		return nullptr;
 	U6Shape *p_shp = new U6Shape();
 	p_shp->load(temp_buf + 8);
 	free(temp_buf);
diff --git a/engines/ultima/nuvie/portraits/portrait_se.cpp b/engines/ultima/nuvie/portraits/portrait_se.cpp
index c3a013d57db..026d2e8edc1 100644
--- a/engines/ultima/nuvie/portraits/portrait_se.cpp
+++ b/engines/ultima/nuvie/portraits/portrait_se.cpp
@@ -67,7 +67,7 @@ bool PortraitSE::load(NuvieIO *objlist) {
 uint8 PortraitSE::get_portrait_num(Actor *actor) {
 	uint8 num;
 
-	if (actor == NULL)
+	if (actor == nullptr)
 		return NO_PORTRAIT_FOUND;
 
 	num = actor->get_actor_num();
@@ -156,13 +156,13 @@ uint8 PortraitSE::get_background_shape_num(Actor *actor) {
 unsigned char *PortraitSE::get_portrait_data(Actor *actor) {
 	uint8 num = get_portrait_num(actor);
 	if (num == NO_PORTRAIT_FOUND)
-		return NULL;
+		return nullptr;
 
 	U6Shape *bg_shp = get_background_shape(actor);
 
 	unsigned char *temp_buf = faces.get_item(num);
 	if (!temp_buf)
-		return NULL;
+		return nullptr;
 	U6Shape *p_shp = new U6Shape();
 	p_shp->load(temp_buf + 8);
 	free(temp_buf);
diff --git a/engines/ultima/nuvie/portraits/portrait_u6.cpp b/engines/ultima/nuvie/portraits/portrait_u6.cpp
index 84647afd0a4..be27dcee87d 100644
--- a/engines/ultima/nuvie/portraits/portrait_u6.cpp
+++ b/engines/ultima/nuvie/portraits/portrait_u6.cpp
@@ -89,7 +89,7 @@ bool PortraitU6::load(NuvieIO *objlist) {
 uint8 PortraitU6::get_portrait_num(Actor *actor) {
 	uint8 num;
 
-	if (actor == NULL)
+	if (actor == nullptr)
 		return NO_PORTRAIT_FOUND;
 
 	num = actor->get_actor_num();
@@ -132,7 +132,7 @@ unsigned char *PortraitU6::get_portrait_data(Actor *actor) {
 	unsigned char *new_portrait;
 	uint8 num = get_portrait_num(actor);
 	if (num == NO_PORTRAIT_FOUND)
-		return NULL;
+		return nullptr;
 
 	if (actor->is_avatar()) { // avatar portrait
 		portrait = &portrait_z;
@@ -147,7 +147,7 @@ unsigned char *PortraitU6::get_portrait_data(Actor *actor) {
 
 	lzw_data = portrait->get_item(num);
 	if (!lzw_data)
-		return NULL;
+		return nullptr;
 	new_portrait = lzw.decompress_buffer(lzw_data, portrait->get_item_size(num), new_length);
 	free(lzw_data);
 	Game::get_game()->get_dither()->dither_bitmap(new_portrait, PORTRAIT_WIDTH, PORTRAIT_HEIGHT, true);
diff --git a/engines/ultima/nuvie/save/save_game.cpp b/engines/ultima/nuvie/save/save_game.cpp
index ccdc15f25d1..75e74132458 100644
--- a/engines/ultima/nuvie/save/save_game.cpp
+++ b/engines/ultima/nuvie/save/save_game.cpp
@@ -63,7 +63,7 @@ SaveGame::SaveGame(Configuration *cfg) {
 	config = cfg;
 
 	// We don't need ObjManager here as there will be nothing to clean at this stage
-	init(NULL);
+	init(nullptr);
 }
 
 SaveGame::~SaveGame() {
diff --git a/engines/ultima/nuvie/screen/dither.cpp b/engines/ultima/nuvie/screen/dither.cpp
index 166554adb2c..9f541008041 100644
--- a/engines/ultima/nuvie/screen/dither.cpp
+++ b/engines/ultima/nuvie/screen/dither.cpp
@@ -34,7 +34,7 @@ static const uint8 dither_cga_tbl[0x10] =   {0, 3, 3, 3, 13, 13, 13, 3, 3, 13, 1
 
 Dither::Dither(Configuration *cfg) {
 	config = cfg;
-	dither = NULL;
+	dither = nullptr;
 	mode = DITHER_NONE;
 
 	set_mode();
@@ -57,7 +57,7 @@ bool Dither::load_data() {
 		return false;//fixme better error handling
 
 	dither = (uint8 *)malloc(0x200);
-	if (dither == NULL)
+	if (dither == nullptr)
 		return false;
 
 	file.readToBuf(dither, 0x200);
diff --git a/engines/ultima/nuvie/screen/screen.cpp b/engines/ultima/nuvie/screen/screen.cpp
index fcf9a0f8edc..2c7e3129cbc 100644
--- a/engines/ultima/nuvie/screen/screen.cpp
+++ b/engines/ultima/nuvie/screen/screen.cpp
@@ -123,7 +123,7 @@ bool Screen::toggle_darkness_cheat() {
 
 
 bool Screen::set_palette(uint8 *p) {
-	if (_renderSurface == NULL || p == NULL)
+	if (_renderSurface == nullptr || p == nullptr)
 		return false;
 
 	for (int i = 0; i < 256; ++i) {
@@ -140,7 +140,7 @@ bool Screen::set_palette(uint8 *p) {
 }
 
 bool Screen::set_palette_entry(uint8 idx, uint8 r, uint8 g, uint8 b) {
-	if (_renderSurface == NULL)
+	if (_renderSurface == nullptr)
 		return false;
 
 	uint32 c = ((((uint32)r) >> RenderSurface::Rloss) << RenderSurface::Rshift) | ((((uint32)g) >> RenderSurface::Gloss) << RenderSurface::Gshift) | ((((uint32)b) >> RenderSurface::Bloss) << RenderSurface::Bshift);
@@ -413,18 +413,18 @@ void Screen::put_pixel(uint8 colour_num, uint16 x, uint16 y) {
 }
 
 void *Screen::get_pixels() {
-//if(scaled_surface == NULL)
-//   return NULL;
+//if(scaled_surface == nullptr)
+//   return nullptr;
 
 //return scaled_surface->pixels;
-	return NULL;
+	return nullptr;
 }
 
 Graphics::ManagedSurface *Screen::get_sdl_surface() {
 	if (_renderSurface)
 		return _renderSurface->get_sdl_surface();
 
-	return NULL;
+	return nullptr;
 }
 
 bool Screen::blit(int32 dest_x, int32 dest_y, const byte *src_buf, uint16 src_bpp,
@@ -833,7 +833,7 @@ void Screen::clearalphamap8(uint16 x, uint16 y, uint16 w, uint16 h, uint8 opacit
 		break;
 	}
 
-	if (shading_data == NULL) {
+	if (shading_data == nullptr) {
 		shading_rect.left = x;
 		shading_rect.top = y;
 		if (lighting_style == LIGHTING_STYLE_ORIGINAL) {
@@ -844,7 +844,7 @@ void Screen::clearalphamap8(uint16 x, uint16 y, uint16 w, uint16 h, uint8 opacit
 			shading_rect.setHeight((h + (SHADING_BORDER * 2)) * 16 + 8);
 		}
 		shading_data = (byte *)malloc(sizeof(byte) * shading_rect.width() * shading_rect.height());
-		if (shading_data == NULL) {
+		if (shading_data == nullptr) {
 			/* We couldn't allocate memory for the opacity map, so just disable lighting */
 			shading_ambient = 0xFF;
 			return;
@@ -1260,7 +1260,7 @@ byte *Screen::copy_area(Common::Rect *area, uint16 down_scale) {
 byte *Screen::copy_area16(Common::Rect *area, uint16 down_scale) {
 	Graphics::PixelFormat *fmt;
 	Graphics::ManagedSurface *main_surface = get_sdl_surface();
-	byte *dst_pixels = NULL;
+	byte *dst_pixels = nullptr;
 	byte *ptr;
 	const uint16 *src_pixels;
 	uint32 r, g, b;
@@ -1318,7 +1318,7 @@ byte *Screen::copy_area16(Common::Rect *area, uint16 down_scale) {
 byte *Screen::copy_area32(Common::Rect *area, uint16 down_scale) {
 	Graphics::PixelFormat *fmt;
 	Graphics::ManagedSurface *main_surface = get_sdl_surface();
-	byte *dst_pixels = NULL;
+	byte *dst_pixels = nullptr;
 	byte *ptr;
 	const uint32 *src_pixels;
 	uint32 r, g, b;
@@ -1374,7 +1374,7 @@ byte *Screen::copy_area32(Common::Rect *area, uint16 down_scale) {
 }
 
 // _renderSurface -> byte *
-// (NULL area = entire screen)
+// (nullptr area = entire screen)
 byte *Screen::copy_area(Common::Rect *area, byte *buf) {
 	Common::Rect screen_area(0, 0, _renderSurface->w, _renderSurface->h);
 	if (!area)
@@ -1388,7 +1388,7 @@ byte *Screen::copy_area(Common::Rect *area, byte *buf) {
 
 // byte * -> _renderSurface
 // byte * -> target (src area still means location on screen, not relative to target)
-// (NULL area = entire screen)
+// (nullptr area = entire screen)
 void Screen::restore_area(byte *pixels, Common::Rect *area,
 						  byte *target, Common::Rect *target_area, bool free_src) {
 	Common::Rect screen_area(0, 0, _renderSurface->w, _renderSurface->h);
@@ -1404,7 +1404,7 @@ void Screen::restore_area(byte *pixels, Common::Rect *area,
 
 byte *Screen::copy_area32(Common::Rect *area, byte *buf) {
 	uint32 *copied = (uint32 *)buf;
-	if (buf == NULL) {
+	if (buf == nullptr) {
 		copied = (uint32 *)malloc(area->width() * area->height() * 4);
 	}
 	uint32 *dest = copied;
@@ -1469,7 +1469,7 @@ void Screen::restore_area32(byte *pixels, Common::Rect *area,
 
 byte *Screen::copy_area16(Common::Rect *area, byte *buf) {
 	uint16 *copied = (uint16 *)buf;
-	if (buf == NULL) {
+	if (buf == nullptr) {
 		copied = (uint16 *)malloc(area->width() * area->height() * 2);
 	}
 	uint16 *dest = copied;
@@ -1533,7 +1533,7 @@ void Screen::restore_area16(byte *pixels, Common::Rect *area,
 }
 
 void Screen::draw_line(int sx, int sy, int ex, int ey, uint8 color) {
-	if (_renderSurface == NULL)
+	if (_renderSurface == nullptr)
 		return;
 
 	_renderSurface->draw_line(sx, sy, ex, ey, color);
diff --git a/engines/ultima/nuvie/screen/screen.h b/engines/ultima/nuvie/screen/screen.h
index c5c55214057..b3281ed41b5 100644
--- a/engines/ultima/nuvie/screen/screen.h
+++ b/engines/ultima/nuvie/screen/screen.h
@@ -82,7 +82,7 @@ public:
 	bool set_palette(uint8 *palette);
 	bool set_palette_entry(uint8 idx, uint8 r, uint8 g, uint8 b);
 	bool rotate_palette(uint8 pos, uint8 length);
-	bool clear(sint16 x, sint16 y, sint16 w, sint16 h, Common::Rect *clip_rect = NULL);
+	bool clear(sint16 x, sint16 y, sint16 w, sint16 h, Common::Rect *clip_rect = nullptr);
 	void *get_pixels();
 	const byte *get_surface_pixels() {
 		return (_renderSurface->get_pixels());
@@ -110,7 +110,7 @@ public:
 	void stipple_8bit(uint8 color_num, uint16 x, uint16 y, uint16 w, uint16 h);
 	void put_pixel(uint8 colour_num, uint16 x, uint16 y);
 
-	bool blit(int32 dest_x, int32 dest_y, const byte *src_buf, uint16 src_bpp, uint16 src_w, uint16 src_h, uint16 src_pitch, bool trans = false, Common::Rect *clip_rect = NULL, uint8 opacity = 255);
+	bool blit(int32 dest_x, int32 dest_y, const byte *src_buf, uint16 src_bpp, uint16 src_w, uint16 src_h, uint16 src_pitch, bool trans = false, Common::Rect *clip_rect = nullptr, uint8 opacity = 255);
 	void blitbitmap(uint16 dest_x, uint16 dest_y, const byte *src_buf, uint16 src_w, uint16 src_h, uint8 fg_color, uint8 bg_color);
 
 	void buildalphamap8();
@@ -141,10 +141,10 @@ public:
 
 	bool initScaler();
 
-	byte *copy_area(Common::Rect *area = NULL, byte *buf = NULL);
+	byte *copy_area(Common::Rect *area = nullptr, byte *buf = nullptr);
 	byte *copy_area(Common::Rect *area, uint16 down_scale);
 
-	void restore_area(byte *pixels, Common::Rect *area = NULL, byte *target = NULL, Common::Rect *target_area = NULL, bool free_src = true);
+	void restore_area(byte *pixels, Common::Rect *area = nullptr, byte *target = nullptr, Common::Rect *target_area = nullptr, bool free_src = true);
 
 	void draw_line(int sx, int sy, int ex, int ey, uint8 color);
 
@@ -179,8 +179,8 @@ protected:
 
 	byte *copy_area16(Common::Rect *area, byte *buf);
 	byte *copy_area32(Common::Rect *area, byte *buf);
-	void restore_area16(byte *pixels, Common::Rect *area, byte *target = NULL, Common::Rect *target_area = NULL, bool free_src = true);
-	void restore_area32(byte *pixels, Common::Rect *area, byte *target = NULL, Common::Rect *target_area = NULL, bool free_src = true);
+	void restore_area16(byte *pixels, Common::Rect *area, byte *target = nullptr, Common::Rect *target_area = nullptr, bool free_src = true);
+	void restore_area32(byte *pixels, Common::Rect *area, byte *target = nullptr, Common::Rect *target_area = nullptr, bool free_src = true);
 
 	void set_screen_mode();
 
diff --git a/engines/ultima/nuvie/screen/surface.cpp b/engines/ultima/nuvie/screen/surface.cpp
index 3afadeec474..567b00063db 100644
--- a/engines/ultima/nuvie/screen/surface.cpp
+++ b/engines/ultima/nuvie/screen/surface.cpp
@@ -41,7 +41,7 @@ uint32 RenderSurface::Gmask;
 uint32 RenderSurface::Bmask;
 
 // Default constructor for no created surface
-RenderSurface::RenderSurface() : buffer(0), zbuffer_priv(0), _rawSurface(NULL),
+RenderSurface::RenderSurface() : buffer(0), zbuffer_priv(0), _rawSurface(nullptr),
 		_disposeSurface(DisposeAfterUse::YES), opengl(0), bytes_per_pixel(0),
 		bits_per_pixel(0), format_type(0), pixels(0), zbuffer(0), w(0), h(0),
 		pitch(0), gl(0), gr(0), gt(0), gb(0),  lock_count(0) {
@@ -49,7 +49,7 @@ RenderSurface::RenderSurface() : buffer(0), zbuffer_priv(0), _rawSurface(NULL),
 
 // Constructor for custom buffer
 RenderSurface::RenderSurface(uint32 width, uint32 height, uint32 bpp, byte *p) :
-		buffer(0), zbuffer_priv(0), _rawSurface(NULL), _disposeSurface(DisposeAfterUse::YES),
+		buffer(0), zbuffer_priv(0), _rawSurface(nullptr), _disposeSurface(DisposeAfterUse::YES),
 		opengl(0), bytes_per_pixel(bpp / 8), bits_per_pixel(bpp), pixels(p), zbuffer(0),
 		w(width), h(height), pitch(width), gl(0), gr(width), gt(0), gb(height), lock_count(0) {
 	// Set default formats for the buffer
@@ -59,7 +59,7 @@ RenderSurface::RenderSurface(uint32 width, uint32 height, uint32 bpp, byte *p) :
 
 // Constructor for generic surface (with optional guardband)
 RenderSurface::RenderSurface(uint32 width, uint32 height, uint32 bpp, sint32 guard) :
-		buffer(0), zbuffer_priv(0), _rawSurface(NULL), _disposeSurface(DisposeAfterUse::YES),
+		buffer(0), zbuffer_priv(0), _rawSurface(nullptr), _disposeSurface(DisposeAfterUse::YES),
 		opengl(0), bytes_per_pixel(bpp / 8), bits_per_pixel(bpp), pixels(0), zbuffer(0),
 		w(width), h(height), pitch(width * (bpp / 8) + 2 * guard * (bpp / 8)),
 		gl(-guard), gr(guard + width), gt(-guard), gb(guard + height), lock_count(0) {
@@ -81,7 +81,7 @@ RenderSurface::RenderSurface(Graphics::ManagedSurface *surf) :
 }
 
 // Constructor for opengl surface
-RenderSurface::RenderSurface(OpenGL *ogl) : buffer(0), zbuffer_priv(0), _rawSurface(NULL),
+RenderSurface::RenderSurface(OpenGL *ogl) : buffer(0), zbuffer_priv(0), _rawSurface(nullptr),
 		_disposeSurface(DisposeAfterUse::NO), opengl(ogl), bytes_per_pixel(0),
 		bits_per_pixel(0), format_type(0), pixels(0), zbuffer(0), w(0), h(0), pitch(0),
 		gl(0), gr(0), gt(0), gb(0), lock_count(0) {
@@ -517,7 +517,7 @@ Graphics::ManagedSurface *RenderSurface::createSurface(int w, int h,
 }
 
 Graphics::ManagedSurface *RenderSurface::get_sdl_surface() {
-	if (_rawSurface == NULL) {
+	if (_rawSurface == nullptr) {
 		_rawSurface = new Graphics::ManagedSurface(w, h,
 			Graphics::PixelFormat(bytes_per_pixel, getBits(Rmask), getBits(Gmask),
 				getBits(Bmask), 0, Rshift, Gshift, Bshift, 0));
diff --git a/engines/ultima/nuvie/script/script.cpp b/engines/ultima/nuvie/script/script.cpp
index d917c5107f1..b1b615121f8 100644
--- a/engines/ultima/nuvie/script/script.cpp
+++ b/engines/ultima/nuvie/script/script.cpp
@@ -123,7 +123,7 @@ static iAVLKey get_iAVLKey(const void *item) {
 	return ((const ScriptObjRef *)item)->key;
 }
 
-static NuvieIO *g_objlist_file = NULL;
+static NuvieIO *g_objlist_file = nullptr;
 
 // used for garbage collection.
 //returns current object reference count. Or -1 on error.
@@ -160,27 +160,27 @@ static const luaL_Reg nscript_objlib_f[] = {
 	{ "removeFromEngine", nscript_obj_removefromengine },
 	{ "use", nscript_obj_use },
 
-	{ NULL, NULL }
+	{ nullptr, nullptr }
 };
 static const luaL_Reg nscript_objlib_m[] = {
 	{ "__index", nscript_obj_get },
 	{ "__newindex", nscript_obj_set },
 	{ "__gc", nscript_obj_gc },
-	{ NULL, NULL }
+	{ nullptr, nullptr }
 };
 
 static int nscript_u6link_gc(lua_State *L);
 
 static const struct luaL_Reg nscript_u6linklib_m[] = {
 	{ "__gc", nscript_u6link_gc },
-	{ NULL, NULL }
+	{ nullptr, nullptr }
 };
 
 static int nscript_u6link_recursive_gc(lua_State *L);
 
 static const struct luaL_Reg nscript_u6linkrecursivelib_m[] = {
 	{ "__gc", nscript_u6link_recursive_gc },
-	{ NULL, NULL }
+	{ nullptr, nullptr }
 };
 
 static int nscript_print(lua_State *L);
@@ -331,7 +331,7 @@ int nscript_init_u6link_iter(lua_State *L, U6LList *list, bool is_recursive);
 static int nscript_find_obj(lua_State *L);
 static int nscript_find_obj_from_area(lua_State *L);
 
-Script *Script::script = NULL;
+Script *Script::script = nullptr;
 
 static int lua_error_handler(lua_State *L) {
 	//lua_getfield(L, LUA_GLOBALSINDEX, "debug");
@@ -461,7 +461,7 @@ uint8 ScriptThread::resume_with_nil() {
 
 uint8 ScriptThread::resume(int narg) {
 	const char *s;
-	int ret = lua_resume(L, /*NULL,*/ narg);
+	int ret = lua_resume(L, /*nullptr,*/ narg);
 
 	state = NUVIE_SCRIPT_ERROR;
 
@@ -525,15 +525,15 @@ Script::Script(Configuration *cfg, GUI *gui, SoundManager *sm, nuvie_game_t type
 	luaL_openlibs(L);
 
 	luaL_newmetatable(L, "nuvie.U6Link");
-	luaL_register(L, NULL, nscript_u6linklib_m);
+	luaL_register(L, nullptr, nscript_u6linklib_m);
 
 	luaL_newmetatable(L, "nuvie.U6LinkRecursive");
-	luaL_register(L, NULL, nscript_u6linkrecursivelib_m);
+	luaL_register(L, nullptr, nscript_u6linkrecursivelib_m);
 
 	luaL_newmetatable(L, "nuvie.Obj");
 	//lua_pushvalue(L, -1); //duplicate metatable
 	//lua_setfield(L, -2, "__index"); // add __index to metatable
-	luaL_register(L, NULL, nscript_objlib_m);
+	luaL_register(L, nullptr, nscript_objlib_m);
 
 	luaL_register(L, "Obj", nscript_objlib_f);
 
@@ -1006,11 +1006,11 @@ bool Script::call_actor_attack(Actor *actor, MapCoord location, Obj *weapon, Act
 	lua_pushnumber(L, (lua_Number)location.x);
 	lua_pushnumber(L, (lua_Number)location.y);
 	lua_pushnumber(L, (lua_Number)location.z);
-	if (weapon == NULL)
+	if (weapon == nullptr)
 		nscript_new_actor_var(L, actor->get_actor_num());
 	else
 		nscript_obj_new(L, weapon);
-	if (foe == NULL)
+	if (foe == nullptr)
 		num_arg = 5;
 	else
 		nscript_new_actor_var(L, foe->get_actor_num());
@@ -1037,7 +1037,7 @@ bool Script::call_loadsave_game(const char *function, NuvieIO *objlist) {
 
 	bool result = call_function(function, 0, 0);
 
-	g_objlist_file = NULL;
+	g_objlist_file = nullptr;
 	return result;
 }
 
@@ -1200,7 +1200,7 @@ bool Script::call_has_usecode(Obj *obj, UseCodeEvent usecode_type) {
 }
 
 ScriptThread *Script::call_use_obj(Obj *obj, Actor *actor) {
-	ScriptThread *t = NULL;
+	ScriptThread *t = nullptr;
 	lua_State *s;
 
 	s = lua_newthread(L);
@@ -1280,7 +1280,7 @@ bool Script::call_magic_get_spell_list(Spell **spell_list) {
 		get_tbl_field_string(L, "name", name, 12);
 		get_tbl_field_string(L, "invocation", invocation, 4);
 
-		if (num < 256 && spell_list[num] == NULL) {
+		if (num < 256 && spell_list[num] == nullptr) {
 			spell_list[num] = new Spell((uint8)num, (const char *)name, (const char *)invocation, re);
 			::debug(1, "num = %d, reagents = %d, name = %s invocation = %s", num, re, name, invocation);
 		}
@@ -1312,7 +1312,7 @@ bool Script::call_can_get_obj_override(Obj *obj) {
 bool Script::call_out_of_ammo(Actor *attacker, Obj *weapon, bool print_message) {
 	lua_getglobal(L, "out_of_ammo");
 	nscript_new_actor_var(L, attacker->get_actor_num());
-	if (weapon == NULL)
+	if (weapon == nullptr)
 		nscript_new_actor_var(L, attacker->get_actor_num());
 	else
 		nscript_obj_new(L, weapon);
@@ -1367,7 +1367,7 @@ bool Script::call_function(const char *func_name, int num_args, int num_return,
 }
 
 ScriptThread *Script::call_function_in_thread(const char *function_name) {
-	ScriptThread *t = NULL;
+	ScriptThread *t = nullptr;
 	lua_State *s;
 
 	s = lua_newthread(L);
@@ -1542,7 +1542,7 @@ bool Script::call_is_tile_object(uint16 obj_n) {
 }
 
 ScriptThread *Script::new_thread(const char *scriptfile) {
-	ScriptThread *t = NULL;
+	ScriptThread *t = nullptr;
 	lua_State *s;
 
 	s = lua_newthread(L);
@@ -1555,13 +1555,13 @@ ScriptThread *Script::new_thread(const char *scriptfile) {
 }
 
 ScriptThread *Script::new_thread_from_string(const char *scriptStr) {
-	ScriptThread *t = NULL;
+	ScriptThread *t = nullptr;
 	lua_State *s;
 
 	s = lua_newthread(L);
 
 	if (luaL_loadbuffer(s, scriptStr, strlen(scriptStr), "nuvie") != 0)
-		return NULL;
+		return nullptr;
 
 	t = new ScriptThread(s, 0);
 
@@ -1585,8 +1585,8 @@ bool nscript_get_location_from_args(lua_State *L, uint16 *x, uint16 *y, uint8 *z
 
 Obj *nscript_get_obj_from_args(lua_State *L, int lua_stack_offset) {
 	Obj **s_obj = (Obj **)luaL_checkudata(L, lua_stack_offset, "nuvie.Obj");
-	if (s_obj == NULL)
-		return NULL;
+	if (s_obj == nullptr)
+		return nullptr;
 
 	return *s_obj;
 }
@@ -1619,7 +1619,7 @@ This function can clone and existing object or create a new object from one or m
 @within Object
  */
 static int nscript_obj_newobj(lua_State *L) {
-	return nscript_obj_new(L, NULL);
+	return nscript_obj_new(L, nullptr);
 }
 
 int nscript_obj_new(lua_State *L, Obj *obj) {
@@ -1630,7 +1630,7 @@ int nscript_obj_new(lua_State *L, Obj *obj) {
 	luaL_getmetatable(L, "nuvie.Obj");
 	lua_setmetatable(L, -2);
 
-	if (obj == NULL) {
+	if (obj == nullptr) {
 		obj = new Obj();
 
 		if (lua_gettop(L) > 1) { // do we have arguments?
@@ -1657,7 +1657,7 @@ sint32 nscript_inc_obj_ref_count(Obj *obj) {
 	key._ptr = obj;
 
 	obj_ref = (ScriptObjRef *)iAVLSearch(script_obj_list, key);
-	if (obj_ref == NULL) {
+	if (obj_ref == nullptr) {
 		obj->set_in_script(true); // mark as being used by script engine.
 		obj_ref =  new ScriptObjRef();
 		obj_ref->key._ptr = obj;
@@ -1675,7 +1675,7 @@ sint32 nscript_dec_obj_ref_count(Obj *obj) {
 	key._ptr = obj;
 
 	obj_ref = (ScriptObjRef *)iAVLSearch(script_obj_list, key);
-	if (obj_ref == NULL)
+	if (obj_ref == nullptr)
 		return -1;
 
 
@@ -1693,11 +1693,11 @@ sint32 nscript_dec_obj_ref_count(Obj *obj) {
 
 inline bool nscript_obj_init_from_obj(lua_State *L, Obj *s_obj) {
 	Obj **tmp_obj = (Obj **)luaL_checkudata(L, 1, "nuvie.Obj");
-	if (tmp_obj == NULL)
+	if (tmp_obj == nullptr)
 		return false;
 
 	Obj *ptr = *tmp_obj;
-	if (ptr == NULL)
+	if (ptr == nullptr)
 		return false;
 
 	s_obj->obj_n = ptr->obj_n;
@@ -1765,7 +1765,7 @@ static int nscript_obj_gc(lua_State *L) {
 	Obj **p_obj = (Obj **)lua_touserdata(L, 1);
 	Obj *obj;
 
-	if (p_obj == NULL)
+	if (p_obj == nullptr)
 		return false;
 
 	obj = *p_obj;
@@ -1790,7 +1790,7 @@ static int nscript_obj_gc(lua_State *L) {
 	  return &s_obj->script_obj;
    }
 
-   return NULL;
+   return nullptr;
    }
  */
 
@@ -1811,11 +1811,11 @@ static int nscript_obj_set(lua_State *L) {
 	const char *key;
 
 	s_obj = (Obj **)lua_touserdata(L, 1);
-	if (s_obj == NULL)
+	if (s_obj == nullptr)
 		return 0;
 
 	obj = *s_obj;
-	if (obj == NULL)
+	if (obj == nullptr)
 		return 0;
 
 	// ptr = nscript_get_obj_ptr(s_obj);
@@ -1886,11 +1886,11 @@ static int nscript_obj_get(lua_State *L) {
 	const char *key;
 
 	s_obj = (Obj **)lua_touserdata(L, 1);
-	if (s_obj == NULL)
+	if (s_obj == nullptr)
 		return 0;
 
 	obj = *s_obj;
-	if (obj == NULL)
+	if (obj == nullptr)
 		return 0;
 
 	//ptr = nscript_get_obj_ptr(s_obj);
@@ -1946,7 +1946,7 @@ static int nscript_obj_get(lua_State *L) {
 	   if(!strcmp(key, "container"))
 	   {
 	       U6LList *obj_list = obj->container;
-	       if(obj_list == NULL)
+	       if(obj_list == nullptr)
 	          return 0;
 
 	       U6Link *link = obj_list->start();
@@ -2128,7 +2128,7 @@ static int nscript_obj_movetoinv(lua_State *L) {
 
 	actor = actor_manager->get_actor(lua_tointeger(L, 2));
 
-	if (actor == NULL)
+	if (actor == nullptr)
 		return luaL_error(L, "Getting Actor (%d)", lua_tointeger(L, 2));
 
 	if (obj) {
@@ -2159,7 +2159,7 @@ static int nscript_obj_movetocont(lua_State *L) {
 
 	obj = *s_obj;
 
-	if (obj == NULL)
+	if (obj == nullptr)
 		return 0;
 
 	if (lua_gettop(L) < 2)
@@ -2193,12 +2193,12 @@ static int nscript_container_remove_obj(lua_State *L) {
 
 	obj = *s_obj;
 
-	if (obj == NULL)
+	if (obj == nullptr)
 		return luaL_error(L, "getting obj!");
 
 	cont_obj = obj->get_container_obj();
 
-	if (cont_obj == NULL)
+	if (cont_obj == nullptr)
 		return luaL_error(L, "obj not in a container!");
 
 	if (cont_obj->remove(obj) == false)
@@ -2258,7 +2258,7 @@ static int nscript_u6link_gc(lua_State *L) {
 	U6Link **s_link = (U6Link **)luaL_checkudata(L, 1, "nuvie.U6Link");
 	U6Link *link = *s_link;
 
-	if (link == NULL)
+	if (link == nullptr)
 		return 0;
 
 	releaseU6Link(link);
@@ -2276,7 +2276,7 @@ static int nscript_u6link_recursive_gc(lua_State *L) {
 		for (; !s->empty(); s->pop()) {
 			U6Link *link = s->top();
 
-			if (link != NULL)
+			if (link != nullptr)
 				releaseU6Link(link);
 		}
 	}
@@ -2755,7 +2755,7 @@ static int nscript_party_get_member(lua_State *L) {
 
 	Actor *actor = party->get_actor(member_num);
 
-	if (actor == NULL)
+	if (actor == nullptr)
 		return 0;
 
 	nscript_new_actor_var(L, actor->get_actor_num());
@@ -3076,7 +3076,7 @@ static int nscript_map_get_tile_num(lua_State *L) {
 	}
 
 	Tile *t = map->get_tile(x, y, z, original_tile);
-	if (t != NULL) {
+	if (t != nullptr) {
 		lua_pushinteger(L, t->tile_num);
 		return 1;
 	}
@@ -3105,7 +3105,7 @@ static int nscript_map_get_dmg_tile_num(lua_State *L) {
 		return 0;
 
 	Tile *t = map->get_dmg_tile(x, y, z);
-	if (t != NULL) {
+	if (t != nullptr) {
 		lua_pushinteger(L, t->tile_num);
 		return 1;
 	}
@@ -3168,7 +3168,7 @@ static int nscript_map_line_hit_check(lua_State *L) {
 	uint8 level = (uint8) luaL_checkinteger(L, 5);
 
 	//FIXME world wrapping for MD
-	if (map->lineTest(x, y, x1, y1, level, LT_HitMissileBoundary, result, 0, NULL, true)) {
+	if (map->lineTest(x, y, x1, y1, level, LT_HitMissileBoundary, result, 0, nullptr, true)) {
 		lua_pushinteger(L, result.hit_x);
 		lua_pushinteger(L, result.hit_y);
 	} else {
@@ -3244,7 +3244,7 @@ static int nscript_tile_get_flag(lua_State *L) {
 
 	Tile *tile = Game::get_game()->get_tile_manager()->get_original_tile(tile_num);
 
-	if (tile == NULL || flag_set < 1 || flag_set > 3 || bit > 7)
+	if (tile == nullptr || flag_set < 1 || flag_set > 3 || bit > 7)
 		return 0;
 
 	uint8 bit_flags = 0;
@@ -3596,8 +3596,8 @@ pixel fade from one tile to another. If to_tile is not supplied the fade to blan
  */
 static int nscript_fade_tile(lua_State *L) {
 	MapCoord loc;
-	Tile *tile_from =  NULL;
-	Tile *tile_to =  NULL;
+	Tile *tile_from =  nullptr;
+	Tile *tile_to =  nullptr;
 	TileManager *tm = Game::get_game()->get_tile_manager();
 
 	if (nscript_get_location_from_args(L, &loc.x, &loc.y, &loc.z) == false)
@@ -3631,7 +3631,7 @@ static int nscript_black_fade_obj(lua_State *L) {
 	uint8 fade_color = (uint8)lua_tointeger(L, 2);
 	uint16 fade_speed = (uint8)lua_tointeger(L, 3);
 
-	if (obj != NULL) {
+	if (obj != nullptr) {
 		AsyncEffect *e = new AsyncEffect(new TileBlackFadeEffect(obj, fade_color, fade_speed));
 		e->run();
 	}
@@ -3696,7 +3696,7 @@ wing strike effect. A dragon flies across the screen. (U6)
 static int nscript_wing_strike_effect(lua_State *L) {
 	Actor *actor = nscript_get_actor_from_args(L, 1);
 
-	if (actor != NULL) {
+	if (actor != nullptr) {
 		AsyncEffect *e = new AsyncEffect(new WingStrikeEffect(actor));
 		e->run();
 	}
@@ -3781,7 +3781,7 @@ int nscript_u6llist_iter(lua_State *L) {
 	U6Link **s_link = (U6Link **)luaL_checkudata(L, 1, "nuvie.U6Link");
 	U6Link *link = *s_link;
 
-	if (link == NULL || link->data == NULL)
+	if (link == nullptr || link->data == nullptr)
 		return 0;
 
 	Obj *obj = (Obj *)link->data;
@@ -3799,7 +3799,7 @@ int nscript_u6llist_iter_recursive(lua_State *L) {
 	Common::Stack<U6Link *> **s_stack = (Common::Stack<U6Link *> **)luaL_checkudata(L, 1, "nuvie.U6LinkRecursive");
 	Common::Stack<U6Link *> *s = *s_stack;
 
-	if (s->empty() || s->top() == NULL)
+	if (s->empty() || s->top() == nullptr)
 		return 0;
 
 	U6Link *link = s->top();
@@ -3808,7 +3808,7 @@ int nscript_u6llist_iter_recursive(lua_State *L) {
 	nscript_obj_new(L, obj);
 
 	s->pop();
-	if (link->next != NULL) {
+	if (link->next != nullptr) {
 		s->push(link->next);
 		retainU6Link(link->next);
 	}
@@ -3856,7 +3856,7 @@ static int nscript_party(lua_State *L) {
 }
 
 int nscript_find_obj_iter(lua_State *L) {
-	Obj *cur_obj = NULL;
+	Obj *cur_obj = nullptr;
 
 	if (!lua_isnil(L, lua_upvalueindex(1)))
 		cur_obj = nscript_get_obj_from_args(L, lua_upvalueindex(1));
@@ -3864,13 +3864,13 @@ int nscript_find_obj_iter(lua_State *L) {
 	bool match_frame_n = (bool)lua_toboolean(L, lua_upvalueindex(3));
 	bool match_quality = (bool)lua_toboolean(L, lua_upvalueindex(4));
 
-	if (cur_obj == NULL)
+	if (cur_obj == nullptr)
 		return 0;
 
 	ObjManager *obj_manager = Game::get_game()->get_obj_manager();
 	Obj *next_obj = obj_manager->find_next_obj(level, cur_obj, match_frame_n, match_quality);
 
-	if (next_obj == NULL) {
+	if (next_obj == nullptr) {
 		lua_pushnil(L);
 	} else {
 		nscript_new_obj_var(L, next_obj);
@@ -3892,7 +3892,7 @@ int nscript_find_obj_iter(lua_State *L) {
 }
 
 Obj *nscript_get_next_obj_from_area(U6Link **link, uint16 x, uint16 y, uint8 z, uint16 w, uint16 h, uint16 *xOffset, uint16 *yOffset) {
-	if (*link != NULL) {
+	if (*link != nullptr) {
 		Obj *obj = (Obj *)(*link)->data;
 		*link = (*link)->next;
 		return obj;
@@ -3918,11 +3918,11 @@ Obj *nscript_get_next_obj_from_area(U6Link **link, uint16 x, uint16 y, uint8 z,
 		}
 	}
 
-	return NULL;
+	return nullptr;
 }
 
 int nscript_find_obj_from_area_iter(lua_State *L) {
-	Obj *cur_obj = NULL;
+	Obj *cur_obj = nullptr;
 
 	U6Link **s_link = (U6Link **)luaL_checkudata(L, lua_upvalueindex(1), "nuvie.U6Link");
 
@@ -3940,7 +3940,7 @@ int nscript_find_obj_from_area_iter(lua_State *L) {
 
 	retainU6Link(*s_link);
 
-	if (cur_obj == NULL)
+	if (cur_obj == nullptr)
 		return 0;
 
 	lua_pushinteger(L, xOffset);
@@ -3989,7 +3989,7 @@ static int nscript_find_obj(lua_State *L) {
 
 	ObjManager *obj_manager = Game::get_game()->get_obj_manager();
 	Obj *obj = obj_manager->find_obj(level, obj_n, quality, match_quality, frame_n, match_frame_n);
-	if (obj != NULL) {
+	if (obj != nullptr) {
 		nscript_new_obj_var(L, obj);
 	} else {
 		lua_pushnil(L);
@@ -4025,7 +4025,7 @@ static int nscript_find_obj_from_area(lua_State *L) {
 	uint16 height = (uint16)luaL_checkinteger(L, stackOffset);
 
 	U6Link **p_link = (U6Link **)lua_newuserdata(L, sizeof(U6Link *));
-	*p_link = NULL;
+	*p_link = nullptr;
 
 	luaL_getmetatable(L, "nuvie.U6Link");
 	lua_setmetatable(L, -2);
@@ -4105,7 +4105,7 @@ Get the current year
 static int nscript_clock_get_year(lua_State *L) {
 	GameClock *clock = Game::get_game()->get_clock();
 
-	if (clock == NULL)
+	if (clock == nullptr)
 		return 0;
 
 	lua_pushinteger(L, clock->get_year());
@@ -4122,7 +4122,7 @@ Get the current month
 static int nscript_clock_get_month(lua_State *L) {
 	GameClock *clock = Game::get_game()->get_clock();
 
-	if (clock == NULL)
+	if (clock == nullptr)
 		return 0;
 
 	lua_pushinteger(L, clock->get_month());
@@ -4139,7 +4139,7 @@ Get the current day
 static int nscript_clock_get_day(lua_State *L) {
 	GameClock *clock = Game::get_game()->get_clock();
 
-	if (clock == NULL)
+	if (clock == nullptr)
 		return 0;
 
 	lua_pushinteger(L, clock->get_day());
@@ -4225,7 +4225,7 @@ Get input from the keyboard
 @within io
  */
 static int nscript_input_select(lua_State *L) {
-	const char *allowed_chars = NULL;
+	const char *allowed_chars = nullptr;
 
 	if (!lua_isnil(L, 1))
 		allowed_chars = luaL_checkstring(L, 1);
@@ -4254,7 +4254,7 @@ C function strtol()
 @within io
  */
 static int nscript_input_select_integer(lua_State *L) {
-	const char *allowed_chars = NULL;
+	const char *allowed_chars = nullptr;
 
 	if (!lua_isnil(L, 1))
 		allowed_chars = luaL_checkstring(L, 1);
@@ -4267,7 +4267,7 @@ static int nscript_input_select_integer(lua_State *L) {
 
 	Std::string input = inputEffect->get_input();
 
-	int num = (int)strtol(input.c_str(), (char **)NULL, 10);
+	int num = (int)strtol(input.c_str(), (char **)nullptr, 10);
 	lua_pushinteger(L, num);
 
 	return 1;
@@ -4280,7 +4280,7 @@ Iterate through objects at a given map location
 @within Object
  */
 static int nscript_objs_at_loc(lua_State *L) {
-	U6Link *link = NULL;
+	U6Link *link = nullptr;
 	ObjManager *obj_manager = Game::get_game()->get_obj_manager();
 
 	uint16 x, y;
@@ -4291,7 +4291,7 @@ static int nscript_objs_at_loc(lua_State *L) {
 
 	if (x < 1024 && y < 1024 && z <= 5) {
 		U6LList *obj_list = obj_manager->get_obj_list(x, y, z);
-		if (obj_list != NULL)
+		if (obj_list != nullptr)
 			link = obj_list->start();
 	} else {
 		DEBUG(0, LEVEL_ERROR, "objs_at_loc() Invalid coordinates (%d, %d, %d)\n", x, y, z);
@@ -4376,9 +4376,9 @@ static int nscript_container(lua_State *L) {
 }
 
 int nscript_init_u6link_iter(lua_State *L, U6LList *list, bool is_recursive) {
-	U6Link *link = NULL;
+	U6Link *link = nullptr;
 
-	if (list != NULL)
+	if (list != nullptr)
 		link = list->start();
 
 	retainU6Link(link);
@@ -4578,7 +4578,7 @@ Loads text from a given LZC file.
 @treturn string the extracted text
  */
 static int nscript_load_text_from_lzc(lua_State *L) {
-	unsigned char *buf = NULL;
+	unsigned char *buf = nullptr;
 	Std::string filename(lua_tostring(L, 1));
 	U6Lib_n lib_n;
 
@@ -4594,7 +4594,7 @@ static int nscript_load_text_from_lzc(lua_State *L) {
 		return 0;
 	}
 
-	buf = lib_n.get_item(idx, NULL);
+	buf = lib_n.get_item(idx, nullptr);
 	if (!buf) {
 		return 0;
 	}
diff --git a/engines/ultima/nuvie/script/script.h b/engines/ultima/nuvie/script/script.h
index dfb041a54de..fef7b4bf623 100644
--- a/engines/ultima/nuvie/script/script.h
+++ b/engines/ultima/nuvie/script/script.h
@@ -144,7 +144,7 @@ public:
 	bool call_look_obj(Obj *obj);
 	int call_obj_get_readiable_location(Obj *obj);
 	uint8 actor_get_max_magic_points(Actor *actor);
-	bool call_actor_get_obj(Actor *actor, Obj *obj, Obj *container = NULL);
+	bool call_actor_get_obj(Actor *actor, Obj *obj, Obj *container = nullptr);
 	bool call_actor_subtract_movement_points(Actor *actor, uint8 points);
 	bool call_actor_resurrect(Actor *actor);
 	bool call_use_keg(Obj *obj); //we need this until we move all usecode into script.
diff --git a/engines/ultima/nuvie/script/script_actor.cpp b/engines/ultima/nuvie/script/script_actor.cpp
index 7ae3e220f1c..166a93e455f 100644
--- a/engines/ultima/nuvie/script/script_actor.cpp
+++ b/engines/ultima/nuvie/script/script_actor.cpp
@@ -197,12 +197,12 @@ static const struct luaL_Reg nscript_actorlib_f[] = {
 	{ "get_number_of_schedules", nscript_actor_get_number_of_schedules },
 	{ "get_schedule", nscript_actor_get_schedule },
 
-	{ NULL, NULL }
+	{ nullptr, nullptr }
 };
 static const struct luaL_Reg nscript_actorlib_m[] = {
 	{ "__index", nscript_actor_get },
 	{ "__newindex", nscript_actor_set },
-	{ NULL, NULL }
+	{ nullptr, nullptr }
 };
 
 
@@ -464,7 +464,7 @@ static int nscript_actor_inv(lua_State *L);
 void nscript_init_actor(lua_State *L) {
 	luaL_newmetatable(L, "nuvie.Actor");
 
-	luaL_register(L, NULL, nscript_actorlib_m);
+	luaL_register(L, nullptr, nscript_actorlib_m);
 
 	luaL_register(L, "Actor", nscript_actorlib_f);
 
@@ -578,7 +578,7 @@ static int nscript_actor_clone(lua_State *L) {
 	uint8 z;
 
 	actor = nscript_get_actor_from_args(L);
-	if (actor == NULL)
+	if (actor == nullptr)
 		return 0;
 
 	if (nscript_get_location_from_args(L, &x, &y, &z, 2) == false)
@@ -615,11 +615,11 @@ static int nscript_get_actor_from_num(lua_State *L) {
 }
 
 Actor *nscript_get_actor_from_args(lua_State *L, int lua_stack_offset) {
-	Actor *actor = NULL;
+	Actor *actor = nullptr;
 
 	if (lua_isuserdata(L, lua_stack_offset)) {
 		uint16 *actor_num = (uint16 *)luaL_checkudata(L, lua_stack_offset, "nuvie.Actor");
-		if (actor_num != NULL)
+		if (actor_num != nullptr)
 			actor = Game::get_game()->get_actor_manager()->get_actor(*actor_num);
 	} else {
 		actor = Game::get_game()->get_actor_manager()->get_actor((uint16)lua_tointeger(L, lua_stack_offset));
@@ -646,7 +646,7 @@ static int nscript_actor_set(lua_State *L) {
 	const char *key;
 
 	actor = nscript_get_actor_from_args(L);
-	if (actor == NULL)
+	if (actor == nullptr)
 		return 0;
 
 	key = lua_tostring(L, 2);
@@ -825,7 +825,7 @@ static int nscript_actor_get(lua_State *L) {
 	const char *key;
 
 	actor = nscript_get_actor_from_args(L);
-	if (actor == NULL)
+	if (actor == nullptr)
 		return 0;
 
 	key = lua_tostring(L, 2);
@@ -1105,7 +1105,7 @@ static int nscript_actor_kill(lua_State *L) {
 	bool create_body = true;
 
 	actor = nscript_get_actor_from_args(L);
-	if (actor == NULL)
+	if (actor == nullptr)
 		return 0;
 
 	if (lua_gettop(L) >= 2)
@@ -1128,7 +1128,7 @@ static int nscript_actor_hit(lua_State *L) {
 	uint8 damage;
 
 	actor = nscript_get_actor_from_args(L);
-	if (actor == NULL)
+	if (actor == nullptr)
 		return 0;
 
 	damage = (uint8)luaL_checkinteger(L, 2);
@@ -1150,7 +1150,7 @@ Calls the get_combat_range script function with the wrapped absolute x,y distanc
 static int nscript_actor_get_range(lua_State *L) {
 	Actor *actor;
 	actor = nscript_get_actor_from_args(L);
-	if (actor == NULL)
+	if (actor == nullptr)
 		return 0;
 	uint16 target_x = (uint16) luaL_checkinteger(L, 2);
 	uint16 target_y = (uint16) luaL_checkinteger(L, 3);
@@ -1172,7 +1172,7 @@ static int nscript_actor_move(lua_State *L) {
 	uint8 z;
 
 	actor = nscript_get_actor_from_args(L);
-	if (actor == NULL)
+	if (actor == nullptr)
 		return 0;
 
 	if (nscript_get_location_from_args(L, &x, &y, &z, 2) == false)
@@ -1191,7 +1191,7 @@ Move the actor one space along their pathfinding path.
  */
 static int nscript_actor_walk_path(lua_State *L) {
 	Actor *actor = nscript_get_actor_from_args(L);
-	if (actor == NULL)
+	if (actor == nullptr)
 		return 0;
 
 	actor->update(); //FIXME this should be specific to pathfinding.
@@ -1208,7 +1208,7 @@ Checks to see if the actor is currently at their scheduled worktype location.
  */
 static int nscript_actor_is_at_scheduled_location(lua_State *L) {
 	Actor *actor = nscript_get_actor_from_args(L);
-	if (actor == NULL)
+	if (actor == nullptr)
 		return 0;
 
 	lua_pushboolean(L, actor->is_at_scheduled_location());
@@ -1227,11 +1227,11 @@ the actor can physically carry the object's weight.
  */
 static int nscript_actor_can_carry_obj(lua_State *L) {
 	Actor *actor = nscript_get_actor_from_args(L);
-	if (actor == NULL)
+	if (actor == nullptr)
 		return 0;
 
 	Obj *obj = nscript_get_obj_from_args(L, 2);
-	if (obj == NULL)
+	if (obj == nullptr)
 		return 0;
 
 	lua_pushboolean(L, (int)actor->can_carry_object(obj));
@@ -1250,11 +1250,11 @@ static int nscript_actor_can_carry_obj_weight(lua_State *L) {
 	if (Game::get_game()->using_hackmove())
 		return 1;
 	Actor *actor = nscript_get_actor_from_args(L);
-	if (actor == NULL)
+	if (actor == nullptr)
 		return 0;
 
 	Obj *obj = nscript_get_obj_from_args(L, 2);
-	if (obj == NULL)
+	if (obj == nullptr)
 		return 0;
 
 	lua_pushboolean(L, (int)actor->can_carry_weight(obj));
@@ -1274,7 +1274,7 @@ static int nscript_actor_black_fade_effect(lua_State *L) {
 	uint8 fade_color = (uint8)lua_tointeger(L, 2);
 	uint16 fade_speed = (uint8)lua_tointeger(L, 3);
 
-	if (actor != NULL) {
+	if (actor != nullptr) {
 		AsyncEffect *e = new AsyncEffect(new TileBlackFadeEffect(actor, fade_color, fade_speed));
 		e->run();
 	}
@@ -1293,7 +1293,7 @@ static int nscript_actor_fade_out_effect(lua_State *L) {
 	Actor *actor = nscript_get_actor_from_args(L);
 	uint16 fade_speed = (uint8)lua_tointeger(L, 2);
 
-	if (actor != NULL) {
+	if (actor != nullptr) {
 		AsyncEffect *e = new AsyncEffect(new TileFadeEffect(actor, fade_speed));
 		e->run();
 	}
@@ -1309,7 +1309,7 @@ Display the actor's portrait
  */
 static int nscript_actor_show_portrait(lua_State *L) {
 	Actor *actor = nscript_get_actor_from_args(L);
-	if (actor == NULL)
+	if (actor == nullptr)
 		return 0;
 
 	Game::get_game()->get_view_manager()->set_portrait_mode(actor, actor->get_name());
@@ -1341,7 +1341,7 @@ Talk to actor. The script will pause until the conversation has ended.
  */
 static int nscript_actor_talk(lua_State *L) {
 	Actor *actor = nscript_get_actor_from_args(L);
-	if (actor == NULL)
+	if (actor == nullptr)
 		return 0;
 
 	Game::get_game()->get_converse()->start(actor);
@@ -1358,7 +1358,7 @@ For multi-tile actors, disconnect their surrounding objects.
  */
 static int nscript_actor_unlink_surrounding_objs(lua_State *L) {
 	Actor *actor = nscript_get_actor_from_args(L);
-	if (actor == NULL)
+	if (actor == nullptr)
 		return 0;
 
 	bool make_temp_obj = lua_toboolean(L, 2);
@@ -1377,7 +1377,7 @@ Call the C++ actor usecode logic.
 static int nscript_actor_use(lua_State *L) {
 	UseCode *usecode = Game::get_game()->get_usecode();
 	Actor *actor = nscript_get_actor_from_args(L);
-	if (actor == NULL)
+	if (actor == nullptr)
 		return 0;
 
 	Obj *my_obj = actor->make_obj();
@@ -1401,7 +1401,7 @@ static int nscript_actor_resurrect(lua_State *L) {
 	MapCoord loc;
 
 	actor = nscript_get_actor_from_args(L);
-	if (actor == NULL)
+	if (actor == nullptr)
 		return 0;
 
 	if (nscript_get_location_from_args(L, &loc.x, &loc.y, &loc.z, 2) == false)
@@ -1433,7 +1433,7 @@ static int nscript_actor_inv_add_obj(lua_State *L) {
 	bool stack_objs = false;
 
 	actor = nscript_get_actor_from_args(L);
-	if (actor == NULL)
+	if (actor == nullptr)
 		return 0;
 
 	Obj **s_obj = (Obj **)luaL_checkudata(L, 2, "nuvie.Obj");
@@ -1445,7 +1445,7 @@ static int nscript_actor_inv_add_obj(lua_State *L) {
 		stack_objs = lua_toboolean(L, 3);
 	}
 
-	actor->inventory_add_object(obj, NULL, stack_objs);
+	actor->inventory_add_object(obj, nullptr, stack_objs);
 
 	return 0;
 }
@@ -1461,7 +1461,7 @@ static int nscript_actor_inv_remove_obj(lua_State *L) {
 	Actor *actor;
 
 	actor = nscript_get_actor_from_args(L);
-	if (actor == NULL)
+	if (actor == nullptr)
 		return 0;
 
 	Obj **s_obj = (Obj **)luaL_checkudata(L, 2, "nuvie.Obj");
@@ -1488,7 +1488,7 @@ static int nscript_actor_inv_remove_obj_qty(lua_State *L) {
 	Actor *actor;
 
 	actor = nscript_get_actor_from_args(L);
-	if (actor == NULL)
+	if (actor == nullptr)
 		return 0;
 
 	uint16 obj_n = (uint16)lua_tointeger(L, 2);
@@ -1520,7 +1520,7 @@ Returns the obj_n the object that is readied at a given location.
  */
 static int nscript_actor_inv_get_readied_obj_n(lua_State *L) {
 	Actor *actor = nscript_get_actor_from_args(L);
-	if (actor == NULL) {
+	if (actor == nullptr) {
 		lua_pushinteger(L, -1);
 		return 1;
 	}
@@ -1541,7 +1541,7 @@ static int nscript_actor_inv_ready_obj(lua_State *L) {
 	MapCoord loc;
 
 	actor = nscript_get_actor_from_args(L);
-	if (actor == NULL)
+	if (actor == nullptr)
 		return 0;
 
 	Obj **s_obj = (Obj **)luaL_checkudata(L, 2, "nuvie.Obj");
@@ -1566,7 +1566,7 @@ static int nscript_actor_inv_unready_obj(lua_State *L) {
 	Actor *actor;
 
 	actor = nscript_get_actor_from_args(L);
-	if (actor == NULL)
+	if (actor == nullptr)
 		return 0;
 
 	Obj **s_obj = (Obj **)luaL_checkudata(L, 2, "nuvie.Obj");
@@ -1599,7 +1599,7 @@ static int nscript_actor_inv_has_obj_n(lua_State *L) {
 	uint16 obj_n;
 
 	actor = nscript_get_actor_from_args(L);
-	if (actor == NULL)
+	if (actor == nullptr)
 		return 0;
 
 	obj_n = (uint16)luaL_checkinteger(L, 2);
@@ -1628,7 +1628,7 @@ static int nscript_actor_inv_get_obj_n(lua_State *L) {
 	bool match_quality = false;
 	Obj *obj;
 	actor = nscript_get_actor_from_args(L);
-	if (actor == NULL)
+	if (actor == nullptr)
 		return 0;
 
 	obj_n = (uint16)luaL_checkinteger(L, 2);
@@ -1666,7 +1666,7 @@ static int nscript_actor_inv_get_obj_total_qty(lua_State *L) {
 	uint16 obj_n;
 
 	actor = nscript_get_actor_from_args(L);
-	if (actor == NULL)
+	if (actor == nullptr)
 		return 0;
 
 	obj_n = (uint16)luaL_checkinteger(L, 2);
@@ -1693,14 +1693,14 @@ static int nscript_map_get_actor(lua_State *L) {
 
 	if (nscript_get_location_from_args(L, &x, &y, &z) == false)
 		return 0;
-	Actor *excluded_actor = NULL;
+	Actor *excluded_actor = nullptr;
 	void *p = lua_touserdata(L, 4); // avoid error warnings when null
-	if (p != NULL)
+	if (p != nullptr)
 		excluded_actor = nscript_get_actor_from_args(L, 4);
 
 	actor = actor_manager->get_actor(x, y, z, true, excluded_actor);
 
-	if (actor == NULL)
+	if (actor == nullptr)
 		return 0;
 
 	if (nscript_new_actor_var(L, actor->get_actor_num()) == false)
@@ -1751,7 +1751,7 @@ static int nscript_actor_inv(lua_State *L) {
 	bool is_recursive = false;
 
 	actor = nscript_get_actor_from_args(L);
-	if (actor == NULL)
+	if (actor == nullptr)
 		return 0;
 
 	if (lua_gettop(L) >= 2)
@@ -1772,7 +1772,7 @@ Set one of the actor's talk flags
 static int nscript_actor_set_talk_flag(lua_State *L) {
 	Actor *actor;
 	actor = nscript_get_actor_from_args(L);
-	if (actor == NULL)
+	if (actor == nullptr)
 		return 0;
 	actor->set_flag((uint8)lua_tointeger(L, 2));
 	return 0;
@@ -1789,7 +1789,7 @@ Get the value of one of the actor's talk flags
 static int nscript_actor_get_talk_flag(lua_State *L) {
 	Actor *actor;
 	actor = nscript_get_actor_from_args(L);
-	if (actor == NULL)
+	if (actor == nullptr)
 		return 0;
 	lua_pushboolean(L, actor->get_flag((uint8)lua_tointeger(L, 2)));
 
@@ -1806,7 +1806,7 @@ Clear one of the actor's talk flags
 static int nscript_actor_clear_talk_flag(lua_State *L) {
 	Actor *actor;
 	actor = nscript_get_actor_from_args(L);
-	if (actor == NULL)
+	if (actor == nullptr)
 		return 0;
 	actor->clear_flag((uint8)lua_tointeger(L, 2));
 	return 0;
@@ -1821,7 +1821,7 @@ Get the number of schedule entries
  */
 static int nscript_actor_get_number_of_schedules(lua_State *L) {
 	Actor *actor = nscript_get_actor_from_args(L);
-	if (actor == NULL)
+	if (actor == nullptr)
 		return 0;
 
 	lua_pushinteger(L, actor->get_number_of_schedules());
@@ -1838,7 +1838,7 @@ Get an Actor schedule entry
  */
 static int nscript_actor_get_schedule(lua_State *L) {
 	Actor *actor = nscript_get_actor_from_args(L);
-	if (actor == NULL)
+	if (actor == nullptr)
 		return 0;
 
 	Schedule *schedule = actor->get_schedule((uint8)lua_tointeger(L, 2));
diff --git a/engines/ultima/nuvie/script/script_cutscene.cpp b/engines/ultima/nuvie/script/script_cutscene.cpp
index 8cbfb2dcee5..454b9188afe 100644
--- a/engines/ultima/nuvie/script/script_cutscene.cpp
+++ b/engines/ultima/nuvie/script/script_cutscene.cpp
@@ -47,7 +47,7 @@ namespace Nuvie {
 #define INPUT_KEY_DOWN  81 | (1<<30)
 #define INPUT_KEY_UP  82 | (1<<30)
 
-static ScriptCutscene *cutScene = NULL;
+static ScriptCutscene *cutScene = nullptr;
 ScriptCutscene *get_cutscene() {
 	return cutScene;
 }
@@ -78,7 +78,7 @@ static const struct luaL_Reg nscript_imagelib_m[] = {
 	{ "__index", nscript_image_get },
 	{ "__newindex", nscript_image_set },
 	{ "__gc", nscript_image_gc },
-	{ NULL, NULL }
+	{ nullptr, nullptr }
 };
 
 static int nscript_sprite_set(lua_State *L);
@@ -91,7 +91,7 @@ static const struct luaL_Reg nscript_spritelib_m[] = {
 	{ "__index", nscript_sprite_get },
 	{ "__newindex", nscript_sprite_set },
 	{ "__gc", nscript_sprite_gc },
-	{ NULL, NULL }
+	{ nullptr, nullptr }
 };
 
 static int nscript_sprite_new(lua_State *L);
@@ -128,10 +128,10 @@ void nscript_init_cutscene(lua_State *L, Configuration *cfg, GUI *gui, SoundMana
 	cutScene = new ScriptCutscene(gui, cfg, sm);
 
 	luaL_newmetatable(L, "nuvie.Image");
-	luaL_register(L, NULL, nscript_imagelib_m);
+	luaL_register(L, nullptr, nscript_imagelib_m);
 
 	luaL_newmetatable(L, "nuvie.Sprite");
-	luaL_register(L, NULL, nscript_spritelib_m);
+	luaL_register(L, nullptr, nscript_spritelib_m);
 
 	lua_pushcfunction(L, nscript_image_new);
 	lua_setglobal(L, "image_new");
@@ -263,8 +263,8 @@ bool nscript_new_image_var(lua_State *L, CSImage *image) {
 
 CSImage *nscript_get_image_from_args(lua_State *L, int lua_stack_offset) {
 	CSImage **s_image = (CSImage **)luaL_checkudata(L, lua_stack_offset, "nuvie.Image");
-	if (s_image == NULL)
-		return NULL;
+	if (s_image == nullptr)
+		return nullptr;
 
 	return *s_image;
 }
@@ -275,11 +275,11 @@ static int nscript_image_set(lua_State *L) {
 	const char *key;
 
 	s_image = (CSImage **)lua_touserdata(L, 1);
-	if (s_image == NULL)
+	if (s_image == nullptr)
 		return 0;
 
 	image = *s_image;
-	if (image == NULL)
+	if (image == nullptr)
 		return 0;
 
 	key = lua_tostring(L, 2);
@@ -299,11 +299,11 @@ static int nscript_image_get(lua_State *L) {
 	const char *key;
 
 	s_image = (CSImage **)lua_touserdata(L, 1);
-	if (s_image == NULL)
+	if (s_image == nullptr)
 		return 0;
 
 	image = *s_image;
-	if (image == NULL)
+	if (image == nullptr)
 		return 0;
 
 	key = lua_tostring(L, 2);
@@ -331,7 +331,7 @@ static int nscript_image_get(lua_State *L) {
 }
 
 static sint32 nscript_dec_image_ref_count(CSImage *image) {
-	if (image == NULL)
+	if (image == nullptr)
 		return -1;
 
 	image->refcount--;
@@ -345,7 +345,7 @@ static int nscript_image_gc(lua_State *L) {
 	CSImage **p_image = (CSImage **)lua_touserdata(L, 1);
 	CSImage *image;
 
-	if (p_image == NULL)
+	if (p_image == nullptr)
 		return false;
 
 	image = *p_image;
@@ -575,8 +575,8 @@ CSSprite *nscript_get_sprite_from_args(lua_State *L, int lua_stack_offset) {
 	CSSprite *sprite;
 
 	s_sprite = (CSSprite **)lua_touserdata(L, 1);
-	if (s_sprite == NULL)
-		return NULL;
+	if (s_sprite == nullptr)
+		return nullptr;
 
 	sprite = *s_sprite;
 	return sprite;
@@ -601,11 +601,11 @@ static int nscript_sprite_set(lua_State *L) {
 	const char *key;
 
 	s_sprite = (CSSprite **)lua_touserdata(L, 1);
-	if (s_sprite == NULL)
+	if (s_sprite == nullptr)
 		return 0;
 
 	sprite = *s_sprite;
-	if (sprite == NULL)
+	if (sprite == nullptr)
 		return 0;
 
 	key = lua_tostring(L, 2);
@@ -687,11 +687,11 @@ static int nscript_sprite_get(lua_State *L) {
 	const char *key;
 
 	s_sprite = (CSSprite **)lua_touserdata(L, 1);
-	if (s_sprite == NULL)
+	if (s_sprite == nullptr)
 		return 0;
 
 	sprite = *s_sprite;
-	if (sprite == NULL)
+	if (sprite == nullptr)
 		return 0;
 
 	key = lua_tostring(L, 2);
@@ -747,7 +747,7 @@ static int nscript_sprite_gc(lua_State *L) {
 	CSSprite **p_sprite = (CSSprite **)lua_touserdata(L, 1);
 	CSSprite *sprite;
 
-	if (p_sprite == NULL)
+	if (p_sprite == nullptr)
 		return false;
 
 	sprite = *p_sprite;
@@ -1084,7 +1084,7 @@ static int nscript_engine_should_quit(lua_State *L) {
 	return 1;
 }
 
-ScriptCutscene::ScriptCutscene(GUI *g, Configuration *cfg, SoundManager *sm) : GUI_Widget(NULL) {
+ScriptCutscene::ScriptCutscene(GUI *g, Configuration *cfg, SoundManager *sm) : GUI_Widget(nullptr) {
 	config = cfg;
 	gui = g;
 
@@ -1097,7 +1097,7 @@ ScriptCutscene::ScriptCutscene(GUI *g, Configuration *cfg, SoundManager *sm) : G
 
 	nuvie_game_t game_type = Game::get_game()->get_game_type();
 
-	GUI_Widget::Init(NULL, 0, 0, g->get_width(), g->get_height());
+	GUI_Widget::Init(nullptr, 0, 0, g->get_width(), g->get_height());
 
 	clip_rect = Common::Rect(x_off, y_off, x_off + 320, y_off + 200);
 	screen = g->get_screen();
@@ -1146,7 +1146,7 @@ ScriptCutscene::ScriptCutscene(GUI *g, Configuration *cfg, SoundManager *sm) : G
 	bg_color = 0;
 	solid_bg = true;
 	rotate_game_palette = false;
-	palette = NULL;
+	palette = nullptr;
 }
 
 ScriptCutscene::~ScriptCutscene() {
@@ -1163,24 +1163,24 @@ bool ScriptCutscene::is_lzc(const char *filename) {
 CSImage *ScriptCutscene::load_image_from_lzc(Std::string filename, uint16 idx, uint16 sub_idx) {
 	CSImage *image = nullptr;
 	U6Lib_n lib_n;
-	unsigned char *buf = NULL;
+	unsigned char *buf = nullptr;
 
 	if (!lib_n.open(filename, 4, NUVIE_GAME_MD)) {
-		return NULL;
+		return nullptr;
 	}
 
 	if (idx >= lib_n.get_num_items()) {
-		return NULL;
+		return nullptr;
 	}
 
-	buf = lib_n.get_item(idx, NULL);
+	buf = lib_n.get_item(idx, nullptr);
 	NuvieIOBuffer io;
 	io.open(buf, lib_n.get_item_size(idx), false);
 	U6Lib_n lib1;
 	lib1.open(&io, 4, NUVIE_GAME_MD);
 
 	if (sub_idx >= lib1.get_num_items()) {
-		return NULL;
+		return nullptr;
 	}
 
 	U6Shape *shp = new U6Shape();
@@ -1196,7 +1196,7 @@ CSImage *ScriptCutscene::load_image_from_lzc(Std::string filename, uint16 idx, u
 CSImage *ScriptCutscene::load_image(const char *filename, int idx, int sub_idx) {
 	U6Lib_n lib_n;
 	Std::string path;
-	CSImage *image = NULL;
+	CSImage *image = nullptr;
 
 	config_get_path(config, filename, path);
 
@@ -1229,7 +1229,7 @@ CSImage *ScriptCutscene::load_image(const char *filename, int idx, int sub_idx)
 		}
 	}
 
-	if (image == NULL)
+	if (image == nullptr)
 		delete shp;
 
 	return image;
@@ -1237,7 +1237,7 @@ CSImage *ScriptCutscene::load_image(const char *filename, int idx, int sub_idx)
 
 Std::vector<Std::vector<CSImage *> > ScriptCutscene::load_all_images(const char *filename) {
 	Std::string path;
-	CSImage *image = NULL;
+	CSImage *image = nullptr;
 
 	config_get_path(config, filename, path);
 
@@ -1245,14 +1245,14 @@ Std::vector<Std::vector<CSImage *> > ScriptCutscene::load_all_images(const char
 	U6Lzw lzw;
 
 	U6Lib_n lib_n;
-	unsigned char *buf = NULL;
+	unsigned char *buf = nullptr;
 
 	if (is_lzc(filename)) {
 		if (!lib_n.open(path, 4, NUVIE_GAME_MD)) {
 			return v;
 		}
 		for (uint32 idx = 0; idx < lib_n.get_num_items(); idx++) {
-			buf = lib_n.get_item(idx, NULL);
+			buf = lib_n.get_item(idx, nullptr);
 			NuvieIOBuffer io;
 			io.open(buf, lib_n.get_item_size(idx), false);
 			U6Lib_n lib1;
@@ -1267,7 +1267,7 @@ Std::vector<Std::vector<CSImage *> > ScriptCutscene::load_all_images(const char
 				}
 			}
 			free(buf);
-			buf = NULL;
+			buf = nullptr;
 			v.push_back(v1);
 		}
 	} else {
@@ -1301,8 +1301,8 @@ Std::vector<Std::vector<CSImage *> > ScriptCutscene::load_all_images(const char
 }
 
 void load_images_from_lib(Std::vector<CSImage *> *images, U6Lib_n *lib, uint32 index) {
-	unsigned char *buf = lib->get_item(index, NULL);
-	if (buf == NULL) {
+	unsigned char *buf = lib->get_item(index, nullptr);
+	if (buf == nullptr) {
 		return;
 	}
 
@@ -1340,7 +1340,7 @@ Std::vector<CSMidGameData> ScriptCutscene::load_midgame_file(const char *filenam
 
 		CSMidGameData data;
 		for (int i = 0; i < 3; i++, idx++) {
-			unsigned char *buf = lib_n.get_item(idx, NULL);
+			unsigned char *buf = lib_n.get_item(idx, nullptr);
 			data.text.push_back(string((const char *)buf));
 			free(buf);
 		}
@@ -1361,7 +1361,7 @@ Std::vector<Std::string> ScriptCutscene::load_text(const char *filename, uint8 i
 	Std::string path;
 	U6Lib_n lib_n;
 	Std::vector<string> v;
-	unsigned char *buf = NULL;
+	unsigned char *buf = nullptr;
 
 	config_get_path(config, filename, path);
 
@@ -1369,9 +1369,9 @@ Std::vector<Std::string> ScriptCutscene::load_text(const char *filename, uint8 i
 		return v;
 	}
 
-	buf = lib_n.get_item(idx, NULL);
+	buf = lib_n.get_item(idx, nullptr);
 	uint16 len = lib_n.get_item_size(idx);
-	if (buf != NULL) {
+	if (buf != nullptr) {
 		uint16 start = 0;
 		for (uint16 i = 0; i < len; i++) {
 			if (buf[i] == '\r') {
@@ -1470,7 +1470,7 @@ void ScriptCutscene::load_palette(const char *filename, int idx) {
 	} else if (has_file_extension(filename, ".pal")) {
 		U6Lib_n lib;
 		lib.open(path, 4, NUVIE_GAME_MD);
-		unsigned char *decomp_buf = lib.get_item(0, NULL);
+		unsigned char *decomp_buf = lib.get_item(0, nullptr);
 		memcpy(unpacked_palette, &decomp_buf[idx * 0x300], 0x300);
 
 		free(decomp_buf);
@@ -1697,7 +1697,7 @@ void CSImage::setScale(uint16 percentage) {
 
 	scale = percentage;
 	if (scale == 100) {
-		scaled_shp = NULL;
+		scaled_shp = nullptr;
 		shp = orig_shp;
 		return;
 	}
@@ -1722,7 +1722,7 @@ void CSImage::setScale(uint16 percentage) {
 	if (!scaled_shp->init(tw, th, tx, ty)) {
 		scale = 100;
 		delete scaled_shp;
-		scaled_shp = NULL;
+		scaled_shp = nullptr;
 		return;
 	}
 
@@ -1768,7 +1768,7 @@ void CSStarFieldImage::updateEffect() {
 			for (int j = 0; j < start_pos; j++) {
 				if (stars[i].line->step() == false) {
 					delete stars[i].line;
-					stars[i].line = NULL;
+					stars[i].line = nullptr;
 					break;
 				}
 			}
@@ -1776,7 +1776,7 @@ void CSStarFieldImage::updateEffect() {
 			uint32 cur_x, cur_y;
 			if (stars[i].line->next(&cur_x, &cur_y) == false) {
 				delete stars[i].line;
-				stars[i].line = NULL;
+				stars[i].line = nullptr;
 			} else {
 				data[cur_y * w + cur_x] = stars[i].color;
 			}
diff --git a/engines/ultima/nuvie/script/script_cutscene.h b/engines/ultima/nuvie/script/script_cutscene.h
index 4bf3e080463..117ce9e8b30 100644
--- a/engines/ultima/nuvie/script/script_cutscene.h
+++ b/engines/ultima/nuvie/script/script_cutscene.h
@@ -48,7 +48,7 @@ public:
 
 	CSImage(U6Shape *shape) {
 		orig_shp = shape;
-		scaled_shp = NULL;
+		scaled_shp = nullptr;
 		shp = shape;
 		scale = 100;
 		refcount = 0;
@@ -95,7 +95,7 @@ struct CSSprite {
 		x = 0;
 		y = 0;
 		opacity = 255;
-		image = NULL;
+		image = nullptr;
 		visible = false;
 		clip_rect = Common::Rect();
 		text = "";
diff --git a/engines/ultima/nuvie/sound/adlib_sfx_manager.cpp b/engines/ultima/nuvie/sound/adlib_sfx_manager.cpp
index 7a6de8e943c..bd33334a661 100644
--- a/engines/ultima/nuvie/sound/adlib_sfx_manager.cpp
+++ b/engines/ultima/nuvie/sound/adlib_sfx_manager.cpp
@@ -37,12 +37,12 @@ AdLibSfxManager::~AdLibSfxManager() {
 }
 
 bool AdLibSfxManager::playSfx(SfxIdType sfx_id, uint8 volume) {
-	return playSfxLooping(sfx_id, NULL, volume);
+	return playSfxLooping(sfx_id, nullptr, volume);
 }
 
 
 bool AdLibSfxManager::playSfxLooping(SfxIdType sfx_id, Audio::SoundHandle *handle, uint8 volume) {
-	AdLibSfxStream *stream = NULL;
+	AdLibSfxStream *stream = nullptr;
 
 	if (sfx_id == NUVIE_SFX_SE_TICK) {
 		stream = new AdLibSfxStream(config, mixer->getOutputRate(), 17, 0x30, 0x60, 0xff, 22050);
diff --git a/engines/ultima/nuvie/sound/adplug/fm_opl.cpp b/engines/ultima/nuvie/sound/adplug/fm_opl.cpp
index 3f01886a181..25aa78f40c9 100644
--- a/engines/ultima/nuvie/sound/adplug/fm_opl.cpp
+++ b/engines/ultima/nuvie/sound/adplug/fm_opl.cpp
@@ -112,7 +112,7 @@ static FILE *sample[1];
 
 /* #define LOG_CYM_FILE */
 #ifdef LOG_CYM_FILE
-	FILE * cymfile = NULL;
+	FILE * cymfile = nullptr;
 #endif
 
 
@@ -561,7 +561,7 @@ static const int8 lfo_pm_table[8*8*2] = {
 static int num_lock = 0;
 
 /* work table */
-static void *cur_chip = NULL;	/* current chip point */
+static void *cur_chip = nullptr;	/* current chip point */
 OPL_SLOT *SLOT7_1,*SLOT7_2,*SLOT8_1,*SLOT8_2;
 
 static signed int phase_modulation;		/* phase modulation input (SLOT 2) */
@@ -1672,7 +1672,7 @@ static int OPL_LockTable(void)
 
 	/* first time */
 
-	cur_chip = NULL;
+	cur_chip = nullptr;
 	/* allocate total level table (128kb space) */
 	if( !init_tables() )
 	{
@@ -1698,12 +1698,12 @@ static void OPL_UnLockTable(void)
 
 	/* last time */
 
-	cur_chip = NULL;
+	cur_chip = nullptr;
 	OPLCloseTable();
 
 #ifdef LOG_CYM_FILE
 	fclose (cymfile);
-	cymfile = NULL;
+	cymfile = nullptr;
 #endif
 
 }
@@ -1762,7 +1762,7 @@ static FM_OPL *OPLCreate(int type, int clock, int rate)
 	FM_OPL *OPL;
 	int state_size;
 
-	if (OPL_LockTable() ==-1) return NULL;
+	if (OPL_LockTable() ==-1) return nullptr;
 
 	/* calculate OPL state size */
 	state_size  = sizeof(FM_OPL);
@@ -1774,8 +1774,8 @@ static FM_OPL *OPLCreate(int type, int clock, int rate)
 	/* allocate memory block */
 	ptr = (char *)malloc(state_size);
 
-	if (ptr==NULL)
-		return NULL;
+	if (ptr==nullptr)
+		return nullptr;
 
 	/* clear */
 	memset(ptr,0,state_size);
@@ -1942,7 +1942,7 @@ int YM3812Init(int num, int clock, int rate)
 	{
 		/* emulator create */
 		OPL_YM3812[i] = OPLCreate(OPL_TYPE_YM3812,clock,rate);
-		if(OPL_YM3812[i] == NULL)
+		if(OPL_YM3812[i] == nullptr)
 		{
 			/* it's really bad - we run out of memeory */
 			YM3812NumChips = 0;
@@ -1961,7 +1961,7 @@ void YM3812Shutdown(void)
 	{
 		/* emulator shutdown */
 		OPLDestroy(OPL_YM3812[i]);
-		OPL_YM3812[i] = NULL;
+		OPL_YM3812[i] = nullptr;
 	}
 	YM3812NumChips = 0;
 }
@@ -2088,7 +2088,7 @@ int YM3526Init(int num, int clock, int rate)
 	{
 		/* emulator create */
 		OPL_YM3526[i] = OPLCreate(OPL_TYPE_YM3526,clock,rate);
-		if(OPL_YM3526[i] == NULL)
+		if(OPL_YM3526[i] == nullptr)
 		{
 			/* it's really bad - we run out of memeory */
 			YM3526NumChips = 0;
@@ -2107,7 +2107,7 @@ void YM3526Shutdown(void)
 	{
 		/* emulator shutdown */
 		OPLDestroy(OPL_YM3526[i]);
-		OPL_YM3526[i] = NULL;
+		OPL_YM3526[i] = nullptr;
 	}
 	YM3526NumChips = 0;
 }
@@ -2234,7 +2234,7 @@ int Y8950Init(int num, int clock, int rate)
 	{
 		/* emulator create */
 		OPL_Y8950[i] = OPLCreate(OPL_TYPE_Y8950,clock,rate);
-		if(OPL_Y8950[i] == NULL)
+		if(OPL_Y8950[i] == nullptr)
 		{
 			/* it's really bad - we run out of memeory */
 			Y8950NumChips = 0;
@@ -2253,7 +2253,7 @@ void Y8950Shutdown(void)
 	{
 		/* emulator shutdown */
 		OPLDestroy(OPL_Y8950[i]);
-		OPL_Y8950[i] = NULL;
+		OPL_Y8950[i] = nullptr;
 	}
 	Y8950NumChips = 0;
 }
diff --git a/engines/ultima/nuvie/sound/adplug/mid.cpp b/engines/ultima/nuvie/sound/adplug/mid.cpp
index 188f01f4fab..f29a7527209 100644
--- a/engines/ultima/nuvie/sound/adplug/mid.cpp
+++ b/engines/ultima/nuvie/sound/adplug/mid.cpp
@@ -151,7 +151,7 @@ bool CmidPlayer::load(Std::string &filename, int song_index) {
 		subsongs = 1;
 	else {
 		delete [] data;
-		data = NULL;
+		data = nullptr;
 		return false;
 	}
 
diff --git a/engines/ultima/nuvie/sound/adplug/opl_class.cpp b/engines/ultima/nuvie/sound/adplug/opl_class.cpp
index fcc97ccb5ae..31783249cc9 100644
--- a/engines/ultima/nuvie/sound/adplug/opl_class.cpp
+++ b/engines/ultima/nuvie/sound/adplug/opl_class.cpp
@@ -394,7 +394,7 @@ OplClass::OplClass(int rate, bool bit16, bool usestereo)
 	: use16bit(bit16), stereo(usestereo), oplRate(rate) {
 	YM3812NumChips = 0;
 	num_lock = 0;
-	cur_chip = NULL;
+	cur_chip = nullptr;
 	YM3812Init(1, 3579545, rate);
 }
 
@@ -1338,7 +1338,7 @@ int OplClass::OPL_LockTable(void) {
 
 	/* first time */
 
-	cur_chip = NULL;
+	cur_chip = nullptr;
 	/* allocate total level table (128kb space) */
 	if (!init_tables()) {
 		num_lock--;
@@ -1354,7 +1354,7 @@ void OplClass::OPL_UnLockTable(void) {
 
 	/* last time */
 
-	cur_chip = NULL;
+	cur_chip = nullptr;
 	OPLCloseTable();
 
 }
@@ -1398,7 +1398,7 @@ FM_OPL *OplClass::OPLCreate(int type, int clock, int rate) {
 	FM_OPL *OPL;
 	int state_size;
 
-	if (OPL_LockTable() == -1) return NULL;
+	if (OPL_LockTable() == -1) return nullptr;
 
 	/* calculate OPL state size */
 	state_size  = sizeof(FM_OPL);
@@ -1406,8 +1406,8 @@ FM_OPL *OplClass::OPLCreate(int type, int clock, int rate) {
 	/* allocate memory block */
 	ptr = (char *)malloc(state_size);
 
-	if (ptr == NULL)
-		return NULL;
+	if (ptr == nullptr)
+		return nullptr;
 
 	/* clear */
 	memset(ptr, 0, state_size);
@@ -1519,7 +1519,7 @@ int OplClass::YM3812Init(int num, int clock, int rate) {
 	for (i = 0; i < YM3812NumChips; i++) {
 		/* emulator create */
 		OPL_YM3812[i] = OPLCreate(OPL_TYPE_YM3812, clock, rate);
-		if (OPL_YM3812[i] == NULL) {
+		if (OPL_YM3812[i] == nullptr) {
 			/* it's really bad - we run out of memeory */
 			YM3812NumChips = 0;
 			return -1;
@@ -1535,7 +1535,7 @@ void OplClass::YM3812Shutdown(void) {
 	for (i = 0; i < YM3812NumChips; i++) {
 		/* emulator shutdown */
 		OPLDestroy(OPL_YM3812[i]);
-		OPL_YM3812[i] = NULL;
+		OPL_YM3812[i] = nullptr;
 	}
 	YM3812NumChips = 0;
 }
diff --git a/engines/ultima/nuvie/sound/custom_sfx_manager.cpp b/engines/ultima/nuvie/sound/custom_sfx_manager.cpp
index 05baaf7f05e..bcda26599d8 100644
--- a/engines/ultima/nuvie/sound/custom_sfx_manager.cpp
+++ b/engines/ultima/nuvie/sound/custom_sfx_manager.cpp
@@ -64,14 +64,14 @@ bool CustomSfxManager::loadSfxMapFile(Std::string cfg_filename, Common::HashMap<
 
 	token1 = strtok(sz, seps);
 
-	while ((token1 != NULL) && ((token2 = strtok(NULL, seps)) != NULL)) {
+	while ((token1 != nullptr) && ((token2 = strtok(nullptr, seps)) != nullptr)) {
 		SfxIdType sfx_id = (SfxIdType)atoi(token1);
 		int custom_wave_id = atoi(token2);
 
 		DEBUG(0, LEVEL_DEBUGGING, "%d : %d.wav\n", sfx_id, custom_wave_id);
 		(*m)[sfx_id] = custom_wave_id;
 
-		token1 = strtok(NULL, seps);
+		token1 = strtok(nullptr, seps);
 	}
 
 
@@ -79,7 +79,7 @@ bool CustomSfxManager::loadSfxMapFile(Std::string cfg_filename, Common::HashMap<
 }
 
 bool CustomSfxManager::playSfx(SfxIdType sfx_id, uint8 volume) {
-	return playSfxLooping(sfx_id, NULL, volume);
+	return playSfxLooping(sfx_id, nullptr, volume);
 }
 
 
@@ -96,7 +96,7 @@ bool CustomSfxManager::playSfxLooping(SfxIdType sfx_id, Audio::SoundHandle *hand
 }
 
 void CustomSfxManager::playSoundSample(uint16 sample_num, Audio::SoundHandle *looping_handle, uint8 volume) {
-	Audio::AudioStream *stream = NULL;
+	Audio::AudioStream *stream = nullptr;
 	Audio::SoundHandle handle;
 	Std::string filename;
 	char wavefile[10]; // "nnnnn.wav\0"
diff --git a/engines/ultima/nuvie/sound/decoder/adlib_sfx_stream.h b/engines/ultima/nuvie/sound/decoder/adlib_sfx_stream.h
index 216a84c2821..14f6a4ef151 100644
--- a/engines/ultima/nuvie/sound/decoder/adlib_sfx_stream.h
+++ b/engines/ultima/nuvie/sound/decoder/adlib_sfx_stream.h
@@ -38,7 +38,7 @@ using Std::string;
 class AdLibSfxStream : public Audio::RewindableAudioStream {
 public:
 	AdLibSfxStream() {
-		opl = NULL;
+		opl = nullptr;
 		duration = 0;
 	}
 
diff --git a/engines/ultima/nuvie/sound/decoder/fm_towns_decoder_stream.cpp b/engines/ultima/nuvie/sound/decoder/fm_towns_decoder_stream.cpp
index a0620aeeda9..039bd5c0a49 100644
--- a/engines/ultima/nuvie/sound/decoder/fm_towns_decoder_stream.cpp
+++ b/engines/ultima/nuvie/sound/decoder/fm_towns_decoder_stream.cpp
@@ -43,7 +43,7 @@ FMtownsDecoderStream::FMtownsDecoderStream(Std::string filename, uint16 sample_n
 
 	sam_file.open(filename, 4);
 
-	item_data = sam_file.get_item(sample_num, NULL);
+	item_data = sam_file.get_item(sample_num, nullptr);
 
 	if (isCompressed) {
 		raw_audio_buf = lzw.decompress_buffer(item_data, sam_file.get_item_size(sample_num), decomp_size);
diff --git a/engines/ultima/nuvie/sound/decoder/fm_towns_decoder_stream.h b/engines/ultima/nuvie/sound/decoder/fm_towns_decoder_stream.h
index 151b035f9c3..43172c237bb 100644
--- a/engines/ultima/nuvie/sound/decoder/fm_towns_decoder_stream.h
+++ b/engines/ultima/nuvie/sound/decoder/fm_towns_decoder_stream.h
@@ -35,7 +35,7 @@ class FMtownsDecoderStream : public Audio::RewindableAudioStream {
 public:
 	FMtownsDecoderStream() {
 		should_free_raw_data = false;
-		raw_audio_buf = NULL;
+		raw_audio_buf = nullptr;
 	}
 
 	FMtownsDecoderStream(unsigned char *buf, uint32 len);
diff --git a/engines/ultima/nuvie/sound/decoder/random_collection_audio_stream.cpp b/engines/ultima/nuvie/sound/decoder/random_collection_audio_stream.cpp
index 37d5ddb9853..9c60568cf84 100644
--- a/engines/ultima/nuvie/sound/decoder/random_collection_audio_stream.cpp
+++ b/engines/ultima/nuvie/sound/decoder/random_collection_audio_stream.cpp
@@ -64,7 +64,7 @@ public:
 		if (_streams.size() > 0)
 			_currentStream = _streams[NUVIE_RAND() % _streams.size()];
 		else
-			_currentStream = NULL;
+			_currentStream = nullptr;
 	}
 
 	~RandomCollectionAudioStreamImpl() override;
diff --git a/engines/ultima/nuvie/sound/decoder/u6_adplug_decoder_stream.h b/engines/ultima/nuvie/sound/decoder/u6_adplug_decoder_stream.h
index 8343275339b..1b5852a8090 100644
--- a/engines/ultima/nuvie/sound/decoder/u6_adplug_decoder_stream.h
+++ b/engines/ultima/nuvie/sound/decoder/u6_adplug_decoder_stream.h
@@ -38,8 +38,8 @@ using Std::string;
 class U6AdPlugDecoderStream : public Audio::RewindableAudioStream {
 public:
 	U6AdPlugDecoderStream() {
-		opl = NULL;
-		player = NULL;
+		opl = nullptr;
+		player = nullptr;
 		player_refresh_count = 0;
 	}
 
diff --git a/engines/ultima/nuvie/sound/origin_fx_adib_driver.cpp b/engines/ultima/nuvie/sound/origin_fx_adib_driver.cpp
index 268da0e85b9..f87760296eb 100644
--- a/engines/ultima/nuvie/sound/origin_fx_adib_driver.cpp
+++ b/engines/ultima/nuvie/sound/origin_fx_adib_driver.cpp
@@ -38,7 +38,7 @@ OriginFXAdLibDriver::OriginFXAdLibDriver(Configuration *cfg, Copl *newopl) {
 
 	config = cfg;
 	opl = newopl;
-	adlib_tim_data = NULL;
+	adlib_tim_data = nullptr;
 	adlib_num_active_channels = 9;
 	memset(midi_chan_tim_ptr, 0, sizeof(midi_chan_tim_ptr));
 	memset(midi_chan_pitch, 0, sizeof(midi_chan_pitch));
@@ -150,7 +150,7 @@ void OriginFXAdLibDriver::program_change(sint8 channel, uint8 program_number) {
 		if (adlib_ins[i].channel == channel) {
 			play_note(channel, adlib_ins[i].note, 0); //note off.
 			adlib_ins[i].channel = -1;
-			adlib_ins[i].tim_data = NULL;
+			adlib_ins[i].tim_data = nullptr;
 
 		}
 	}
@@ -192,7 +192,7 @@ void OriginFXAdLibDriver::pitch_bend(uint8 channel, uint8 pitch_lsb, uint8 pitch
 		if (adlib_ins[i].byte_68 > 1 && adlib_ins[i].channel == channel) {
 			sint16 var_4 = 0;
 
-			if (adlib_ins[i].tim_data != NULL) {
+			if (adlib_ins[i].tim_data != nullptr) {
 				var_4 = read_sint16(&adlib_ins[i].tim_data[0x24]);
 			}
 
@@ -250,7 +250,7 @@ void OriginFXAdLibDriver::control_mode_change(uint8 channel, uint8 function, uin
 }
 void OriginFXAdLibDriver::play_note(uint8 channel, sint8 note, uint8 velocity) {
 	unsigned char *cur_tim_ptr = midi_chan_tim_ptr[channel];
-	for (; cur_tim_ptr != NULL; cur_tim_ptr += 48) {
+	for (; cur_tim_ptr != nullptr; cur_tim_ptr += 48) {
 		sint8 voice = sub_4BF(channel, note, velocity, cur_tim_ptr);
 		sint16 var_4 = voice;
 		if (voice > 8) {
@@ -473,7 +473,7 @@ void OriginFXAdLibDriver::interrupt_vector() {
 	const uint8 byte_229[] = {24, 0, 18, 20, 22, 0, 0, 0};
 
 	for (int i = 0; i < adlib_num_active_channels; i++) {
-		unsigned char *cur_tim_data = NULL;
+		unsigned char *cur_tim_data = nullptr;
 		bool update_adlib = false;
 		sint8 channel = adlib_ins[i].channel;
 		if (channel < 0 || channel >= 32) {
@@ -481,7 +481,7 @@ void OriginFXAdLibDriver::interrupt_vector() {
 		}
 		uint8 var_8 = byte_229[adlib_ins[i].byte_68];
 		sint16 var_10 = 0;
-		if (adlib_ins[i].tim_data == NULL) {
+		if (adlib_ins[i].tim_data == nullptr) {
 			cur_tim_data = adlib_tim_data;
 		} else {
 			cur_tim_data = adlib_ins[i].tim_data;
diff --git a/engines/ultima/nuvie/sound/pc_speaker_sfx_manager.cpp b/engines/ultima/nuvie/sound/pc_speaker_sfx_manager.cpp
index f1e9bca340f..7ce6c1dfdbe 100644
--- a/engines/ultima/nuvie/sound/pc_speaker_sfx_manager.cpp
+++ b/engines/ultima/nuvie/sound/pc_speaker_sfx_manager.cpp
@@ -39,12 +39,12 @@ PCSpeakerSfxManager::~PCSpeakerSfxManager() {
 }
 
 bool PCSpeakerSfxManager::playSfx(SfxIdType sfx_id, uint8 volume) {
-	return playSfxLooping(sfx_id, NULL, volume);
+	return playSfxLooping(sfx_id, nullptr, volume);
 }
 
 
 bool PCSpeakerSfxManager::playSfxLooping(SfxIdType sfx_id, Audio::SoundHandle *handle, uint8 volume) {
-	Audio::AudioStream *stream = NULL;
+	Audio::AudioStream *stream = nullptr;
 
 	if (sfx_id == NUVIE_SFX_BLOCKED) {
 		stream = new PCSpeakerFreqStream(311, 0xa);
diff --git a/engines/ultima/nuvie/sound/song.cpp b/engines/ultima/nuvie/sound/song.cpp
index b81ef34863f..f0a342c1b97 100644
--- a/engines/ultima/nuvie/sound/song.cpp
+++ b/engines/ultima/nuvie/sound/song.cpp
@@ -26,15 +26,15 @@
 
 Song::Song() {
 	m_Filename="";
-	m_pMusic=NULL;
+	m_pMusic=nullptr;
 //  m_Paused=false;
 }
 
 Song::~Song() {
-	if (m_pMusic!=NULL) {
+	if (m_pMusic!=nullptr) {
 		Mix_HaltMusic();
 		Mix_FreeMusic(m_pMusic);
-		m_pMusic=NULL;
+		m_pMusic=nullptr;
 	}
 }
 */
diff --git a/engines/ultima/nuvie/sound/song_adplug.cpp b/engines/ultima/nuvie/sound/song_adplug.cpp
index eb055e41b35..1059b3c114f 100644
--- a/engines/ultima/nuvie/sound/song_adplug.cpp
+++ b/engines/ultima/nuvie/sound/song_adplug.cpp
@@ -35,14 +35,14 @@ SongAdPlug::SongAdPlug(Audio::Mixer *m, CEmuopl *o) {
 	mixer = m;
 	opl = o;
 	samples_left = 0;
-	stream = NULL;
+	stream = nullptr;
 }
 
 SongAdPlug::~SongAdPlug() {
 }
 
 bool SongAdPlug::Init(const char *filename, const char *fileId, uint16 song_num) {
-	if (filename == NULL)
+	if (filename == nullptr)
 		return false;
 
 	m_Filename = filename; // SB-X
diff --git a/engines/ultima/nuvie/sound/song_filename.cpp b/engines/ultima/nuvie/sound/song_filename.cpp
index a31be1b655b..c381165598d 100644
--- a/engines/ultima/nuvie/sound/song_filename.cpp
+++ b/engines/ultima/nuvie/sound/song_filename.cpp
@@ -37,7 +37,7 @@ bool SongFilename::Init(const char *path, const char *fileId) {
 }
 
 bool SongFilename::Init(const char *filename, const char *fileId, uint16 song_num) {
-	if (filename == NULL)
+	if (filename == nullptr)
 		return false;
 
 	m_Filename = filename; // SB-X
diff --git a/engines/ultima/nuvie/sound/sound_manager.cpp b/engines/ultima/nuvie/sound/sound_manager.cpp
index 52c1586177f..83ae7ea6362 100644
--- a/engines/ultima/nuvie/sound/sound_manager.cpp
+++ b/engines/ultima/nuvie/sound/sound_manager.cpp
@@ -312,15 +312,15 @@ bool SoundManager::LoadCustomSongs(string sound_dir) {
 
 	sz = (char *)niof.readAll();
 
-	if (sz == NULL)
+	if (sz == nullptr)
 		return false;
 
 	token1 = strtok(sz, seps);
-	for (; (token1 != NULL) && ((token2 = strtok(NULL, seps)) != NULL) ; token1 = strtok(NULL, seps)) {
+	for (; (token1 != nullptr) && ((token2 = strtok(nullptr, seps)) != nullptr) ; token1 = strtok(nullptr, seps)) {
 		build_path(sound_dir, token2, filename);
 
 		song = (Song *)SongExists(token2);
-		if (song == NULL) {
+		if (song == nullptr) {
 			// Note: the base class Song does not have an implementation for
 			// Init, so loading custom songs does not work.
 			song = new Song;
@@ -358,7 +358,7 @@ bool SoundManager::loadSong(Song *song, const char *filename, const char *fileId
 }
 
 bool SoundManager::groupAddSong(const char *group, Song *song) {
-	if (song != NULL) {
+	if (song != nullptr) {
 		//we have a valid song
 		SoundCollection *psc;
 		Common::HashMap <Common::String, SoundCollection * >::iterator it;
@@ -397,13 +397,13 @@ bool SoundManager::LoadObjectSamples (string sound_dir)
 
   token1 = strtok (sz, seps);
 
-  while ((token1 != NULL) && ((token2 = strtok (NULL, seps)) != NULL))
+  while ((token1 != nullptr) && ((token2 = strtok (nullptr, seps)) != nullptr))
 	{
 	  int id = atoi (token1);
 	  DEBUG(0,LEVEL_DEBUGGING,"%d : %s\n", id, token2);
 	  Sound *ps;
 	  ps = SampleExists (token2);
-	  if (ps == NULL)
+	  if (ps == nullptr)
 		{
 		  Sample *s;
 		  s = new Sample;
@@ -415,7 +415,7 @@ bool SoundManager::LoadObjectSamples (string sound_dir)
 		  ps = s;
 		  m_Samples.push_back (ps);     //add it to our global list
 		}
-	  if (ps != NULL)
+	  if (ps != nullptr)
 		{                       //we have a valid sound
 		  SoundCollection *psc;
 		  Common::HashMap < int, SoundCollection * >::iterator it;
@@ -432,7 +432,7 @@ bool SoundManager::LoadObjectSamples (string sound_dir)
 			  psc->m_Sounds.push_back (ps);     //add this sound to the collection
 			}
 		}
-	  token1 = strtok (NULL, seps);
+	  token1 = strtok (nullptr, seps);
 	}
   return true;
 };
@@ -459,13 +459,13 @@ bool SoundManager::LoadTileSamples (string sound_dir)
 
   token1 = strtok (sz, seps);
 
-  while ((token1 != NULL) && ((token2 = strtok (NULL, seps)) != NULL))
+  while ((token1 != nullptr) && ((token2 = strtok (nullptr, seps)) != nullptr))
 	{
 	  int id = atoi (token1);
 	  DEBUG(0,LEVEL_DEBUGGING,"%d : %s\n", id, token2);
 	  Sound *ps;
 	  ps = SampleExists (token2);
-	  if (ps == NULL)
+	  if (ps == nullptr)
 		{
 		  Sample *s;
 		  s = new Sample;
@@ -477,7 +477,7 @@ bool SoundManager::LoadTileSamples (string sound_dir)
 		  ps = s;
 		  m_Samples.push_back (ps);     //add it to our global list
 		}
-	  if (ps != NULL)
+	  if (ps != nullptr)
 		{                       //we have a valid sound
 		  SoundCollection *psc;
 		  Common::HashMap < int, SoundCollection * >::iterator it;
@@ -494,13 +494,13 @@ bool SoundManager::LoadTileSamples (string sound_dir)
 			  psc->m_Sounds.push_back (ps);     //add this sound to the collection
 			}
 		}
-	  token1 = strtok (NULL, seps);
+	  token1 = strtok (nullptr, seps);
 	}
   return true;
 };
 */
 bool SoundManager::LoadSfxManager(string sfx_style) {
-	if (m_SfxManager != NULL) {
+	if (m_SfxManager != nullptr) {
 		return false;
 	}
 
@@ -549,7 +549,7 @@ void SoundManager::musicPlayFrom(string group) {
 void SoundManager::musicPause() {
 	Common::StackLock lock(_musicMutex);
 
-	if (m_pCurrentSong != NULL && _midiParser->isPlaying()) {
+	if (m_pCurrentSong != nullptr && _midiParser->isPlaying()) {
 		_midiParser->stopPlaying();
 	}
 }
@@ -558,16 +558,16 @@ void SoundManager::musicPause() {
 void SoundManager::musicPlay() {
 	Common::StackLock lock(_musicMutex);
 
-	if (m_pCurrentSong != NULL && _midiParser->isPlaying()) {
+	if (m_pCurrentSong != nullptr && _midiParser->isPlaying()) {
 		// Already playing a song.
 		return;
 	}
 
 	// (SB-X) Get a new song if stopped.
-	if (m_pCurrentSong == NULL)
+	if (m_pCurrentSong == nullptr)
 		m_pCurrentSong = RequestSong(m_CurrentGroup);
 
-	if (m_pCurrentSong != NULL) {
+	if (m_pCurrentSong != nullptr) {
 		DEBUG(0, LEVEL_INFORMATIONAL, "assigning new song! '%s'\n", m_pCurrentSong->GetName().c_str());
 
 		// TODO Only Ultima 6 LZW format is supported.
@@ -621,7 +621,7 @@ void SoundManager::musicStop() {
 	Common::StackLock lock(_musicMutex);
 
 	musicPause();
-	m_pCurrentSong = NULL;
+	m_pCurrentSong = nullptr;
 	if (_musicData) {
 		delete _musicData;
 		_musicData = nullptr;
@@ -685,7 +685,7 @@ void SoundManager::update_map_sfx() {
 	for (i = 0; i < mw->m_ViewableTiles.size(); i++)
 	  {
 	    Sound *sp = RequestTileSound (mw->m_ViewableTiles[i].t->tile_num);        //does this object have an associated sound?
-	    if (sp != NULL)
+	    if (sp != nullptr)
 	      {
 	        //calculate the volume
 	        short ox = mw->m_ViewableTiles[i].x - 5;
@@ -769,7 +769,7 @@ Sound *SoundManager::SongExists(string name) {
 			return *it;
 	}
 
-	return NULL;
+	return nullptr;
 }
 
 Sound *SoundManager::SampleExists(string name) {
@@ -779,7 +779,7 @@ Sound *SoundManager::SampleExists(string name) {
 			return *it;
 	}
 
-	return NULL;
+	return nullptr;
 }
 
 Sound *SoundManager::RequestTileSound(int id) {
@@ -790,7 +790,7 @@ Sound *SoundManager::RequestTileSound(int id) {
 		psc = (*it)._value;
 		return psc->Select();
 	}
-	return NULL;
+	return nullptr;
 }
 
 Sound *SoundManager::RequestObjectSound(int id) {
@@ -801,7 +801,7 @@ Sound *SoundManager::RequestObjectSound(int id) {
 		psc = (*it)._value;
 		return psc->Select();
 	}
-	return NULL;
+	return nullptr;
 }
 
 uint16 SoundManager::RequestObjectSfxId(uint16 obj_n) {
@@ -823,7 +823,7 @@ Sound *SoundManager::RequestSong(string group) {
 		psc = (*it)._value;
 		return psc->Select();
 	}
-	return NULL;
+	return nullptr;
 }
 
 Audio::SoundHandle SoundManager::playTownsSound(Std::string filename, uint16 sample_num) {
@@ -839,7 +839,7 @@ bool SoundManager::isSoundPLaying(Audio::SoundHandle handle) {
 }
 
 bool SoundManager::playSfx(uint16 sfx_id, bool async) {
-	if (m_SfxManager == NULL || audio_enabled == false || sfx_enabled == false)
+	if (m_SfxManager == nullptr || audio_enabled == false || sfx_enabled == false)
 		return false;
 
 	if (async) {
diff --git a/engines/ultima/nuvie/sound/towns_sfx_manager.cpp b/engines/ultima/nuvie/sound/towns_sfx_manager.cpp
index e679cd12ec6..ac3d05051a2 100644
--- a/engines/ultima/nuvie/sound/towns_sfx_manager.cpp
+++ b/engines/ultima/nuvie/sound/towns_sfx_manager.cpp
@@ -110,7 +110,7 @@ void TownsSfxManager::loadSound1Dat() {
 }
 
 bool TownsSfxManager::playSfx(SfxIdType sfx_id, uint8 volume) {
-	return playSfxLooping(sfx_id, NULL, volume);
+	return playSfxLooping(sfx_id, nullptr, volume);
 }
 
 
@@ -126,7 +126,7 @@ bool TownsSfxManager::playSfxLooping(SfxIdType sfx_id, Audio::SoundHandle *handl
 }
 
 void TownsSfxManager::playSoundSample(uint8 sample_num, Audio::SoundHandle *looping_handle, uint8 volume) {
-	Audio::AudioStream *stream = NULL;
+	Audio::AudioStream *stream = nullptr;
 	Audio::SoundHandle handle;
 
 	if (sample_num > 5 && sample_num < 9) {
diff --git a/engines/ultima/nuvie/usecode/u6_usecode.cpp b/engines/ultima/nuvie/usecode/u6_usecode.cpp
index 6d3b38a632f..1764767e1c1 100644
--- a/engines/ultima/nuvie/usecode/u6_usecode.cpp
+++ b/engines/ultima/nuvie/usecode/u6_usecode.cpp
@@ -284,7 +284,7 @@ bool U6UseCode::search_obj(Obj *obj, Actor *actor) {
 uint16 U6UseCode::callback(uint16 msg, CallBack *caller, void *msg_data) {
 	Obj *obj = (Obj *)callback_user_data;
 	if (!obj) {
-		DEBUG(0, LEVEL_ERROR, "UseCode: internal message %d sent to NULL object\n", msg);
+		DEBUG(0, LEVEL_ERROR, "UseCode: internal message %d sent to nullptr object\n", msg);
 		return (0);
 	}
 	return (message_obj(obj, (CallbackMessage)msg, msg_data));
@@ -379,7 +379,7 @@ bool U6UseCode::drop_obj(Obj *obj, Actor *actor, uint16 x, uint16 y, uint16 qty)
 }
 
 
-/* Return pointer to object-type in list for object N:F, or NULL if none. */
+/* Return pointer to object-type in list for object N:F, or nullptr if none. */
 inline const U6ObjectType *U6UseCode::get_object_type(uint16 n, uint8 f, UseCodeEvent ev) {
 	const U6ObjectType *type = U6ObjectTypes;
 	while (type->obj_n != OBJ_U6_NOTHING) {
@@ -388,7 +388,7 @@ inline const U6ObjectType *U6UseCode::get_object_type(uint16 n, uint8 f, UseCode
 			return (type);
 		++type;
 	}
-	return (NULL);
+	return (nullptr);
 }
 
 
@@ -450,7 +450,7 @@ bool U6UseCode::use_door(Obj *obj, UseCodeEvent ev) {
 
 	if (is_locked_door(obj)) { // locked door
 		key_obj = player->get_actor()->inventory_get_object(OBJ_U6_KEY, obj->quality);


Commit: 3738debab17583f4e0a0718f31659612131f89a9
    https://github.com/scummvm/scummvm/commit/3738debab17583f4e0a0718f31659612131f89a9
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2023-12-09T13:56:05+11:00

Commit Message:
ULTIMA: NUVIE: Improve const correctness

A lot of parts of the engine did not constify pointers, and made many
unneccessary copies of objects as a result.

This is a huge change in line count but most of the changes are simply adding
"const".

Changed paths:
    engines/ultima/nuvie/actors/actor.cpp
    engines/ultima/nuvie/actors/actor.h
    engines/ultima/nuvie/actors/actor_manager.h
    engines/ultima/nuvie/actors/md_actor.cpp
    engines/ultima/nuvie/actors/md_actor.h
    engines/ultima/nuvie/actors/se_actor.cpp
    engines/ultima/nuvie/actors/se_actor.h
    engines/ultima/nuvie/actors/u6_actor.cpp
    engines/ultima/nuvie/actors/u6_actor.h
    engines/ultima/nuvie/actors/wou_actor.cpp
    engines/ultima/nuvie/actors/wou_actor.h
    engines/ultima/nuvie/core/anim_manager.cpp
    engines/ultima/nuvie/core/anim_manager.h
    engines/ultima/nuvie/core/converse.h
    engines/ultima/nuvie/core/converse_interpret.h
    engines/ultima/nuvie/core/cursor.h
    engines/ultima/nuvie/core/effect.cpp
    engines/ultima/nuvie/core/effect.h
    engines/ultima/nuvie/core/effect_manager.cpp
    engines/ultima/nuvie/core/effect_manager.h
    engines/ultima/nuvie/core/egg_manager.h
    engines/ultima/nuvie/core/events.h
    engines/ultima/nuvie/core/game.h
    engines/ultima/nuvie/core/game_clock.cpp
    engines/ultima/nuvie/core/game_clock.h
    engines/ultima/nuvie/core/look.cpp
    engines/ultima/nuvie/core/look.h
    engines/ultima/nuvie/core/magic.h
    engines/ultima/nuvie/core/map.cpp
    engines/ultima/nuvie/core/map.h
    engines/ultima/nuvie/core/obj.cpp
    engines/ultima/nuvie/core/obj.h
    engines/ultima/nuvie/core/obj_manager.cpp
    engines/ultima/nuvie/core/obj_manager.h
    engines/ultima/nuvie/core/party.cpp
    engines/ultima/nuvie/core/party.h
    engines/ultima/nuvie/core/player.cpp
    engines/ultima/nuvie/core/tile_manager.cpp
    engines/ultima/nuvie/core/tile_manager.h
    engines/ultima/nuvie/core/weather.cpp
    engines/ultima/nuvie/core/weather.h
    engines/ultima/nuvie/files/nuvie_bmp_file.h
    engines/ultima/nuvie/files/nuvie_file_list.cpp
    engines/ultima/nuvie/files/nuvie_file_list.h
    engines/ultima/nuvie/gui/gui_text_input.h
    engines/ultima/nuvie/gui/widgets/background.h
    engines/ultima/nuvie/gui/widgets/command_bar.h
    engines/ultima/nuvie/gui/widgets/command_bar_new_ui.cpp
    engines/ultima/nuvie/gui/widgets/command_bar_new_ui.h
    engines/ultima/nuvie/gui/widgets/converse_gump.cpp
    engines/ultima/nuvie/gui/widgets/converse_gump.h
    engines/ultima/nuvie/gui/widgets/converse_gump_wou.h
    engines/ultima/nuvie/gui/widgets/gui_widget.h
    engines/ultima/nuvie/gui/widgets/map_window.cpp
    engines/ultima/nuvie/gui/widgets/map_window.h
    engines/ultima/nuvie/gui/widgets/msg_scroll.cpp
    engines/ultima/nuvie/gui/widgets/msg_scroll.h
    engines/ultima/nuvie/gui/widgets/msg_scroll_new_ui.cpp
    engines/ultima/nuvie/gui/widgets/msg_scroll_new_ui.h
    engines/ultima/nuvie/misc/u6_list.cpp
    engines/ultima/nuvie/misc/u6_llist.h
    engines/ultima/nuvie/pathfinder/actor_path_finder.cpp
    engines/ultima/nuvie/pathfinder/actor_path_finder.h
    engines/ultima/nuvie/pathfinder/astar_path.cpp
    engines/ultima/nuvie/pathfinder/astar_path.h
    engines/ultima/nuvie/pathfinder/dir_finder.cpp
    engines/ultima/nuvie/pathfinder/dir_finder.h
    engines/ultima/nuvie/pathfinder/party_path_finder.cpp
    engines/ultima/nuvie/pathfinder/party_path_finder.h
    engines/ultima/nuvie/pathfinder/path.cpp
    engines/ultima/nuvie/pathfinder/path.h
    engines/ultima/nuvie/pathfinder/path_finder.cpp
    engines/ultima/nuvie/pathfinder/path_finder.h
    engines/ultima/nuvie/pathfinder/sched_path_finder.cpp
    engines/ultima/nuvie/pathfinder/seek_path.cpp
    engines/ultima/nuvie/pathfinder/seek_path.h
    engines/ultima/nuvie/pathfinder/u6_astar_path.cpp
    engines/ultima/nuvie/pathfinder/u6_astar_path.h
    engines/ultima/nuvie/portraits/portrait.cpp
    engines/ultima/nuvie/portraits/portrait.h
    engines/ultima/nuvie/portraits/portrait_md.cpp
    engines/ultima/nuvie/portraits/portrait_md.h
    engines/ultima/nuvie/portraits/portrait_se.cpp
    engines/ultima/nuvie/portraits/portrait_se.h
    engines/ultima/nuvie/portraits/portrait_u6.cpp
    engines/ultima/nuvie/portraits/portrait_u6.h
    engines/ultima/nuvie/screen/dither.h
    engines/ultima/nuvie/screen/game_palette.h
    engines/ultima/nuvie/screen/screen.cpp
    engines/ultima/nuvie/screen/screen.h
    engines/ultima/nuvie/script/script.cpp
    engines/ultima/nuvie/script/script.h
    engines/ultima/nuvie/script/script_cutscene.h
    engines/ultima/nuvie/sound/sound.h
    engines/ultima/nuvie/usecode/u6_usecode.cpp
    engines/ultima/nuvie/usecode/u6_usecode.h
    engines/ultima/nuvie/usecode/usecode.cpp
    engines/ultima/nuvie/usecode/usecode.h
    engines/ultima/nuvie/views/container_view_gump.h
    engines/ultima/nuvie/views/container_widget.h
    engines/ultima/nuvie/views/inventory_view.h
    engines/ultima/nuvie/views/inventory_widget.h
    engines/ultima/nuvie/views/party_view.cpp
    engines/ultima/nuvie/views/portrait_view.h
    engines/ultima/nuvie/views/scroll_widget_gump.cpp
    engines/ultima/nuvie/views/scroll_widget_gump.h
    engines/ultima/nuvie/views/spell_view.cpp
    engines/ultima/nuvie/views/spell_view.h
    engines/ultima/nuvie/views/spell_view_gump.cpp
    engines/ultima/nuvie/views/spell_view_gump.h
    engines/ultima/nuvie/views/sun_moon_ribbon.cpp
    engines/ultima/nuvie/views/sun_moon_ribbon.h
    engines/ultima/nuvie/views/sun_moon_strip_widget.cpp
    engines/ultima/nuvie/views/sun_moon_strip_widget.h
    engines/ultima/nuvie/views/view.cpp
    engines/ultima/nuvie/views/view.h


diff --git a/engines/ultima/nuvie/actors/actor.cpp b/engines/ultima/nuvie/actors/actor.cpp
index f8fddd8032a..976082a3e5c 100644
--- a/engines/ultima/nuvie/actors/actor.cpp
+++ b/engines/ultima/nuvie/actors/actor.cpp
@@ -114,7 +114,7 @@ void Actor::init_from_obj(Obj *obj, bool change_base_obj) {
 
 /* Returns true if another NPC `n' is in proximity to location `where'.
  */
-bool Actor::is_nearby(MapCoord &where, uint8 thresh) {
+bool Actor::is_nearby(const MapCoord &where, uint8 thresh) const {
 	MapCoord here(x, y, z);
 	if (here.xdistance(where) <= thresh && here.ydistance(where) <= thresh && z == where.z)
 		return (true);
@@ -122,53 +122,51 @@ bool Actor::is_nearby(MapCoord &where, uint8 thresh) {
 }
 
 
-bool Actor::is_nearby(Actor *other) {
+bool Actor::is_nearby(const Actor *other) const {
 	MapCoord there(other->get_location());
 	return (is_nearby(there));
 }
 
 
-bool Actor::is_nearby(uint8 actor_num) {
+bool Actor::is_nearby(uint8 actor_num) const {
 	return (is_nearby(Game::get_game()->get_actor_manager()->get_actor(actor_num)));
 }
 
-bool Actor::is_at_position(Obj *obj) {
+bool Actor::is_at_position(const Obj *obj) const {
 	if (obj->x == x && obj->y == y && obj->z == z)
 		return true;
 
 	return false;
 }
 
-bool Actor::is_passable() {
+bool Actor::is_passable() const {
 	if (ethereal)
 		return true;
-	Tile *tile;
-
-	tile = obj_manager->get_obj_tile(obj_n, frame_n);
+	const Tile *tile = obj_manager->get_obj_tile(obj_n, frame_n);
 
 	return tile->passable;
 }
 
-bool Actor::is_in_vehicle() {
+bool Actor::is_in_vehicle() const {
 	if (is_in_party() == false)
 		return false;
 
 	return Game::get_game()->get_party()->is_in_vehicle();
 }
 
-void Actor::get_location(uint16 *ret_x, uint16 *ret_y, uint8 *ret_level) {
+void Actor::get_location(uint16 *ret_x, uint16 *ret_y, uint8 *ret_level) const {
 	if (ret_x) *ret_x = x;
 	if (ret_y) *ret_y = y;
 	if (ret_level) *ret_level = z;
 }
 
 
-MapCoord Actor::get_location() {
+MapCoord Actor::get_location() const {
 	return (MapCoord(x, y, z));
 }
 
 
-uint16 Actor::get_tile_num() {
+uint16 Actor::get_tile_num() const {
 	if (custom_tile_tbl) {
 		return get_custom_tile_num(obj_n);
 	}
@@ -176,7 +174,7 @@ uint16 Actor::get_tile_num() {
 	return obj_manager->get_obj_tile_num(obj_n);
 }
 
-uint16 Actor::get_tile_num(uint16 obj_num) {
+uint16 Actor::get_tile_num(uint16 obj_num) const {
 	if (custom_tile_tbl) {
 		return get_custom_tile_num(obj_num);
 	}
@@ -184,7 +182,7 @@ uint16 Actor::get_tile_num(uint16 obj_num) {
 	return obj_manager->get_obj_tile_num(obj_num);
 }
 
-uint16 Actor::get_custom_tile_num(uint16 obj_num) {
+uint16 Actor::get_custom_tile_num(uint16 obj_num) const {
 	if (custom_tile_tbl) {
 		Common::HashMap<uint16, uint16>::iterator it;
 		it = custom_tile_tbl->find(obj_num);
@@ -196,7 +194,7 @@ uint16 Actor::get_custom_tile_num(uint16 obj_num) {
 	return obj_manager->get_obj_tile_num(obj_num);
 }
 
-Tile *Actor::get_tile() {
+Tile *Actor::get_tile() const {
 	return Game::get_game()->get_tile_manager()->get_tile(get_tile_num() + frame_n);
 }
 
@@ -211,7 +209,7 @@ uint8 Actor::get_sched_worktype() {
 	return 0; //no worktype
 }
 
-uint16 Actor::get_downward_facing_tile_num() {
+uint16 Actor::get_downward_facing_tile_num() const {
 	return obj_manager->get_obj_tile_num(obj_n) + frame_n;
 }
 
@@ -396,7 +394,7 @@ bool Actor::can_be_moved() {
 	return can_move;
 }
 
-bool Actor::can_be_passed(Actor *other) {
+bool Actor::can_be_passed(const Actor *other) const {
 	// ethereal actors can always pass us
 	return (other->ethereal || is_passable());
 }
@@ -545,7 +543,7 @@ void Actor::pathfind_to(uint16 gx, uint16 gy, uint8 gz) {
 	pathfind_to(d);
 }
 
-void Actor::pathfind_to(MapCoord &d) {
+void Actor::pathfind_to(const MapCoord &d) {
 	if (pathfinder) {
 		pathfinder->set_actor(this);
 		pathfinder->set_goal(d);
@@ -673,6 +671,9 @@ U6LList *Actor::get_inventory_list() {
 	return obj_manager->get_actor_inventory(id_n);
 }
 
+const U6LList *Actor::get_inventory_list() const {
+	return obj_manager->get_actor_inventory(id_n);
+}
 
 bool Actor::inventory_has_object(uint16 objN, uint8 qual, bool match_quality, uint8 frameN, bool match_frame_n) {
 	if (inventory_get_object(objN, qual, match_quality, frameN, match_frame_n))
@@ -680,17 +681,15 @@ bool Actor::inventory_has_object(uint16 objN, uint8 qual, bool match_quality, ui
 	return (false);
 }
 
-uint32 Actor::inventory_count_objects(bool inc_readied_objects) {
-	Obj *obj;
+uint32 Actor::inventory_count_objects(bool inc_readied_objects) const {
 	uint32 count = 0;
-	U6Link *link;
-	U6LList *inventory = get_inventory_list();
+	const U6LList *inventory = get_inventory_list();
 
 	if (inc_readied_objects) {
 		return inventory->count();
 	} else {
-		for (link = inventory->start(); link != nullptr; link = link->next) {
-			obj = (Obj *)link->data;
+		for (const U6Link *link = inventory->start(); link != nullptr; link = link->next) {
+			const Obj *obj = (const Obj *)link->data;
 			if (!obj->is_readied())
 				count++;
 		}
@@ -874,7 +873,7 @@ bool Actor::inventory_remove_obj(Obj *obj, bool run_usecode) {
 	return inventory->remove(obj);
 }
 
-float Actor::get_inventory_weight() {
+float Actor::get_inventory_weight() const {
 	U6LList *inventory;
 	U6Link *link;
 	Obj *obj;
@@ -916,7 +915,7 @@ float Actor::get_inventory_equip_weight() {
 
 /* Can the actor carry a new object of this type?
  */
-bool Actor::can_carry_object(uint16 objN, uint32 qty) {
+bool Actor::can_carry_object(uint16 objN, uint32 qty) const {
 	if (Game::get_game()->using_hackmove())
 		return true;
 	float obj_weight = obj_manager->get_obj_weight(objN);
@@ -924,7 +923,7 @@ bool Actor::can_carry_object(uint16 objN, uint32 qty) {
 	return (can_carry_weight(obj_weight));
 }
 
-bool Actor::can_carry_object(Obj *obj) {
+bool Actor::can_carry_object(Obj *obj) const {
 	if (Game::get_game()->using_hackmove())
 		return true;
 	if (obj_manager->can_get_obj(obj) == false)
@@ -933,14 +932,14 @@ bool Actor::can_carry_object(Obj *obj) {
 	return can_carry_weight(obj);
 }
 
-bool Actor::can_carry_weight(Obj *obj) {
+bool Actor::can_carry_weight(Obj *obj) const {
 	return (can_carry_weight(obj_manager->get_obj_weight(obj, OBJ_WEIGHT_INCLUDE_CONTAINER_ITEMS, OBJ_WEIGHT_DO_SCALE)));
 }
 
 /* Can the actor carry new object(s) of this weight?
  * (return from get_obj_weight())
  */
-bool Actor::can_carry_weight(float obj_weight) {
+bool Actor::can_carry_weight(float obj_weight) const {
 	if (Game::get_game()->using_hackmove())
 		return true;
 	// obj_weight /= 10;
@@ -1138,7 +1137,7 @@ void Actor::inventory_drop_all() {
 		if (!inventory_remove_obj(obj))
 			break;
 
-		Tile *obj_tile = obj_manager->get_obj_tile(obj->obj_n, obj->frame_n);
+		const Tile *obj_tile = obj_manager->get_obj_tile(obj->obj_n, obj->frame_n);
 		if (obj_tile && (obj_tile->flags3 & TILEFLAG_IGNORE)) { //Don't drop charges.
 			delete_obj(obj);
 		} else {
@@ -1155,23 +1154,19 @@ void Actor::inventory_drop_all() {
 
 // Moves inventory and all readied items into a container object.
 void Actor::all_items_to_container(Obj *container_obj, bool stack) {
-	U6LList *inventory;
-	U6Link *link;
-	Obj *obj;
-
-	inventory = get_inventory_list();
+	U6LList *inventory = get_inventory_list();
 
 	if (!inventory)
 		return;
 
-	for (link = inventory->start(); link != nullptr;) {
-		obj = (Obj *)link->data;
+	for (U6Link *link = inventory->start(); link != nullptr;) {
+		Obj *obj = (Obj *)link->data;
 		link = link->next;
 
 		if (temp_actor)
 			obj->status |= OBJ_STATUS_TEMPORARY;
 
-		Tile *obj_tile = obj_manager->get_obj_tile(obj->obj_n, obj->frame_n);
+		const Tile *obj_tile = obj_manager->get_obj_tile(obj->obj_n, obj->frame_n);
 		if (obj_tile && obj_tile->flags3 & TILEFLAG_IGNORE) {
 			inventory_remove_obj(obj);
 			delete_obj(obj);
@@ -1179,7 +1174,6 @@ void Actor::all_items_to_container(Obj *container_obj, bool stack) {
 			obj_manager->moveto_container(obj, container_obj, stack);
 	}
 
-
 	return;
 }
 
@@ -1700,7 +1694,7 @@ ActorError *Actor::get_error() {
 }
 
 // frozen by worktype or status
-bool Actor::is_immobile() {
+bool Actor::is_immobile() const {
 	return (false);
 }
 
diff --git a/engines/ultima/nuvie/actors/actor.h b/engines/ultima/nuvie/actors/actor.h
index 8684ae8f0e7..9fc5f66d4c7 100644
--- a/engines/ultima/nuvie/actors/actor.h
+++ b/engines/ultima/nuvie/actors/actor.h
@@ -306,61 +306,61 @@ public:
 	virtual bool init(uint8 obj_status = NO_OBJ_STATUS);
 	void init_from_obj(Obj *obj, bool change_base_obj = false);
 
-	bool is_avatar() {
+	bool is_avatar() const {
 		return (id_n == ACTOR_AVATAR_ID_N);
 	}
-	bool is_onscreen() {
+	bool is_onscreen() const {
 		return (MapCoord(x, y, z).is_visible());
 	}
-	bool is_in_party() {
+	bool is_in_party() const {
 		return ((status_flags & ACTOR_STATUS_IN_PARTY) == ACTOR_STATUS_IN_PARTY);
 	}
-	bool is_in_vehicle();
-	bool is_visible() {
+	bool is_in_vehicle() const;
+	bool is_visible() const {
 		return visible_flag;
 	}
-	bool is_alive() {
+	bool is_alive() const {
 		return (status_flags & ACTOR_STATUS_DEAD) ? false : true;
 	}
-	bool is_nearby(Actor *other);
-	bool is_nearby(uint8 actor_num);
-	bool is_nearby(MapCoord &where, uint8 thresh = 5);
-	bool is_at_position(Obj *obj);
-	virtual bool is_passable();
-	bool is_temp() {
+	bool is_nearby(const Actor *other) const;
+	bool is_nearby(uint8 actor_num) const;
+	bool is_nearby(const MapCoord &where, uint8 thresh = 5) const;
+	bool is_at_position(const Obj *obj) const;
+	virtual bool is_passable() const;
+	bool is_temp() const {
 		return temp_actor;
 	}
 
 //for lack of a better name:
-	bool is_met() {
+	bool is_met() const {
 		return (talk_flags & 0x01);
 	}
-	bool is_poisoned() {
+	bool is_poisoned() const {
 		return (status_flags & ACTOR_STATUS_POISONED);
 	}
-	bool is_invisible() {
+	bool is_invisible() const {
 		return (obj_flags & OBJ_STATUS_INVISIBLE);
 	}
-	virtual bool is_immobile(); // frozen by worktype or status
-	virtual bool is_sleeping() {
+	virtual bool is_immobile() const; // frozen by worktype or status
+	virtual bool is_sleeping() const {
 		return (status_flags & ACTOR_STATUS_ASLEEP);
 	}
-	virtual bool is_paralyzed() {
+	virtual bool is_paralyzed() const {
 		return (status_flags & ACTOR_STATUS_PARALYZED);
 	}
-	virtual bool is_protected() {
+	virtual bool is_protected() const {
 		return (status_flags & ACTOR_STATUS_PROTECTED);
 	}
-	virtual bool is_charmed() {
+	virtual bool is_charmed() const {
 		return (obj_flags & OBJ_STATUS_CHARMED);
 	}
-	virtual bool is_cursed() {
+	virtual bool is_cursed() const {
 		return (obj_flags & OBJ_STATUS_CURSED);
 	}
-	virtual bool get_corpser_flag() {
+	virtual bool get_corpser_flag() const {
 		return false;
 	}
-	bool is_hit() {
+	bool is_hit() const {
 		return (movement_flags & ACTOR_MOVEMENT_HIT_FLAG);
 	}
 
@@ -369,92 +369,92 @@ public:
 	}
 	const char *get_name(bool force_real_name = false);
 
-	void get_location(uint16 *ret_x, uint16 *ret_y, uint8 *ret_level);
-	MapCoord get_location();
+	void get_location(uint16 *ret_x, uint16 *ret_y, uint8 *ret_level) const;
+	MapCoord get_location() const;
 
-	uint16 get_tile_num();
-	Tile *get_tile();
-	virtual uint16 get_downward_facing_tile_num();
-	uint8 get_actor_num() {
+	uint16 get_tile_num() const;
+	Tile *get_tile() const;
+	virtual uint16 get_downward_facing_tile_num() const;
+	uint8 get_actor_num() const {
 		return (id_n);
 	}
-	uint8 get_talk_flags() {
+	uint8 get_talk_flags() const {
 		return (talk_flags);
 	}
-	virtual ActorTileType get_tile_type() {
+	virtual ActorTileType get_tile_type() const {
 		return (ACTOR_ST);
 	}
 
-	uint16 get_frame_n() {
+	uint16 get_frame_n() const {
 		return (frame_n);
 	}
-	uint16 get_old_frame_n() {
+	uint16 get_old_frame_n() const {
 		return (old_frame_n);
 	}
-	uint16 get_x() {
+	uint16 get_x() const {
 		return (x);
 	}
-	uint16 get_y() {
+	uint16 get_y() const {
 		return (y);
 	}
-	uint8  get_z() {
+	uint8  get_z() const {
 		return (z);
 	}
 
-	uint8 get_strength() {
+	uint8 get_strength() const {
 		return (strength);
 	}
-	uint8 get_dexterity() {
+	uint8 get_dexterity() const {
 		return (dex);
 	}
-	uint8 get_intelligence() {
+	uint8 get_intelligence() const {
 		return (intelligence);
 	}
-	uint8 get_hp() {
+	uint8 get_hp() const {
 		return (hp);
 	}
-	virtual uint8 get_hp_text_color() {
+	virtual uint8 get_hp_text_color() const {
 		return 0;
 	}
-	virtual uint8 get_str_text_color() {
+	virtual uint8 get_str_text_color() const {
 		return 0;
 	}
-	virtual uint8 get_dex_text_color() {
+	virtual uint8 get_dex_text_color() const {
 		return 0;
 	}
 
-	uint8 get_level() {
+	uint8 get_level() const {
 		return (level);
 	}
-	uint16 get_exp() {
+	uint16 get_exp() const {
 		return (exp);
 	}
-	uint8 get_magic() {
+	uint8 get_magic() const {
 		return (magic);
 	}
-	uint8 get_alignment() {
+	uint8 get_alignment() const {
 		return (alignment);
 	}
-	uint8 get_old_alignment() {
+	uint8 get_old_alignment() const {
 		return ((movement_flags & ACTOR_MOVEMENT_FLAGS_OLD_ALIGNMENT_MASK) >> 5) + 1;
 	}
-	sint8 get_moves_left() {
+	sint8 get_moves_left() const {
 		return (moves);
 	}
-	virtual uint8 get_maxhp() {
+	virtual uint8 get_maxhp() const {
 		return 0;
 	}
-	virtual uint8 get_maxmagic() {
+	virtual uint8 get_maxmagic() const {
 		return 0;
 	}
-	bool get_obj_flag(uint8 bitFlag) {
+	bool get_obj_flag(uint8 bitFlag) const {
 		return bitFlag < 8 ? (obj_flags & (1 << bitFlag)) : false;
 	}
-	bool get_status_flag(uint8 bitFlag) {
+	bool get_status_flag(uint8 bitFlag) const {
 		return bitFlag < 8 ? (status_flags & (1 << bitFlag)) : false;
 	}
 
-	uint16 get_base_obj_n() {
+	uint16 get_base_obj_n() const {
 		return base_obj_n;
 	}
 	virtual void change_base_obj_n(uint16 val) {
@@ -535,13 +535,13 @@ public:
 	uint8 get_worktype();
 	uint8 get_sched_worktype();
 	virtual void set_worktype(uint8 new_worktype, bool init = false);
-	uint8 get_combat_mode() {
+	uint8 get_combat_mode() const {
 		return combat_mode;
 	}
 	void set_combat_mode(uint8 new_mode);
 	virtual void revert_worktype() { }
 
-	uint8 get_direction() {
+	uint8 get_direction() const {
 		return (direction);
 	}
 	void set_direction(sint16 rel_x, sint16 rel_y);
@@ -574,7 +574,7 @@ public:
 	bool check_moveRelative(sint16 rel_x, sint16 rel_y, ActorMoveFlags flags = 0);
 
 	virtual bool can_be_moved();
-	virtual bool can_be_passed(Actor *other);
+	virtual bool can_be_passed(const Actor *other) const;
 	virtual void update();
 	void set_in_party(bool state);
 	void set_pathfinder(ActorPathFinder *new_pf, Path *path_type = 0);
@@ -582,7 +582,7 @@ public:
 		return (pathfinder);
 	}
 	void delete_pathfinder();
-	virtual void pathfind_to(MapCoord &d);
+	virtual void pathfind_to(const MapCoord &d);
 	void pathfind_to(uint16 gx, uint16 gy, uint8 gz = 255);
 	bool walk_path();
 	virtual void preform_worktype() {
@@ -612,8 +612,9 @@ public:
 	ActorList *find_enemies(); // returns list or 0 if no enemies nearby
 
 	U6LList *get_inventory_list();
+	const U6LList *get_inventory_list() const;
 	bool inventory_has_object(uint16 obj_n, uint8 qual = 0, bool match_quality = OBJ_MATCH_QUALITY, uint8 frame_n = 0, bool match_frame_n = OBJ_NOMATCH_FRAME_N);
-	uint32 inventory_count_objects(bool inc_readied_objects);
+	uint32 inventory_count_objects(bool inc_readied_objects) const;
 	uint32 inventory_count_object(uint16 obj_n);
 	Obj *inventory_get_object(uint16 obj_n, uint8 qual = 0, bool match_quality = OBJ_MATCH_QUALITY, uint8 frame_n = 0, bool match_frame_n = OBJ_NOMATCH_FRAME_N);
 	bool is_double_handed_obj_readied();
@@ -633,17 +634,17 @@ public:
 	bool inventory_remove_obj(Obj *obj, bool run_usecode = true);
 	Obj *inventory_new_object(uint16 obj_n, uint32 qty, uint8 quality = 0);
 	uint32 inventory_del_object(uint16 obj_n, uint32 qty, uint8 quality);
-	float inventory_get_max_weight() {
+	float inventory_get_max_weight() const {
 		return ((strength * 2));
 	}
-	float get_inventory_weight();
+	float get_inventory_weight() const;
 	float get_inventory_equip_weight();
 	void inventory_drop_all();
 	void all_items_to_container(Obj *container_obj, bool stack);
-	bool can_carry_weight(Obj *obj);
-	bool can_carry_weight(float obj_weight); // return from get_obj_weight()
-	virtual bool can_carry_object(uint16 obj_n, uint32 qty = 0);
-	virtual bool can_carry_object(Obj *obj);
+	bool can_carry_weight(Obj *obj) const;
+	bool can_carry_weight(float obj_weight) const; // return from get_obj_weight()
+	virtual bool can_carry_object(uint16 obj_n, uint32 qty = 0) const;
+	virtual bool can_carry_object(Obj *obj) const;
 
 	virtual uint8 get_object_readiable_location(Obj *obj);
 	virtual const CombatType *get_object_combat_type(uint16 objN) {
@@ -665,7 +666,7 @@ public:
 	bool push(Actor *pusher, uint8 where = ACTOR_PUSH_ANYWHERE);
 
 	Obj *make_obj();
-	uint16 get_obj_n() {
+	uint16 get_obj_n() const {
 		return (obj_n);
 	}
 	virtual void clear();
@@ -677,10 +678,10 @@ public:
 		return num_schedules;
 	}
 	Schedule *get_schedule(uint8 index);
-	virtual bool will_not_talk() {
+	virtual bool will_not_talk() const {
 		return false;
 	}
-	uint16 get_custom_tile_num(uint16 obj_num);
+	uint16 get_custom_tile_num(uint16 obj_num) const;
 protected:
 
 	void loadSchedule(unsigned char *schedule_data, uint16 num);
@@ -691,7 +692,7 @@ protected:
 
 	void inventory_parse_readied_objects(); //this is used to initialise the readied_objects array on load.
 
-	virtual const CombatType *get_hand_combat_type() {
+	virtual const CombatType *get_hand_combat_type() const {
 		return nullptr;
 	}
 
@@ -702,13 +703,13 @@ protected:
 	virtual void handle_lightsource(uint8 hour) {
 		return;
 	}
-	virtual const char *get_worktype_string(uint32 wt) {
+	virtual const char *get_worktype_string(uint32 wt) const {
 		return nullptr;
 	}
 
 	Obj *find_body();
-	uint16 get_tile_num(uint16 obj_num);
-	uint8 get_num_light_sources() {
+	uint16 get_tile_num(uint16 obj_num) const;
+	uint8 get_num_light_sources() const {
 		return light_source.size();
 	}
 
diff --git a/engines/ultima/nuvie/actors/actor_manager.h b/engines/ultima/nuvie/actors/actor_manager.h
index d055e0bf1b4..63c7c068bf9 100644
--- a/engines/ultima/nuvie/actors/actor_manager.h
+++ b/engines/ultima/nuvie/actors/actor_manager.h
@@ -93,7 +93,7 @@ public:
 	void set_update(bool u) {
 		update = u;
 	}
-	bool get_update()       {
+	bool get_update() const {
 		return (update);
 	}
 	void set_combat_movement(bool c);
diff --git a/engines/ultima/nuvie/actors/md_actor.cpp b/engines/ultima/nuvie/actors/md_actor.cpp
index 6e71e9e4476..079ffe1a4da 100644
--- a/engines/ultima/nuvie/actors/md_actor.cpp
+++ b/engines/ultima/nuvie/actors/md_actor.cpp
@@ -42,13 +42,13 @@ bool MDActor::init(uint8) {
 	return true;
 }
 
-bool MDActor::will_not_talk() {
+bool MDActor::will_not_talk() const {
 	if (worktype == 0xa0)
 		return true;
 	return false;
 }
 
-bool MDActor::is_immobile() {
+bool MDActor::is_immobile() const {
 	return (obj_n == 294 || obj_n == 295 || obj_n == 318 || obj_n == 319); //avatar wall walking objects
 }
 
@@ -68,11 +68,11 @@ bool MDActor::check_move(uint16 new_x, uint16 new_y, uint8 new_z, ActorMoveFlags
 	return map->is_passable(new_x, new_y, new_z);
 }
 
-uint16 MDActor::get_downward_facing_tile_num() {
+uint16 MDActor::get_downward_facing_tile_num() const {
 	return get_tile_num(base_obj_n) + (uint16) MD_DOWNWARD_FACING_FRAME_N;
 }
 
-uint8 MDActor::get_hp_text_color() {
+uint8 MDActor::get_hp_text_color() const {
 	if (is_poisoned())
 		return 4;
 
@@ -91,7 +91,7 @@ uint8 MDActor::get_hp_text_color() {
 	return 0;
 }
 
-uint8 MDActor::get_str_text_color() {
+uint8 MDActor::get_str_text_color() const {
 	uint8 color = 0;
 	if (get_obj_flag(ACTOR_MD_OBJ_FLAG_HYPOXIA))
 		color = 9;
@@ -105,7 +105,7 @@ uint8 MDActor::get_str_text_color() {
 	return color;
 }
 
-uint8 MDActor::get_dex_text_color() {
+uint8 MDActor::get_dex_text_color() const {
 	uint8 color = 0;
 	if (get_obj_flag(ACTOR_MD_OBJ_FLAG_HYPOXIA))
 		color = 9;
@@ -139,7 +139,7 @@ void MDActor::set_direction(uint8 d) {
 	frame_n = direction * num_walk_frames + walk_frame_tbl[walk_frame];
 }
 
-bool MDActor::is_passable() {
+bool MDActor::is_passable() const {
 	if (obj_n == 391) { //FIXME hack for mother.
 		return false;
 	}
diff --git a/engines/ultima/nuvie/actors/md_actor.h b/engines/ultima/nuvie/actors/md_actor.h
index bb121e31ee0..447a5b85187 100644
--- a/engines/ultima/nuvie/actors/md_actor.h
+++ b/engines/ultima/nuvie/actors/md_actor.h
@@ -36,19 +36,19 @@ public:
 	~MDActor() override;
 
 	bool init(uint8 unused = 0) override;
-	bool will_not_talk() override;
-	uint8 get_maxhp() override {
+	bool will_not_talk() const override;
+	uint8 get_maxhp() const override {
 		return (((level * 24 + strength * 2) < 255) ? (level * 24 + strength * 2) : 255);
 	}
-	uint8 get_hp_text_color() override;
-	uint8 get_str_text_color() override;
-	uint8 get_dex_text_color() override;
-	bool is_immobile() override;
+	uint8 get_hp_text_color() const override;
+	uint8 get_str_text_color() const override;
+	uint8 get_dex_text_color() const override;
+	bool is_immobile() const override;
 
 	bool check_move(uint16 new_x, uint16 new_y, uint8 new_z, ActorMoveFlags flags = 0) override;
-	uint16 get_downward_facing_tile_num() override;
+	uint16 get_downward_facing_tile_num() const override;
 	void set_direction(uint8 d) override;
-	bool is_passable() override;
+	bool is_passable() const override;
 
 };
 
diff --git a/engines/ultima/nuvie/actors/se_actor.cpp b/engines/ultima/nuvie/actors/se_actor.cpp
index 0235a493c05..3ddb26a8374 100644
--- a/engines/ultima/nuvie/actors/se_actor.cpp
+++ b/engines/ultima/nuvie/actors/se_actor.cpp
@@ -35,7 +35,7 @@ bool SEActor::init(uint8) {
 	return true;
 }
 
-bool SEActor::will_not_talk() {
+bool SEActor::will_not_talk() const {
 	if (worktype == 0x07 || worktype == 0x8 || worktype == 0x9b)
 		return true;
 	return false;
diff --git a/engines/ultima/nuvie/actors/se_actor.h b/engines/ultima/nuvie/actors/se_actor.h
index 1d1961dc172..2ad0a884d04 100644
--- a/engines/ultima/nuvie/actors/se_actor.h
+++ b/engines/ultima/nuvie/actors/se_actor.h
@@ -37,8 +37,8 @@ public:
 	~SEActor() override;
 
 	bool init(uint8 unused = 0) override;
-	bool will_not_talk() override;
-	uint8 get_maxhp() override {
+	bool will_not_talk() const override;
+	uint8 get_maxhp() const override {
 		return (((level * 4 + strength * 2) < 255) ? (level * 4 + strength * 2) : 255);
 	}
 };
diff --git a/engines/ultima/nuvie/actors/u6_actor.cpp b/engines/ultima/nuvie/actors/u6_actor.cpp
index df0695284f9..f4f5482a99a 100644
--- a/engines/ultima/nuvie/actors/u6_actor.cpp
+++ b/engines/ultima/nuvie/actors/u6_actor.cpp
@@ -404,7 +404,7 @@ void U6Actor::gather_snake_objs_from_map(Obj *start_obj, uint16 ax, uint16 ay, u
 
 }
 
-uint16 U6Actor::get_downward_facing_tile_num() {
+uint16 U6Actor::get_downward_facing_tile_num() const {
 	uint8 shift = 0;
 
 	if (base_actor_type->frames_per_direction > 1) //we want the second frame for most actor types.
@@ -560,7 +560,7 @@ bool U6Actor::move(uint16 new_x, uint16 new_y, uint8 new_z, ActorMoveFlags flags
 
 bool U6Actor::check_move(uint16 new_x, uint16 new_y, uint8 new_z, ActorMoveFlags flags) {
 // bool ignore_actors = flags & ACTOR_IGNORE_OTHERS;
-	Tile *map_tile;
+	const Tile *map_tile;
 
 	if (Actor::check_move(new_x, new_y, new_z, flags) == false)
 		return false;
@@ -683,7 +683,7 @@ const CombatType *U6Actor::get_object_combat_type(uint16 objN) {
 	return nullptr;
 }
 
-const CombatType *U6Actor::get_hand_combat_type() {
+const CombatType *U6Actor::get_hand_combat_type() const {
 	if (obj_n == OBJ_U6_SHIP)
 		return &u6combat_ship_cannon;
 
@@ -881,7 +881,7 @@ void U6Actor::set_worktype(uint8 new_worktype, bool init) {
 }
 
 
-void U6Actor::pathfind_to(MapCoord &d) {
+void U6Actor::pathfind_to(const MapCoord &d) {
 	if (pathfinder) {
 		pathfinder->set_actor(this);
 		pathfinder->set_goal(d);
@@ -1500,7 +1500,7 @@ void U6Actor::die(bool create_body) {
 }
 
 // frozen by worktype or status
-bool U6Actor::is_immobile() {
+bool U6Actor::is_immobile() const {
 	return (((worktype == WORKTYPE_U6_MOTIONLESS
 	          || worktype == WORKTYPE_U6_IMMOBILE) && !is_in_party())
 	        || get_corpser_flag() == true
@@ -1518,8 +1518,8 @@ bool U6Actor::can_twitch() {
 	        && is_paralyzed() == false);
 }
 
-bool U6Actor::can_be_passed(Actor *other) {
-	U6Actor *other_ = static_cast<U6Actor *>(other);
+bool U6Actor::can_be_passed(const Actor *other) const {
+	const U6Actor *other_ = static_cast<const U6Actor *>(other);
 	// Sherry the mouse can pass others if they are in a party with her.
 	bool is_sherry = is_in_party() && other_->is_in_party() && other_->obj_n == OBJ_U6_MOUSE;
 	return (Actor::can_be_passed(other_) || other_->current_movetype != current_movetype || is_sherry);
@@ -1531,7 +1531,7 @@ void U6Actor::print() {
 }
 
 /* Returns name of NPC worktype/activity (game specific) or nullptr. */
-const char *U6Actor::get_worktype_string(uint32 wt) {
+const char *U6Actor::get_worktype_string(uint32 wt) const {
 	const char *wt_string = nullptr;
 	if (wt == WORKTYPE_U6_MOTIONLESS) wt_string = "Motionless";
 	else if (wt == WORKTYPE_U6_PLAYER) wt_string = "Player";
@@ -1617,11 +1617,11 @@ void U6Actor::revert_worktype() {
 }
 
 /* Maximum magic points is derived from Intelligence and base_obj_n. */
-uint8 U6Actor::get_maxmagic() {
+uint8 U6Actor::get_maxmagic() const {
 	return Game::get_game()->get_script()->actor_get_max_magic_points(this);
 }
 
-bool U6Actor::will_not_talk() {
+bool U6Actor::will_not_talk() const {
 	if (worktype == WORKTYPE_U6_COMBAT_RETREAT || worktype == 0x12 // guard arrest player
 	        || Game::get_game()->is_armageddon()
 	        || worktype == WORKTYPE_U6_ATTACK_PARTY || worktype == 0x13) // repel undead and retreat
@@ -1659,7 +1659,7 @@ void U6Actor::handle_lightsource(uint8 hour) {
 	}
 }
 
-uint8 U6Actor::get_hp_text_color() {
+uint8 U6Actor::get_hp_text_color() const {
 	uint8 hp_text_color = 0x48; //standard text color)
 
 	if (is_poisoned()) //actor is poisoned, display their hp in green
diff --git a/engines/ultima/nuvie/actors/u6_actor.h b/engines/ultima/nuvie/actors/u6_actor.h
index 4b303c728ec..d5ed3299005 100644
--- a/engines/ultima/nuvie/actors/u6_actor.h
+++ b/engines/ultima/nuvie/actors/u6_actor.h
@@ -71,7 +71,7 @@ public:
 	~U6Actor() override;
 
 	bool init(uint8 obj_status = NO_OBJ_STATUS) override;
-	uint16 get_downward_facing_tile_num() override;
+	uint16 get_downward_facing_tile_num() const override;
 	bool updateSchedule(uint8 hour, bool teleport = false) override;
 	void set_worktype(uint8 new_worktype, bool init = false) override;
 	void revert_worktype() override;
@@ -97,35 +97,35 @@ public:
 
 	uint8 get_object_readiable_location(Obj *obj) override;
 	const CombatType *get_object_combat_type(uint16 objN) override;
-	ActorTileType get_tile_type() override {
+	ActorTileType get_tile_type() const override {
 		return (actor_type->tile_type);
 	}
 	Obj *inventory_get_food(Obj *container = 0) override;
-	uint8 get_maxhp() override {
+	uint8 get_maxhp() const override {
 		return (((level * 30) <= 255) ? (level * 30) : 255);    // U6
 	}
-	uint8 get_maxmagic() override;
+	uint8 get_maxmagic() const override;
 
 	bool weapon_can_hit(const CombatType *weapon, Actor *target, uint16 *hit_x, uint16 *hit_y) override;
 
-	bool is_immobile() override; // frozen by worktype or status
+	bool is_immobile() const override; // frozen by worktype or status
 	bool can_twitch();
 
-	bool get_corpser_flag() override {
+	bool get_corpser_flag() const override {
 		return (movement_flags & ACTOR_MOVEMENT_FLAGS_CORPSER);
 	}
-	bool can_be_passed(Actor *other) override;
-	bool will_not_talk() override;
+	bool can_be_passed(const Actor *other) const override;
+	bool will_not_talk() const override;
 
 	void set_actor_obj_n(uint16 new_obj_n);
-	void pathfind_to(MapCoord &d) override;
+	void pathfind_to(const MapCoord &d) override;
 	void handle_lightsource(uint8 hour) override;
 
-	uint8 get_hp_text_color() override;
-	uint8 get_str_text_color() override {
+	uint8 get_hp_text_color() const override;
+	uint8 get_str_text_color() const override {
 		return 0x48;
 	}
-	uint8 get_dex_text_color() override {
+	uint8 get_dex_text_color() const override {
 		return 0x48;
 	}
 
@@ -165,10 +165,10 @@ protected:
 	inline void clear_surrounding_objs_list(bool delete_objs = false);
 	inline void init_surrounding_obj(uint16 x, uint16 y, uint8 z, uint16 actor_obj_n, uint16 obj_frame_n);
 
-	const CombatType *get_hand_combat_type() override;
+	const CombatType *get_hand_combat_type() const override;
 
 	void print() override;
-	const char *get_worktype_string(uint32 wt) override;
+	const char *get_worktype_string(uint32 wt) const override;
 	void inventory_make_all_objs_ok_to_take();
 };
 
diff --git a/engines/ultima/nuvie/actors/wou_actor.cpp b/engines/ultima/nuvie/actors/wou_actor.cpp
index 4a1b9c7d113..94e209f6540 100644
--- a/engines/ultima/nuvie/actors/wou_actor.cpp
+++ b/engines/ultima/nuvie/actors/wou_actor.cpp
@@ -24,7 +24,7 @@
 namespace Ultima {
 namespace Nuvie {
 
-bool WOUActor::can_carry_object(Obj *obj) {
+bool WOUActor::can_carry_object(Obj *obj) const {
 	if (inventory_count_objects(INV_EXCLUDE_READIED_OBJECTS) >= 16) {
 		return false;
 	}
@@ -32,7 +32,7 @@ bool WOUActor::can_carry_object(Obj *obj) {
 	return Actor::can_carry_object(obj);
 }
 
-bool WOUActor::can_carry_object(uint16 objN, uint32 qty) {
+bool WOUActor::can_carry_object(uint16 objN, uint32 qty) const {
 	if (inventory_count_objects(INV_EXCLUDE_READIED_OBJECTS) >= 16) {
 		return false;
 	}
diff --git a/engines/ultima/nuvie/actors/wou_actor.h b/engines/ultima/nuvie/actors/wou_actor.h
index b0eef2f9840..b64e8441301 100644
--- a/engines/ultima/nuvie/actors/wou_actor.h
+++ b/engines/ultima/nuvie/actors/wou_actor.h
@@ -35,8 +35,8 @@ public:
 	WOUActor(Map *m, ObjManager *om, GameClock *c) : Actor(m, om, c) { }
 	~WOUActor() override { }
 
-	bool can_carry_object(uint16 obj_n, uint32 qty = 0) override;
-	bool can_carry_object(Obj *obj) override;
+	bool can_carry_object(uint16 obj_n, uint32 qty = 0) const override;
+	bool can_carry_object(Obj *obj) const override;
 
 };
 
diff --git a/engines/ultima/nuvie/core/anim_manager.cpp b/engines/ultima/nuvie/core/anim_manager.cpp
index b6b88525d14..b0591b2db2b 100644
--- a/engines/ultima/nuvie/core/anim_manager.cpp
+++ b/engines/ultima/nuvie/core/anim_manager.cpp
@@ -202,7 +202,7 @@ bool AnimManager::destroy_anim(NuvieAnim *anim_pt) {
 
 /* Draw tile on viewsurf at x,y.
  */
-void AnimManager::drawTile(Tile *tile, uint16 x, uint16 y) {
+void AnimManager::drawTile(const Tile *tile, uint16 x, uint16 y) {
 	viewsurf->blit(mapwindow_x_offset + x, mapwindow_y_offset + y, tile->data, 8, tile_pitch, tile_pitch, 16,
 	               tile->transparent, &viewport);
 }
@@ -213,7 +213,7 @@ void AnimManager::drawText(Font *font, const char *text, uint16 x, uint16 y) {
 
 /* Draw tile on viewsurf at map location wx,wy (offset by add_x,add_y).
  */
-void AnimManager::drawTileAtWorldCoords(Tile *tile, uint16 wx, uint16 wy,
+void AnimManager::drawTileAtWorldCoords(const Tile *tile, uint16 wx, uint16 wy,
 										uint16 add_x, uint16 add_y) {
 	sint16 cur_x = map_window->cur_x;
 	sint16 cur_y = map_window->cur_y;
@@ -479,7 +479,7 @@ uint16 TextAnim::callback(uint16 msg, CallBack *caller, void *msg_data) {
 }
 
 /*** TossAnim ***/
-TossAnim::TossAnim(Tile *tile, const MapCoord &start, const MapCoord &stop, uint16 pixels_per_sec, uint8 stop_flags) {
+TossAnim::TossAnim(const Tile *tile, const MapCoord &start, const MapCoord &stop, uint16 pixels_per_sec, uint8 stop_flags) {
 	tile_center = 0;
 	actor_manager = Game::get_game()->get_actor_manager();
 	obj_manager = Game::get_game()->get_obj_manager();
@@ -508,7 +508,7 @@ TossAnim::~TossAnim() {
 	delete toss_tile;
 }
 
-void TossAnim::init(Tile *tile, uint16 degrees, const MapCoord &start, const MapCoord &stop, uint16 pixels_per_sec, uint8 stop_flags) {
+void TossAnim::init(const Tile *tile, uint16 degrees, const MapCoord &start, const MapCoord &stop, uint16 pixels_per_sec, uint8 stop_flags) {
 	src = new MapCoord(start);
 	target = new MapCoord(stop);
 	blocking = stop_flags;
diff --git a/engines/ultima/nuvie/core/anim_manager.h b/engines/ultima/nuvie/core/anim_manager.h
index ebfdba2c9a5..940d93fe355 100644
--- a/engines/ultima/nuvie/core/anim_manager.h
+++ b/engines/ultima/nuvie/core/anim_manager.h
@@ -85,7 +85,7 @@ public:
 	void set_tile_pitch(uint8 p)     {
 		tile_pitch = p;
 	}
-	uint8 get_tile_pitch()           {
+	uint8 get_tile_pitch() const {
 		return (tile_pitch);
 	}
 
@@ -97,8 +97,8 @@ public:
 
 	NuvieAnim *get_anim(uint32 anim_id);
 
-	void drawTile(Tile *tile, uint16 x, uint16 y);
-	void drawTileAtWorldCoords(Tile *tile, uint16 wx, uint16 wy, uint16 add_x = 0, uint16 add_y = 0);
+	void drawTile(const Tile *tile, uint16 x, uint16 y);
+	void drawTileAtWorldCoords(const Tile *tile, uint16 wx, uint16 wy, uint16 add_x = 0, uint16 add_y = 0);
 	void drawText(Font *font, const char *text, uint16 x, uint16 y);
 };
 
@@ -144,14 +144,14 @@ public:
 	void unpause() {
 		paused = false;
 	}
-	bool is_paused() {
+	bool is_paused() const {
 		return paused;
 	}
 
 	virtual MapCoord get_location() {
 		return (MapCoord(px, py, 0));
 	}
-	uint32 get_id()                 {
+	uint32 get_id() const {
 		return (id_n);
 	}
 
@@ -216,7 +216,7 @@ public:
 	MapCoord get_location() override {
 		return (MapCoord(_tx, _ty, 0));
 	}
-	void get_offset(uint32 &x_add, uint32 &y_add) {
+	void get_offset(uint32 &x_add, uint32 &y_add) const {
 		x_add = _px;
 		y_add = _py;
 	}
@@ -302,11 +302,11 @@ protected:
 	void display() override;
 
 public:
-	TossAnim(Tile *tile, const MapCoord &start, const MapCoord &stop, uint16 pixels_per_sec, uint8 stop_flags = 0);
+	TossAnim(const Tile *tile, const MapCoord &start, const MapCoord &stop, uint16 pixels_per_sec, uint8 stop_flags = 0);
 	TossAnim(Obj *obj, uint16 degrees, const MapCoord &start, const MapCoord &stop, uint16 pixels_per_sec, uint8 stop_flags = 0);
 	~TossAnim() override;
 
-	void init(Tile *tile, uint16 degrees, const MapCoord &start, const MapCoord &stop, uint16 pixels_per_sec, uint8 stop_flags);
+	void init(const Tile *tile, uint16 degrees, const MapCoord &start, const MapCoord &stop, uint16 pixels_per_sec, uint8 stop_flags);
 	void start() override;
 	void stop() override;
 	uint32 update_position(uint32 max_move = 0);
diff --git a/engines/ultima/nuvie/core/converse.h b/engines/ultima/nuvie/core/converse.h
index fff6ff8fe01..a8cdb3b6c78 100644
--- a/engines/ultima/nuvie/core/converse.h
+++ b/engines/ultima/nuvie/core/converse.h
@@ -154,7 +154,7 @@ public:
 	void continue_script();
 	void stop();
 
-	bool running()    {
+	bool running() const {
 		return (active);
 	}
 	bool is_waiting_for_scroll() {
@@ -167,10 +167,10 @@ public:
 
 	bool input();
 	void print(const char *s = nullptr);
-	const Std::string &get_input()  {
+	const Std::string &get_input() const {
 		return in_str;
 	}
-	const Std::string &get_output() {
+	const Std::string &get_output() const {
 		return out_str;
 	}
 	void set_input(Std::string s) {
@@ -185,7 +185,7 @@ public:
 	}
 	const char *npc_name(uint8 num);
 	void show_portrait(uint8 n);
-	converse_value get_var(uint8 varnum) {
+	converse_value get_var(uint8 varnum) const {
 		return (varnum <= U6TALK_VAR__LAST_ ? variables[varnum].cv : 0x00);
 	}
 	const char *get_svar(uint8 varnum);
diff --git a/engines/ultima/nuvie/core/converse_interpret.h b/engines/ultima/nuvie/core/converse_interpret.h
index 794fbae46a3..856c800f2f3 100644
--- a/engines/ultima/nuvie/core/converse_interpret.h
+++ b/engines/ultima/nuvie/core/converse_interpret.h
@@ -206,7 +206,7 @@ public:
 	ConverseInterpret(Converse *owner);
 	virtual ~ConverseInterpret();
 
-	bool waiting() {
+	bool waiting() const {
 		return (is_waiting);
 	}
 	void wait()    {
@@ -279,16 +279,16 @@ public:
 	converse_value find_db_string(uint32 loc, const char *dstring);
 
 	/* value tests */
-	virtual bool is_print(converse_value check) {
+	virtual bool is_print(converse_value check) const {
 		return (((check == 0x0a) || (check >= 0x20 && check <= 0x7a) || (check == 0x7e) || (check == 0x7b)));    //added '~' 0x7e, '{' 0x7b  for fm towns.
 	}
-	virtual bool is_ctrl(converse_value code) {
+	virtual bool is_ctrl(converse_value code) const {
 		return (((code >= 0xa1 || code == 0x9c || code == 0x9e) && !is_valop(code) && !is_datasize(code)));
 	}
-	virtual bool is_datasize(converse_value check) {
+	virtual bool is_datasize(converse_value check) const {
 		return ((check == 0xd3 || check == 0xd2 || check == 0xd4));
 	}
-	virtual bool is_valop(converse_value check) {
+	virtual bool is_valop(converse_value check) const {
 		return (((check == 0x81) || (check == 0x82) || (check == 0x83)
 		         || (check == 0x84) || (check == 0x85) || (check == 0x86)
 		         || (check == 0x90) || (check == 0x91) || (check == 0x92)
diff --git a/engines/ultima/nuvie/core/cursor.h b/engines/ultima/nuvie/core/cursor.h
index 3a1acaabfc5..11b05bec4b8 100644
--- a/engines/ultima/nuvie/core/cursor.h
+++ b/engines/ultima/nuvie/core/cursor.h
@@ -90,7 +90,7 @@ public:
 		hidden = false;
 	}
 
-	void get_hotspot(uint16 &x, uint16 &y) {
+	void get_hotspot(uint16 &x, uint16 &y) const {
 		x = cursors[cursor_id]->point_x;
 		y = cursors[cursor_id]->point_y;
 	}
@@ -101,7 +101,7 @@ public:
 	void clear();
 	void update();
 
-	bool is_visible() {
+	bool is_visible() const {
 		return !hidden;
 	}
 };
diff --git a/engines/ultima/nuvie/core/effect.cpp b/engines/ultima/nuvie/core/effect.cpp
index 0d9eeeb5b0f..2953e77c19d 100644
--- a/engines/ultima/nuvie/core/effect.cpp
+++ b/engines/ultima/nuvie/core/effect.cpp
@@ -129,8 +129,8 @@ uint16 CannonballEffect::callback(uint16 msg, CallBack *caller, void *msg_data)
 	switch (msg) {
 	case MESG_ANIM_HIT_WORLD: {
 		MapCoord *hit_loc = static_cast<MapCoord *>(msg_data);
-		Tile *obj_tile = game->get_obj_manager()->get_obj_tile(hit_loc->x, hit_loc->y, hit_loc->z);
-		Tile *tile = game->get_game_map()->get_tile(hit_loc->x, hit_loc->y,
+		const Tile *obj_tile = game->get_obj_manager()->get_obj_tile(hit_loc->x, hit_loc->y, hit_loc->z);
+		const Tile *tile = game->get_game_map()->get_tile(hit_loc->x, hit_loc->y,
 		             hit_loc->z);
 
 		if ((tile->flags2 & TILEFLAG_MISSILE_BOUNDARY)
@@ -277,7 +277,7 @@ uint16 ProjectileEffect::callback(uint16 msg, CallBack *caller, void *msg_data)
 	switch (msg) {
 	case MESG_ANIM_HIT_WORLD: {
 		MapCoord *hit_loc = static_cast<MapCoord *>(msg_data);
-		Tile *tile = game->get_game_map()->get_tile(hit_loc->x, hit_loc->y,
+		const Tile *tile = game->get_game_map()->get_tile(hit_loc->x, hit_loc->y,
 		             hit_loc->z);
 		if (tile->flags1 & TILEFLAG_WALL) {
 			//new ExplosiveEffect(hit_loc->x, hit_loc->y, 2);
@@ -590,7 +590,7 @@ ThrowObjectEffect::ThrowObjectEffect() {
 
 	anim = nullptr;
 	throw_obj = nullptr;
-	throw_tile = 0;
+	throw_tile = nullptr;
 	throw_speed = 0;
 	degrees = 0;
 	stop_flags = 0;
diff --git a/engines/ultima/nuvie/core/effect.h b/engines/ultima/nuvie/core/effect.h
index 20c232045b7..e13b8b1b23e 100644
--- a/engines/ultima/nuvie/core/effect.h
+++ b/engines/ultima/nuvie/core/effect.h
@@ -82,7 +82,7 @@ public:
 	void release() {
 		if (retain_count > 0) retain_count--;
 	}
-	bool is_retained() {
+	bool is_retained() const {
 		return retain_count == 0 ? false : true;
 	}
 
@@ -91,7 +91,7 @@ public:
 	}
 	void add_anim(NuvieAnim *anim);
 
-	bool is_defunct()  {
+	bool is_defunct() const {
 		return (defunct);
 	}
 	uint16 callback(uint16, CallBack *, void *) override {
@@ -304,7 +304,7 @@ protected:
 //  *sfx;
 	MapCoord start_at, stop_at; // start_at -> stop_at
 	Obj *throw_obj; // object being thrown
-	Tile *throw_tile; // graphic to use (default is object's tile)
+	const Tile *throw_tile; // graphic to use (default is object's tile)
 	uint16 throw_speed; // used in animation
 	uint16 degrees; // rotation of tile
 	uint8 stop_flags; // TossAnim blocking flags
diff --git a/engines/ultima/nuvie/core/effect_manager.cpp b/engines/ultima/nuvie/core/effect_manager.cpp
index 7dcb8ee94f5..6425a689e1f 100644
--- a/engines/ultima/nuvie/core/effect_manager.cpp
+++ b/engines/ultima/nuvie/core/effect_manager.cpp
@@ -74,9 +74,9 @@ void EffectManager::update_effects() {
 
 /* Returns true if there are any effects still active.
  */
-bool EffectManager::has_effects() {
+bool EffectManager::has_effects() const {
 	if (!effects.empty()) {
-		EffectIterator i = effects.begin();
+		ConstEffectIterator i = effects.begin();
 		while (i != effects.end())
 			if (!(*i)->is_defunct()) // effect is still active
 				return (true);
diff --git a/engines/ultima/nuvie/core/effect_manager.h b/engines/ultima/nuvie/core/effect_manager.h
index 358b986538c..ca0dd27b0dc 100644
--- a/engines/ultima/nuvie/core/effect_manager.h
+++ b/engines/ultima/nuvie/core/effect_manager.h
@@ -34,6 +34,7 @@ class Effect;
 class EffectManager {
 	friend class Effect;
 	typedef Std::vector<Effect *>::iterator EffectIterator;
+	typedef Std::vector<Effect *>::const_iterator ConstEffectIterator;
 	/* For each EffectWatch, a message will be sent to "watcher" when
 	   "effect" is deleted. */
 	typedef struct {
@@ -56,7 +57,7 @@ public:
 	void delete_effect(Effect *eff); // anyone may delete an effect
 	void update_effects(); // check and delete
 
-	bool has_effects();
+	bool has_effects() const;
 	void watch_effect(CallBack *callback_target, Effect *watch);
 	void unwatch_effect(CallBack *callback_target, Effect *watch = nullptr);
 };
diff --git a/engines/ultima/nuvie/core/egg_manager.h b/engines/ultima/nuvie/core/egg_manager.h
index d71cc2b918a..bc1b5ebe3de 100644
--- a/engines/ultima/nuvie/core/egg_manager.h
+++ b/engines/ultima/nuvie/core/egg_manager.h
@@ -73,7 +73,7 @@ public:
 	Std::list<Egg *> *get_egg_list() {
 		return &egg_list;
 	};
-	bool is_spawning_actors() {
+	bool is_spawning_actors() const {
 		return !not_spawning_actors;
 	}
 	void set_spawning_actors(bool spawning) {
diff --git a/engines/ultima/nuvie/core/events.h b/engines/ultima/nuvie/core/events.h
index 633e0a3e839..79f92fcee74 100644
--- a/engines/ultima/nuvie/core/events.h
+++ b/engines/ultima/nuvie/core/events.h
@@ -257,10 +257,10 @@ public:
 	TimeQueue *get_game_time_queue() {
 		return (game_time_queue);
 	}
-	EventMode get_mode() {
+	EventMode get_mode() const {
 		return (mode);
 	}
-	EventMode get_last_mode() {
+	EventMode get_last_mode() const {
 		return (last_mode);
 	}
 	void set_mode(EventMode new_mode);
diff --git a/engines/ultima/nuvie/core/game.h b/engines/ultima/nuvie/core/game.h
index 13626667d94..e4f5c980a20 100644
--- a/engines/ultima/nuvie/core/game.h
+++ b/engines/ultima/nuvie/core/game.h
@@ -156,7 +156,7 @@ public:
 	bool isLoaded() const {
 		return script != nullptr;
 	}
-	GamePauseState get_pause_flags()            {
+	GamePauseState get_pause_flags() const {
 		return (pause_flags);
 	}
 	void set_pause_flags(GamePauseState state);
@@ -199,25 +199,25 @@ public:
 
 	void init_new_command_bar();
 	void delete_new_command_bar();
-	nuvie_game_t get_game_type() {
+	nuvie_game_t get_game_type() const {
 		return game_type;
 	}
-	uint8 get_game_style() {
+	uint8 get_game_style() const {
 		return game_style;
 	}
-	bool is_original_plus() {
+	bool is_original_plus() const {
 		return (game_style == NUVIE_STYLE_ORIG_PLUS_CUTOFF_MAP || game_style == NUVIE_STYLE_ORIG_PLUS_FULL_MAP);
 	}
-	bool is_original_plus_cutoff_map() {
+	bool is_original_plus_cutoff_map() const {
 		return (game_style == NUVIE_STYLE_ORIG_PLUS_CUTOFF_MAP);
 	}
-	bool is_original_plus_full_map() {
+	bool is_original_plus_full_map() const {
 		return (game_style == NUVIE_STYLE_ORIG_PLUS_FULL_MAP);
 	}
-	bool is_new_style() {
+	bool is_new_style() const {
 		return (game_style == NUVIE_STYLE_NEW);
 	}
-	bool is_orig_style() {
+	bool is_orig_style() const {
 		return (game_style == NUVIE_STYLE_ORIG);
 	}
 	bool doubleclick_opens_containers();
@@ -227,10 +227,10 @@ public:
 	void set_using_text_gumps(bool val) {
 		using_text_gumps = val;
 	}
-	bool is_using_text_gumps() {
+	bool is_using_text_gumps() const {
 		return (using_text_gumps || is_new_style());
 	}
-	bool is_roof_mode() {
+	bool is_roof_mode() const {
 		return roof_mode;
 	}
 	void set_roof_mode(bool val) {
@@ -244,37 +244,37 @@ public:
 	void set_dragging_enabled(bool drag) {
 		dragging_enabled = drag;
 	}
-	bool is_god_mode_enabled() {
+	bool is_god_mode_enabled() const {
 		return (god_mode_enabled && cheats_enabled);
 	}
 	bool toggle_god_mode() {
 		return (god_mode_enabled = !god_mode_enabled);
 	}
-	bool are_cheats_enabled() {
+	bool are_cheats_enabled() const {
 		return cheats_enabled;
 	}
 	void set_cheats_enabled(bool cheat) {
 		cheats_enabled = cheat;
 	}
-	bool has_unlimited_casting() {
+	bool has_unlimited_casting() const {
 		return (unlimited_casting && cheats_enabled);
 	}
 	void set_unlimited_casting(bool unlimited) {
 		unlimited_casting = unlimited;
 	}
-	bool is_armageddon() {
+	bool is_armageddon() const {
 		return armageddon;
 	}
 	void set_armageddon(bool val) {
 		armageddon = val;
 	}
-	bool is_ethereal() {
+	bool is_ethereal() const {
 		return ethereal;
 	}
 	void set_ethereal(bool val) {
 		ethereal = val;
 	}
-	uint8 get_converse_gump_type() {
+	uint8 get_converse_gump_type() const {
 		return converse_gump_type;
 	}
 	void set_converse_gump_type(uint8 new_type);
@@ -282,28 +282,28 @@ public:
 	void set_free_balloon_movement(bool val) {
 		free_balloon_movement = val;
 	}
-	bool has_free_balloon_movement() {
+	bool has_free_balloon_movement() const {
 		return free_balloon_movement;
 	}
-	bool is_forcing_solid_converse_bg() {
+	bool is_forcing_solid_converse_bg() const {
 		return force_solid_converse_bg;
 	}
-	uint16 get_converse_gump_width() {
+	uint16 get_converse_gump_width() const {
 		return converse_gump_width;
 	}
-	uint16 get_min_converse_gump_width() {
+	uint16 get_min_converse_gump_width() const {
 		return min_converse_gump_width;
 	}
-	uint16 get_game_width() {
+	uint16 get_game_width() const {
 		return game_width;
 	}
-	uint16 get_game_height() {
+	uint16 get_game_height() const {
 		return game_height;
 	}
-	uint16 get_game_x_offset() {
+	uint16 get_game_x_offset() const {
 		return game_x_offset;
 	}
-	uint16 get_game_y_offset() {
+	uint16 get_game_y_offset() const {
 		return game_y_offset;
 	}
 	Std::string get_data_file_path(Std::string datafile);
diff --git a/engines/ultima/nuvie/core/game_clock.cpp b/engines/ultima/nuvie/core/game_clock.cpp
index e19e7ed461c..2993e958a77 100644
--- a/engines/ultima/nuvie/core/game_clock.cpp
+++ b/engines/ultima/nuvie/core/game_clock.cpp
@@ -255,7 +255,7 @@ void GameClock::inc_year() {
 	return;
 }
 
-uint32 GameClock::get_move_count() {
+uint32 GameClock::get_move_count() const {
 	return move_counter;
 }
 
@@ -269,38 +269,38 @@ const char *GameClock::get_time_of_day_string() {
 	return "evening";
 }
 
-uint8 GameClock::get_hour() {
+uint8 GameClock::get_hour() const {
 	return hour;
 }
 
-uint8 GameClock::get_minute() {
+uint8 GameClock::get_minute() const {
 	return minute;
 }
 
-uint8 GameClock::get_day() {
+uint8 GameClock::get_day() const {
 	return day;
 }
 
-uint8 GameClock::get_month() {
+uint8 GameClock::get_month() const {
 	return month;
 }
 
-uint16 GameClock::get_year() {
+uint16 GameClock::get_year() const {
 	return year;
 }
 
-uint8 GameClock::get_day_of_week() {
+uint8 GameClock::get_day_of_week() const {
 	return day_of_week;
 }
 
-char *GameClock::get_date_string() {
+const char *GameClock::get_date_string() {
 
 	Common::sprintf_s(date_string, "%2u-%02u-%04u", month, day, year);
 
 	return date_string;
 }
 
-char *GameClock::get_time_string() {
+const char *GameClock::get_time_string() {
 	char c;
 	uint8 tmp_hour;
 
@@ -323,7 +323,7 @@ char *GameClock::get_time_string() {
 	return time_string;
 }
 
-uint8 GameClock::get_rest_counter() {
+uint8 GameClock::get_rest_counter() const {
 	return rest_counter;
 }
 
@@ -339,7 +339,7 @@ void GameClock::set_timer(uint8 timer_num, uint8 val) {
 	}
 }
 
-uint8 GameClock::get_timer(uint8 timer_num) {
+uint8 GameClock::get_timer(uint8 timer_num) const {
 	if (timer_num < num_timers) {
 		return timers[timer_num];
 	}
diff --git a/engines/ultima/nuvie/core/game_clock.h b/engines/ultima/nuvie/core/game_clock.h
index d67f24a9100..d29d4c6e798 100644
--- a/engines/ultima/nuvie/core/game_clock.h
+++ b/engines/ultima/nuvie/core/game_clock.h
@@ -93,49 +93,49 @@ public:
 	void inc_month();
 	void inc_year();
 
-	uint32 get_move_count();
+	uint32 get_move_count() const;
 
 	const char *get_time_of_day_string();
 
-	uint8 get_hour();
-	uint8 get_minute();
+	uint8 get_hour() const;
+	uint8 get_minute() const;
 
-	uint8 get_day();
-	uint8 get_month();
-	uint16 get_year();
-	uint8 get_day_of_week();
+	uint8 get_day() const;
+	uint8 get_month() const;
+	uint16 get_year() const;
+	uint8 get_day_of_week() const;
 
-	char *get_date_string();
-	char *get_time_string();
+	const char *get_date_string();
+	const char *get_time_string();
 
-	uint8 get_rest_counter();
+	uint8 get_rest_counter() const;
 	void set_rest_counter(uint8 value) {
 		rest_counter = value;
 	}
 
-	uint32 get_ticks() {
+	uint32 get_ticks() const {
 		return (SDL_GetTicks());    // milliseconds since start
 	}
-	uint32 get_game_ticks() {
+	uint32 get_game_ticks() const {
 		return (time_counter/**GAMECLOCK_TICKS_PER_MINUTE+tick_counter*/);
 	}
 // uint32 get_time()  { return(time_counter); } // get_game_ticks() is preferred
-	uint32 get_turn()  {
+	uint32 get_turn() const {
 		return (move_counter);
 	}
 
 	void set_timer(uint8 timer_num, uint8 val);
-	uint8 get_timer(uint8 timer_num);
+	uint8 get_timer(uint8 timer_num) const;
 	void update_timers(uint8 amount);
 
 //MD berry counters
-	uint8 get_purple_berry_counter(uint8 actor_num) {
+	uint8 get_purple_berry_counter(uint8 actor_num) const {
 		return get_timer(actor_num * 3);
 	}
-	uint8 get_green_berry_counter(uint8 actor_num) {
+	uint8 get_green_berry_counter(uint8 actor_num) const {
 		return get_timer(actor_num * 3 + 1);
 	}
-	uint8 get_brown_berry_counter(uint8 actor_num) {
+	uint8 get_brown_berry_counter(uint8 actor_num) const {
 		return get_timer(actor_num * 3 + 2);
 	}
 
diff --git a/engines/ultima/nuvie/core/look.cpp b/engines/ultima/nuvie/core/look.cpp
index 82c6783eadb..17cce67183c 100644
--- a/engines/ultima/nuvie/core/look.cpp
+++ b/engines/ultima/nuvie/core/look.cpp
@@ -149,13 +149,11 @@ const char *Look::get_description(uint16 tile_num, bool *plural) {
 	return desc_buf;
 }
 
-bool Look::has_plural(uint16 tile_num) {
-	const char *desc;
-
+bool Look::has_plural(uint16 tile_num) const {
 	if (tile_num >= 2048)
 		return false;
 
-	desc = look_tbl[tile_num];
+	const char *desc = look_tbl[tile_num];
 
 	if (desc == nullptr)
 		return false;
@@ -168,7 +166,7 @@ bool Look::has_plural(uint16 tile_num) {
 	return false;
 }
 
-uint16 Look::get_max_len() {
+uint16 Look::get_max_len() const {
 	return max_len;
 }
 
diff --git a/engines/ultima/nuvie/core/look.h b/engines/ultima/nuvie/core/look.h
index ec3c70b3155..03c051cbc16 100644
--- a/engines/ultima/nuvie/core/look.h
+++ b/engines/ultima/nuvie/core/look.h
@@ -43,8 +43,8 @@ public:
 
 // if description has a plural form, true is returned in plural
 	const char *get_description(uint16 tile_num, bool *plural);
-	bool has_plural(uint16 tile_num);
-	uint16 get_max_len();
+	bool has_plural(uint16 tile_num) const;
+	uint16 get_max_len() const;
 
 	void print();
 
diff --git a/engines/ultima/nuvie/core/magic.h b/engines/ultima/nuvie/core/magic.h
index f20b5b538d3..866fffeab8f 100644
--- a/engines/ultima/nuvie/core/magic.h
+++ b/engines/ultima/nuvie/core/magic.h
@@ -113,36 +113,36 @@ public:
 	bool resume_with_spell_num(uint8 spell_num);
 	bool resume(Obj *obj);
 	bool resume();
-	bool is_waiting_for_location() {
+	bool is_waiting_for_location() const {
 		if (magic_script && state == MAGIC_STATE_ACQUIRE_TARGET) return true;
 		else return false;
 	}
-	bool is_waiting_for_direction() {
+	bool is_waiting_for_direction() const {
 		if (magic_script && state == MAGIC_STATE_ACQUIRE_DIRECTION) return true;
 		else return false;
 	}
-	bool is_waiting_for_inventory_obj() {
+	bool is_waiting_for_inventory_obj() const {
 		if (magic_script && state == MAGIC_STATE_ACQUIRE_INV_OBJ) return true;
 		else return false;
 	}
-	bool is_waiting_for_obj() {
+	bool is_waiting_for_obj() const {
 		if (magic_script && state == MAGIC_STATE_ACQUIRE_OBJ) return true;
 		else return false;
 	}
-	bool is_waiting_to_talk() {
+	bool is_waiting_to_talk() const {
 		if (state == MAGIC_STATE_TALK_TO_ACTOR) return true;
 		else return false;
 	}
-	bool is_waiting_for_spell() {
+	bool is_waiting_for_spell() const {
 		if (magic_script && state == MAGIC_STATE_ACQUIRE_SPELL) return true;
 		else return false;
 	}
-	bool is_selecting_spell() {
+	bool is_selecting_spell() const {
 		if (magic_script && state == MAGIC_STATE_SELECT_SPELL) return true;
 		else return false;
 	}
 
-	bool is_waiting_to_resume() {
+	bool is_waiting_to_resume() const {
 		if (magic_script) return true;
 		else return false;
 	}
diff --git a/engines/ultima/nuvie/core/map.cpp b/engines/ultima/nuvie/core/map.cpp
index b08f08ab45a..d3bb671572b 100644
--- a/engines/ultima/nuvie/core/map.cpp
+++ b/engines/ultima/nuvie/core/map.cpp
@@ -65,7 +65,7 @@ Map::~Map() {
 }
 
 
-unsigned char *Map::get_map_data(uint8 level) {
+byte *Map::get_map_data(uint8 level) {
 	if (level == 0)
 		return surface;
 
@@ -82,18 +82,15 @@ uint16 *Map::get_roof_data(uint8 level) {
 	return nullptr;
 }
 
-Tile *Map::get_tile(uint16 x, uint16 y, uint8 level, bool original_tile) {
-	Tile *map_tile;
-	uint8 *ptr;
-
+const Tile *Map::get_tile(uint16 x, uint16 y, uint8 level, bool original_tile) {
 	if (level > 5)
 		return nullptr;
 
-	ptr = get_map_data(level);
-
 	WRAP_COORD(x, level);
 	WRAP_COORD(y, level);
 
+	const uint8 *ptr = get_map_data(level);
+	const Tile *map_tile;
 	if (original_tile)
 		map_tile = tile_manager->get_original_tile(ptr[y * get_width(level) + x]);
 	else
@@ -102,7 +99,7 @@ Tile *Map::get_tile(uint16 x, uint16 y, uint8 level, bool original_tile) {
 	return map_tile;
 }
 
-uint16 Map::get_width(uint8 level) {
+uint16 Map::get_width(uint8 level) const {
 	if (level == 0)
 		return 1024; // surface
 
@@ -110,9 +107,6 @@ uint16 Map::get_width(uint8 level) {
 }
 
 bool Map::is_passable(uint16 x, uint16 y, uint8 level) {
-	uint8 *ptr;
-	Tile *map_tile;
-
 	WRAP_COORD(x, level);
 	WRAP_COORD(y, level);
 
@@ -125,8 +119,8 @@ bool Map::is_passable(uint16 x, uint16 y, uint8 level) {
 	if (obj_status != OBJ_NO_OBJ && obj_manager->is_forced_passable(x, y, level))
 		return true;
 
-	ptr = get_map_data(level);
-	map_tile = tile_manager->get_original_tile(ptr[y * get_width(level) + x]);
+	const uint8 *ptr = get_map_data(level);
+	const Tile *map_tile = tile_manager->get_original_tile(ptr[y * get_width(level) + x]);
 
 	return map_tile->passable;
 }
@@ -148,9 +142,6 @@ bool Map::is_passable(uint16 x, uint16 y, uint8 level, uint8 dir) {
 }
 
 bool Map::is_passable_from_dir(uint16 x, uint16 y, uint8 level, uint8 dir) {
-	uint8 *ptr;
-	Tile *map_tile;
-
 	WRAP_COORD(x, level);
 	WRAP_COORD(y, level);
 
@@ -163,8 +154,8 @@ bool Map::is_passable_from_dir(uint16 x, uint16 y, uint8 level, uint8 dir) {
 	if (obj_status != OBJ_NO_OBJ && obj_manager->is_forced_passable(x, y, level))
 		return true;
 
-	ptr = get_map_data(level);
-	map_tile = tile_manager->get_original_tile(ptr[y * get_width(level) + x]);
+	const uint8 *ptr = get_map_data(level);
+	const Tile *map_tile = tile_manager->get_original_tile(ptr[y * get_width(level) + x]);
 
 	if (!map_tile->passable && !(map_tile->flags1 & TILEFLAG_WALL)) {
 		switch (dir) {
@@ -238,21 +229,17 @@ bool Map::is_missile_boundary(uint16 x, uint16 y, uint8 level, Obj *excluded_obj
 }
 
 bool Map::is_water(uint16 x, uint16 y, uint16 level, bool ignore_objects) {
-	uint8 *ptr;
-	Tile *map_tile;
-	Obj *obj;
-
 	WRAP_COORD(x, level);
 	WRAP_COORD(y, level);
 
 	if (!ignore_objects) {
-		obj = obj_manager->get_obj(x, y, level);
+		const Obj *obj = obj_manager->get_obj(x, y, level);
 		if (obj != nullptr)
 			return false;
 	}
 
-	ptr = get_map_data(level);
-	map_tile = tile_manager->get_original_tile(ptr[y * get_width(level) + x]);
+	const uint8 *ptr = get_map_data(level);
+	const Tile *map_tile = tile_manager->get_original_tile(ptr[y * get_width(level) + x]);
 
 	if (map_tile->water)
 		return true;
@@ -261,12 +248,12 @@ bool Map::is_water(uint16 x, uint16 y, uint16 level, bool ignore_objects) {
 }
 
 bool Map::is_damaging(uint16 x, uint16 y, uint8 level, bool ignore_objects) {
-	uint8 *ptr = get_map_data(level);
+	const uint8 *ptr = get_map_data(level);
 
 	WRAP_COORD(x, level);
 	WRAP_COORD(y, level);
 
-	Tile *map_tile = tile_manager->get_original_tile(ptr[y * get_width(level) + x]);
+	const Tile *map_tile = tile_manager->get_original_tile(ptr[y * get_width(level) + x]);
 
 	if (map_tile->damages)
 		return true;
@@ -306,7 +293,7 @@ uint8 Map::get_impedance(uint16 x, uint16 y, uint8 level, bool ignore_objects) {
 	uint8 *ptr = get_map_data(level);
 	WRAP_COORD(x, level);
 	WRAP_COORD(y, level);
-	Tile *map_tile = tile_manager->get_original_tile(ptr[y * get_width(level) + x]);
+	const Tile *map_tile = tile_manager->get_original_tile(ptr[y * get_width(level) + x]);
 	uint8 impedance = 0;
 
 	if (!ignore_objects) {
@@ -330,8 +317,8 @@ uint8 Map::get_impedance(uint16 x, uint16 y, uint8 level, bool ignore_objects) {
 	return impedance;
 }
 
-Tile *Map::get_dmg_tile(uint16 x, uint16 y, uint8 level) {
-	Tile *tile = get_tile(x, y, level);
+const Tile *Map::get_dmg_tile(uint16 x, uint16 y, uint8 level) {
+	const Tile *tile = get_tile(x, y, level);
 
 	if (tile->damages)
 		return tile;
@@ -658,7 +645,7 @@ void Map::insertDungeonChunk(unsigned char *chunk, uint16 x, uint16 y, uint8 lev
 
 /* Get absolute coordinates for relative destination from MapCoord.
  */
-MapCoord MapCoord::abs_coords(sint16 dx, sint16 dy) {
+MapCoord MapCoord::abs_coords(sint16 dx, sint16 dy) const {
 //    uint16 pitch = Map::get_width(z); cannot call function without object
 	uint16 pitch = (z == 0) ? 1024 : 256;
 	dx += x;
@@ -678,7 +665,7 @@ MapCoord MapCoord::abs_coords(sint16 dx, sint16 dy) {
 
 /* Returns true if this map coordinate is visible in the game window.
  */
-bool MapCoord::is_visible() {
+bool MapCoord::is_visible() const {
 	return (Game::get_game()->get_map_window()->in_window(x, y, z));
 }
 
diff --git a/engines/ultima/nuvie/core/map.h b/engines/ultima/nuvie/core/map.h
index bca539abeb3..e58d234bab2 100644
--- a/engines/ultima/nuvie/core/map.h
+++ b/engines/ultima/nuvie/core/map.h
@@ -103,39 +103,39 @@ public:
 	}
 	MapCoord() : x(0), y(0), z(0) { }
 
-	uint32 xdistance(MapCoord &c2) {
+	uint32 xdistance(const MapCoord &c2) const {
 		uint32 dist = abs(c2.x - x);
 		if (dist > 512)
 			dist = 1024 - dist;
 
 		return dist;
 	}
-	uint32 ydistance(MapCoord &c2) {
+	uint32 ydistance(const MapCoord &c2) const {
 		return (abs(c2.y - y));
 	}
 	// greatest 2D distance X or Y (estimate of shortest)
-	uint32 distance(MapCoord &c2) {
+	uint32 distance(const MapCoord &c2) const {
 		uint16 dx = xdistance(c2), dy = ydistance(c2);
 		return (dx >= dy ? dx : dy);
 	}
 	// get absolute coordinates for relative destination (dx,dy)
-	MapCoord abs_coords(sint16 dx, sint16 dy);
+	MapCoord abs_coords(sint16 dx, sint16 dy) const;
 	// location is on screen?
-	bool is_visible();
-	void print_d(DebugLevelType level) {
+	bool is_visible() const;
+	void print_d(DebugLevelType level) const {
 		DEBUG(1, level, "%d, %d, %d", x, y, z);
 	}
-	void print_h(DebugLevelType level) {
+	void print_h(DebugLevelType level) const {
 		DEBUG(1, level, "%x, %x, %x", x, y, z);
 	}
-	void print_s(DebugLevelType level) {
+	void print_s(DebugLevelType level) const {
 		DEBUG(1, level, "%d, %d", sx, sy);
 	}
 
-	bool operator==(MapCoord &c2) {
+	bool operator==(const MapCoord &c2) const {
 		return (x == c2.x && y == c2.y && z == c2.z);
 	}
-	bool operator!=(MapCoord &c2) {
+	bool operator!=(const MapCoord &c2) const {
 		return (!(*this == c2));
 	}
 //    MapCoord operator+(MapCoord &c2) { return(abs_coords(c2)); }
@@ -165,10 +165,10 @@ public:
 	Actor *get_actor(uint16 x, uint16 y, uint8 z, bool inc_surrounding_objs = true);
 
 	bool loadMap(TileManager *tm, ObjManager *om);
-	unsigned char *get_map_data(uint8 level);
+	byte *get_map_data(uint8 level);
 	uint16 *get_roof_data(uint8 level);
-	Tile *get_tile(uint16 x, uint16 y, uint8 level, bool original_tile = false);
-	uint16 get_width(uint8 level);
+	const Tile *get_tile(uint16 x, uint16 y, uint8 level, bool original_tile = false);
+	uint16 get_width(uint8 level) const;
 	bool is_passable(uint16 x, uint16 y, uint8 level);
 	bool is_water(uint16 x, uint16 y, uint16 level, bool ignore_objects = false);
 	bool is_boundary(uint16 x, uint16 y, uint8 level);
@@ -177,7 +177,7 @@ public:
 	bool can_put_obj(uint16 x, uint16 y, uint8 level);
 	bool actor_at_location(uint16 x, uint16 y, uint8 level, bool inc_surrounding_objs = true);
 	uint8 get_impedance(uint16 x, uint16 y, uint8 level, bool ignore_objects = false);
-	Tile *get_dmg_tile(uint16 x, uint16 y, uint8 level);
+	const Tile *get_dmg_tile(uint16 x, uint16 y, uint8 level);
 	bool is_passable(uint16 x, uint16 y, uint8 level, uint8 dir);
 	bool is_passable(uint16 x1, uint16 y1, uint16 x2, uint16 y2, uint8 level);
 	bool is_passable_from_dir(uint16 x, uint16 y, uint8 level, uint8 dir);
diff --git a/engines/ultima/nuvie/core/obj.cpp b/engines/ultima/nuvie/core/obj.cpp
index f4bf7d23d62..4b3d2a3f9d8 100644
--- a/engines/ultima/nuvie/core/obj.cpp
+++ b/engines/ultima/nuvie/core/obj.cpp
@@ -155,7 +155,7 @@ void Obj::set_actor_obj(bool flag) {
 
 /* Returns true if an object is in an actor inventory, including containers and readied items. */
 
-bool Obj::is_in_inventory(bool check_parent) {
+bool Obj::is_in_inventory(bool check_parent) const {
 	switch (get_engine_loc()) {
 	case OBJ_LOC_INV :
 	case OBJ_LOC_READIED :
@@ -171,7 +171,7 @@ bool Obj::is_in_inventory(bool check_parent) {
 	return false;
 }
 
-uint8 Obj::get_engine_loc() {
+uint8 Obj::get_engine_loc() const {
 	return (nuvie_status & NUVIE_OBJ_STATUS_LOC_MASK_GET);
 }
 
diff --git a/engines/ultima/nuvie/core/obj.h b/engines/ultima/nuvie/core/obj.h
index 2c46fddd36a..5251cc03cd9 100644
--- a/engines/ultima/nuvie/core/obj.h
+++ b/engines/ultima/nuvie/core/obj.h
@@ -103,59 +103,59 @@ public:
 	Obj();
 	Obj(Obj *sobj);
 
-	bool is_script_obj()    {
+	bool is_script_obj() const {
 		return (nuvie_status & NUVIE_OBJ_STATUS_SCRIPTING);
 	}
-	bool is_actor_obj()     {
+	bool is_actor_obj() const {
 		return (nuvie_status & NUVIE_OBJ_STATUS_ACTOR_OBJ);
 	}
 
 	bool is_ok_to_take();
-	bool is_invisible()     {
+	bool is_invisible() const {
 		return (status & OBJ_STATUS_INVISIBLE);
 	}
-	bool is_charmed()     {
+	bool is_charmed() const {
 		return (status & OBJ_STATUS_CHARMED);
 	}
-	bool is_temporary()    {
+	bool is_temporary() const {
 		return (status & OBJ_STATUS_TEMPORARY);
 	}
-	bool is_egg_active()   {
+	bool is_egg_active() const {
 		return (status & OBJ_STATUS_EGG_ACTIVE);
 	}
-	bool is_broken()       {
+	bool is_broken() const {
 		return (status & OBJ_STATUS_BROKEN);
 	}
-	bool is_mutant()       {
+	bool is_mutant() const {
 		return (status & OBJ_STATUS_MUTANT);
 	}
-	bool is_cursed()       {
+	bool is_cursed() const {
 		return (status & OBJ_STATUS_CURSED);
 	}
-	bool is_lit()          {
+	bool is_lit() const {
 		return (status & OBJ_STATUS_LIT);
 	}
 
-	bool is_on_map()       {
+	bool is_on_map() const {
 		return ((nuvie_status & NUVIE_OBJ_STATUS_LOC_MASK_GET) == OBJ_LOC_MAP);
 	}
-	bool is_in_container() {
+	bool is_in_container() const {
 		return ((nuvie_status & NUVIE_OBJ_STATUS_LOC_MASK_GET) == OBJ_LOC_CONT);
 	}
-	bool is_in_inventory(bool check_parent = true);
+	bool is_in_inventory(bool check_parent = true) const;
 
-	bool is_readied()      {
+	bool is_readied() const {
 		return ((nuvie_status & NUVIE_OBJ_STATUS_LOC_MASK_GET) == OBJ_LOC_READIED);
 	}
 
-	bool has_container() {
+	bool has_container() const {
 		return (container != nullptr);
 	}
 	void make_container();
 	Obj *get_container_obj(bool recursive = false);
 	uint32 container_count_objects();
 
-	uint8 get_engine_loc();
+	uint8 get_engine_loc() const;
 	Actor *get_actor_holding_obj();
 
 	void set_on_map(U6LList *map_list);
diff --git a/engines/ultima/nuvie/core/obj_manager.cpp b/engines/ultima/nuvie/core/obj_manager.cpp
index cacfd3939be..7820140cd35 100644
--- a/engines/ultima/nuvie/core/obj_manager.cpp
+++ b/engines/ultima/nuvie/core/obj_manager.cpp
@@ -1040,20 +1040,16 @@ U6LList *ObjManager::get_obj_list(uint16 x, uint16 y, uint8 level) {
 }
 
 Tile *ObjManager::get_obj_tile(uint16 obj_n, uint8 frame_n) {
-	return  tile_manager->get_tile(get_obj_tile_num(obj_n) + frame_n);
+	return tile_manager->get_tile(get_obj_tile_num(obj_n) + frame_n);
 }
 
-Tile *ObjManager::get_obj_tile(uint16 x, uint16 y, uint8 level, bool top_obj) {
-	Obj *obj;
-	Tile *tile;
-	uint16 tile_num;
-
-	obj = get_obj(x, y, level, top_obj);
+const Tile *ObjManager::get_obj_tile(uint16 x, uint16 y, uint8 level, bool top_obj) {
+	const Obj *obj = get_obj(x, y, level, top_obj);
 	if (obj == nullptr)
 		return nullptr;
 
-	tile_num = get_obj_tile_num(obj->obj_n) + obj->frame_n;
-	tile = tile_manager->get_tile(tile_num);
+	uint16 tile_num = get_obj_tile_num(obj->obj_n) + obj->frame_n;
+	const Tile *tile = tile_manager->get_tile(tile_num);
 
 	if (tile->dbl_width && obj->x == x + 1 && obj->y == y)
 		tile_num--;
@@ -1065,18 +1061,13 @@ Tile *ObjManager::get_obj_tile(uint16 x, uint16 y, uint8 level, bool top_obj) {
 	return tile_manager->get_original_tile(tile_num);
 }
 
-Tile *ObjManager::get_obj_dmg_tile(uint16 x, uint16 y, uint8 level) {
-	Tile *tile;
-	U6LList *obj_list;
-	U6Link *link;
-	Obj *obj = nullptr;
-
-	obj_list = get_obj_list(x, y, level);
+const Tile *ObjManager::get_obj_dmg_tile(uint16 x, uint16 y, uint8 level) {
+	const U6LList *obj_list = get_obj_list(x, y, level);
 
 	if (obj_list != nullptr) {
-		for (link = obj_list->end(); link != nullptr; link = link->prev) {
-			obj = (Obj *)link->data;
-			tile = tile_manager->get_original_tile(get_obj_tile_num(obj->obj_n) + obj->frame_n);
+		for (const U6Link *link = obj_list->end(); link != nullptr; link = link->prev) {
+			const Obj *obj = (const Obj *)link->data;
+			const Tile *tile = tile_manager->get_original_tile(get_obj_tile_num(obj->obj_n) + obj->frame_n);
 
 			if (tile->damages == true)
 				return tile;
@@ -1227,7 +1218,7 @@ Obj *ObjManager::get_objBasedAt(uint16 x, uint16 y, uint8 level, bool top_obj, b
 				if (include_ignored_objects)
 					return obj;
 
-				Tile *tile = get_obj_tile(obj->obj_n, obj->frame_n);
+				const Tile *tile = get_obj_tile(obj->obj_n, obj->frame_n);
 				if ((tile->flags3 & TILEFLAG_IGNORE) != TILEFLAG_IGNORE)
 					return obj;
 			}
diff --git a/engines/ultima/nuvie/core/obj_manager.h b/engines/ultima/nuvie/core/obj_manager.h
index 866c316b6cb..35bf6a649e3 100644
--- a/engines/ultima/nuvie/core/obj_manager.h
+++ b/engines/ultima/nuvie/core/obj_manager.h
@@ -157,8 +157,8 @@ public:
 	U6LList *get_obj_list(uint16 x, uint16 y, uint8 level);
 
 	Tile *get_obj_tile(uint16 obj_n, uint8 frame_n);
-	Tile *get_obj_tile(uint16 x, uint16 y, uint8 level, bool top_obj = true);
-	Tile *get_obj_dmg_tile(uint16 x, uint16 y, uint8 level);
+	const Tile *get_obj_tile(uint16 x, uint16 y, uint8 level, bool top_obj = true);
+	const Tile *get_obj_dmg_tile(uint16 x, uint16 y, uint8 level);
 	Obj *get_obj(uint16 x, uint16 y, uint8 level, bool top_obj = OBJ_SEARCH_TOP, bool include_ignored_objects = OBJ_EXCLUDE_IGNORED, Obj *excluded_obj = nullptr);
 	Obj *get_obj_of_type_from_location_inc_multi_tile(uint16 obj_n, uint16 x, uint16 y, uint8 z);
 	Obj *get_obj_of_type_from_location_inc_multi_tile(uint16 obj_n, sint16 quality, sint32 qty, uint16 x, uint16 y, uint8 z);
diff --git a/engines/ultima/nuvie/core/party.cpp b/engines/ultima/nuvie/core/party.cpp
index 848b8cdf172..7ef5483386a 100644
--- a/engines/ultima/nuvie/core/party.cpp
+++ b/engines/ultima/nuvie/core/party.cpp
@@ -257,7 +257,7 @@ uint8 Party::get_party_size() {
 	return num_in_party;
 }
 
-Actor *Party::get_leader_actor() {
+Actor *Party::get_leader_actor() const {
 	sint8 leader = get_leader();
 	if (leader < 0) {
 		return nullptr;
@@ -266,14 +266,14 @@ Actor *Party::get_leader_actor() {
 	return get_actor(leader);
 }
 
-Actor *Party::get_actor(uint8 member_num) {
+Actor *Party::get_actor(uint8 member_num) const {
 	if (num_in_party <= member_num)
 		return nullptr;
 
 	return member[member_num].actor;
 }
 
-char *Party::get_actor_name(uint8 member_num) {
+const char *Party::get_actor_name(uint8 member_num) const {
 	if (num_in_party <= member_num)
 		return nullptr;
 
@@ -283,7 +283,7 @@ char *Party::get_actor_name(uint8 member_num) {
 
 /* Returns position of actor in party or -1.
  */
-sint8 Party::get_member_num(Actor *actor) {
+sint8 Party::get_member_num(const Actor *actor) const {
 	for (int i = 0; i < num_in_party; i++) {
 		if (member[i].actor->id_n == actor->id_n)
 			return (i);
@@ -291,11 +291,11 @@ sint8 Party::get_member_num(Actor *actor) {
 	return (-1);
 }
 
-sint8 Party::get_member_num(uint8 a) {
+sint8 Party::get_member_num(uint8 a) const {
 	return (get_member_num(actor_manager->get_actor(a)));
 }
 
-uint8 Party::get_actor_num(uint8 member_num) {
+uint8 Party::get_actor_num(uint8 member_num) const {
 	if (num_in_party <= member_num)
 		return 0; // hmm how should we handle this error.
 
@@ -399,7 +399,7 @@ void Party::reform_party() {
 
 /* Returns number of person leading the party (the first active member), or -1
  * if the party has no leader and can't move. */
-sint8 Party::get_leader() {
+sint8 Party::get_leader() const {
 	for (int m = 0; m < num_in_party; m++)
 		if (member[m].actor->is_immobile() == false && member[m].actor->is_charmed() == false)
 			return m;
@@ -407,12 +407,12 @@ sint8 Party::get_leader() {
 }
 
 /* Get map location of a party member. */
-MapCoord Party::get_location(uint8 m) {
+MapCoord Party::get_location(uint8 m) const {
 	return (member[m].actor->get_location());
 }
 
 /* Get map location of the first active party member. */
-MapCoord Party::get_leader_location() {
+MapCoord Party::get_leader_location() const {
 	sint8 m = get_leader();
 	MapCoord loc;
 	if (m >= 0)
@@ -423,7 +423,7 @@ MapCoord Party::get_leader_location() {
 /* Returns absolute location where party member `m' SHOULD be (based on party
  * formation and leader location.
  */
-MapCoord Party::get_formation_coords(uint8 m) {
+MapCoord Party::get_formation_coords(uint8 m) const {
 	MapCoord a = get_location(m); // my location
 	MapCoord l = get_leader_location(); // leader location
 	sint8 leader = get_leader();
@@ -506,7 +506,7 @@ void Party::follow(sint8 rel_x, sint8 rel_y) {
 }
 
 // Returns true if anyone in the party has a matching object.
-bool Party::has_obj(uint16 obj_n, uint8 quality, bool match_zero_qual) {
+bool Party::has_obj(uint16 obj_n, uint8 quality, bool match_zero_qual) const {
 	uint16 i;
 
 	for (i = 0; i < num_in_party; i++) {
@@ -557,7 +557,7 @@ Obj *Party::get_obj(uint16 obj_n, uint8 quality, bool match_qual_zero, uint8 fra
 
 /* Is EVERYONE in the party at or near the coordinates?
  */
-bool Party::is_at(uint16 x, uint16 y, uint8 z, uint32 threshold) {
+bool Party::is_at(uint16 x, uint16 y, uint8 z, uint32 threshold) const {
 	for (uint32 p = 0; p < num_in_party; p++) {
 		MapCoord loc(x, y, z);
 		if (!member[p].actor->is_nearby(loc, threshold))
@@ -566,12 +566,12 @@ bool Party::is_at(uint16 x, uint16 y, uint8 z, uint32 threshold) {
 	return (true);
 }
 
-bool Party::is_at(MapCoord &xyz, uint32 threshold) {
+bool Party::is_at(MapCoord &xyz, uint32 threshold) const {
 	return (is_at(xyz.x, xyz.y, xyz.z, threshold));
 }
 
 /* Is ANYONE in the party at or near the coordinates? */
-bool Party::is_anyone_at(uint16 x, uint16 y, uint8 z, uint32 threshold) {
+bool Party::is_anyone_at(uint16 x, uint16 y, uint8 z, uint32 threshold) const {
 	for (uint32 p = 0; p < num_in_party; p++) {
 		MapCoord loc(x, y, z);
 		if (member[p].actor->is_nearby(loc, threshold))
@@ -580,18 +580,18 @@ bool Party::is_anyone_at(uint16 x, uint16 y, uint8 z, uint32 threshold) {
 	return (false);
 }
 
-bool Party::is_anyone_at(MapCoord &xyz, uint32 threshold) {
+bool Party::is_anyone_at(MapCoord &xyz, uint32 threshold) const {
 	return (is_anyone_at(xyz.x, xyz.y, xyz.z, threshold));
 }
 
-bool Party::contains_actor(Actor *actor) {
+bool Party::contains_actor(const Actor *actor) const {
 	if (get_member_num(actor) >= 0)
 		return (true);
 
 	return (false);
 }
 
-bool Party::contains_actor(uint8 actor_num) {
+bool Party::contains_actor(uint8 actor_num) const {
 	return (contains_actor(actor_manager->get_actor(actor_num)));
 }
 
@@ -902,14 +902,14 @@ bool Party::can_rest(Std::string &err_str) {
 	return false;
 }
 
-bool Party::is_horsed() {
+bool Party::is_horsed() const {
 	for (int p = 0; p < num_in_party; p++)
 		if (member[p].actor->get_obj_n() == OBJ_U6_HORSE_WITH_RIDER)
 			return true;
 	return false;
 }
 
-bool Party::is_everyone_horsed() {
+bool Party::is_everyone_horsed() const {
 	for (int p = 0; p < num_in_party; p++)
 		if (member[p].actor->get_obj_n() != OBJ_U6_HORSE_WITH_RIDER)
 			return false;
diff --git a/engines/ultima/nuvie/core/party.h b/engines/ultima/nuvie/core/party.h
index 8688471fa91..084faf0d675 100644
--- a/engines/ultima/nuvie/core/party.h
+++ b/engines/ultima/nuvie/core/party.h
@@ -139,7 +139,7 @@ public:
 	void cure();
 	void set_ethereal(bool ethereal);
 //void set_active(uint8 member_num, bool state) { member[member_num].inactive = !state; }
-	uint8 get_formation() {
+	uint8 get_formation() const {
 		return formation;    // walking formation
 	}
 	void set_formation(uint8 val) {
@@ -151,44 +151,44 @@ public:
 	virtual uint8 get_party_max() {
 		return (8);    // U6
 	}
-	sint8 get_leader(); // returns -1 if party has no leader and can't move
-	MapCoord get_leader_location();
-	MapCoord get_location(uint8 m = 0);
-	MapCoord get_formation_coords(uint8 m);
+	sint8 get_leader() const; // returns -1 if party has no leader and can't move
+	MapCoord get_leader_location() const;
+	MapCoord get_location(uint8 m = 0) const;
+	MapCoord get_formation_coords(uint8 m) const;
 	void set_in_vehicle(bool value);
 	void set_in_combat_mode(bool value);
-	bool is_in_vehicle() {
+	bool is_in_vehicle() const {
 		return in_vehicle;
 	}
-	bool is_in_combat_mode() {
+	bool is_in_combat_mode() const {
 		return in_combat_mode;
 	}
 	Actor *get_slowest_actor(); // actor with lowest move count
 
 // Check specific actors
-	uint8 get_actor_num(uint8 member_num); //get actor id_n from party_member num.
-	Actor *get_actor(uint8 member_num);
-	sint8 get_member_num(Actor *actor);
-	sint8 get_member_num(uint8 a);
-	Actor *get_leader_actor();
-	char *get_actor_name(uint8 member_num);
-	bool is_leader(Actor *actor) {
+	uint8 get_actor_num(uint8 member_num) const; //get actor id_n from party_member num.
+	Actor *get_actor(uint8 member_num) const;
+	sint8 get_member_num(const Actor *actor) const;
+	sint8 get_member_num(uint8 a) const;
+	Actor *get_leader_actor() const;
+	const char *get_actor_name(uint8 member_num) const;
+	bool is_leader(const Actor *actor) const {
 		return (get_member_num(actor) == get_leader());
 	}
-	bool contains_actor(Actor *actor);
-	bool contains_actor(uint8 actor_num);
+	bool contains_actor(const Actor *actor) const;
+	bool contains_actor(uint8 actor_num) const;
 
 // Check entire party
-	bool is_at(uint16 x, uint16 y, uint8 z, uint32 threshold = 0);
-	bool is_at(MapCoord &xyz, uint32 threshold = 0);
-	bool is_anyone_at(uint16 x, uint16 y, uint8 z, uint32 threshold = 0);
-	bool is_anyone_at(MapCoord &xyz, uint32 threshold = 0);
-	bool has_obj(uint16 obj_n, uint8 quality, bool match_zero_qual = true);
+	bool is_at(uint16 x, uint16 y, uint8 z, uint32 threshold = 0) const;
+	bool is_at(MapCoord &xyz, uint32 threshold = 0) const;
+	bool is_anyone_at(uint16 x, uint16 y, uint8 z, uint32 threshold = 0) const;
+	bool is_anyone_at(MapCoord &xyz, uint32 threshold = 0) const;
+	bool has_obj(uint16 obj_n, uint8 quality, bool match_zero_qual = true) const;
 	bool remove_obj(uint16 obj_n, uint8 quality);
 	Actor *who_has_obj(uint16 obj_n, uint8 quality, bool match_zero_qual = true);
 	Obj *get_obj(uint16 obj_n, uint8 quality, bool match_qual_zero = true, uint8 frame_n = 0, bool match_frame_n = false);
-	bool is_horsed(); // is anyone on a horse?
-	bool is_everyone_horsed();
+	bool is_horsed() const; // is anyone on a horse?
+	bool is_everyone_horsed() const;
 	Obj *get_food(); // used while resting
 
 // Automatic-walking. These methods should be replaced with ActorActions.
diff --git a/engines/ultima/nuvie/core/player.cpp b/engines/ultima/nuvie/core/player.cpp
index 605a86e67a5..2ba46abcddb 100644
--- a/engines/ultima/nuvie/core/player.cpp
+++ b/engines/ultima/nuvie/core/player.cpp
@@ -331,7 +331,7 @@ void Player::moveRelative(sint16 rel_x, sint16 rel_y, bool mouse_movement) {
 			} else if (actor->obj_n == OBJ_U6_RAFT) {
 				uint8 dir = 0;
 				can_change_rel_dir = false;
-				Tile *t = Game::get_game()->get_game_map()->get_tile(x, y, z, true);
+				const Tile *t = Game::get_game()->get_game_map()->get_tile(x, y, z, true);
 				if (t->flags1 & TILEFLAG_BLOCKING) { //deep water tiles are blocking. Shore tiles should allow player movement.
 					//deep water, so take control away from player.
 					if (t->tile_num >= 8 && t->tile_num < 16) {
@@ -429,7 +429,7 @@ void Player::moveRelative(sint16 rel_x, sint16 rel_y, bool mouse_movement) {
 			if (nuvie_dir != NUVIE_DIR_NONE) {
 				sint8 dir = get_original_dir_code(nuvie_dir);
 				sint8 water_dir = dir;
-				Tile *t = Game::get_game()->get_game_map()->get_tile(x, y, z, true);
+				const Tile *t = Game::get_game()->get_game_map()->get_tile(x, y, z, true);
 				if (t->tile_num >= 8 && t->tile_num < 16) {
 					dir = t->tile_num - 8;
 				}
diff --git a/engines/ultima/nuvie/core/tile_manager.cpp b/engines/ultima/nuvie/core/tile_manager.cpp
index 909666d9004..695712422c1 100644
--- a/engines/ultima/nuvie/core/tile_manager.cpp
+++ b/engines/ultima/nuvie/core/tile_manager.cpp
@@ -650,14 +650,14 @@ void TileManager::set_anim_first_frame(uint16 anim_number, uint16 new_start_tile
  * **Fixed-point rotate function taken from the SDL Graphics Extension library
  * (SGE) (c)1999-2003 Anders Lindstr�m, licensed under LGPL v2+.**
  */
-Tile *TileManager::get_rotated_tile(Tile *tileP, float rotate, uint8 src_y_offset) {
+Tile *TileManager::get_rotated_tile(const Tile *tileP, float rotate, uint8 src_y_offset) {
 	Tile *new_tile = new Tile(*tileP); // retain properties of original tileP
 	get_rotated_tile(tileP, new_tile, rotate, src_y_offset);
 
 	return new_tile;
 }
 
-void TileManager::get_rotated_tile(Tile *tileP, Tile *dest_tile, float rotate, uint8 src_y_offset) {
+void TileManager::get_rotated_tile(const Tile *tileP, Tile *dest_tile, float rotate, uint8 src_y_offset) {
 	unsigned char tile_data[256];
 
 	memset(&dest_tile->data, 255, 256); // fill output with transparent color
diff --git a/engines/ultima/nuvie/core/tile_manager.h b/engines/ultima/nuvie/core/tile_manager.h
index a0de5c57c26..2f9c6035441 100644
--- a/engines/ultima/nuvie/core/tile_manager.h
+++ b/engines/ultima/nuvie/core/tile_manager.h
@@ -191,8 +191,8 @@ public:
 	void anim_stop_playing(uint8 anim_index);
 
 
-	Tile *get_rotated_tile(Tile *tile, float rotate, uint8 src_y_offset = 0);
-	void get_rotated_tile(Tile *tile, Tile *dest_tile, float rotate, uint8 src_y_offset = 0);
+	Tile *get_rotated_tile(const Tile *tile, float rotate, uint8 src_y_offset = 0);
+	void get_rotated_tile(const Tile *tile, Tile *dest_tile, float rotate, uint8 src_y_offset = 0);
 
 	Tile *get_cursor_tile();
 	Tile *get_use_tile();
diff --git a/engines/ultima/nuvie/core/weather.cpp b/engines/ultima/nuvie/core/weather.cpp
index d186d43f9f6..b2af1cc2f2a 100644
--- a/engines/ultima/nuvie/core/weather.cpp
+++ b/engines/ultima/nuvie/core/weather.cpp
@@ -153,14 +153,14 @@ bool Weather::save_wind(NuvieIO *objlist) {
 	return true;
 }
 
-bool Weather::is_eclipse() {
+bool Weather::is_eclipse() const {
 	if (gametype != NUVIE_GAME_U6 || clock->get_timer(GAMECLOCK_TIMER_U6_ECLIPSE) == 0)
 		return false;
 
 	return true;
 }
 
-bool Weather::is_moon_visible() {
+bool Weather::is_moon_visible() const {
 	//FIXME this is duplicated logic. Maybe we should look at how the original works out moon locations
 
 	uint8 day = clock->get_day();
@@ -184,17 +184,14 @@ bool Weather::is_moon_visible() {
 	return false;
 }
 
-string Weather::get_wind_dir_str() {
-	string s;
+string Weather::get_wind_dir_str() const {
 	if (display_from_wind_dir) {
 		const char from_names[9][3] = {"N", "E", "S", "W", "NE", "SE", "SW", "NW", "C"};
-		s = from_names[wind_dir];
+		return from_names[wind_dir];
 	} else {
 		const char to_names[9][3] = {"S", "W", "N", "E", "SW", "NW", "NE", "SE", "C"};
-		s = to_names[wind_dir];
+		return to_names[wind_dir];
 	}
-
-	return s;
 }
 
 void Weather::change_wind_dir() {
diff --git a/engines/ultima/nuvie/core/weather.h b/engines/ultima/nuvie/core/weather.h
index d4a9025e17a..9878c7dce1a 100644
--- a/engines/ultima/nuvie/core/weather.h
+++ b/engines/ultima/nuvie/core/weather.h
@@ -62,11 +62,11 @@ public:
 	bool load(NuvieIO *objlist);
 	bool save(NuvieIO *objlist);
 
-	Std::string get_wind_dir_str();
-	uint8 get_wind_dir() {
+	Std::string get_wind_dir_str() const;
+	uint8 get_wind_dir() const {
 		return wind_dir;
 	}
-	bool is_displaying_from_wind_dir() {
+	bool is_displaying_from_wind_dir() const {
 		return display_from_wind_dir;
 	}
 	bool set_wind_dir(uint8 new_wind_dir);
@@ -75,8 +75,8 @@ public:
 	MapCoord get_moonstone(uint8 moonstone);
 	void update_moongates();
 
-	bool is_eclipse();
-	bool is_moon_visible();
+	bool is_eclipse() const;
+	bool is_moon_visible() const;
 
 	uint16 callback(uint16 msg, CallBack *caller, void *data = nullptr) override;
 
diff --git a/engines/ultima/nuvie/files/nuvie_bmp_file.h b/engines/ultima/nuvie/files/nuvie_bmp_file.h
index fcad415b32d..c6723290212 100644
--- a/engines/ultima/nuvie/files/nuvie_bmp_file.h
+++ b/engines/ultima/nuvie/files/nuvie_bmp_file.h
@@ -72,10 +72,10 @@ public:
 	bool load(Std::string filename);
 	bool save(Std::string filename);
 
-	uint16 getWidth() {
+	uint16 getWidth() const {
 		return (uint16)infoHeader.width;
 	}
-	uint16 getHeight() {
+	uint16 getHeight() const {
 		return (uint16)infoHeader.height;
 	}
 
diff --git a/engines/ultima/nuvie/files/nuvie_file_list.cpp b/engines/ultima/nuvie/files/nuvie_file_list.cpp
index 6f78bb466c4..ab0b7af7769 100644
--- a/engines/ultima/nuvie/files/nuvie_file_list.cpp
+++ b/engines/ultima/nuvie/files/nuvie_file_list.cpp
@@ -56,7 +56,6 @@ bool NuvieFileList::open(const char *directory, const char *search, uint8 s_mode
 
 	//sort list by time last modified in decending order.
 	Common::sort(file_list.begin(), file_list.end(), NuvieFileDesc());
-	list_ptr = file_list.begin();
 
 	return true;
 }
@@ -71,33 +70,19 @@ bool NuvieFileList::add_filename(const Common::FSNode &file) {
 	return true;
 }
 
-Std::string *NuvieFileList::next() {
-	if (list_ptr != file_list.end()) {
-
-		Std::string *filename = &((*list_ptr).filename);
-		list_ptr++;
-
-		return filename;
-	}
-
-	return nullptr;
-}
-
-Std::string *NuvieFileList::get_latest() {
-	Std::list<NuvieFileDesc>::iterator iter;
+const Std::string *NuvieFileList::get_latest() const {
+	Std::list<NuvieFileDesc>::const_iterator iter;
 
 	iter = file_list.begin();
 
 	if (iter != file_list.end()) {
-		Std::string *filename = &((*iter).filename);
-
-		return filename;
+		return &((*iter).filename);
 	}
 
 	return nullptr;
 }
 
-uint32 NuvieFileList::get_num_files() {
+uint32 NuvieFileList::get_num_files() const {
 	return (uint32)file_list.size();
 }
 
@@ -105,9 +90,9 @@ void NuvieFileList::close() {
 	return;
 }
 
-Std::set<Std::string> NuvieFileList::get_filenames() {
+Std::set<Std::string> NuvieFileList::get_filenames() const {
 	Std::set<Std::string> filenames;
-	Std::list<NuvieFileDesc>::iterator iter = file_list.begin();
+	Std::list<NuvieFileDesc>::const_iterator iter = file_list.begin();
 
 	while (iter != file_list.end()) {
 		filenames.insert((*iter).filename);
diff --git a/engines/ultima/nuvie/files/nuvie_file_list.h b/engines/ultima/nuvie/files/nuvie_file_list.h
index 2fb54a059de..ea58cb23e47 100644
--- a/engines/ultima/nuvie/files/nuvie_file_list.h
+++ b/engines/ultima/nuvie/files/nuvie_file_list.h
@@ -55,7 +55,6 @@ public:
 class NuvieFileList {
 protected:
 	Std::list<NuvieFileDesc> file_list;
-	Std::list<NuvieFileDesc>::iterator list_ptr;
 
 	Std::string search_prefix;
 	uint8 sort_mode;
@@ -68,12 +67,11 @@ public:
 
 	bool open(const char *directory, const char *restrict, uint8 sort_mode);
 
-
 	Std::string *next();
-	Std::string *get_latest();
-	uint32 get_num_files();
+	const Std::string *get_latest() const;
+	uint32 get_num_files() const;
 
-	Std::set<Std::string> get_filenames();
+	Std::set<Std::string> get_filenames() const;
 
 	void close();
 };
diff --git a/engines/ultima/nuvie/gui/gui_text_input.h b/engines/ultima/nuvie/gui/gui_text_input.h
index c3c80e3ac2c..c601115d781 100644
--- a/engines/ultima/nuvie/gui/gui_text_input.h
+++ b/engines/ultima/nuvie/gui/gui_text_input.h
@@ -57,7 +57,7 @@ public:
 	void add_char(char c);
 	void remove_char();
 	void set_text(const char *new_text);
-	char *get_text() {
+	const char *get_text() {
 		return text;
 	}
 	void SetDisplay(Screen *s) override;
diff --git a/engines/ultima/nuvie/gui/widgets/background.h b/engines/ultima/nuvie/gui/widgets/background.h
index 951c4e8cd0c..7ff7757f7f9 100644
--- a/engines/ultima/nuvie/gui/widgets/background.h
+++ b/engines/ultima/nuvie/gui/widgets/background.h
@@ -44,7 +44,7 @@ public:
 	~Background() override;
 
 	bool init();
-	uint16 get_border_width() {
+	uint16 get_border_width() const {
 		return border_width;
 	}
 	void Display(bool full_redraw) override;
@@ -53,7 +53,7 @@ public:
 	U6Shape *get_bg_shape() {
 		return background;
 	}
-	uint16 get_bg_w() {
+	uint16 get_bg_w() const {
 		return bg_w;
 	}
 };
diff --git a/engines/ultima/nuvie/gui/widgets/command_bar.h b/engines/ultima/nuvie/gui/widgets/command_bar.h
index e6be4cb18aa..05ff4be146a 100644
--- a/engines/ultima/nuvie/gui/widgets/command_bar.h
+++ b/engines/ultima/nuvie/gui/widgets/command_bar.h
@@ -85,7 +85,7 @@ public:
 		update_display = true;
 	}
 	bool try_selected_action(sint8 command_num = -1);
-	sint8 get_selected_action() {
+	sint8 get_selected_action() const {
 		return selected_action;
 	}
 
diff --git a/engines/ultima/nuvie/gui/widgets/command_bar_new_ui.cpp b/engines/ultima/nuvie/gui/widgets/command_bar_new_ui.cpp
index 4b5a13b67fe..ff8f47407bc 100644
--- a/engines/ultima/nuvie/gui/widgets/command_bar_new_ui.cpp
+++ b/engines/ultima/nuvie/gui/widgets/command_bar_new_ui.cpp
@@ -263,7 +263,7 @@ void CommandBarNewUI::Display(bool full_redraw) {
 	//  }
 }
 
-const char *CommandBarNewUI::get_command_name(sint8 command_num) {
+const char *CommandBarNewUI::get_command_name(sint8 command_num) const {
 	if (command_num < 0 || command_num >= num_icons)
 		return "";
 
diff --git a/engines/ultima/nuvie/gui/widgets/command_bar_new_ui.h b/engines/ultima/nuvie/gui/widgets/command_bar_new_ui.h
index 5b061dd6b7a..7d87eb9ff79 100644
--- a/engines/ultima/nuvie/gui/widgets/command_bar_new_ui.h
+++ b/engines/ultima/nuvie/gui/widgets/command_bar_new_ui.h
@@ -57,7 +57,7 @@ public:
 	GUI_status MouseUp(int x, int y, Shared::MouseButton button) override;
 
 private:
-	const char *get_command_name(sint8 command_num);
+	const char *get_command_name(sint8 command_num) const;
 };
 
 } // End of namespace Nuvie
diff --git a/engines/ultima/nuvie/gui/widgets/converse_gump.cpp b/engines/ultima/nuvie/gui/widgets/converse_gump.cpp
index 0e776596c3b..081fa330d2e 100644
--- a/engines/ultima/nuvie/gui/widgets/converse_gump.cpp
+++ b/engines/ultima/nuvie/gui/widgets/converse_gump.cpp
@@ -328,7 +328,7 @@ void ConverseGump::add_token(MsgText *token)
 }
 */
 
-void ConverseGump::display_string(Std::string s, Font *f,  bool include_on_map_window) {
+void ConverseGump::display_string(const Std::string &s, Font *f,  bool include_on_map_window) {
 	if (s.empty())
 		return;
 
@@ -433,8 +433,8 @@ void ConverseGump::parse_fm_towns_token(MsgText *token) {
 	return;
 }
 
-void ConverseGump::add_keyword(Std::string keyword) {
-	keyword = " *" + keyword;
+void ConverseGump::add_keyword(const Std::string keyword_) {
+	string keyword = " *" + keyword_;
 
 	Std::list<MsgText>::iterator iter;
 	for (iter = keyword_list->begin(); iter != keyword_list->end(); iter++) {
@@ -750,7 +750,7 @@ void ConverseGump::input_add_string(Std::string token_str) {
 	}
 }
 
-bool ConverseGump::is_permanent_keyword(Std::string keyword) {
+bool ConverseGump::is_permanent_keyword(const Std::string &keyword) {
 	return (string_i_compare(keyword, " *buy") || string_i_compare(keyword, " *sell")
 	        || string_i_compare(keyword, " *bye") || string_i_compare(keyword, " *spells")
 	        || string_i_compare(keyword, " *reagents"));
diff --git a/engines/ultima/nuvie/gui/widgets/converse_gump.h b/engines/ultima/nuvie/gui/widgets/converse_gump.h
index aaf7d057731..57a55e44d08 100644
--- a/engines/ultima/nuvie/gui/widgets/converse_gump.h
+++ b/engines/ultima/nuvie/gui/widgets/converse_gump.h
@@ -71,7 +71,7 @@ public:
 	unsigned char *create_framed_portrait(Actor *a);
 	bool parse_token(MsgText *token) override;
 	Std::string get_token_string_at_pos(uint16 x, uint16 y) override;
-	void display_string(Std::string s, Font *f, bool include_on_map_window) override;
+	void display_string(const Std::string &s, Font *f, bool include_on_map_window) override;
 	void set_talking(bool state, Actor *actor = nullptr) override;
 	void set_font(uint8 font_type) override {}
 //bool get_solid_bg() { return solid_bg; }
@@ -129,7 +129,7 @@ protected:
 	void set_permitted_input(const char *allowed) override;
 	void clear_permitted_input() override;
 
-	bool cursor_at_input_section() {
+	bool cursor_at_input_section() const {
 		return (keyword_list && cursor_position == keyword_list->size());
 	}
 	void cursor_reset() {
@@ -143,7 +143,7 @@ protected:
 
 	Std::string get_token_at_cursor();
 
-	bool is_permanent_keyword(Std::string keyword);
+	bool is_permanent_keyword(const Std::string &keyword);
 	void parse_fm_towns_token(MsgText *token);
 
 private:
diff --git a/engines/ultima/nuvie/gui/widgets/converse_gump_wou.h b/engines/ultima/nuvie/gui/widgets/converse_gump_wou.h
index 9d4b6750d48..4a26a645909 100644
--- a/engines/ultima/nuvie/gui/widgets/converse_gump_wou.h
+++ b/engines/ultima/nuvie/gui/widgets/converse_gump_wou.h
@@ -96,7 +96,7 @@ protected:
 
 	void input_add_string(Std::string token_str);
 	void process_page_break() override;
-	uint8 get_input_font_color() override {
+	uint8 get_input_font_color() const override {
 		return FONT_COLOR_WOU_CONVERSE_INPUT;
 	}
 	void display_bg();
diff --git a/engines/ultima/nuvie/gui/widgets/gui_widget.h b/engines/ultima/nuvie/gui/widgets/gui_widget.h
index 14b698a2acc..32aaa0e8df2 100644
--- a/engines/ultima/nuvie/gui/widgets/gui_widget.h
+++ b/engines/ultima/nuvie/gui/widgets/gui_widget.h
@@ -100,7 +100,7 @@ public:
 	virtual void MoveRelative(int dx, int dy);
 	virtual void Move(int32 new_x, int32 new_y);
 	void MoveRelativeToParent(int dx, int dy);
-	bool has_focus() {
+	bool has_focus() const {
 		return focused;
 	}
 	void grab_focus();
@@ -122,16 +122,16 @@ public:
 	}
 
 	/* Return the bounds of the widget */
-	virtual int X() {
+	virtual int X() const {
 		return area.left;
 	}
-	virtual int Y() {
+	virtual int Y() const {
 		return area.top;
 	}
-	virtual int W() {
+	virtual int W() const {
 		return area.width();
 	}
-	virtual int H() {
+	virtual int H() const {
 		return area.height();
 	}
 
@@ -154,7 +154,7 @@ public:
 	virtual void Redraw(void);
 
 	/* should this widget be redrawn */
-	inline bool needs_redraw() {
+	inline bool needs_redraw() const {
 		return update_display;
 	}
 	/* widget has focus or no widget is focused */
@@ -226,11 +226,11 @@ protected:
 	void set_accept_mouseclick(bool set, int button = 0);
 	void set_mouseup(int set, int button = 0);
 	void set_mousedown(int set, int button = 0);
-	int get_mouseup(int button)  {
+	int get_mouseup(int button) const {
 		if (button > 0 && button < 4) return (mouseup[button - 1]);
 		else return (0);
 	}
-	int get_mousedown(int button) {
+	int get_mousedown(int button) const {
 		if (button > 0 && button < 4) return (mousedown[button - 1]);
 		else return (0);
 	}
diff --git a/engines/ultima/nuvie/gui/widgets/map_window.cpp b/engines/ultima/nuvie/gui/widgets/map_window.cpp
index d3052639ed9..8f75f94dc8d 100644
--- a/engines/ultima/nuvie/gui/widgets/map_window.cpp
+++ b/engines/ultima/nuvie/gui/widgets/map_window.cpp
@@ -1341,15 +1341,12 @@ void MapWindow::drawGrid() {
 }
 
 void MapWindow::generateTmpMap() {
-	byte *map_ptr;
-	uint16 pitch;
 	uint16 x, y;
-	Tile *tile;
 
 	m_ViewableMapTiles.clear();
 
-	map_ptr = map->get_map_data(cur_level);
-	pitch = map->get_width(cur_level);
+	const byte *map_ptr = map->get_map_data(cur_level);
+	uint16 pitch = map->get_width(cur_level);
 
 	if (enable_blacking == false) {
 		uint16 *ptr = tmp_map_buf;
@@ -1388,7 +1385,7 @@ void MapWindow::generateTmpMap() {
 //fills correctly. We move east for vertical wall tiles and south for
 //horizontal wall tiles.
 	if (game_type == NUVIE_GAME_U6 && obj_manager->is_boundary(x, y, cur_level)) {
-		tile = obj_manager->get_obj_tile(x, y, cur_level, false);
+		const Tile *tile = obj_manager->get_obj_tile(x, y, cur_level, false);
 		if ((tile->flags1 & TILEFLAG_WALL_MASK) == (TILEFLAG_WALL_NORTH | TILEFLAG_WALL_SOUTH))
 			x = WRAPPED_COORD(x + 1, cur_level);
 		else
@@ -1404,7 +1401,7 @@ void MapWindow::generateTmpMap() {
 		roof_display = ROOF_DISPLAY_OFF; // hide roof if a building's floor is showing.
 }
 
-void MapWindow::boundaryFill(byte *map_ptr, uint16 pitch, uint16 x, uint16 y) {
+void MapWindow::boundaryFill(const byte *map_ptr, uint16 pitch, uint16 x, uint16 y) {
 	unsigned char current;
 	uint16 *ptr;
 	uint16 pos;
@@ -1489,7 +1486,7 @@ bool MapWindow::floorTilesVisible() {
 	for (; cY != eY;) {
 		for (; cX != eX;) {
 			if (map->has_roof(cX, cY, cur_level) && !map->is_boundary(cX, cY, cur_level)) {
-				Tile *t = obj_manager->get_obj_tile(cX, cY, cur_level, false);
+				const Tile *t = obj_manager->get_obj_tile(cX, cY, cur_level, false);
 				if (t && (t->flags1 & TILEFLAG_WALL))
 					return true;
 			}
@@ -1647,15 +1644,13 @@ bool MapWindow::tmpBufTileIsBoundary(uint16 x, uint16 y) {
 }
 
 bool MapWindow::tmpBufTileIsWall(uint16 x, uint16 y, uint8 direction) {
-	uint16 tile_num;
-	Tile *tile;
-	uint8 mask = 0;
 
-	tile_num = tmp_map_buf[y * tmp_map_width + x];
+	uint16 tile_num = tmp_map_buf[y * tmp_map_width + x];
 
 	if (tile_num == 0)
 		return false;
 
+	uint8 mask = 0;
 	switch (direction) {
 	case NUVIE_DIR_N :
 		mask = TILEFLAG_WALL_SOUTH;
@@ -1671,7 +1666,7 @@ bool MapWindow::tmpBufTileIsWall(uint16 x, uint16 y, uint8 direction) {
 		break;
 	}
 
-	tile = tile_manager->get_tile(tile_num);
+	const Tile *tile = tile_manager->get_tile(tile_num);
 
 	if (tile->flags1 & TILEFLAG_WALL) {
 		if (tile->flags1 & mask)
@@ -1771,7 +1766,7 @@ CanDropOrMoveMsg MapWindow::can_drop_or_move_obj(uint16 x, uint16 y, Actor *acto
 			return MSG_BLOCKED;
 		}
 	}
-	Tile *tile;
+	const Tile *tile;
 	if (dest_obj)
 		tile = obj_manager->get_obj_tile(dest_obj->obj_n, dest_obj->frame_n);
 	else
@@ -1834,7 +1829,7 @@ bool MapWindow::can_get_obj(Actor *actor, Obj *obj) {
 bool MapWindow::blocked_by_wall(Actor *actor, Obj *obj) {
 	if (game_type == NUVIE_GAME_U6 && obj->x == 282 && obj->y == 438 && cur_level == 0) // HACK for buggy location
 		return false;
-	Tile *tile = map->get_tile(obj->x, obj->y, cur_level);
+	const Tile *tile = map->get_tile(obj->x, obj->y, cur_level);
 	if (((tile->flags1 & TILEFLAG_WALL) && !game->get_usecode()->is_door(obj))
 	        && (((tile->flags1 & TILEFLAG_WALL_MASK) == 208 && actor->get_y() < obj->y) // can't get items that are south
 	            || ((tile->flags1 & TILEFLAG_WALL_MASK) == 176 && actor->get_x() < obj->x) // can't get items that are east
diff --git a/engines/ultima/nuvie/gui/widgets/map_window.h b/engines/ultima/nuvie/gui/widgets/map_window.h
index 66308c7a8bd..b59bbb70f31 100644
--- a/engines/ultima/nuvie/gui/widgets/map_window.h
+++ b/engines/ultima/nuvie/gui/widgets/map_window.h
@@ -353,7 +353,7 @@ protected:
 
 	void updateLighting();
 	void generateTmpMap();
-	void boundaryFill(unsigned char *map_ptr, uint16 pitch, uint16 x, uint16 y);
+	void boundaryFill(const byte *map_ptr, uint16 pitch, uint16 x, uint16 y);
 	bool floorTilesVisible();
 	bool boundaryLookThroughWindow(uint16 tile_num, uint16 x, uint16 y);
 
diff --git a/engines/ultima/nuvie/gui/widgets/msg_scroll.cpp b/engines/ultima/nuvie/gui/widgets/msg_scroll.cpp
index cc5535a8116..15a95b571ff 100644
--- a/engines/ultima/nuvie/gui/widgets/msg_scroll.cpp
+++ b/engines/ultima/nuvie/gui/widgets/msg_scroll.cpp
@@ -351,23 +351,23 @@ void MsgScroll::display_fmt_string(const char *format, ...) {
 	display_string(buf);
 }
 
-void MsgScroll::display_string(Std::string s, uint16 length, uint8 lang_num) {
+void MsgScroll::display_string(const Std::string &s, uint16 length, uint8 lang_num) {
 
 }
 
-void MsgScroll::display_string(Std::string s, bool include_on_map_window) {
+void MsgScroll::display_string(const Std::string &s, bool include_on_map_window) {
 	display_string(s, font, include_on_map_window);
 }
 
-void MsgScroll::display_string(Std::string s, uint8 color, bool include_on_map_window) {
+void MsgScroll::display_string(const Std::string &s, uint8 color, bool include_on_map_window) {
 	display_string(s, font, color, include_on_map_window);
 }
 
-void MsgScroll::display_string(Std::string s, Font *f, bool include_on_map_window) {
+void MsgScroll::display_string(const Std::string &s, Font *f, bool include_on_map_window) {
 	display_string(s, f, font_color, include_on_map_window);
 }
 
-void MsgScroll::display_string(Std::string s, Font *f, uint8 color, bool include_on_map_window) {
+void MsgScroll::display_string(const Std::string &s, Font *f, uint8 color, bool include_on_map_window) {
 	MsgText *msg_text;
 
 	if (s.empty())
diff --git a/engines/ultima/nuvie/gui/widgets/msg_scroll.h b/engines/ultima/nuvie/gui/widgets/msg_scroll.h
index 7d151037875..823b5e72c55 100644
--- a/engines/ultima/nuvie/gui/widgets/msg_scroll.h
+++ b/engines/ultima/nuvie/gui/widgets/msg_scroll.h
@@ -183,10 +183,10 @@ public:
 	void process_holding_buffer();
 
 	MsgText *holding_buffer_get_token();
-	bool is_holding_buffer_empty() {
+	bool is_holding_buffer_empty() const {
 		return holding_buffer.empty();
 	}
-	virtual bool can_display_prompt() {
+	virtual bool can_display_prompt() const {
 		return (!just_displayed_prompt);
 	}
 
@@ -200,11 +200,11 @@ public:
 	template<class... TParam>
 	int print(const Std::string &format, TParam... param);
 
-	virtual void display_string(Std::string s, Font *f, bool include_on_map_window);
-	void display_string(Std::string s, Font *f, uint8 color, bool include_on_map_window);
-	void display_string(Std::string s, uint16 length, uint8 lang_num);
-	void display_string(Std::string s, bool include_on_map_window = true);
-	void display_string(Std::string s, uint8 color, bool include_on_map_window);
+	virtual void display_string(const Std::string &s, Font *f, bool include_on_map_window);
+	void display_string(const Std::string &s, Font *f, uint8 color, bool include_on_map_window);
+	void display_string(const Std::string &s, uint16 length, uint8 lang_num);
+	void display_string(const Std::string &s, bool include_on_map_window = true);
+	void display_string(const Std::string &s, uint8 color, bool include_on_map_window);
 	void display_fmt_string(const char *format, ...);
 	void message(const char *string) {
 		display_string(string);
@@ -224,7 +224,7 @@ public:
 		talking = state;
 		input_char = 0;
 	}
-	bool is_talking() {
+	bool is_talking() const {
 		return talking;
 	}
 	void set_show_cursor(bool state) {
@@ -238,7 +238,7 @@ public:
 		discard_whitespace = discard;
 	}
 
-	bool get_page_break() {
+	bool get_page_break() const {
 		return (page_break);
 	}
 
@@ -285,7 +285,7 @@ protected:
 	void increase_input_char();
 	void decrease_input_char();
 	uint8 get_char_from_input_char();
-	virtual uint8 get_input_font_color() {
+	virtual uint8 get_input_font_color() const {
 		return font_color;
 	}
 
diff --git a/engines/ultima/nuvie/gui/widgets/msg_scroll_new_ui.cpp b/engines/ultima/nuvie/gui/widgets/msg_scroll_new_ui.cpp
index 681c0967982..560e7e17920 100644
--- a/engines/ultima/nuvie/gui/widgets/msg_scroll_new_ui.cpp
+++ b/engines/ultima/nuvie/gui/widgets/msg_scroll_new_ui.cpp
@@ -99,11 +99,11 @@ bool MsgScrollNewUI::can_fit_token_on_msgline(MsgLine *msg_line, MsgText *token)
 	return true;
 }
 
-void MsgScrollNewUI::display_string(Std::string s, Font *f, bool include_on_map_window) {
-	if (s.empty())
+void MsgScrollNewUI::display_string(const Std::string &str, Font *f, bool include_on_map_window) {
+	if (str.empty())
 		return;
 	bool has_trailing_whitespace = (!trailing_whitespace.empty());
-	s = trailing_whitespace + s;
+	string s = trailing_whitespace + str;
 	trailing_whitespace.clear();
 
 	Std::string::reverse_iterator iter;
diff --git a/engines/ultima/nuvie/gui/widgets/msg_scroll_new_ui.h b/engines/ultima/nuvie/gui/widgets/msg_scroll_new_ui.h
index 72e7d51786a..1722495242f 100644
--- a/engines/ultima/nuvie/gui/widgets/msg_scroll_new_ui.h
+++ b/engines/ultima/nuvie/gui/widgets/msg_scroll_new_ui.h
@@ -67,7 +67,7 @@ public:
 		return GUI_PASS;
 	}
 	uint16 callback(uint16 msg, CallBack *caller, void *data) override;
-	bool can_display_prompt() override {
+	bool can_display_prompt() const override {
 		return false;
 	}
 
@@ -77,7 +77,7 @@ public:
 
 	void display_prompt() override {}
 
-	void display_string(Std::string s, Font *f, bool include_on_map_window) override;
+	void display_string(const Std::string &s, Font *f, bool include_on_map_window) override;
 
 	void set_font(uint8 font_type) override;
 	bool is_garg_font() override;
diff --git a/engines/ultima/nuvie/misc/u6_list.cpp b/engines/ultima/nuvie/misc/u6_list.cpp
index f9f07526605..2fef4ba5cee 100644
--- a/engines/ultima/nuvie/misc/u6_list.cpp
+++ b/engines/ultima/nuvie/misc/u6_list.cpp
@@ -53,7 +53,6 @@ inline void deleteU6Link(U6Link *link) {
 U6LList::U6LList() {
 	head = nullptr;
 	tail = nullptr;
-	cur = nullptr;
 }
 
 U6LList::~U6LList() {
@@ -200,14 +199,13 @@ bool U6LList::removeAll() {
 
 	head = nullptr;
 	tail = nullptr;
-	cur = nullptr;
 
 	return true;
 }
 
 
 
-uint32 U6LList::count() {
+uint32 U6LList::count() const {
 	uint32 i;
 	U6Link *link;
 
@@ -219,33 +217,19 @@ uint32 U6LList::count() {
 }
 
 U6Link *U6LList::start() {
-	cur = head;
-
-	return cur;
+	return head;
 }
 
 U6Link *U6LList::end() {
-	cur = tail;
-
-	return cur;
+	return tail;
 }
 
-U6Link *U6LList::next() {
-	if (cur == tail)
-		return nullptr;
-
-	cur = cur->next;
-
-	return cur;
+const U6Link *U6LList::start() const {
+	return head;
 }
 
-U6Link *U6LList::prev() {
-	if (cur == head)
-		return nullptr;
-
-	cur = cur->prev;
-
-	return cur;
+const U6Link *U6LList::end() const {
+	return tail;
 }
 
 U6Link *U6LList::gotoPos(uint32 pos) {
diff --git a/engines/ultima/nuvie/misc/u6_llist.h b/engines/ultima/nuvie/misc/u6_llist.h
index 64471a6fec7..492614f4cf0 100644
--- a/engines/ultima/nuvie/misc/u6_llist.h
+++ b/engines/ultima/nuvie/misc/u6_llist.h
@@ -46,7 +46,6 @@ void releaseU6Link(U6Link *link);
 class U6LList {
 	U6Link *head;
 	U6Link *tail;
-	U6Link *cur;
 
 public:
 
@@ -62,13 +61,13 @@ public:
 	bool remove(void *data);
 	bool removeAll();
 
-	uint32 count();
+	uint32 count() const;
 
 	U6Link *start();
 	U6Link *end();
+	const U6Link *start() const;
+	const U6Link *end() const;
 
-	U6Link *next();
-	U6Link *prev();
 	U6Link *gotoPos(uint32 pos);
 };
 
diff --git a/engines/ultima/nuvie/pathfinder/actor_path_finder.cpp b/engines/ultima/nuvie/pathfinder/actor_path_finder.cpp
index 7048099213f..116b3cfd24d 100644
--- a/engines/ultima/nuvie/pathfinder/actor_path_finder.cpp
+++ b/engines/ultima/nuvie/pathfinder/actor_path_finder.cpp
@@ -102,7 +102,7 @@ bool ActorPathFinder::search_towards_target(const MapCoord &g, MapCoord &rel_ste
 }
 
 // check rotated dir, and copy results to rel_step if neighbor is passable
-bool ActorPathFinder::check_dir_and_distance(MapCoord mapLoc, MapCoord g, MapCoord &rel_step, sint8 rotate) {
+bool ActorPathFinder::check_dir_and_distance(const MapCoord &mapLoc, const MapCoord &g, MapCoord &rel_step, sint8 rotate) {
 	MapCoord rel_step_2 = rel_step;
 	if (check_dir(mapLoc, rel_step_2, rotate)) {
 		MapCoord neighbor = mapLoc.abs_coords(rel_step_2.sx, rel_step_2.sy);
diff --git a/engines/ultima/nuvie/pathfinder/actor_path_finder.h b/engines/ultima/nuvie/pathfinder/actor_path_finder.h
index b4b6d1c3a69..d0a7b0076c5 100644
--- a/engines/ultima/nuvie/pathfinder/actor_path_finder.h
+++ b/engines/ultima/nuvie/pathfinder/actor_path_finder.h
@@ -51,7 +51,7 @@ public:
 protected:
 	bool search_towards_target(const MapCoord &g, MapCoord &rel_step);
 	bool check_dir(const MapCoord &loc, MapCoord &rel, sint8 rot = 0) override;
-	bool check_dir_and_distance(MapCoord loc, MapCoord g, MapCoord &rel_step, sint8 rotate);
+	bool check_dir_and_distance(const MapCoord &loc, const MapCoord &g, MapCoord &rel_step, sint8 rotate);
 };
 
 } // End of namespace Nuvie
diff --git a/engines/ultima/nuvie/pathfinder/astar_path.cpp b/engines/ultima/nuvie/pathfinder/astar_path.cpp
index 0d7c083100d..1d4d175ef18 100644
--- a/engines/ultima/nuvie/pathfinder/astar_path.cpp
+++ b/engines/ultima/nuvie/pathfinder/astar_path.cpp
@@ -68,7 +68,7 @@ bool AStarPath::compare_neighbors(astar_node *nnode, astar_node *neighbor,
 	}
 	return true;
 }/* Check all neighbors of a node (location) and save them to the "seen" list. */
-bool AStarPath::search_node_neighbors(astar_node *nnode, MapCoord &goal,
+bool AStarPath::search_node_neighbors(astar_node *nnode, const MapCoord &goal,
 									  const uint32 max_score) {
 	for (uint32 dir = 1; dir < 8; dir += 2) {
 		astar_node *neighbor = new astar_node;
@@ -94,12 +94,15 @@ bool AStarPath::search_node_neighbors(astar_node *nnode, MapCoord &goal,
 			push_open_node(neighbor);
 	}
 	return true;
-}/* Do A* search of tiles to create a path from `start' to `goal'.
+}
+
+/* Do A* search of tiles to create a path from `start' to `goal'.
  * Don't search past nodes with a score over the max. score.
  * Create a partial path to low-score nodes with a distance-to-start over the
  * max_steps count, defined here. Actor may perform another search when needed.
  * Returns true if a path is created
- */bool AStarPath::path_search(MapCoord &start, MapCoord &goal) {
+ */
+bool AStarPath::path_search(const MapCoord &start, const MapCoord &goal) {
 	//DEBUG(0,LEVEL_DEBUGGING,"SEARCH: %d: %d,%d -> %d,%d\n",actor->get_actor_num(),start.x,start.y,goal.x,goal.y);
 	astar_node *start_node = new astar_node;
 	start_node->loc = start;
@@ -132,7 +135,7 @@ bool AStarPath::search_node_neighbors(astar_node *nnode, MapCoord &goal,
 }/* Return the cost of moving one step from `c1' to `c2', which is always 1. This
  * isn't very helpful, so subclasses should provide their own function.
  * Returns -1 if c2 is blocked. */
-sint32 AStarPath::step_cost(MapCoord &c1, MapCoord &c2) {
+sint32 AStarPath::step_cost(const MapCoord &c1, const MapCoord &c2) {
 	if (!pf->check_loc(c2.x, c2.y, c2.z)
 	        || c2.distance(c1) > 1)
 		return (-1);
diff --git a/engines/ultima/nuvie/pathfinder/astar_path.h b/engines/ultima/nuvie/pathfinder/astar_path.h
index d9c77f60862..c714c1834a6 100644
--- a/engines/ultima/nuvie/pathfinder/astar_path.h
+++ b/engines/ultima/nuvie/pathfinder/astar_path.h
@@ -46,7 +46,7 @@ protected:
 	/* Forms a usable path from results of a search. */
 	void create_path();
 	/* Search routine. */
-	bool search_node_neighbors(astar_node *nnode, MapCoord &goal, const uint32 max_score);
+	bool search_node_neighbors(astar_node *nnode, const MapCoord &goal, const uint32 max_score);
 	bool compare_neighbors(astar_node *nnode, astar_node *neighbor,
 	                       sint32 nnode_to_neighbor, astar_node *in_open,
 	                       astar_node *in_closed);
@@ -55,17 +55,17 @@ protected:
 public:
 	AStarPath();
 	~AStarPath() override { }
-	bool path_search(MapCoord &start, MapCoord &goal) override;
-	uint32 path_cost_est(MapCoord &s, MapCoord &g) override  {
+	bool path_search(const MapCoord &start, const MapCoord &goal) override;
+	uint32 path_cost_est(const MapCoord &s, const MapCoord &g) override  {
 		return (Path::path_cost_est(s, g));
 	}
 	uint32 get_max_score(uint32 cost) override {
 		return (Path::get_max_score(cost));
 	}
-	uint32 path_cost_est(astar_node &n1, astar_node &n2) {
+	uint32 path_cost_est(const astar_node &n1, const astar_node &n2) {
 		return (Path::path_cost_est(n1.loc, n2.loc));
 	}
-	sint32 step_cost(MapCoord &c1, MapCoord &c2) override;
+	sint32 step_cost(const MapCoord &c1, const MapCoord &c2) override;
 protected:
 	/* FIXME: These node functions can be replaced with a priority_queue and a list. */
 	astar_node *find_open_node(astar_node *ncmp);
diff --git a/engines/ultima/nuvie/pathfinder/dir_finder.cpp b/engines/ultima/nuvie/pathfinder/dir_finder.cpp
index c57d7d1cd3a..0a12b9a87bc 100644
--- a/engines/ultima/nuvie/pathfinder/dir_finder.cpp
+++ b/engines/ultima/nuvie/pathfinder/dir_finder.cpp
@@ -99,7 +99,7 @@ sint8 DirFinder::get_turn_towards_dir(sint16 oxdir, sint16 oydir, sint8 txdir, s
 }
 
 // xdir,ydir = normal direction from->to (simple method)
-void DirFinder::get_normalized_dir(MapCoord from, MapCoord to, sint8 &xdir, sint8 &ydir) {
+void DirFinder::get_normalized_dir(const MapCoord &from, const MapCoord &to, sint8 &xdir, sint8 &ydir) {
 	xdir = clamp(to.x - from.x, -1, 1);
 	ydir = clamp(to.y - from.y, -1, 1);
 
diff --git a/engines/ultima/nuvie/pathfinder/dir_finder.h b/engines/ultima/nuvie/pathfinder/dir_finder.h
index 6fe765c252c..243fb173819 100644
--- a/engines/ultima/nuvie/pathfinder/dir_finder.h
+++ b/engines/ultima/nuvie/pathfinder/dir_finder.h
@@ -35,7 +35,7 @@ public:
 	static uint8 get_nuvie_dir(sint16 xrel, sint16 yrel);
 	static uint8 get_nuvie_dir(uint16 sx, uint16 sy, uint16 tx, uint16 ty, uint8 z);
 	static sint8 get_turn_towards_dir(sint16 oxdir, sint16 oydir, sint8 txdir, sint8 tydir);
-	static void get_normalized_dir(MapCoord from, MapCoord to, sint8 &xdir, sint8 &ydir);
+	static void get_normalized_dir(const MapCoord &from, const MapCoord &to, sint8 &xdir, sint8 &ydir);
 };
 
 } // End of namespace Nuvie
diff --git a/engines/ultima/nuvie/pathfinder/party_path_finder.cpp b/engines/ultima/nuvie/pathfinder/party_path_finder.cpp
index ca2c694b223..940d749a12f 100644
--- a/engines/ultima/nuvie/pathfinder/party_path_finder.cpp
+++ b/engines/ultima/nuvie/pathfinder/party_path_finder.cpp
@@ -64,9 +64,9 @@ bool PartyPathFinder::is_at_target(uint32 p) {
 /* Is anyone in front of `member_num' adjacent to `from'?
  * (is_contiguous(member, member_loc) == "is member adjacent to another member
  * whose following position is lower-numbered?") */
-bool PartyPathFinder::is_contiguous(uint32 member_num, MapCoord from) {
+bool PartyPathFinder::is_contiguous(uint32 member_num, const MapCoord &from) {
 	for (uint32 q = 0; q < member_num; q++) { // check lower-numbered members
-		Actor *actor = get_member(q).actor;
+		const Actor *actor = get_member(q).actor;
 		if (actor && actor->is_immobile() == true) continue;
 
 		MapCoord loc = party->get_location(q);
diff --git a/engines/ultima/nuvie/pathfinder/party_path_finder.h b/engines/ultima/nuvie/pathfinder/party_path_finder.h
index d52b1681b44..937ea053443 100644
--- a/engines/ultima/nuvie/pathfinder/party_path_finder.h
+++ b/engines/ultima/nuvie/pathfinder/party_path_finder.h
@@ -65,7 +65,7 @@ public:
 	bool is_seeking(uint32 member_num) {
 		return (get_member(member_num).actor->get_pathfinder() != 0);
 	}
-	bool is_contiguous(uint32 member_num, MapCoord from);
+	bool is_contiguous(uint32 member_num, const MapCoord &from);
 	bool is_contiguous(uint32 member_num);
 	bool is_behind_target(uint32 member_num);
 	bool is_at_target(uint32 p);
diff --git a/engines/ultima/nuvie/pathfinder/path.cpp b/engines/ultima/nuvie/pathfinder/path.cpp
index a460f30408c..e3f73653774 100644
--- a/engines/ultima/nuvie/pathfinder/path.cpp
+++ b/engines/ultima/nuvie/pathfinder/path.cpp
@@ -53,7 +53,7 @@ uint32 Path::get_max_score(uint32 cost) {
 
 /* Return a weighted estimate of the highest cost from location `s' to `g'.
  */
-uint32 Path::path_cost_est(MapCoord &s, MapCoord &g) {
+uint32 Path::path_cost_est(const MapCoord &s, const MapCoord &g) {
 	uint32 major = (s.xdistance(g) >= s.ydistance(g))
 	               ? s.xdistance(g) : s.ydistance(g);
 	uint32 minor = (s.xdistance(g) >= s.ydistance(g))
@@ -71,18 +71,16 @@ void Path::delete_path() {
 	path_size = 0;
 }
 
-MapCoord Path::get_first_step() {
+const MapCoord &Path::get_first_step() {
 	return (Path::get_step(0));
 }
 
-MapCoord Path::get_last_step() {
+const MapCoord &Path::get_last_step() {
 	return (Path::get_step(step_count - 1));
 }
 
-MapCoord Path::get_step(uint32 step_index) {
-	MapCoord step(0, 0, 0);
-	step = path[step_index];
-	return (step);
+const MapCoord &Path::get_step(uint32 step_index) {
+	return path[step_index];
 }
 
 bool Path::have_path() {
@@ -96,7 +94,7 @@ void Path::get_path(MapCoord **path_start, uint32 &pathSize) {
 }
 
 /* Increases path size in blocks and adds a step to the end of the path. */
-void Path::add_step(MapCoord loc) {
+void Path::add_step(const MapCoord &loc) {
 	const int path_block_size = 8;
 	if (step_count >= path_size) {
 		path_size += path_block_size;
diff --git a/engines/ultima/nuvie/pathfinder/path.h b/engines/ultima/nuvie/pathfinder/path.h
index 28667ab264a..862b00d7f34 100644
--- a/engines/ultima/nuvie/pathfinder/path.h
+++ b/engines/ultima/nuvie/pathfinder/path.h
@@ -40,7 +40,7 @@ protected:
 	uint32 path_size; // allocated elements in list
 	PathFinder *pf;
 
-	void add_step(MapCoord loc);
+	void add_step(const MapCoord &loc);
 	bool check_dir(const MapCoord &loc, MapCoord &rel);
 	bool check_loc(const MapCoord &loc);
 	void set_path_size(int alloc_size);
@@ -53,23 +53,23 @@ public:
 	}
 
 	/* The pathfinding routine. Can return success or failure of a search. */
-	virtual bool path_search(MapCoord &start, MapCoord &goal) = 0;
+	virtual bool path_search(const MapCoord &start, const MapCoord &goal) = 0;
 	void delete_path();
 	virtual bool have_path();
 
 	/* Returns the real cost of moving from a node (or location) to a
 	   neighboring node. (a single step) */
-	virtual sint32 step_cost(MapCoord &c1, MapCoord &c2) = 0;
+	virtual sint32 step_cost(const MapCoord &c1, const MapCoord &c2) = 0;
 
 	/* Estimate highest possible cost from s to g */
-	virtual uint32 path_cost_est(MapCoord &s, MapCoord &g);
+	virtual uint32 path_cost_est(const MapCoord &s, const MapCoord &g);
 	/* Returns maximum score of any single node in the search of a path with
 	   a certain estimated cost.*/
 	virtual uint32 get_max_score(uint32 cost);
 
-	virtual MapCoord get_first_step();
-	virtual MapCoord get_last_step();
-	virtual MapCoord get_step(uint32 step_index);
+	virtual const MapCoord &get_first_step();
+	virtual const MapCoord &get_last_step();
+	virtual const MapCoord &get_step(uint32 step_index);
 	virtual void get_path(MapCoord **path_start, uint32 &path_size);
 	uint32 get_num_steps() {
 		return step_count;
diff --git a/engines/ultima/nuvie/pathfinder/path_finder.cpp b/engines/ultima/nuvie/pathfinder/path_finder.cpp
index 2d7a4e219e1..9e8c1859818 100644
--- a/engines/ultima/nuvie/pathfinder/path_finder.cpp
+++ b/engines/ultima/nuvie/pathfinder/path_finder.cpp
@@ -29,7 +29,7 @@ PathFinder::PathFinder() : start(0, 0, 0), goal(0, 0, 0), loc(0, 0, 0), search(0
 
 }
 
-PathFinder::PathFinder(MapCoord s, MapCoord g)
+PathFinder::PathFinder(const MapCoord &s, const MapCoord &g)
 	: start(s), goal(g), loc(0, 0, 0), search(0) {
 
 }
@@ -80,7 +80,7 @@ void PathFinder::set_start(const MapCoord &s) {
 bool PathFinder::is_path_clear() {
 	uint32 num_steps = search->get_num_steps();
 	for (unsigned int n = 0; n < num_steps; n++) {
-		MapCoord pos = search->get_step(n);
+		const MapCoord &pos = search->get_step(n);
 		if (!check_loc(pos))
 			return false;
 	}
diff --git a/engines/ultima/nuvie/pathfinder/path_finder.h b/engines/ultima/nuvie/pathfinder/path_finder.h
index a162ca3587d..9ce8db0e486 100644
--- a/engines/ultima/nuvie/pathfinder/path_finder.h
+++ b/engines/ultima/nuvie/pathfinder/path_finder.h
@@ -41,7 +41,7 @@ protected:
 
 public:
 	PathFinder();
-	PathFinder(MapCoord s, MapCoord g);
+	PathFinder(const MapCoord &s, const MapCoord &g);
 	virtual ~PathFinder();
 	void set_search(Path *new_path) {
 		new_search(new_path);
diff --git a/engines/ultima/nuvie/pathfinder/sched_path_finder.cpp b/engines/ultima/nuvie/pathfinder/sched_path_finder.cpp
index 239527a37c4..58cff2e661b 100644
--- a/engines/ultima/nuvie/pathfinder/sched_path_finder.cpp
+++ b/engines/ultima/nuvie/pathfinder/sched_path_finder.cpp
@@ -70,15 +70,15 @@ bool SchedPathFinder::find_path() {
 
 /* Returns true if actor location is correct. */
 bool SchedPathFinder::is_location_in_path() {
-	MapCoord prev_step = search->get_step(prev_step_i);
+	const MapCoord &prev_step = search->get_step(prev_step_i);
 	return (loc == prev_step);
 }
 
 /* Update previous and next steps in path. */
 void SchedPathFinder::incr_step() {
-	MapCoord prev_loc = search->get_step(prev_step_i);
-	MapCoord next_loc = search->get_step(next_step_i);
-	MapCoord last_loc = search->get_last_step();
+	const MapCoord &prev_loc = search->get_step(prev_step_i);
+	const MapCoord &next_loc = search->get_step(next_step_i);
+	const MapCoord &last_loc = search->get_last_step();
 	if (prev_loc != last_loc) {
 		if (prev_loc != next_loc) // prev_step is going to stay behind next_step
 			++prev_step_i;
diff --git a/engines/ultima/nuvie/pathfinder/seek_path.cpp b/engines/ultima/nuvie/pathfinder/seek_path.cpp
index 0ca67590f31..03342addf5f 100644
--- a/engines/ultima/nuvie/pathfinder/seek_path.cpp
+++ b/engines/ultima/nuvie/pathfinder/seek_path.cpp
@@ -38,7 +38,7 @@ SeekPath::~SeekPath() {
 
 /* Get two relative directions that a line can travel to trace around an
    obstacle towards `xdir',`ydir'. */
-bool SeekPath::get_obstacle_tracer(MapCoord &start, sint32 xdir, sint32 ydir,
+bool SeekPath::get_obstacle_tracer(const MapCoord &start, sint32 xdir, sint32 ydir,
 								   sint32 &Axdir, sint32 &Aydir,
 								   sint32 &Bxdir, sint32 &Bydir) {
 	if (xdir && ydir) { // original direction is diagonal
@@ -128,7 +128,7 @@ bool SeekPath::trace_obstacle(MapCoord line, sint32 deltax, sint32 deltay, sint3
 }
 
 // choose which set of nodes traced around an obstacle should be used for a path
-Std::vector<MapCoord> *SeekPath::get_best_scan(MapCoord &start, MapCoord &goal) {
+Std::vector<MapCoord> *SeekPath::get_best_scan(const MapCoord &start, const MapCoord &goal) {
 	if (A_scan.empty() && B_scan.empty())
 		return 0;
 	if (A_scan.empty())
@@ -141,7 +141,7 @@ Std::vector<MapCoord> *SeekPath::get_best_scan(MapCoord &start, MapCoord &goal)
 }
 
 // copy A or B nodes to the path
-void SeekPath::create_path(MapCoord &start, MapCoord &goal) {
+void SeekPath::create_path(const MapCoord &start, const MapCoord &goal) {
 	vector<MapCoord> *nodes = get_best_scan(start, goal); // points to line A or B
 	MapCoord prev_node(start);
 
@@ -164,7 +164,7 @@ void SeekPath::create_path(MapCoord &start, MapCoord &goal) {
 }
 
 /* Returns true if a path is found around the obstacle between locations. */
-bool SeekPath::path_search(MapCoord &start, MapCoord &goal) {
+bool SeekPath::path_search(const MapCoord &start, const MapCoord &goal) {
 	sint8 xdir = 0, ydir = 0; // direction start->goal
 	DirFinder::get_normalized_dir(start, goal, xdir, ydir); // init xdir & ydir
 
diff --git a/engines/ultima/nuvie/pathfinder/seek_path.h b/engines/ultima/nuvie/pathfinder/seek_path.h
index b6c9e9cd9e0..7cbdfa9f674 100644
--- a/engines/ultima/nuvie/pathfinder/seek_path.h
+++ b/engines/ultima/nuvie/pathfinder/seek_path.h
@@ -36,8 +36,8 @@ class SeekPath: public Path {
 protected:
 	Std::vector<MapCoord> A_scan, B_scan; // nodes of a line scanned by trace_obstacle()
 
-	void create_path(MapCoord &start, MapCoord &goal);
-	Std::vector<MapCoord> *get_best_scan(MapCoord &start, MapCoord &goal);
+	void create_path(const MapCoord &start, const MapCoord &goal);
+	Std::vector<MapCoord> *get_best_scan(const MapCoord &start, const MapCoord &goal);
 	void delete_nodes();
 	bool trace_check_obstacle(bool &turned, MapCoord &line, sint32 &deltax, sint32 &deltay, sint32 &xdir, sint32 &ydir, Std::vector<MapCoord> *scan);
 	void trace_around_corner(MapCoord &line, sint32 &deltax, sint32 &deltay, sint32 &xdir, sint32 &ydir, Std::vector<MapCoord> *scan);
@@ -45,10 +45,10 @@ protected:
 public:
 	SeekPath();
 	~SeekPath() override;
-	sint32 step_cost(MapCoord &c1, MapCoord &c2) override {
+	sint32 step_cost(const MapCoord &c1, const MapCoord &c2) override {
 		return -1;
 	}
-	bool path_search(MapCoord &start, MapCoord &goal) override;
+	bool path_search(const MapCoord &start, const MapCoord &goal) override;
 	void delete_path() {
 		Path::delete_path();
 		delete_nodes();
@@ -58,7 +58,7 @@ public:
 	bool trace_obstacle(MapCoord line, sint32 deltax, sint32 deltay, sint32 xdir, sint32 ydir, Std::vector<MapCoord> *scan);
 	/* Get two relative directions that a line can travel to trace around an
 	   obstacle towards `xdir',`ydir'. */
-	bool get_obstacle_tracer(MapCoord &start, sint32 xdir, sint32 ydir,
+	bool get_obstacle_tracer(const MapCoord &start, sint32 xdir, sint32 ydir,
 	                         sint32 &Axdir, sint32 &Aydir,
 	                         sint32 &Bxdir, sint32 &Bydir);
 };
diff --git a/engines/ultima/nuvie/pathfinder/u6_astar_path.cpp b/engines/ultima/nuvie/pathfinder/u6_astar_path.cpp
index 2e589e57c90..94783082697 100644
--- a/engines/ultima/nuvie/pathfinder/u6_astar_path.cpp
+++ b/engines/ultima/nuvie/pathfinder/u6_astar_path.cpp
@@ -32,7 +32,7 @@ namespace Nuvie {
  * Blocking objects are checked for, and doors may be passable
  * Returns -1 if c2 is blocked.
  */
-sint32 U6AStarPath::step_cost(MapCoord &c1, MapCoord &c2) {
+sint32 U6AStarPath::step_cost(const MapCoord &c1, const MapCoord &c2) {
 	Game *game = Game::get_game();
 	sint32 c = 1; // final cost is not necessarily the actual move cost
 
@@ -59,7 +59,7 @@ sint32 U6AStarPath::step_cost(MapCoord &c1, MapCoord &c2) {
 }
 
 // Possible step cost is 1 to 16.
-uint32 U6AStarPath::path_cost_est(MapCoord &s, MapCoord &g) {
+uint32 U6AStarPath::path_cost_est(const MapCoord &s, const MapCoord &g) {
 	return (Path::path_cost_est(s, g));
 }
 
diff --git a/engines/ultima/nuvie/pathfinder/u6_astar_path.h b/engines/ultima/nuvie/pathfinder/u6_astar_path.h
index bce30f6ea1b..1941fe09afd 100644
--- a/engines/ultima/nuvie/pathfinder/u6_astar_path.h
+++ b/engines/ultima/nuvie/pathfinder/u6_astar_path.h
@@ -30,8 +30,8 @@ namespace Nuvie {
 /* This provides a U6-specific step_cost() method. */
 class U6AStarPath: public AStarPath {
 public:
-	sint32 step_cost(MapCoord &c1, MapCoord &c2) override;
-	uint32 path_cost_est(MapCoord &s, MapCoord &g) override;
+	sint32 step_cost(const MapCoord &c1, const MapCoord &c2) override;
+	uint32 path_cost_est(const MapCoord &s, const MapCoord &g) override;
 };
 
 } // End of namespace Nuvie
diff --git a/engines/ultima/nuvie/portraits/portrait.cpp b/engines/ultima/nuvie/portraits/portrait.cpp
index 0aafa960331..da63cdad609 100644
--- a/engines/ultima/nuvie/portraits/portrait.cpp
+++ b/engines/ultima/nuvie/portraits/portrait.cpp
@@ -69,7 +69,7 @@ Portrait::Portrait(Configuration *cfg) {
 	height = 0;
 }
 
-uint8 Portrait::get_avatar_portrait_num() {
+uint8 Portrait::get_avatar_portrait_num() const {
 	return get_portrait_num(Game::get_game()->get_actor_manager()->get_avatar());
 }
 
diff --git a/engines/ultima/nuvie/portraits/portrait.h b/engines/ultima/nuvie/portraits/portrait.h
index eed4b32cfde..091f18443cd 100644
--- a/engines/ultima/nuvie/portraits/portrait.h
+++ b/engines/ultima/nuvie/portraits/portrait.h
@@ -53,18 +53,18 @@ public:
 	virtual bool load(NuvieIO *objlist) = 0;
 	virtual unsigned char *get_portrait_data(Actor *actor) = 0;
 
-	uint8 get_portrait_width() {
+	uint8 get_portrait_width() const {
 		return width;
 	}
-	uint8 get_portrait_height() {
+	uint8 get_portrait_height() const {
 		return height;
 	}
 
-	bool has_portrait(Actor *actor) {
+	bool has_portrait(Actor *actor) const {
 		return (get_portrait_num(actor) != NO_PORTRAIT_FOUND);
 	}
 
-	uint8 get_avatar_portrait_num();
+	uint8 get_avatar_portrait_num() const;
 
 protected:
 
@@ -72,7 +72,7 @@ protected:
 
 private:
 
-	virtual uint8 get_portrait_num(Actor *actor) = 0;
+	virtual uint8 get_portrait_num(Actor *actor) const = 0;
 
 };
 
diff --git a/engines/ultima/nuvie/portraits/portrait_md.cpp b/engines/ultima/nuvie/portraits/portrait_md.cpp
index fb0fd982de7..d6f2887dc4b 100644
--- a/engines/ultima/nuvie/portraits/portrait_md.cpp
+++ b/engines/ultima/nuvie/portraits/portrait_md.cpp
@@ -64,7 +64,7 @@ bool PortraitMD::load(NuvieIO *objlist) {
 	return true;
 }
 
-uint8 PortraitMD::get_portrait_num(Actor *actor) {
+uint8 PortraitMD::get_portrait_num(Actor *actor) const {
 	if (actor == nullptr)
 		return NO_PORTRAIT_FOUND;
 
@@ -120,7 +120,7 @@ U6Shape *PortraitMD::get_background_shape(uint8 actor_num) {
 	return bg;
 }
 
-uint8 PortraitMD::get_background_shape_num(uint8 actor_num) {
+uint8 PortraitMD::get_background_shape_num(uint8 actor_num) const {
 	const uint8 bg_tbl[] = {
 		0x22, 0x17, 0x50, 0x0, 0x0, 0x0, 0x0, 0x0, 0x56, 0x27, 0x0, 0x0, 0x55, 0x45,
 		0x70, 0x0, 0x53, 0x25, 0x45, 0x15, 0x17, 0x37, 0x45, 0x32, 0x24,
diff --git a/engines/ultima/nuvie/portraits/portrait_md.h b/engines/ultima/nuvie/portraits/portrait_md.h
index 1c909d08993..30ae901f396 100644
--- a/engines/ultima/nuvie/portraits/portrait_md.h
+++ b/engines/ultima/nuvie/portraits/portrait_md.h
@@ -44,11 +44,11 @@ public:
 
 protected:
 
-	uint8 get_portrait_num(Actor *actor) override;
+	uint8 get_portrait_num(Actor *actor) const override;
 
 private:
 	U6Shape *get_background_shape(uint8 actor_num);
-	uint8 get_background_shape_num(uint8 actor_num);
+	uint8 get_background_shape_num(uint8 actor_num) const;
 };
 
 } // End of namespace Nuvie
diff --git a/engines/ultima/nuvie/portraits/portrait_se.cpp b/engines/ultima/nuvie/portraits/portrait_se.cpp
index 026d2e8edc1..2b75632143f 100644
--- a/engines/ultima/nuvie/portraits/portrait_se.cpp
+++ b/engines/ultima/nuvie/portraits/portrait_se.cpp
@@ -64,7 +64,7 @@ bool PortraitSE::load(NuvieIO *objlist) {
 	return true;
 }
 
-uint8 PortraitSE::get_portrait_num(Actor *actor) {
+uint8 PortraitSE::get_portrait_num(Actor *actor) const {
 	uint8 num;
 
 	if (actor == nullptr)
@@ -88,7 +88,7 @@ U6Shape *PortraitSE::get_background_shape(Actor *actor) {
 	return bg;
 }
 
-uint8 PortraitSE::get_background_shape_num(Actor *actor) {
+uint8 PortraitSE::get_background_shape_num(Actor *actor) const {
 	const struct {
 		uint16 x;
 		uint16 y;
diff --git a/engines/ultima/nuvie/portraits/portrait_se.h b/engines/ultima/nuvie/portraits/portrait_se.h
index 6458e37dcde..ec55b4c1fee 100644
--- a/engines/ultima/nuvie/portraits/portrait_se.h
+++ b/engines/ultima/nuvie/portraits/portrait_se.h
@@ -46,8 +46,8 @@ public:
 private:
 
 	U6Shape *get_background_shape(Actor *actor);
-	uint8 get_background_shape_num(Actor *actor);
-	uint8 get_portrait_num(Actor *actor) override;
+	uint8 get_background_shape_num(Actor *actor) const;
+	uint8 get_portrait_num(Actor *actor) const override;
 
 };
 
diff --git a/engines/ultima/nuvie/portraits/portrait_u6.cpp b/engines/ultima/nuvie/portraits/portrait_u6.cpp
index be27dcee87d..e90e4bb76f7 100644
--- a/engines/ultima/nuvie/portraits/portrait_u6.cpp
+++ b/engines/ultima/nuvie/portraits/portrait_u6.cpp
@@ -86,7 +86,7 @@ bool PortraitU6::load(NuvieIO *objlist) {
 	return true;
 }
 
-uint8 PortraitU6::get_portrait_num(Actor *actor) {
+uint8 PortraitU6::get_portrait_num(Actor *actor) const {
 	uint8 num;
 
 	if (actor == nullptr)
diff --git a/engines/ultima/nuvie/portraits/portrait_u6.h b/engines/ultima/nuvie/portraits/portrait_u6.h
index 62ce0cc449e..ac71601272e 100644
--- a/engines/ultima/nuvie/portraits/portrait_u6.h
+++ b/engines/ultima/nuvie/portraits/portrait_u6.h
@@ -48,7 +48,7 @@ public:
 
 private:
 
-	uint8 get_portrait_num(Actor *actor) override;
+	uint8 get_portrait_num(Actor *actor) const override;
 
 };
 
diff --git a/engines/ultima/nuvie/screen/dither.h b/engines/ultima/nuvie/screen/dither.h
index fea859f332c..8326ec204c2 100644
--- a/engines/ultima/nuvie/screen/dither.h
+++ b/engines/ultima/nuvie/screen/dither.h
@@ -45,7 +45,7 @@ public:
 
 	Dither(Configuration *cfg);
 	~Dither();
-	uint8 get_mode() {
+	uint8 get_mode() const {
 		return mode;
 	}
 	bool dither_bitmap(unsigned char *src_buf, uint16 src_w, uint16 src_h, bool has_transparency);
diff --git a/engines/ultima/nuvie/screen/game_palette.h b/engines/ultima/nuvie/screen/game_palette.h
index 03f08f85cb7..ab168934d45 100644
--- a/engines/ultima/nuvie/screen/game_palette.h
+++ b/engines/ultima/nuvie/screen/game_palette.h
@@ -41,7 +41,7 @@ public:
 	GamePalette(Screen *s, Configuration *cfg);
 	~GamePalette();
 	void rotatePalette();
-	uint8 get_bg_color() {
+	uint8 get_bg_color() const {
 		return bg_color;
 	}
 	void set_palette();
diff --git a/engines/ultima/nuvie/screen/screen.cpp b/engines/ultima/nuvie/screen/screen.cpp
index 2c7e3129cbc..5a12dfb4e45 100644
--- a/engines/ultima/nuvie/screen/screen.cpp
+++ b/engines/ultima/nuvie/screen/screen.cpp
@@ -164,14 +164,14 @@ bool Screen::rotate_palette(uint8 pos, uint8 length) {
 	return true;
 }
 
-uint16 Screen::get_translated_x(uint16 x) {
+uint16 Screen::get_translated_x(uint16 x) const {
 	if (scale_factor != 1)
 		x /= scale_factor;
 
 	return x;
 }
 
-uint16 Screen::get_translated_y(uint16 y) {
+uint16 Screen::get_translated_y(uint16 y) const {
 	if (scale_factor != 1)
 		y /= scale_factor;
 
@@ -1542,7 +1542,7 @@ void Screen::draw_line(int sx, int sy, int ex, int ey, uint8 color) {
 }
 
 
-void Screen::get_mouse_location(int *x, int *y) {
+void Screen::get_mouse_location(int *x, int *y) const {
 	Common::Point pt = Events::get()->getMousePos();
 	*x = pt.x;
 	*y = pt.y;
diff --git a/engines/ultima/nuvie/screen/screen.h b/engines/ultima/nuvie/screen/screen.h
index b3281ed41b5..f4b174b16b3 100644
--- a/engines/ultima/nuvie/screen/screen.h
+++ b/engines/ultima/nuvie/screen/screen.h
@@ -91,18 +91,18 @@ public:
 	Graphics::ManagedSurface *create_sdl_surface_from(byte *src_buf, uint16 src_bpp, uint16 src_w, uint16 src_h, uint16 src_pitch);
 	Graphics::ManagedSurface *create_sdl_surface_8(byte *src_buf, uint16 src_w, uint16 src_h);
 	uint16 get_bpp();
-	int get_scale_factor() {
+	int get_scale_factor() const {
 		return scale_factor;
 	}
 	Graphics::ManagedSurface *get_sdl_surface();
-	uint16 get_width() {
+	uint16 get_width() const {
 		return width;
 	}
-	uint16 get_height() {
+	uint16 get_height() const {
 		return height;
 	}
-	uint16 get_translated_x(uint16 x);
-	uint16 get_translated_y(uint16 y);
+	uint16 get_translated_x(uint16 x) const;
+	uint16 get_translated_y(uint16 y) const;
 
 	bool fill(uint8 colour_num, uint16 x, uint16 y, sint16 w, sint16 h);
 	void fade(uint16 dest_x, uint16 dest_y, uint16 src_w, uint16 src_h, uint8 opacity, uint8 fade_bg_color = 0);
@@ -118,15 +118,15 @@ public:
 	void drawalphamap8globe(sint16 x, sint16 y, uint16 radius);
 	void blitalphamap8(sint16 x, sint16 y, Common::Rect *clip_rect);
 
-	int get_lighting_style() {
+	int get_lighting_style() const {
 		return lighting_style;
 	}
-	int get_old_lighting_style() {
+	int get_old_lighting_style() const {
 		return old_lighting_style;    // return the lighting_style before cheats applied
 	}
 	void set_lighting_style(int lighting);
 
-	uint8 get_ambient() {
+	uint8 get_ambient() const {
 		return shading_ambient;
 	}
 	void set_ambient(uint8 ambient) {
@@ -148,7 +148,7 @@ public:
 
 	void draw_line(int sx, int sy, int ex, int ey, uint8 color);
 
-	void get_mouse_location(int *x, int *y);
+	void get_mouse_location(int *x, int *y) const;
 
 	void set_non_square_pixels(bool value);
 
diff --git a/engines/ultima/nuvie/script/script.cpp b/engines/ultima/nuvie/script/script.cpp
index b1b615121f8..a9f0532bead 100644
--- a/engines/ultima/nuvie/script/script.cpp
+++ b/engines/ultima/nuvie/script/script.cpp
@@ -1103,7 +1103,7 @@ int Script::call_obj_get_readiable_location(Obj *obj) {
 	return lua_tointeger(L, -1);
 }
 
-uint8 Script::actor_get_max_magic_points(Actor *actor) {
+uint8 Script::actor_get_max_magic_points(const Actor *actor) {
 	lua_getglobal(L, "actor_get_max_magic_points");
 	nscript_new_actor_var(L, actor->get_actor_num());
 
@@ -3075,7 +3075,7 @@ static int nscript_map_get_tile_num(lua_State *L) {
 			original_tile = (bool) lua_toboolean(L, 4);
 	}
 
-	Tile *t = map->get_tile(x, y, z, original_tile);
+	const Tile *t = map->get_tile(x, y, z, original_tile);
 	if (t != nullptr) {
 		lua_pushinteger(L, t->tile_num);
 		return 1;
@@ -3104,7 +3104,7 @@ static int nscript_map_get_dmg_tile_num(lua_State *L) {
 	if (nscript_get_location_from_args(L, &x, &y, &z, 1) == false)
 		return 0;
 
-	Tile *t = map->get_dmg_tile(x, y, z);
+	const Tile *t = map->get_dmg_tile(x, y, z);
 	if (t != nullptr) {
 		lua_pushinteger(L, t->tile_num);
 		return 1;
diff --git a/engines/ultima/nuvie/script/script.h b/engines/ultima/nuvie/script/script.h
index fef7b4bf623..183fadf9da9 100644
--- a/engines/ultima/nuvie/script/script.h
+++ b/engines/ultima/nuvie/script/script.h
@@ -143,7 +143,7 @@ public:
 	uint8 call_actor_int_adj(Actor *actor);
 	bool call_look_obj(Obj *obj);
 	int call_obj_get_readiable_location(Obj *obj);
-	uint8 actor_get_max_magic_points(Actor *actor);
+	uint8 actor_get_max_magic_points(const Actor *actor);
 	bool call_actor_get_obj(Actor *actor, Obj *obj, Obj *container = nullptr);
 	bool call_actor_subtract_movement_points(Actor *actor, uint8 points);
 	bool call_actor_resurrect(Actor *actor);
diff --git a/engines/ultima/nuvie/script/script_cutscene.h b/engines/ultima/nuvie/script/script_cutscene.h
index 117ce9e8b30..5a6ef5e642d 100644
--- a/engines/ultima/nuvie/script/script_cutscene.h
+++ b/engines/ultima/nuvie/script/script_cutscene.h
@@ -168,10 +168,10 @@ public:
 		return sound_manager;
 	}
 
-	uint16 get_x_off() {
+	uint16 get_x_off() const {
 		return x_off;
 	}
-	uint16 get_y_off() {
+	uint16 get_y_off() const {
 		return y_off;
 	}
 
diff --git a/engines/ultima/nuvie/sound/sound.h b/engines/ultima/nuvie/sound/sound.h
index 874d615a8cb..4cdca37d72d 100644
--- a/engines/ultima/nuvie/sound/sound.h
+++ b/engines/ultima/nuvie/sound/sound.h
@@ -40,7 +40,7 @@ public:
 	virtual bool Stop() = 0;
 	virtual bool FadeOut(float seconds) = 0;
 	virtual bool SetVolume(uint8 volume) = 0; //range 0..255
-	string GetName() {
+	const string &GetName() const {
 		return m_Filename;
 	}
 	string GetTitle() {
diff --git a/engines/ultima/nuvie/usecode/u6_usecode.cpp b/engines/ultima/nuvie/usecode/u6_usecode.cpp
index 1764767e1c1..f2657c0f4e6 100644
--- a/engines/ultima/nuvie/usecode/u6_usecode.cpp
+++ b/engines/ultima/nuvie/usecode/u6_usecode.cpp
@@ -202,23 +202,23 @@ U6UseCode::~U6UseCode() {
 
 
 /* Is the object a food (or drink) item? */
-bool U6UseCode::is_food(Obj *obj) {
+bool U6UseCode::is_food(const Obj *obj) const {
 	const U6ObjectType *type = get_object_type(obj->obj_n, obj->frame_n);
 	return (type && (type->flags & OBJTYPE_FOOD));
 }
 
 
-bool U6UseCode::is_container(Obj *obj) {
+bool U6UseCode::is_container(const Obj *obj) const {
 	const U6ObjectType *type = get_object_type(obj->obj_n, obj->frame_n);
 	return (type && (type->flags & OBJTYPE_CONTAINER));
 }
 
-bool U6UseCode::is_container(uint16 obj_n, uint8 frame_n) {
+bool U6UseCode::is_container(uint16 obj_n, uint8 frame_n) const {
 	const U6ObjectType *type = get_object_type(obj_n, frame_n);
 	return (type && (type->flags & OBJTYPE_CONTAINER));
 }
 
-bool U6UseCode::is_readable(Obj *obj) {
+bool U6UseCode::is_readable(const Obj *obj) const {
 	const U6ObjectType *type = get_object_type(obj->obj_n, obj->frame_n);
 	return ((type && (type->flags & OBJTYPE_BOOK)) || obj->obj_n == OBJ_U6_CLOCK
 	        || obj->obj_n == OBJ_U6_SUNDIAL);
@@ -380,7 +380,7 @@ bool U6UseCode::drop_obj(Obj *obj, Actor *actor, uint16 x, uint16 y, uint16 qty)
 
 
 /* Return pointer to object-type in list for object N:F, or nullptr if none. */
-inline const U6ObjectType *U6UseCode::get_object_type(uint16 n, uint8 f, UseCodeEvent ev) {
+inline const U6ObjectType *U6UseCode::get_object_type(uint16 n, uint8 f, UseCodeEvent ev) const {
 	const U6ObjectType *type = U6ObjectTypes;
 	while (type->obj_n != OBJ_U6_NOTHING) {
 		if (type->obj_n == n && (type->frame_n == 0xFF || type->frame_n == f)
@@ -1030,7 +1030,7 @@ bool U6UseCode::use_moonstone(Obj *obj, UseCodeEvent ev) {
 	} else if (ev == USE_EVENT_USE) {
 		Weather *weather = game->get_weather();
 		MapCoord loc = Game::get_game()->get_player()->get_actor()->get_location();
-		Tile *map_tile = map->get_tile(loc.x, loc.y, loc.z);
+		const Tile *map_tile = map->get_tile(loc.x, loc.y, loc.z);
 
 		if ((map_tile->tile_num < 1 || map_tile->tile_num > 7) && (map_tile->tile_num < 0x10 || map_tile->tile_num > 0x6f)) {
 			scroll->display_string("Cannot be buried here!\n");
@@ -1320,7 +1320,7 @@ bool U6UseCode::use_shovel(Obj *obj, UseCodeEvent ev) {
 			dug_up_obj = new_obj(OBJ_U6_HOLE, 0, dig_at.x, dig_at.y, dig_at.z); //found a connecting ladder, dig a hole
 		}
 	}
-	Tile *tile = map->get_tile(dig_at.x, dig_at.y, dig_at.z, true);
+	const Tile *tile = map->get_tile(dig_at.x, dig_at.y, dig_at.z, true);
 // uncomment first check if the coord conversion gets added back
 	if (/*(!dug_up_obj && dig_at.z == 0) ||*/ !tile // original might have checked for earth desc and no wall mask
 	        || !((tile->tile_num <= 111 && tile->tile_num >= 108) || tile->tile_num == 540)) {
@@ -2988,7 +2988,7 @@ bool U6UseCode::holy_flame(Obj *obj, UseCodeEvent ev) {
 	return false;
 }
 
-bool U6UseCode::cannot_unready(Obj *obj) {
+bool U6UseCode::cannot_unready(const Obj *obj) const {
 	if (!obj->is_readied())
 		return false;
 	if (obj->obj_n == OBJ_U6_AMULET_OF_SUBMISSION
diff --git a/engines/ultima/nuvie/usecode/u6_usecode.h b/engines/ultima/nuvie/usecode/u6_usecode.h
index d904289569c..18fdac5ba75 100644
--- a/engines/ultima/nuvie/usecode/u6_usecode.h
+++ b/engines/ultima/nuvie/usecode/u6_usecode.h
@@ -83,34 +83,34 @@ public:
 
 	bool has_usecode(Obj *obj, UseCodeEvent ev = USE_EVENT_USE) override;
 	bool has_usecode(Actor *actor, UseCodeEvent ev = USE_EVENT_USE) override;
-	bool cannot_unready(Obj *obj) override;
+	bool cannot_unready(const Obj *obj) const override;
 
-	bool is_door(Obj *obj) {
+	bool is_door(const Obj *obj) const {
 		return (obj->obj_n >= 297 && obj->obj_n <= 300);
 	}
-	bool is_unlocked_door(Obj *obj) override {
+	bool is_unlocked_door(const Obj *obj) const override {
 		return (is_door(obj) && obj->frame_n != 9 && obj->frame_n != 11);
 	}
-	bool is_locked_door(Obj *obj) override {
+	bool is_locked_door(const Obj *obj) const override {
 		return (is_door(obj) && (obj->frame_n == 9 || obj->frame_n == 11));
 	}
-	bool is_magically_locked_door(Obj *obj) {
+	bool is_magically_locked_door(const Obj *obj) const {
 		return (is_door(obj) && (obj->frame_n == 13 || obj->frame_n == 15));
 	}
-	bool is_closed_door(Obj *obj) override {
+	bool is_closed_door(const Obj *obj) const override {
 		return (is_door(obj) && obj->frame_n > 3);
 	}
 
-	bool is_chest(Obj *obj) override {
+	bool is_chest(const Obj *obj) const override {
 		return (obj->obj_n == OBJ_U6_CHEST);
 	}
-	bool is_closed_chest(Obj *obj) {
+	bool is_closed_chest(const Obj *obj) const {
 		return (is_chest(obj) && obj->frame_n > 0);
 	}
-	bool is_locked_chest(Obj *obj) {
+	bool is_locked_chest(const Obj *obj) const {
 		return (is_chest(obj) && obj->frame_n == 2);
 	}
-	bool is_magically_locked_chest(Obj *obj) {
+	bool is_magically_locked_chest(const Obj *obj) const {
 		return (is_chest(obj) && obj->frame_n == 3);
 	}
 	void unlock_chest(Obj *obj) {
@@ -122,25 +122,25 @@ public:
 		return;
 	}
 
-	bool is_locked(Obj *obj) {
+	bool is_locked(const Obj *obj) const {
 		return (is_locked_door(obj) || is_locked_chest(obj));
 	}
-	bool is_magically_locked(Obj *obj) {
+	bool is_magically_locked(const Obj *obj) const {
 		return (is_magically_locked_door(obj) || is_magically_locked_chest(obj));
 	}
 	void unlock(Obj *obj);
 	void lock(Obj *obj);
 
-	bool is_food(Obj *obj) override;
-	bool is_container(Obj *obj) override;
-	bool is_container(uint16 obj_n, uint8 frame_n) override;
-	bool is_readable(Obj *obj) override;
+	bool is_food(const Obj *obj) const override;
+	bool is_container(const Obj *obj) const override;
+	bool is_container(uint16 obj_n, uint8 frame_n) const override;
+	bool is_readable(const Obj *obj) const override;
 
 	uint16 callback(uint16 msg, CallBack *caller, void *data = nullptr) override;
 
 protected:
 	bool uc_event(const U6ObjectType *type, UseCodeEvent ev, Obj *obj);
-	inline const U6ObjectType *get_object_type(uint16 n, uint8 f, UseCodeEvent ev = 0);
+	inline const U6ObjectType *get_object_type(uint16 n, uint8 f, UseCodeEvent ev = 0) const;
 
 public:
 // usecode
diff --git a/engines/ultima/nuvie/usecode/usecode.cpp b/engines/ultima/nuvie/usecode/usecode.cpp
index ad48e51b926..b661f48598e 100644
--- a/engines/ultima/nuvie/usecode/usecode.cpp
+++ b/engines/ultima/nuvie/usecode/usecode.cpp
@@ -99,7 +99,7 @@ bool UseCode::is_script_running() {
 	return false;
 }
 
-bool UseCode::is_container(Obj *obj) {
+bool UseCode::is_container(const Obj *obj) const {
 	return script->call_is_container_obj(obj->obj_n);
 }
 
diff --git a/engines/ultima/nuvie/usecode/usecode.h b/engines/ultima/nuvie/usecode/usecode.h
index 3795fd50051..1c20da1475d 100644
--- a/engines/ultima/nuvie/usecode/usecode.h
+++ b/engines/ultima/nuvie/usecode/usecode.h
@@ -215,7 +215,7 @@ public:
 	}
 
 	virtual bool has_usecode(Obj *obj, UseCodeEvent ev = USE_EVENT_USE);
-	virtual bool has_usecode(Actor *actor, UseCodeEvent ev = USE_EVENT_USE)  {
+	virtual bool has_usecode(Actor *actor, UseCodeEvent ev = USE_EVENT_USE) {
 		return (false);
 	}
 	virtual bool has_lookcode(Obj *obj) {
@@ -233,7 +233,7 @@ public:
 	virtual bool has_readycode(Obj *obj) {
 		return (has_usecode(obj, USE_EVENT_READY));
 	}
-	virtual bool cannot_unready(Obj *obj) {
+	virtual bool cannot_unready(const Obj *obj) const {
 		return false;
 	}
 	virtual bool has_getcode(Obj *obj)  {
@@ -243,32 +243,32 @@ public:
 		return (has_usecode(obj, USE_EVENT_DROP));
 	}
 
-	bool is_door(Obj *obj) {
+	bool is_door(const Obj *obj) const {
 		return (is_locked_door(obj) || is_unlocked_door(obj));
 	}
-	virtual bool is_locked_door(Obj *obj)   {
+	virtual bool is_locked_door(const Obj *obj) const {
 		return (false);
 	}
-	virtual bool is_unlocked_door(Obj *obj) {
+	virtual bool is_unlocked_door(const Obj *obj) const {
 		return (false);
 	}
-	virtual bool is_closed_door(Obj *obj)   {
+	virtual bool is_closed_door(const Obj *obj) const {
 		return (false);
 	}
 	virtual bool process_effects(Obj *container_obj, Actor *actor) {
 		return (false);
 	}
-	virtual bool is_food(Obj *obj)          {
+	virtual bool is_food(const Obj *obj) const {
 		return (false);
 	}
-	virtual bool is_container(Obj *obj);
-	virtual bool is_container(uint16 obj_n, uint8 frame_n) {
+	virtual bool is_container(const Obj *obj) const;
+	virtual bool is_container(uint16 obj_n, uint8 frame_n) const {
 		return (false);
 	}
-	virtual bool is_readable(Obj *obj)      {
+	virtual bool is_readable(const Obj *obj) const {
 		return (false);
 	}
-	virtual bool is_chest(Obj *obj)         {
+	virtual bool is_chest(const Obj *obj) const {
 		return (false);
 	}
 
diff --git a/engines/ultima/nuvie/views/container_view_gump.h b/engines/ultima/nuvie/views/container_view_gump.h
index 0d2a2ac4eca..71e47b72360 100644
--- a/engines/ultima/nuvie/views/container_view_gump.h
+++ b/engines/ultima/nuvie/views/container_view_gump.h
@@ -63,15 +63,15 @@ public:
 	void Display(bool full_redraw) override;
 
 	void set_actor(Actor *a);
-	Actor *get_actor() {
+	const Actor *get_actor() const {
 		return actor;
 	}
 	void set_container_obj(Obj *o);
-	Obj *get_container_obj() {
+	const Obj *get_container_obj() const {
 		return container_obj;
 	}
 
-	bool is_actor_container() {
+	bool is_actor_container() const {
 		return (container_obj == nullptr);
 	}
 
diff --git a/engines/ultima/nuvie/views/container_widget.h b/engines/ultima/nuvie/views/container_widget.h
index 14ef0ddd1a1..4d043a9bfa1 100644
--- a/engines/ultima/nuvie/views/container_widget.h
+++ b/engines/ultima/nuvie/views/container_widget.h
@@ -68,7 +68,7 @@ public:
 
 	bool init(Actor *a, uint16 x, uint16 y, TileManager *tm, ObjManager *om, Font *f);
 	virtual void set_actor(Actor *a);
-	Actor *get_actor() {
+	const Actor *get_actor() const {
 		return (actor);
 	}
 	Obj *get_container() {
@@ -79,7 +79,7 @@ public:
 		row_offset = 0;
 		Redraw();
 	}
-	bool is_showing_container() {
+	bool is_showing_container() const {
 		return (container_obj != nullptr ? true : false);
 	}
 	void Display(bool full_redraw) override;
diff --git a/engines/ultima/nuvie/views/inventory_view.h b/engines/ultima/nuvie/views/inventory_view.h
index 21b31d44321..d7f694f44c2 100644
--- a/engines/ultima/nuvie/views/inventory_view.h
+++ b/engines/ultima/nuvie/views/inventory_view.h
@@ -85,7 +85,7 @@ public:
 	void PlaceOnScreen(Screen *s, GUI_DragManager *dm, int x, int y) override;
 	GUI_status KeyDown(const Common::KeyState &key) override;
 	void simulate_CB_callback();
-	bool is_picking_pocket() {
+	bool is_picking_pocket() const {
 		return picking_pocket;
 	}
 	void lock_to_actor(bool value) {
diff --git a/engines/ultima/nuvie/views/inventory_widget.h b/engines/ultima/nuvie/views/inventory_widget.h
index ead5e884060..654b20411a4 100644
--- a/engines/ultima/nuvie/views/inventory_widget.h
+++ b/engines/ultima/nuvie/views/inventory_widget.h
@@ -98,7 +98,7 @@ public:
 
 	void drag_draw(int x, int y, int message, void *data) override;
 
-	uint8 get_num_rows() {
+	uint8 get_num_rows() const {
 		return game_type == NUVIE_GAME_U6 ? 3 : 4;
 	}
 
diff --git a/engines/ultima/nuvie/views/party_view.cpp b/engines/ultima/nuvie/views/party_view.cpp
index 4a926e2ffc6..f21309e3eb1 100644
--- a/engines/ultima/nuvie/views/party_view.cpp
+++ b/engines/ultima/nuvie/views/party_view.cpp
@@ -267,9 +267,6 @@ void PartyView::Display(bool full_redraw) {
 	if (full_redraw || update_display || MD || Game::get_game()->is_original_plus_full_map()) {
 		uint8 i;
 		uint8 hp_text_color;
-		Actor *actor;
-		Tile *actor_tile;
-		char *actor_name;
 		char hp_string[4];
 		uint8 party_size = party->get_party_size();
 		int rowH = 16;
@@ -292,8 +289,8 @@ void PartyView::Display(bool full_redraw) {
 			end_offset = party_size;
 
 		for (i = row_offset; i < end_offset; i++) {
-			actor = party->get_actor(i);
-			actor_tile = tile_manager->get_tile(actor->get_downward_facing_tile_num());
+			Actor *actor = party->get_actor(i);
+			Tile *actor_tile = tile_manager->get_tile(actor->get_downward_facing_tile_num());
 
 			int x_offset = 8;
 			int y_offset = 18;
@@ -322,7 +319,7 @@ void PartyView::Display(bool full_redraw) {
 			}
 
 			screen->blit(area.left + x_offset, area.top + y_offset + (i - row_offset)*rowH, actor_tile->data, 8, 16, 16, 16, true);
-			actor_name = party->get_actor_name(i);
+			const char *actor_name = party->get_actor_name(i);
 
 			if (SE) {
 				x_offset = 4;
diff --git a/engines/ultima/nuvie/views/portrait_view.h b/engines/ultima/nuvie/views/portrait_view.h
index bbc2872461b..c75b359c602 100644
--- a/engines/ultima/nuvie/views/portrait_view.h
+++ b/engines/ultima/nuvie/views/portrait_view.h
@@ -72,7 +72,7 @@ public:
 		show_cursor = state;
 	}
 	void set_waiting(bool state);
-	bool get_waiting()     {
+	bool get_waiting() const {
 		return (waiting);
 	}
 
diff --git a/engines/ultima/nuvie/views/scroll_widget_gump.cpp b/engines/ultima/nuvie/views/scroll_widget_gump.cpp
index 78d0c2230aa..27214f74a95 100644
--- a/engines/ultima/nuvie/views/scroll_widget_gump.cpp
+++ b/engines/ultima/nuvie/views/scroll_widget_gump.cpp
@@ -102,7 +102,7 @@ bool ScrollWidgetGump::parse_token(MsgText *token) {
 	return MsgScroll::parse_token(token);
 }
 
-void ScrollWidgetGump::display_string(Std::string s) {
+void ScrollWidgetGump::display_string(const Std::string &s) {
 	MsgScroll::display_string(s);
 	update_arrows();
 }
diff --git a/engines/ultima/nuvie/views/scroll_widget_gump.h b/engines/ultima/nuvie/views/scroll_widget_gump.h
index 5d054305d88..224acf01781 100644
--- a/engines/ultima/nuvie/views/scroll_widget_gump.h
+++ b/engines/ultima/nuvie/views/scroll_widget_gump.h
@@ -73,15 +73,15 @@ public:
 
 	bool parse_token(MsgText *token) override;
 
-	bool can_display_prompt() override {
+	bool can_display_prompt() const override {
 		return false;
 	}
 
 	void Display(bool full_redraw) override;
 
 	void display_prompt() override {}
-	void display_string(Std::string s);
-	void display_string(Std::string s, Font *f, bool include_on_map_window) override {
+	void display_string(const Std::string &s);
+	void display_string(const Std::string &s, Font *f, bool include_on_map_window) override {
 		return MsgScroll::display_string(s, f, include_on_map_window);
 	}
 
diff --git a/engines/ultima/nuvie/views/spell_view.cpp b/engines/ultima/nuvie/views/spell_view.cpp
index a47a1884763..6dcff430bcc 100644
--- a/engines/ultima/nuvie/views/spell_view.cpp
+++ b/engines/ultima/nuvie/views/spell_view.cpp
@@ -147,7 +147,7 @@ uint8 SpellView::fill_cur_spell_list() {
 	return j;
 }
 
-sint8 SpellView::get_selected_index() {
+sint8 SpellView::get_selected_index() const {
 	for (uint8 i = 0; i < 16; i++) {
 		if (cur_spells[i] == spell_container->quality) {
 			return (sint8)i;
@@ -301,7 +301,7 @@ void SpellView::display_spell_text(Spell *spell, uint16 line_num, uint8 selected
 		font->drawChar(screen, 26, area.left + 8, area.top + (line_num * 8));
 }
 
-uint16 SpellView::get_available_spell_count(Spell *s) {
+uint16 SpellView::get_available_spell_count(const Spell *s) const {
 	if (s->reagents == 0) // Help and Armageddon
 		return 1;
 	if (Game::get_game()->has_unlimited_casting())
diff --git a/engines/ultima/nuvie/views/spell_view.h b/engines/ultima/nuvie/views/spell_view.h
index f7d6a319aec..1050f16bc27 100644
--- a/engines/ultima/nuvie/views/spell_view.h
+++ b/engines/ultima/nuvie/views/spell_view.h
@@ -63,7 +63,7 @@ public:
 	virtual bool init(Screen *tmp_screen, void *view_manager, uint16 x, uint16 y, Font *f, Party *p, TileManager *tm, ObjManager *om);
 
 	void set_spell_caster(Actor *actor, Obj *s_container, bool eventMode);
-	sint16 get_selected_spell() {
+	sint16 get_selected_spell() const {
 		if (spell_container) {
 			return spell_container->quality;
 		} else return -1;
@@ -118,14 +118,14 @@ protected:
 	void set_next_level();
 
 	virtual uint8 fill_cur_spell_list();
-	sint8 get_selected_index();
+	sint8 get_selected_index() const;
 
 	void display_level_text();
 	void display_spell_list_text();
 	void display_spell_text(Spell *spell, uint16 line_num, uint8 selected_spell);
 	void show_spell_description();
 	GUI_status cancel_spell();
-	uint16 get_available_spell_count(Spell *s);
+	uint16 get_available_spell_count(const Spell *s) const;
 
 	GUI_status callback(uint16 msg, GUI_CallBack *caller, void *data) override;
 };
diff --git a/engines/ultima/nuvie/views/spell_view_gump.cpp b/engines/ultima/nuvie/views/spell_view_gump.cpp
index d7d123fd835..5d290334b59 100644
--- a/engines/ultima/nuvie/views/spell_view_gump.cpp
+++ b/engines/ultima/nuvie/views/spell_view_gump.cpp
@@ -154,7 +154,7 @@ uint8 SpellViewGump::fill_cur_spell_list() {
 	return count;
 }
 
-void SpellViewGump::loadCircleString(Std::string datadir) {
+void SpellViewGump::loadCircleString(const Std::string &datadir) {
 	Std::string imagefile;
 	char filename[7]; // n.bmp\0
 
@@ -183,7 +183,7 @@ void SpellViewGump::loadCircleString(Std::string datadir) {
 	}
 }
 
-void SpellViewGump::loadCircleSuffix(Std::string datadir, Std::string image) {
+void SpellViewGump::loadCircleSuffix(const Std::string &datadir, const Std::string &image) {
 	Std::string imagefile;
 
 	build_path(datadir, image, imagefile);
@@ -257,7 +257,7 @@ void SpellViewGump::close_spellbook() {
 	Game::get_game()->get_event()->close_spellbook();
 }
 
-sint16 SpellViewGump::getSpell(int x, int y) {
+sint16 SpellViewGump::getSpell(int x, int y) const {
 	int localy = y - area.top;
 	int localx = x - area.left;
 
diff --git a/engines/ultima/nuvie/views/spell_view_gump.h b/engines/ultima/nuvie/views/spell_view_gump.h
index 89b06bb837c..cd4ed13bf56 100644
--- a/engines/ultima/nuvie/views/spell_view_gump.h
+++ b/engines/ultima/nuvie/views/spell_view_gump.h
@@ -67,11 +67,11 @@ public:
 	GUI_status callback(uint16 msg, GUI_CallBack *caller, void *data) override;
 protected:
 
-	sint16 getSpell(int x, int y);
+	sint16 getSpell(int x, int y) const;
 
 	uint8 fill_cur_spell_list() override;
-	void loadCircleString(Std::string datadir);
-	void loadCircleSuffix(Std::string datadir, Std::string image);
+	void loadCircleString(const Std::string &datadir);
+	void loadCircleSuffix(const Std::string &datadir, const Std::string &image);
 	void printSpellQty(uint8 spell_num, uint16 x, uint16 y);
 
 	void close_spellbook();
diff --git a/engines/ultima/nuvie/views/sun_moon_ribbon.cpp b/engines/ultima/nuvie/views/sun_moon_ribbon.cpp
index 97805fac2a5..dfbb465b54d 100644
--- a/engines/ultima/nuvie/views/sun_moon_ribbon.cpp
+++ b/engines/ultima/nuvie/views/sun_moon_ribbon.cpp
@@ -123,7 +123,7 @@ void SunMoonRibbon::update_hour(uint16 time) {
 	}
 }
 
-void SunMoonRibbon::display_sun_moon(Tile *tile, uint8 pos) {
+void SunMoonRibbon::display_sun_moon(const Tile *tile, uint8 pos) {
 	struct {
 		sint16 x, y;
 	} skypos[15] = { // sky positions relative to area
diff --git a/engines/ultima/nuvie/views/sun_moon_ribbon.h b/engines/ultima/nuvie/views/sun_moon_ribbon.h
index 14e24d00422..56dbb2232ef 100644
--- a/engines/ultima/nuvie/views/sun_moon_ribbon.h
+++ b/engines/ultima/nuvie/views/sun_moon_ribbon.h
@@ -53,7 +53,7 @@ public:
 	}
 
 protected:
-	void display_sun_moon(Tile *tile, uint8 pos) override;
+	void display_sun_moon(const Tile *tile, uint8 pos) override;
 
 private:
 	void loadBgImage(uint8 num);
diff --git a/engines/ultima/nuvie/views/sun_moon_strip_widget.cpp b/engines/ultima/nuvie/views/sun_moon_strip_widget.cpp
index 95869049b74..88e19cbb63c 100644
--- a/engines/ultima/nuvie/views/sun_moon_strip_widget.cpp
+++ b/engines/ultima/nuvie/views/sun_moon_strip_widget.cpp
@@ -98,7 +98,7 @@ void SunMoonStripWidget::display_dungeon_strip() {
 	return;
 }
 // <SB-X>
-void SunMoonStripWidget::display_sun_moon(Tile *tile, uint8 pos) {
+void SunMoonStripWidget::display_sun_moon(const Tile *tile, uint8 pos) {
 	struct {
 		sint16 x, y;
 	} skypos[15] = { // sky positions relative to area
diff --git a/engines/ultima/nuvie/views/sun_moon_strip_widget.h b/engines/ultima/nuvie/views/sun_moon_strip_widget.h
index 2f06bc87cc5..39ad9555781 100644
--- a/engines/ultima/nuvie/views/sun_moon_strip_widget.h
+++ b/engines/ultima/nuvie/views/sun_moon_strip_widget.h
@@ -44,7 +44,7 @@ public:
 	void Display(bool full_redraw) override;
 
 protected:
-	virtual void display_sun_moon(Tile *tile, uint8 pos);
+	virtual void display_sun_moon(const Tile *tile, uint8 pos);
 	void display_sun(uint8 hour, uint8 minute, bool eclipse);
 	void display_moons(uint8 day, uint8 hour, uint8 minute = 0);
 
diff --git a/engines/ultima/nuvie/views/view.cpp b/engines/ultima/nuvie/views/view.cpp
index c1a145ec6a4..8530bd9385e 100644
--- a/engines/ultima/nuvie/views/view.cpp
+++ b/engines/ultima/nuvie/views/view.cpp
@@ -148,7 +148,7 @@ void View::set_combat_mode(Actor *actor) {
 	actor->set_combat_mode(combat_mode);
 }
 
-uint8 View::get_combat_mode_index(Actor *actor) {
+uint8 View::get_combat_mode_index(const Actor *actor) const {
 	uint8 combat_mode = actor->get_combat_mode();
 	if (Game::get_game()->get_game_type() == NUVIE_GAME_U6)
 		return (combat_mode - 2);
diff --git a/engines/ultima/nuvie/views/view.h b/engines/ultima/nuvie/views/view.h
index 69a84409b0d..bc457cba88f 100644
--- a/engines/ultima/nuvie/views/view.h
+++ b/engines/ultima/nuvie/views/view.h
@@ -62,14 +62,14 @@ public:
 	bool init(uint16 x, uint16 y, Font *f, Party *p, TileManager *tm, ObjManager *om);
 
 	virtual bool set_party_member(uint8 party_member);
-	uint8 get_party_member_num() {
+	uint8 get_party_member_num() const {
 		return cur_party_member;
 	}
 	bool next_party_member();
 	bool prev_party_member();
 	void fill_md_background(uint8 color, const Common::Rect &r);
 	void set_combat_mode(Actor *actor);
-	uint8 get_combat_mode_index(Actor *actor);
+	uint8 get_combat_mode_index(const Actor *actor) const;
 
 	virtual void close_view() {}
 


Commit: db9edb80e3886408f9bbe72dc9aa81e9428365ca
    https://github.com/scummvm/scummvm/commit/db9edb80e3886408f9bbe72dc9aa81e9428365ca
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2023-12-09T13:56:06+11:00

Commit Message:
ULTIMA: NUVIE: Use initializer list in more constructors

Changed paths:
    engines/ultima/nuvie/actors/actor.cpp
    engines/ultima/nuvie/actors/actor.h
    engines/ultima/nuvie/actors/actor_manager.cpp
    engines/ultima/nuvie/actors/actor_manager.h
    engines/ultima/nuvie/actors/u6_actor.cpp
    engines/ultima/nuvie/core/anim_manager.cpp
    engines/ultima/nuvie/core/book.cpp
    engines/ultima/nuvie/core/converse.cpp
    engines/ultima/nuvie/core/converse.h
    engines/ultima/nuvie/core/converse_interpret.cpp
    engines/ultima/nuvie/core/converse_interpret.h
    engines/ultima/nuvie/core/converse_speech.cpp
    engines/ultima/nuvie/core/cursor.cpp
    engines/ultima/nuvie/core/effect.cpp
    engines/ultima/nuvie/core/effect.h
    engines/ultima/nuvie/gui/widgets/gui_widget.cpp
    engines/ultima/nuvie/gui/widgets/gui_widget.h
    engines/ultima/nuvie/gui/widgets/map_window.h


diff --git a/engines/ultima/nuvie/actors/actor.cpp b/engines/ultima/nuvie/actors/actor.cpp
index 976082a3e5c..63bac3aeadd 100644
--- a/engines/ultima/nuvie/actors/actor.cpp
+++ b/engines/ultima/nuvie/actors/actor.cpp
@@ -56,8 +56,7 @@ Actor::Actor(Map *m, ObjManager *om, GameClock *c)
 	  talk_flags(0), obj_flags(0), body_armor_class(0), readied_armor_class(0),
 	  custom_tile_tbl(nullptr), id_n(0), x(0), y(0), z(0), obj_n(0), frame_n(0),
 	  base_obj_n(0), old_frame_n(0), movement_flags(0), strength(0), dex(0),
-	  intelligence(0), hp(0), level(0), magic(0), combat_mode(0) {
-	clock = c;
+	  intelligence(0), hp(0), level(0), magic(0), combat_mode(0), _clock(c) {
 	memset(readied_objects, 0, sizeof(readied_objects));
 	clear_error();
 }
@@ -494,7 +493,7 @@ bool Actor::move(uint16 new_x, uint16 new_y, uint8 new_z, ActorMoveFlags flags)
 	if (id_n == game->get_player()->get_actor()->id_n && game->get_player()->is_mapwindow_centered())
 		game->get_map_window()->centerMapOnActor(this);
 // allows a delay to be set on actor movement, in lieu of using animations
-	move_time = clock->get_ticks();
+	move_time = _clock->get_ticks();
 	return true;
 }
 
diff --git a/engines/ultima/nuvie/actors/actor.h b/engines/ultima/nuvie/actors/actor.h
index 9fc5f66d4c7..fd5b8441a47 100644
--- a/engines/ultima/nuvie/actors/actor.h
+++ b/engines/ultima/nuvie/actors/actor.h
@@ -231,7 +231,7 @@ protected:
 
 	Map *map;
 	ObjManager *obj_manager;
-	GameClock *clock;
+	GameClock *_clock;
 	UseCode *usecode;
 	ActorPathFinder *pathfinder;
 
diff --git a/engines/ultima/nuvie/actors/actor_manager.cpp b/engines/ultima/nuvie/actors/actor_manager.cpp
index 75cc1269171..6b943681ad8 100644
--- a/engines/ultima/nuvie/actors/actor_manager.cpp
+++ b/engines/ultima/nuvie/actors/actor_manager.cpp
@@ -49,18 +49,10 @@ namespace Nuvie {
 #define ACTOR_TEMP_INIT 255
 #define SCHEDULE_SIZE 5
 
-ActorManager::ActorManager(Configuration *cfg, Map *m, TileManager *tm, ObjManager *om, GameClock *c) {
-	uint16 i;
-
-	config = cfg;
-	map = m;
-	tile_manager = tm;
-	obj_manager = om;
-	clock = c;
-
-	for (i = 0; i < ACTORMANAGER_MAX_ACTORS; i++)
-		actors[i] = nullptr;
-	temp_actor_offset = 224;
+ActorManager::ActorManager(Configuration *cfg, Map *m, TileManager *tm, ObjManager *om, GameClock *c)
+		: config(cfg), map(m), tile_manager(tm), obj_manager(om), _clock(c),
+		  temp_actor_offset(224) {
+	ARRAYCLEAR(actors);
 	init();
 }
 
@@ -118,13 +110,13 @@ bool ActorManager::load(NuvieIO *objlist) {
 	for (i = 0; i < ACTORMANAGER_MAX_ACTORS; i++) {
 		switch (game_type) {
 		case NUVIE_GAME_U6 :
-			actors[i] = new U6Actor(map, obj_manager, clock);
+			actors[i] = new U6Actor(map, obj_manager, _clock);
 			break;
 		case NUVIE_GAME_MD :
-			actors[i] = new MDActor(map, obj_manager, clock);
+			actors[i] = new MDActor(map, obj_manager, _clock);
 			break;
 		case NUVIE_GAME_SE :
-			actors[i] = new SEActor(map, obj_manager, clock);
+			actors[i] = new SEActor(map, obj_manager, _clock);
 			break;
 		}
 
@@ -647,7 +639,7 @@ void ActorManager::startActors() {
 }
 
 void ActorManager::updateSchedules(bool teleport) {
-	uint8 cur_hour = clock->get_hour();
+	uint8 cur_hour = _clock->get_hour();
 
 	for (int i = 0; i < ACTORMANAGER_MAX_ACTORS; i++)
 		if (!actors[i]->is_in_party()) // don't do scheduled activities while partying
@@ -818,7 +810,7 @@ bool ActorManager::create_temp_actor(uint16 obj_n, uint8 obj_status, uint16 x, u
 
 		if (new_actor)
 			*new_actor = actor;
-		actor->handle_lightsource(clock->get_hour());
+		actor->handle_lightsource(_clock->get_hour());
 		return true;
 	} else
 		DEBUG(0, LEVEL_NOTIFICATION, "***All Temp Actor Slots Full***\n");
diff --git a/engines/ultima/nuvie/actors/actor_manager.h b/engines/ultima/nuvie/actors/actor_manager.h
index 63c7c068bf9..067e726a7f9 100644
--- a/engines/ultima/nuvie/actors/actor_manager.h
+++ b/engines/ultima/nuvie/actors/actor_manager.h
@@ -54,7 +54,7 @@ class ActorManager {
 	Actor *actors[ACTORMANAGER_MAX_ACTORS];
 	uint8 player_actor;
 	uint8 temp_actor_offset;
-	GameClock *clock;
+	GameClock *_clock;
 
 	uint16 last_obj_blk_x, last_obj_blk_y;
 	uint8 last_obj_blk_z;
diff --git a/engines/ultima/nuvie/actors/u6_actor.cpp b/engines/ultima/nuvie/actors/u6_actor.cpp
index f4f5482a99a..cd48ac0e21a 100644
--- a/engines/ultima/nuvie/actors/u6_actor.cpp
+++ b/engines/ultima/nuvie/actors/u6_actor.cpp
@@ -46,10 +46,9 @@
 namespace Ultima {
 namespace Nuvie {
 
-U6Actor::U6Actor(Map *m, ObjManager *om, GameClock *c): Actor(m, om, c), actor_type(nullptr),
-	base_actor_type(nullptr) {
-	walk_frame_inc = 1;
-	current_movetype = MOVETYPE_U6_NONE;
+U6Actor::U6Actor(Map *m, ObjManager *om, GameClock *c): Actor(m, om, c),
+		actor_type(nullptr), walk_frame_inc(1), base_actor_type(nullptr),
+		current_movetype(MOVETYPE_U6_NONE) {
 }
 
 U6Actor::~U6Actor() {
diff --git a/engines/ultima/nuvie/core/anim_manager.cpp b/engines/ultima/nuvie/core/anim_manager.cpp
index b0591b2db2b..ac7adfe5f0f 100644
--- a/engines/ultima/nuvie/core/anim_manager.cpp
+++ b/engines/ultima/nuvie/core/anim_manager.cpp
@@ -83,16 +83,12 @@ static float get_relative_degrees(sint16 sx, sint16 sy, float angle_up) {
 
 
 AnimManager::AnimManager(sint16 x, sint16 y, Screen *screen, Common::Rect *clipto)
-	: next_id(0) {
+		: next_id(0), tile_pitch(16), viewsurf(screen), mapwindow_x_offset(x),
+		  mapwindow_y_offset(y) {
 	map_window = Game::get_game()->get_map_window();
-	tile_pitch = 16;
 
-	viewsurf = screen;
 	if (clipto)
 		viewport = *clipto;
-
-	mapwindow_x_offset = x;
-	mapwindow_y_offset = y;
 }
 
 
diff --git a/engines/ultima/nuvie/core/book.cpp b/engines/ultima/nuvie/core/book.cpp
index f44e9d9039a..bb77500f0d5 100644
--- a/engines/ultima/nuvie/core/book.cpp
+++ b/engines/ultima/nuvie/core/book.cpp
@@ -29,9 +29,7 @@
 namespace Ultima {
 namespace Nuvie {
 
-Book::Book(Configuration *cfg) {
-	config = cfg;
-	books = new U6Lib_n;
+Book::Book(Configuration *cfg) : config(cfg), books(new U6Lib_n) {
 }
 
 Book::~Book() {
diff --git a/engines/ultima/nuvie/core/converse.cpp b/engines/ultima/nuvie/core/converse.cpp
index 42ca63a0738..9f228cfaa5f 100644
--- a/engines/ultima/nuvie/core/converse.cpp
+++ b/engines/ultima/nuvie/core/converse.cpp
@@ -50,8 +50,7 @@ Converse::Converse() : config(nullptr), actors(nullptr), objects(nullptr),
 		src(nullptr), src_num(0), allowed_input(nullptr), active(false),
 		variables(nullptr), party_all_the_time(false), speech(nullptr),
 		using_fmtowns(false), need_input(false), conversations_stop_music(false),
-		gametype(NUVIE_GAME_NONE) {
-	clock = nullptr;
+		gametype(NUVIE_GAME_NONE), _clock(nullptr) {
 	ARRAYCLEAR(aname);
 }
 
@@ -66,7 +65,7 @@ Converse::init(Configuration *cfg, nuvie_game_t t, MsgScroll *s, ActorManager *a
 	config = cfg;
 	scroll = s;
 	actors = a;
-	clock = c;
+	_clock = c;
 	player = p;
 	views = v;
 	objects = o;
diff --git a/engines/ultima/nuvie/core/converse.h b/engines/ultima/nuvie/core/converse.h
index a8cdb3b6c78..0efc8162203 100644
--- a/engines/ultima/nuvie/core/converse.h
+++ b/engines/ultima/nuvie/core/converse.h
@@ -92,7 +92,7 @@ class Converse {
 
 	// game system objects from nuvie
 	Configuration *config;
-	GameClock *clock;
+	GameClock *_clock;
 	ActorManager *actors;
 	ObjManager *objects;
 	Player *player;
diff --git a/engines/ultima/nuvie/core/converse_interpret.cpp b/engines/ultima/nuvie/core/converse_interpret.cpp
index 64e99c139a1..46812f515ce 100644
--- a/engines/ultima/nuvie/core/converse_interpret.cpp
+++ b/engines/ultima/nuvie/core/converse_interpret.cpp
@@ -38,18 +38,11 @@ namespace Nuvie {
 
 //#define CONVERSE_DEBUG
 
-ConverseInterpret::ConverseInterpret(Converse *owner) {
-	converse = owner;
-	b_frame = nullptr;
-	decl_v = decl_t = 0x00;
-	in_start = 0;
-
+ConverseInterpret::ConverseInterpret(Converse *owner)
+		: converse(owner), b_frame(nullptr), decl_v(0), decl_t(0), in_start(0),
+		  answer_mode(ANSWER_NO), stopped(false), db_lvar(false), db_loc(0),
+		  db_offset(0) {
 	unwait();
-	answer_mode = ANSWER_NO;
-	stopped = false;
-	db_lvar = false;
-	db_loc = 0;
-	db_offset = 0;
 }
 
 
@@ -283,7 +276,7 @@ string ConverseInterpret::get_formatted_text(const char *c_str) {
 			else if (!strcmp(symbol, "$P")) // player name
 				output.append(converse->player->get_name());
 			else if (!strcmp(symbol, "$T")) // time of day
-				output.append(converse->clock->get_time_of_day_string());
+				output.append(converse->_clock->get_time_of_day_string());
 			else if (!strcmp(symbol, "$Y")) // Y-string
 				output.append(get_ystr());
 			else if (!strcmp(symbol, "$Z")) // previous input
diff --git a/engines/ultima/nuvie/core/converse_interpret.h b/engines/ultima/nuvie/core/converse_interpret.h
index 856c800f2f3..97d2ad20183 100644
--- a/engines/ultima/nuvie/core/converse_interpret.h
+++ b/engines/ultima/nuvie/core/converse_interpret.h
@@ -158,10 +158,10 @@ protected:
 	converse_value db_offset;
 
 
-	const char *get_rstr(uint32 sn) {
+	const char *get_rstr(uint32 sn) const {
 		return ((sn < rstrings.size()) ? rstrings[sn].c_str() : "");
 	}
-	const char *get_ystr()          {
+	const char *get_ystr() const {
 		return (ystring.c_str());
 	}
 	void set_ystr(const char *s);
@@ -181,7 +181,7 @@ protected:
 	void leave_all() {
 		while (b_frame && !b_frame->empty()) leave();
 	}
-	struct convi_frame_s *top_frame() {
+	struct convi_frame_s *top_frame() const {
 		return ((b_frame && !b_frame->empty()) ? b_frame->top() : nullptr);
 	}
 	void do_frame(converse_value c);
@@ -189,7 +189,7 @@ protected:
 	void set_break(converse_value c) {
 		if (top_frame()) top_frame()->break_c = c;
 	}
-	converse_value get_break()       {
+	converse_value get_break() const {
 		return (top_frame() ? top_frame()->break_c : 0x00);
 	}
 	void clear_break()               {
@@ -198,7 +198,7 @@ protected:
 	void set_run(bool r) {
 		if (top_frame()) top_frame()->run = r;
 	}
-	bool get_run()       {
+	bool get_run() const {
 		return (top_frame() ? top_frame()->run : true);
 	}
 
@@ -235,14 +235,14 @@ protected:
 	void add_text(unsigned char c = 0);
 
 	/* manipulating collected input */
-	uint32 val_count()     {
+	uint32 val_count() const {
 		return (in.size());
 	}
 	converse_value get_val(uint32 vi);
 	uint8 get_val_size(uint32 vi);
 	converse_value pop_val();
 	uint8 pop_val_size();
-	const Std::string &get_text() {
+	const Std::string &get_text() const {
 		return text;
 	}
 	void flush() {
@@ -268,7 +268,7 @@ protected:
 public:
 	virtual uint8 npc_num(uint32 n);//uint8 npc_num(uint32 n){return((n!=0xeb)?n:converse->npc_num);}
 	bool check_keywords(Std::string keystr, Std::string instr);
-	bool var_input() {
+	bool var_input() const {
 		return (decl_t != 0x00);
 	}
 	void assign_input(); // set declared variable to Converse input
diff --git a/engines/ultima/nuvie/core/converse_speech.cpp b/engines/ultima/nuvie/core/converse_speech.cpp
index 7655d45ede5..f720646d82c 100644
--- a/engines/ultima/nuvie/core/converse_speech.cpp
+++ b/engines/ultima/nuvie/core/converse_speech.cpp
@@ -31,8 +31,7 @@
 namespace Ultima {
 namespace Nuvie {
 
-ConverseSpeech::ConverseSpeech() {
-	config = nullptr;
+ConverseSpeech::ConverseSpeech() : config(nullptr) {
 }
 
 
diff --git a/engines/ultima/nuvie/core/cursor.cpp b/engines/ultima/nuvie/core/cursor.cpp
index 220ac2e8c71..e6e843cd955 100644
--- a/engines/ultima/nuvie/core/cursor.cpp
+++ b/engines/ultima/nuvie/core/cursor.cpp
@@ -37,16 +37,8 @@ using Std::string;
 using Std::vector;
 
 
-Cursor::Cursor() {
-	cursor_id = 0;
-	cur_x = cur_y = -1;
-	cleanup = nullptr;
-	cleanup_area = Common::Rect();
-	update_area = Common::Rect();
-	hidden = false;
-	screen = nullptr;
-	config = nullptr;
-	screen_w = screen_h = 0;
+Cursor::Cursor() : cursor_id(0), cur_x(-1), cur_y(-1), cleanup(nullptr),
+		hidden(false), screen(nullptr), config(nullptr), screen_w(0), screen_h(0) {
 }
 
 
diff --git a/engines/ultima/nuvie/core/effect.cpp b/engines/ultima/nuvie/core/effect.cpp
index 2953e77c19d..0942a190ec2 100644
--- a/engines/ultima/nuvie/core/effect.cpp
+++ b/engines/ultima/nuvie/core/effect.cpp
@@ -58,8 +58,7 @@ FadeEffect *FadeEffect::current_fade = nullptr;
 
 /* Add self to effect list (for future deletion).
  */
-Effect::Effect() : defunct(false) {
-	retain_count = 0;
+Effect::Effect() : defunct(false), retain_count(0) {
 	game = Game::get_game();
 	effect_manager = game->get_effect_manager();
 	effect_manager->add_effect(this);
@@ -84,11 +83,9 @@ void Effect::add_anim(NuvieAnim *anim) {
  *                                 -1=use cannon frame
  */
 CannonballEffect::CannonballEffect(Obj *src_obj, sint8 direction)
-	: target_loc() {
+	: obj(src_obj) {
 	usecode = game->get_usecode();
-	obj = src_obj;
-	MapCoord obj_loc(obj->x, obj->y, obj->z);
-	target_loc = obj_loc;
+	target_loc = MapCoord(obj->x, obj->y, obj->z);
 
 	if (direction == -1)
 		direction = obj->frame_n;
@@ -189,13 +186,9 @@ uint16 CannonballEffect::callback(uint16 msg, CallBack *caller, void *msg_data)
 #define EXP_EFFECT_SPEED 3
 
 
-ExpEffect::ExpEffect(uint16 tileNum, MapCoord location) {
+ExpEffect::ExpEffect(uint16 tileNum, MapCoord location) : ProjectileEffect(),
+		exp_tile_num(tileNum), usecode(nullptr), obj(nullptr) {
 	start_loc = location;
-	finished_tiles = 0;
-	exp_tile_num = tileNum;
-	usecode = nullptr;
-	obj = nullptr;
-
 	start_anim();
 }
 
@@ -477,7 +470,7 @@ uint16 HitEffect::callback(uint16 msg, CallBack *caller, void *msg_data) {
 }
 
 TextEffect::TextEffect(Std::string text) { // default somewhat centered on player for cheat messages
-	MapWindow *map_window = game->get_map_window();
+	const MapWindow *map_window = game->get_map_window();
 	if (!map_window || map_window->Status() != WIDGET_VISIBLE) // scripted sequence like intro and intro menu
 		return;
 	MapCoord loc = game->get_player()->get_actor()->get_location();
diff --git a/engines/ultima/nuvie/core/effect.h b/engines/ultima/nuvie/core/effect.h
index e13b8b1b23e..e886181fc46 100644
--- a/engines/ultima/nuvie/core/effect.h
+++ b/engines/ultima/nuvie/core/effect.h
@@ -137,14 +137,9 @@ protected:
 	virtual void start_anim();
 
 public:
-	ProjectileEffect() {
-		tile_num = 0;
-		anim_speed = 0;
-		trail = false;
-		initial_tile_rotation = 0;
-		rotation_amount = 0;
-		src_tile_y_offset = 0;
-		finished_tiles = 0;
+	ProjectileEffect() : tile_num(0), anim_speed(0), trail(false),
+			initial_tile_rotation(0), rotation_amount(0), src_tile_y_offset(0),
+			finished_tiles(0) {
 	}
 	ProjectileEffect(uint16 tileNum, MapCoord start, MapCoord target, uint8 speed, bool trailFlag, uint16 initialTileRotation, uint16 rotationAmount, uint8 src_y_offset);
 	ProjectileEffect(uint16 tileNum, MapCoord start, vector<MapCoord> t, uint8 speed, bool trailFlag, uint16 initialTileRotation);
diff --git a/engines/ultima/nuvie/gui/widgets/gui_widget.cpp b/engines/ultima/nuvie/gui/widgets/gui_widget.cpp
index 29f2af50c60..e58e0dc2f86 100644
--- a/engines/ultima/nuvie/gui/widgets/gui_widget.cpp
+++ b/engines/ultima/nuvie/gui/widgets/gui_widget.cpp
@@ -173,7 +173,7 @@ void GUI_Widget::PlaceOnScreen(Screen *s, GUI_DragManager *dm, int x, int y) {
 }
 
 /* Report status to GUI */
-int GUI_Widget:: Status(void) {
+int GUI_Widget:: Status(void) const {
 	return (status);
 }
 
diff --git a/engines/ultima/nuvie/gui/widgets/gui_widget.h b/engines/ultima/nuvie/gui/widgets/gui_widget.h
index 32aaa0e8df2..2a80857c660 100644
--- a/engines/ultima/nuvie/gui/widgets/gui_widget.h
+++ b/engines/ultima/nuvie/gui/widgets/gui_widget.h
@@ -108,7 +108,7 @@ public:
 	void moveToFront();
 	virtual void PlaceOnScreen(Screen *s, GUI_DragManager *dm, int x, int y);
 
-	virtual int  Status(void);  /* Reports status to GUI */
+	virtual int  Status(void) const;  /* Reports status to GUI */
 
 	/* Set the bounds of the widget.
 	   If 'w' or 'h' is -1, that parameter will not be changed.
diff --git a/engines/ultima/nuvie/gui/widgets/map_window.h b/engines/ultima/nuvie/gui/widgets/map_window.h
index b59bbb70f31..abd512fa2e1 100644
--- a/engines/ultima/nuvie/gui/widgets/map_window.h
+++ b/engines/ultima/nuvie/gui/widgets/map_window.h
@@ -156,10 +156,10 @@ public:
 
 	bool init(TileManager *tm, ObjManager *om, ActorManager *am);
 
-	sint16 get_cur_x() {
+	sint16 get_cur_x() const {
 		return cur_x;
 	}
-	sint16 get_cur_y() {
+	sint16 get_cur_y() const {
 		return cur_y;
 	}
 	bool set_windowSize(uint16 width, uint16 height);


Commit: 93f3e5b5a4ca9584aa4a759cb8ad22b4c19ca20a
    https://github.com/scummvm/scummvm/commit/93f3e5b5a4ca9584aa4a759cb8ad22b4c19ca20a
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2023-12-09T13:56:06+11:00

Commit Message:
ULTIMA: NUVIE: Clean up brackets on return statements

Most of these brackets are unneccessary and just make the code slightly harder
to read.

Also added a few missing trivial const modifiers I noticed in the process.

Changed paths:
    engines/ultima/nuvie/actors/actor.cpp
    engines/ultima/nuvie/actors/actor.h
    engines/ultima/nuvie/actors/actor_manager.cpp
    engines/ultima/nuvie/actors/actor_manager.h
    engines/ultima/nuvie/actors/u6_actor.cpp
    engines/ultima/nuvie/core/anim_manager.cpp
    engines/ultima/nuvie/core/anim_manager.h
    engines/ultima/nuvie/core/converse.cpp
    engines/ultima/nuvie/core/converse.h
    engines/ultima/nuvie/core/converse_interpret.cpp
    engines/ultima/nuvie/core/converse_interpret.h
    engines/ultima/nuvie/core/cursor.cpp
    engines/ultima/nuvie/core/cursor.h
    engines/ultima/nuvie/core/effect.cpp
    engines/ultima/nuvie/core/effect.h
    engines/ultima/nuvie/core/effect_manager.cpp
    engines/ultima/nuvie/core/events.cpp
    engines/ultima/nuvie/core/events.h
    engines/ultima/nuvie/core/game.h
    engines/ultima/nuvie/core/game_clock.h
    engines/ultima/nuvie/core/map.h
    engines/ultima/nuvie/core/obj_manager.cpp
    engines/ultima/nuvie/core/obj_manager.h
    engines/ultima/nuvie/core/party.cpp
    engines/ultima/nuvie/core/party.h
    engines/ultima/nuvie/core/player.cpp
    engines/ultima/nuvie/core/player.h
    engines/ultima/nuvie/core/tile_manager.cpp
    engines/ultima/nuvie/core/tile_manager.h
    engines/ultima/nuvie/core/timed_event.cpp
    engines/ultima/nuvie/core/timed_event.h
    engines/ultima/nuvie/files/u6_lib_n.cpp
    engines/ultima/nuvie/files/u6_lzw.cpp
    engines/ultima/nuvie/files/u6_lzw.h
    engines/ultima/nuvie/gui/gui.cpp
    engines/ultima/nuvie/gui/gui.h
    engines/ultima/nuvie/gui/gui_console.cpp
    engines/ultima/nuvie/gui/gui_dialog.cpp
    engines/ultima/nuvie/gui/gui_load_image.cpp
    engines/ultima/nuvie/gui/gui_scroll_bar.cpp
    engines/ultima/nuvie/gui/gui_scroller.cpp
    engines/ultima/nuvie/gui/gui_text_input.cpp
    engines/ultima/nuvie/gui/widgets/command_bar.cpp
    engines/ultima/nuvie/gui/widgets/command_bar_new_ui.cpp
    engines/ultima/nuvie/gui/widgets/converse_gump.cpp
    engines/ultima/nuvie/gui/widgets/gui_widget.cpp
    engines/ultima/nuvie/gui/widgets/gui_widget.h
    engines/ultima/nuvie/gui/widgets/map_window.cpp
    engines/ultima/nuvie/gui/widgets/msg_scroll.cpp
    engines/ultima/nuvie/gui/widgets/msg_scroll.h
    engines/ultima/nuvie/gui/widgets/msg_scroll_new_ui.cpp
    engines/ultima/nuvie/misc/u6_misc.cpp
    engines/ultima/nuvie/pathfinder/astar_path.cpp
    engines/ultima/nuvie/pathfinder/astar_path.h
    engines/ultima/nuvie/pathfinder/dir_finder.cpp
    engines/ultima/nuvie/pathfinder/party_path_finder.cpp
    engines/ultima/nuvie/pathfinder/path.cpp
    engines/ultima/nuvie/pathfinder/u6_astar_path.cpp
    engines/ultima/nuvie/portraits/portrait.cpp
    engines/ultima/nuvie/portraits/portrait_u6.cpp
    engines/ultima/nuvie/screen/screen.cpp
    engines/ultima/nuvie/script/script.h
    engines/ultima/nuvie/sound/adplug/mid.cpp
    engines/ultima/nuvie/sound/adplug/u6m.cpp
    engines/ultima/nuvie/sound/decoder/fm_towns_decoder_stream.h
    engines/ultima/nuvie/usecode/u6_usecode.cpp
    engines/ultima/nuvie/usecode/usecode.cpp
    engines/ultima/nuvie/usecode/usecode.h
    engines/ultima/nuvie/views/actor_view.cpp
    engines/ultima/nuvie/views/container_view_gump.h
    engines/ultima/nuvie/views/container_widget.cpp
    engines/ultima/nuvie/views/container_widget.h
    engines/ultima/nuvie/views/doll_widget.cpp
    engines/ultima/nuvie/views/doll_widget.h
    engines/ultima/nuvie/views/draggable_view.cpp
    engines/ultima/nuvie/views/inventory_view.cpp
    engines/ultima/nuvie/views/inventory_view.h
    engines/ultima/nuvie/views/inventory_widget.cpp
    engines/ultima/nuvie/views/inventory_widget.h
    engines/ultima/nuvie/views/map_editor_view.cpp
    engines/ultima/nuvie/views/party_view.cpp
    engines/ultima/nuvie/views/party_view.h
    engines/ultima/nuvie/views/portrait_view.cpp
    engines/ultima/nuvie/views/portrait_view.h
    engines/ultima/nuvie/views/scroll_widget_gump.cpp
    engines/ultima/nuvie/views/spell_view.cpp
    engines/ultima/nuvie/views/view.cpp
    engines/ultima/nuvie/views/view_manager.h


diff --git a/engines/ultima/nuvie/actors/actor.cpp b/engines/ultima/nuvie/actors/actor.cpp
index 63bac3aeadd..abae5c2b647 100644
--- a/engines/ultima/nuvie/actors/actor.cpp
+++ b/engines/ultima/nuvie/actors/actor.cpp
@@ -116,19 +116,19 @@ void Actor::init_from_obj(Obj *obj, bool change_base_obj) {
 bool Actor::is_nearby(const MapCoord &where, uint8 thresh) const {
 	MapCoord here(x, y, z);
 	if (here.xdistance(where) <= thresh && here.ydistance(where) <= thresh && z == where.z)
-		return (true);
-	return (false);
+		return true;
+	return false;
 }
 
 
 bool Actor::is_nearby(const Actor *other) const {
 	MapCoord there(other->get_location());
-	return (is_nearby(there));
+	return is_nearby(there);
 }
 
 
 bool Actor::is_nearby(uint8 actor_num) const {
-	return (is_nearby(Game::get_game()->get_actor_manager()->get_actor(actor_num)));
+	return is_nearby(Game::get_game()->get_actor_manager()->get_actor(actor_num));
 }
 
 bool Actor::is_at_position(const Obj *obj) const {
@@ -161,7 +161,7 @@ void Actor::get_location(uint16 *ret_x, uint16 *ret_y, uint8 *ret_level) const {
 
 
 MapCoord Actor::get_location() const {
-	return (MapCoord(x, y, z));
+	return MapCoord(x, y, z);
 }
 
 
@@ -325,7 +325,7 @@ const char *Actor::get_name(bool force_real_name) {
 		name = talk_name;
 	else
 		name = actor_manager->look_actor(this, false);
-	return (name.c_str());
+	return name.c_str();
 }
 
 void Actor::add_surrounding_obj(Obj *obj) {
@@ -381,7 +381,7 @@ bool Actor::check_move(uint16 new_x, uint16 new_y, uint8 new_z, ActorMoveFlags f
 		if (map->is_damaging(new_x, new_y, new_z))
 			return false;
 
-	return (true);
+	return true;
 }
 
 bool Actor::check_moveRelative(sint16 rel_x, sint16 rel_y, ActorMoveFlags flags) {
@@ -395,7 +395,7 @@ bool Actor::can_be_moved() {
 
 bool Actor::can_be_passed(const Actor *other) const {
 	// ethereal actors can always pass us
-	return (other->ethereal || is_passable());
+	return other->ethereal || is_passable();
 }
 
 uint8 Actor::get_object_readiable_location(Obj *obj) {
@@ -676,8 +676,8 @@ const U6LList *Actor::get_inventory_list() const {
 
 bool Actor::inventory_has_object(uint16 objN, uint8 qual, bool match_quality, uint8 frameN, bool match_frame_n) {
 	if (inventory_get_object(objN, qual, match_quality, frameN, match_frame_n))
-		return (true);
-	return (false);
+		return true;
+	return false;
 }
 
 uint32 Actor::inventory_count_objects(bool inc_readied_objects) const {
@@ -713,7 +713,7 @@ uint32 Actor::inventory_count_object(uint16 objN) {
 			qty += obj->get_total_qty(objN);
 	}
 
-	return (qty);
+	return qty;
 }
 
 
@@ -729,10 +729,10 @@ Obj *Actor::inventory_get_object(uint16 objN, uint8 qual, bool match_quality, ui
 		obj = (Obj *)link->data;
 		if (obj->obj_n == objN && (match_quality == false || obj->quality == qual)
 				&& (match_frame_n == false || obj->frame_n == frameN)) //FIXME should qual = 0 be an all quality search!?
-			return (obj);
+			return obj;
 		else if (obj->has_container()) {
 			if ((obj = obj->find_in_container(objN, qual, match_quality)))
-				return (obj);
+				return obj;
 		}
 	}
 
@@ -832,7 +832,7 @@ uint32 Actor::inventory_del_object(uint16 objN, uint32 qty, uint8 quality) {
 			deleted += (qty - deleted);
 		}
 	}
-	return (deleted);
+	return deleted;
 }
 
 void Actor::inventory_del_all_objs() {
@@ -888,7 +888,7 @@ float Actor::get_inventory_weight() const {
 		weight += obj_manager->get_obj_weight(obj);
 	}
 
-	return (weight);
+	return weight;
 }
 
 float Actor::get_inventory_equip_weight() {
@@ -908,7 +908,7 @@ float Actor::get_inventory_equip_weight() {
 			weight += obj_manager->get_obj_weight(obj);
 	}
 
-	return (weight);
+	return weight;
 }
 
 
@@ -919,7 +919,7 @@ bool Actor::can_carry_object(uint16 objN, uint32 qty) const {
 		return true;
 	float obj_weight = obj_manager->get_obj_weight(objN);
 	if (qty) obj_weight *= qty;
-	return (can_carry_weight(obj_weight));
+	return can_carry_weight(obj_weight);
 }
 
 bool Actor::can_carry_object(Obj *obj) const {
@@ -932,7 +932,7 @@ bool Actor::can_carry_object(Obj *obj) const {
 }
 
 bool Actor::can_carry_weight(Obj *obj) const {
-	return (can_carry_weight(obj_manager->get_obj_weight(obj, OBJ_WEIGHT_INCLUDE_CONTAINER_ITEMS, OBJ_WEIGHT_DO_SCALE)));
+	return can_carry_weight(obj_manager->get_obj_weight(obj, OBJ_WEIGHT_INCLUDE_CONTAINER_ITEMS, OBJ_WEIGHT_DO_SCALE));
 }
 
 /* Can the actor carry new object(s) of this weight?
@@ -944,7 +944,7 @@ bool Actor::can_carry_weight(float obj_weight) const {
 	// obj_weight /= 10;
 	float inv_weight = get_inventory_weight() + obj_weight;
 	float max_weight = inventory_get_max_weight();
-	return (inv_weight <= max_weight);
+	return inv_weight <= max_weight;
 }
 
 
@@ -1236,7 +1236,7 @@ bool Actor::updateSchedule(uint8 hour, bool teleport) {
 // U6: temp. fix for walking statues; they shouldn't have schedules
 	if (Game::get_game()->get_game_type() == NUVIE_GAME_U6 && id_n >= 188 && id_n <= 200) {
 		DEBUG(0, LEVEL_WARNING, "tried to update schedule for non-movable actor %d\n", id_n);
-		return (false);
+		return false;
 	}
 
 	set_worktype(sched[sched_pos]->worktype);
@@ -1430,33 +1430,33 @@ bool Actor::push(Actor *pusher, uint8 where) {
 	if (where == ACTOR_PUSH_HERE) { // move to pusher's square and use up moves
 		MapCoord to(pusher->x, pusher->y, pusher->z), from(get_location());
 		if (to.distance(from) > 1 || z != to.z)
-			return (false);
+			return false;
 		face_location(to.x, to.y);
 		move(to.x, to.y, to.z, ACTOR_FORCE_MOVE); // can even move onto blocked squares
 		if (moves > 0)
 			set_moves_left(0); // we use up our moves exchanging positions
-		return (true);
+		return true;
 	} else if (where == ACTOR_PUSH_ANYWHERE) { // go to any neighboring direction
 		MapCoord from(get_location());
 		const uint16 square = 1;
 		if (this->push(pusher, ACTOR_PUSH_FORWARD))
-			return (true); // prefer forward push
+			return true; // prefer forward push
 		for (uint16 xp = (from.x - square); xp <= (from.x + square); xp += square)
 			for (uint16 yp = (from.y - square); yp <= (from.y + square); yp += square)
 				if (xp != from.x && yp != from.y && move(xp, yp, from.z))
-					return (true);
+					return true;
 	} else if (where == ACTOR_PUSH_FORWARD) { // move away from pusher
 		MapCoord from(get_location());
 		MapCoord pusher_loc(pusher->x, pusher->y, pusher->z);
 		if (pusher_loc.distance(from) > 1 || z != pusher->z)
-			return (false);
+			return false;
 		sint8 rel_x = -(pusher_loc.x - from.x), rel_y = -(pusher_loc.y - from.y);
 		if (moveRelative(rel_x, rel_y)) {
 			set_direction(rel_x, rel_y);
-			return (true);
+			return true;
 		}
 	}
-	return (false);
+	return false;
 }
 
 /* Subtract amount from hp. May die if hp is too low. */
@@ -1689,12 +1689,12 @@ void Actor::clear_error() {
 }
 
 ActorError *Actor::get_error() {
-	return (&error_struct);
+	return &error_struct;
 }
 
 // frozen by worktype or status
 bool Actor::is_immobile() const {
-	return (false);
+	return false;
 }
 
 void Actor::print() {
@@ -1894,7 +1894,7 @@ bool Actor::morph(uint16 objN) {
 	return true;
 }
 
-bool Actor::get_schedule_location(MapCoord *loc) {
+bool Actor::get_schedule_location(MapCoord *loc) const {
 	if (sched[sched_pos] == nullptr)
 		return false;
 
@@ -1904,7 +1904,7 @@ bool Actor::get_schedule_location(MapCoord *loc) {
 	return true;
 }
 
-bool Actor::is_at_scheduled_location() {
+bool Actor::is_at_scheduled_location() const {
 	if (sched[sched_pos] != nullptr && x == sched[sched_pos]->x && y == sched[sched_pos]->y && z == sched[sched_pos]->z)
 		return true;
 
diff --git a/engines/ultima/nuvie/actors/actor.h b/engines/ultima/nuvie/actors/actor.h
index fd5b8441a47..16b9fae9144 100644
--- a/engines/ultima/nuvie/actors/actor.h
+++ b/engines/ultima/nuvie/actors/actor.h
@@ -307,10 +307,10 @@ public:
 	void init_from_obj(Obj *obj, bool change_base_obj = false);
 
 	bool is_avatar() const {
-		return (id_n == ACTOR_AVATAR_ID_N);
+		return id_n == ACTOR_AVATAR_ID_N;
 	}
 	bool is_onscreen() const {
-		return (MapCoord(x, y, z).is_visible());
+		return MapCoord(x, y, z).is_visible();
 	}
 	bool is_in_party() const {
 		return ((status_flags & ACTOR_STATUS_IN_PARTY) == ACTOR_STATUS_IN_PARTY);
@@ -333,35 +333,35 @@ public:
 
 //for lack of a better name:
 	bool is_met() const {
-		return (talk_flags & 0x01);
+		return talk_flags & 0x01;
 	}
 	bool is_poisoned() const {
-		return (status_flags & ACTOR_STATUS_POISONED);
+		return status_flags & ACTOR_STATUS_POISONED;
 	}
 	bool is_invisible() const {
-		return (obj_flags & OBJ_STATUS_INVISIBLE);
+		return obj_flags & OBJ_STATUS_INVISIBLE;
 	}
 	virtual bool is_immobile() const; // frozen by worktype or status
 	virtual bool is_sleeping() const {
-		return (status_flags & ACTOR_STATUS_ASLEEP);
+		return status_flags & ACTOR_STATUS_ASLEEP;
 	}
 	virtual bool is_paralyzed() const {
-		return (status_flags & ACTOR_STATUS_PARALYZED);
+		return status_flags & ACTOR_STATUS_PARALYZED;
 	}
 	virtual bool is_protected() const {
-		return (status_flags & ACTOR_STATUS_PROTECTED);
+		return status_flags & ACTOR_STATUS_PROTECTED;
 	}
 	virtual bool is_charmed() const {
-		return (obj_flags & OBJ_STATUS_CHARMED);
+		return obj_flags & OBJ_STATUS_CHARMED;
 	}
 	virtual bool is_cursed() const {
-		return (obj_flags & OBJ_STATUS_CURSED);
+		return obj_flags & OBJ_STATUS_CURSED;
 	}
 	virtual bool get_corpser_flag() const {
 		return false;
 	}
 	bool is_hit() const {
-		return (movement_flags & ACTOR_MOVEMENT_HIT_FLAG);
+		return movement_flags & ACTOR_MOVEMENT_HIT_FLAG;
 	}
 
 	void set_name(const char *actor_name) {
@@ -376,42 +376,42 @@ public:
 	Tile *get_tile() const;
 	virtual uint16 get_downward_facing_tile_num() const;
 	uint8 get_actor_num() const {
-		return (id_n);
+		return id_n;
 	}
 	uint8 get_talk_flags() const {
-		return (talk_flags);
+		return talk_flags;
 	}
 	virtual ActorTileType get_tile_type() const {
-		return (ACTOR_ST);
+		return ACTOR_ST;
 	}
 
 	uint16 get_frame_n() const {
-		return (frame_n);
+		return frame_n;
 	}
 	uint16 get_old_frame_n() const {
-		return (old_frame_n);
+		return old_frame_n;
 	}
 	uint16 get_x() const {
-		return (x);
+		return x;
 	}
 	uint16 get_y() const {
-		return (y);
+		return y;
 	}
 	uint8  get_z() const {
-		return (z);
+		return z;
 	}
 
 	uint8 get_strength() const {
-		return (strength);
+		return strength;
 	}
 	uint8 get_dexterity() const {
-		return (dex);
+		return dex;
 	}
 	uint8 get_intelligence() const {
-		return (intelligence);
+		return intelligence;
 	}
 	uint8 get_hp() const {
-		return (hp);
+		return hp;
 	}
 	virtual uint8 get_hp_text_color() const {
 		return 0;
@@ -424,22 +424,22 @@ public:
 	}
 
 	uint8 get_level() const {
-		return (level);
+		return level;
 	}
 	uint16 get_exp() const {
-		return (exp);
+		return exp;
 	}
 	uint8 get_magic() const {
-		return (magic);
+		return magic;
 	}
 	uint8 get_alignment() const {
-		return (alignment);
+		return alignment;
 	}
 	uint8 get_old_alignment() const {
 		return ((movement_flags & ACTOR_MOVEMENT_FLAGS_OLD_ALIGNMENT_MASK) >> 5) + 1;
 	}
 	sint8 get_moves_left() const {
-		return (moves);
+		return moves;
 	}
 	virtual uint8 get_maxhp() const {
 		return 0;
@@ -542,7 +542,7 @@ public:
 	virtual void revert_worktype() { }
 
 	uint8 get_direction() const {
-		return (direction);
+		return direction;
 	}
 	void set_direction(sint16 rel_x, sint16 rel_y);
 	virtual void set_direction(uint8 d);
@@ -579,7 +579,7 @@ public:
 	void set_in_party(bool state);
 	void set_pathfinder(ActorPathFinder *new_pf, Path *path_type = 0);
 	ActorPathFinder *get_pathfinder() {
-		return (pathfinder);
+		return pathfinder;
 	}
 	void delete_pathfinder();
 	virtual void pathfind_to(const MapCoord &d);
@@ -635,7 +635,7 @@ public:
 	Obj *inventory_new_object(uint16 obj_n, uint32 qty, uint8 quality = 0);
 	uint32 inventory_del_object(uint16 obj_n, uint32 qty, uint8 quality);
 	float inventory_get_max_weight() const {
-		return ((strength * 2));
+		return strength * 2;
 	}
 	float get_inventory_weight() const;
 	float get_inventory_equip_weight();
@@ -667,14 +667,14 @@ public:
 
 	Obj *make_obj();
 	uint16 get_obj_n() const {
-		return (obj_n);
+		return obj_n;
 	}
 	virtual void clear();
 	virtual bool morph(uint16 obj_n); // change actor type
 
-	bool get_schedule_location(MapCoord *loc);
-	bool is_at_scheduled_location();
-	int get_number_of_schedules() {
+	bool get_schedule_location(MapCoord *loc) const;
+	bool is_at_scheduled_location() const;
+	int get_number_of_schedules() const {
 		return num_schedules;
 	}
 	Schedule *get_schedule(uint8 index);
diff --git a/engines/ultima/nuvie/actors/actor_manager.cpp b/engines/ultima/nuvie/actors/actor_manager.cpp
index 6b943681ad8..257051b53da 100644
--- a/engines/ultima/nuvie/actors/actor_manager.cpp
+++ b/engines/ultima/nuvie/actors/actor_manager.cpp
@@ -933,15 +933,15 @@ bool ActorManager::toss_actor(Actor *actor, uint16 xrange, uint16 yrange) {
 		       y = (actor->y - yrange) + (NUVIE_RAND() % ((actor->y + yrange) - (actor->y - yrange) + 1));
 		if (!map->lineTest(actor->x, actor->y, x, y, actor->z, LT_HitUnpassable, lt))
 			if (!get_actor(x, y, actor->z))
-				return (actor->move(x, y, actor->z));
+				return actor->move(x, y, actor->z);
 	}
 	// TRY ANY LOCATION
 	for (int y = actor->y - yrange; y < actor->y + yrange; y++)
 		for (int x = actor->x - xrange; x < actor->x + xrange; x++)
 			if (!map->lineTest(actor->x, actor->y, x, y, actor->z, LT_HitUnpassable, lt))
 				if (!get_actor(x, y, actor->z))
-					return (actor->move(x, y, actor->z));
-	return (false);
+					return actor->move(x, y, actor->z);
+	return false;
 }
 
 /* Find a location to put actor within range.
@@ -979,7 +979,7 @@ bool ActorManager::toss_actor_get_location(uint16 start_x, uint16 start_y, uint8
 				}
 			}
 
-	return (false);
+	return false;
 }
 
 
diff --git a/engines/ultima/nuvie/actors/actor_manager.h b/engines/ultima/nuvie/actors/actor_manager.h
index 067e726a7f9..35240f33d84 100644
--- a/engines/ultima/nuvie/actors/actor_manager.h
+++ b/engines/ultima/nuvie/actors/actor_manager.h
@@ -94,7 +94,7 @@ public:
 		update = u;
 	}
 	bool get_update() const {
-		return (update);
+		return update;
 	}
 	void set_combat_movement(bool c);
 
diff --git a/engines/ultima/nuvie/actors/u6_actor.cpp b/engines/ultima/nuvie/actors/u6_actor.cpp
index cd48ac0e21a..1c6c2b9aa97 100644
--- a/engines/ultima/nuvie/actors/u6_actor.cpp
+++ b/engines/ultima/nuvie/actors/u6_actor.cpp
@@ -609,17 +609,17 @@ bool U6Actor::check_move(uint16 new_x, uint16 new_y, uint8 new_z, ActorMoveFlags
 			        && (obj_manager->get_obj_of_type_from_location(OBJ_U6_MOUSEHOLE, new_x, new_y, new_z) != nullptr
 			            || obj_manager->get_obj_of_type_from_location(OBJ_U6_BARS, new_x, new_y, new_z) != nullptr
 			            || obj_manager->get_obj_of_type_from_location(OBJ_U6_PORTCULLIS, new_x, new_y, new_z) != nullptr))
-				return (true);
+				return true;
 			if (obj_n == OBJ_U6_SILVER_SERPENT //silver serpents can crossover themselves
 			        && obj_manager->get_obj_of_type_from_location(OBJ_U6_SILVER_SERPENT, new_x, new_y, new_z) != nullptr)
-				return (true);
+				return true;
 
 			return false;
 		}
 
 	}
 
-	return (true);
+	return true;
 }
 
 bool U6Actor::check_move_silver_serpent(uint16 new_x, uint16 new_y) {
@@ -1048,23 +1048,15 @@ inline void U6Actor::move_surrounding_objs_relative(sint16 rel_x, sint16 rel_y)
 }
 
 inline void U6Actor::move_silver_serpent_objs_relative(sint16 rel_x, sint16 rel_y) {
-	Std::list<Obj *>::iterator obj;
-	uint8 objFrameN;
-	uint8 tmp_frame_n;
-	uint16 old_x, old_y;
-	uint16 tmp_x, tmp_y;
-	sint8 new_pos;
-	sint8 old_pos;
-
-	const uint8 new_frame_n_tbl[5][5] = {
-		{ 8, 10, 0, 13, 0},
-		{12, 9, 0, 0, 13},
-		{ 0, 0, 0, 0, 0},
-		{11, 0, 0, 9, 10},
-		{ 0, 11, 0, 12, 8}
+	static const uint8 new_frame_n_tbl[5][5] = {
+		{ 8, 10, 0, 13,  0},
+		{12,  9, 0,  0, 13},
+		{ 0,  0, 0,  0,  0},
+		{11,  0, 0,  9, 10},
+		{ 0, 11, 0, 12,  8}
 	};
 
-	const uint8 new_tail_frame_n_tbl[8][6] = {
+	static const uint8 new_tail_frame_n_tbl[8][6] = {
 		{0, 0, 0, 0, 0, 0},
 		{1, 0, 0, 3, 7, 0},
 		{0, 0, 0, 0, 0, 0},
@@ -1078,25 +1070,25 @@ inline void U6Actor::move_silver_serpent_objs_relative(sint16 rel_x, sint16 rel_
 	if (surrounding_objects.empty())
 		return;
 
-	obj = surrounding_objects.begin();
+	Std::list<Obj *>::iterator obj = surrounding_objects.begin();
 
-	new_pos = 2 + rel_x + (rel_y * 2);
+	sint8 new_pos = 2 + rel_x + (rel_y * 2);
 
-	old_x = (*obj)->x;
-	old_y = (*obj)->y;
+	uint16 old_x = (*obj)->x;
+	uint16 old_y = (*obj)->y;
 
 	(*obj)->x = x - rel_x; // old actor x
 	(*obj)->y = y - rel_y; // old actor y
 
-	old_pos = 2 + ((*obj)->x - old_x) + (((*obj)->y - old_y) * 2);
+	sint8 old_pos = 2 + ((*obj)->x - old_x) + (((*obj)->y - old_y) * 2);
 
-	objFrameN = (*obj)->frame_n;
+	uint8 objFrameN = (*obj)->frame_n;
 	(*obj)->frame_n = new_frame_n_tbl[new_pos][old_pos];
 	obj++;
 	for (; obj != surrounding_objects.end(); obj++) {
-		tmp_x = (*obj)->x;
-		tmp_y = (*obj)->y;
-		tmp_frame_n = (*obj)->frame_n;
+		uint16 tmp_x = (*obj)->x;
+		uint16 tmp_y = (*obj)->y;
+		uint8 tmp_frame_n = (*obj)->frame_n;
 
 		(*obj)->x = old_x;
 		(*obj)->y = old_y;
@@ -1143,13 +1135,12 @@ inline void U6Actor::set_direction_of_surrounding_objs(uint8 new_direction) {
 }
 
 inline void U6Actor::set_direction_of_surrounding_ship_objs(uint8 new_direction) {
-	Std::list<Obj *>::iterator obj;
-	uint16 pitch = map->get_width(z);
-
-	obj = surrounding_objects.begin();
+	Std::list<Obj *>::iterator obj = surrounding_objects.begin();
 	if (obj == surrounding_objects.end())
 		return;
 
+	uint16 pitch = map->get_width(z);
+
 	(*obj)->x = x;
 	(*obj)->y = y;
 
@@ -1225,13 +1216,11 @@ inline void U6Actor::set_direction_of_surrounding_ship_objs(uint8 new_direction)
 }
 
 inline void U6Actor::set_direction_of_surrounding_splitactor_objs(uint8 new_direction) {
-	Obj *obj;
-	uint16 pitch = map->get_width(z);
-
 	if (surrounding_objects.empty())
 		return;
 
-	obj = surrounding_objects.back();
+	uint16 pitch = map->get_width(z);
+	Obj *obj = surrounding_objects.back();
 
 	if (obj->frame_n < 8)
 		obj->frame_n = (get_reverse_direction(new_direction) * actor_type->tiles_per_direction + actor_type->tiles_per_frame - 1); //mutant actor
@@ -1455,7 +1444,6 @@ void U6Actor::die(bool create_body) {
 	if (has_surrounding_objs())
 		clear_surrounding_objs_list(true);
 
-
 	set_dead_flag(true); // needed sooner for unready usecode of torches
 	if (game->is_armageddon())
 		inventory_drop_all();
@@ -1502,19 +1490,17 @@ void U6Actor::die(bool create_body) {
 bool U6Actor::is_immobile() const {
 	return (((worktype == WORKTYPE_U6_MOTIONLESS
 	          || worktype == WORKTYPE_U6_IMMOBILE) && !is_in_party())
-	        || get_corpser_flag() == true
-	        || is_sleeping() == true
-	        || is_paralyzed() == true
+	        || get_corpser_flag() || is_sleeping() || is_paralyzed()
 	        /*|| can_move == false*/); // can_move really means can_twitch/animate
 }
 
 bool U6Actor::can_twitch() {
-	return ((can_move == true || obj_n == OBJ_U6_MUSICIAN_PLAYING)
-	        && visible_flag == true
+	return ((can_move || obj_n == OBJ_U6_MUSICIAN_PLAYING)
+	        && visible_flag
 	        && actor_type->twitch_rand != 0
-	        && get_corpser_flag() == false
-	        && is_sleeping() == false
-	        && is_paralyzed() == false);
+	        && !get_corpser_flag()
+	        && !is_sleeping()
+	        && !is_paralyzed());
 }
 
 bool U6Actor::can_be_passed(const Actor *other) const {
@@ -1566,7 +1552,7 @@ const char *U6Actor::get_worktype_string(uint32 wt) const {
 	else if (wt == 0x99) wt_string = "Brawl";
 	else if (wt == 0x9a) wt_string = "Mousing";
 	else if (wt == 0x9b) wt_string = "Attack Party";
-	return (wt_string);
+	return wt_string;
 }
 
 /* Return the first food or drink object in inventory. */
@@ -1588,17 +1574,13 @@ Obj *U6Actor::inventory_get_food(Obj *container) {
 }
 
 void U6Actor::inventory_make_all_objs_ok_to_take() {
-	U6LList *inventory;
-	U6Link *link;
-	Obj *obj;
-
-	inventory = get_inventory_list();
+	U6LList *inventory = get_inventory_list();
 
 	if (!inventory)
 		return;
 
-	for (link = inventory->start(); link != nullptr;) {
-		obj = (Obj *)link->data;
+	for (U6Link *link = inventory->start(); link != nullptr;) {
+		Obj *obj = (Obj *)link->data;
 		link = link->next;
 
 		obj->set_ok_to_take(true, true);
@@ -1608,7 +1590,7 @@ void U6Actor::inventory_make_all_objs_ok_to_take() {
 }
 /* Set worktype to normal non-combat activity. */
 void U6Actor::revert_worktype() {
-	Party *party = Game::get_game()->get_party();
+	const Party *party = Game::get_game()->get_party();
 	if (is_in_party())
 		set_worktype(WORKTYPE_U6_IN_PARTY);
 	if (party->get_leader_actor() == this)
@@ -1659,11 +1641,11 @@ void U6Actor::handle_lightsource(uint8 hour) {
 }
 
 uint8 U6Actor::get_hp_text_color() const {
-	uint8 hp_text_color = 0x48; //standard text color)
+	uint8 hp_text_color = 0x48; // standard text color
 
-	if (is_poisoned()) //actor is poisoned, display their hp in green
+	if (is_poisoned()) // actor is poisoned, display their hp in green
 		hp_text_color = 0xa;
-	else if (get_hp() < 10) //actor is critical, display their hp in red.
+	else if (get_hp() < 10) // actor is critical, display their hp in red.
 		hp_text_color = 0x0c;
 
 	return hp_text_color;
diff --git a/engines/ultima/nuvie/core/anim_manager.cpp b/engines/ultima/nuvie/core/anim_manager.cpp
index ac7adfe5f0f..83ad769ecd3 100644
--- a/engines/ultima/nuvie/core/anim_manager.cpp
+++ b/engines/ultima/nuvie/core/anim_manager.cpp
@@ -78,7 +78,7 @@ static float get_relative_degrees(sint16 sx, sint16 sy, float angle_up) {
 	angle += angle_up;
 	if (angle >= 360)
 		angle -= 360;
-	return (angle);
+	return angle;
 }
 
 
@@ -98,10 +98,10 @@ AnimIterator AnimManager::get_anim_iterator(uint32 anim_id) {
 	AnimIterator i = anim_list.begin();
 	while (i != anim_list.end()) {
 		if ((*i)->id_n == anim_id)
-			return (i);
+			return i;
 		++i;
 	}
-	return (anim_list.end());
+	return anim_list.end();
 }
 
 
@@ -110,8 +110,8 @@ AnimIterator AnimManager::get_anim_iterator(uint32 anim_id) {
 NuvieAnim *AnimManager::get_anim(uint32 anim_id) {
 	AnimIterator i = get_anim_iterator(anim_id);
 	if (i != anim_list.end())
-		return (*i);
-	return (nullptr);
+		return *i;
+	return nullptr;
 }
 
 
@@ -160,7 +160,7 @@ sint32 AnimManager::new_anim(NuvieAnim *new_anim) {
 		return ((uint32)new_anim->id_n);
 	}
 	DEBUG(0, LEVEL_ERROR, "Anim: tried to add nullptr anim\n");
-	return (-1);
+	return -1;
 }
 
 
@@ -176,7 +176,7 @@ void AnimManager::destroy_all() {
 /* Delete an animation.
  */
 bool AnimManager::destroy_anim(uint32 anim_id) {
-	return (destroy_anim(get_anim(anim_id)));
+	return destroy_anim(get_anim(anim_id));
 }
 
 
@@ -189,10 +189,10 @@ bool AnimManager::destroy_anim(NuvieAnim *anim_pt) {
 		if ((*i)->safe_to_delete)
 			delete *i;
 		anim_list.erase(i);
-		return (true);
+		return true;
 	}
 	DEBUG(0, LEVEL_ERROR, "Anim: error deleting %d\n", anim_pt->id_n);
-	return (false);
+	return false;
 }
 
 
@@ -304,8 +304,8 @@ sint32 TileAnim::get_tile_id(PositionedTile *find_tile) {
 	uint32 tile_count = _tiles.size();
 	for (uint32 t = 0; t < tile_count; t++)
 		if (find_tile == _tiles[t])
-			return (t);
-	return (-1);
+			return t;
+	return -1;
 }
 
 
@@ -331,7 +331,7 @@ PositionedTile *TileAnim::add_tile(Tile *tile, sint16 x, sint16 y,
 	new_tile->px = add_x;
 	new_tile->py = add_y;
 	_tiles.insert(_tiles.begin(), new_tile);
-	return (new_tile);
+	return new_tile;
 }
 
 
@@ -430,7 +430,7 @@ bool HitAnim::update() {
 		MapCoord loc = hit_actor->get_location();
 		move(loc.x, loc.y);
 	}
-	return (true);
+	return true;
 }
 
 uint16 HitAnim::callback(uint16 msg, CallBack *caller, void *msg_data) {
@@ -439,7 +439,7 @@ uint16 HitAnim::callback(uint16 msg, CallBack *caller, void *msg_data) {
 		stop();
 	}
 
-	return (0);
+	return 0;
 }
 
 
@@ -471,7 +471,7 @@ uint16 TextAnim::callback(uint16 msg, CallBack *caller, void *msg_data) {
 		stop();
 	}
 
-	return (0);
+	return 0;
 }
 
 /*** TossAnim ***/
@@ -588,7 +588,7 @@ MapCoord TossAnim::get_location() {
 	if (src->y > target->y) { // moving up
 		if (_px > 0) loc.y += 1;
 	}
-	return (loc);
+	return loc;
 }
 
 
@@ -637,7 +637,7 @@ bool TossAnim::update() {
 			}
 		}
 	} while (running && moves_left > 0);
-	return (true);
+	return true;
 }
 
 void TossAnim::display() {
@@ -702,7 +702,7 @@ uint32 TossAnim::update_position(uint32 max_move) {
 //DEBUG(0,LEVEL_DEBUGGING,"(%d) moves:%f x_move:%d y_move:%d x_left:%f y_left:%f\n",ms_passed,moves,x_move,y_move,x_left,y_left);
 	// too slow for movement, just return
 	if (x_move == 0 && y_move == 0)
-		return (moves_left);
+		return moves_left;
 
 	if (x_move != 0) {
 		if (x_dist >= y_dist) { // Y=X*tangent
@@ -720,7 +720,7 @@ uint32 TossAnim::update_position(uint32 max_move) {
 		}
 	} else // only moving along Y
 		shift(0, y_move); // **MOVE**
-	return (moves_left);
+	return moves_left;
 }
 
 
@@ -833,7 +833,7 @@ uint16 ExplosiveAnim::callback(uint16 msg, CallBack *caller, void *msg_data) {
 	uint32 flame_size = flame.size();
 
 	if (msg != MESG_TIMED)
-		return (0);
+		return 0;
 
 	for (uint32 t = 0; t < flame_size; t++) { // update each line of fire
 		uint32 r = radius;
@@ -853,7 +853,7 @@ uint16 ExplosiveAnim::callback(uint16 msg, CallBack *caller, void *msg_data) {
 		message(MESG_ANIM_DONE); // FIXME: in the future make all Anims send when deleted
 		stop();
 	}
-	return (0);
+	return 0;
 }
 
 
@@ -899,7 +899,7 @@ bool ExplosiveAnim::update() {
 //            flame[t].direction.sx = flame[t].direction.sy = 0;
 	}
 
-	return (true);
+	return true;
 }
 
 
@@ -910,8 +910,8 @@ bool ExplosiveAnim::already_hit(MapEntity ent) {
 	for (uint32 e = 0; e < hit_items.size(); e++)
 		if (hit_items[e].entity_type == ent.entity_type)
 			if (hit_items[e].data == ent.data)
-				return (true);
-	return (false);
+				return true;
+	return false;
 }
 
 
@@ -1069,7 +1069,7 @@ bool ProjectileAnim::update() {
 		stop();
 	}
 
-	return (true);
+	return true;
 }
 
 /* Also adds actor/object to hit_items list for already_hit() to check. */
@@ -1087,8 +1087,8 @@ bool ProjectileAnim::already_hit(MapEntity ent) {
 	for (uint32 e = 0; e < hit_items.size(); e++)
 		if (hit_items[e].entity_type == ent.entity_type)
 			if (hit_items[e].data == ent.data)
-				return (true);
-	return (false);
+				return true;
+	return false;
 }
 
 /*** WingAnim ***/
@@ -1179,7 +1179,7 @@ bool WingAnim::update() {
 		}
 	}
 
-	return (true);
+	return true;
 }
 
 HailstormAnim::HailstormAnim(MapCoord t) : target(t) {
diff --git a/engines/ultima/nuvie/core/anim_manager.h b/engines/ultima/nuvie/core/anim_manager.h
index 940d93fe355..2bb751130af 100644
--- a/engines/ultima/nuvie/core/anim_manager.h
+++ b/engines/ultima/nuvie/core/anim_manager.h
@@ -74,7 +74,7 @@ public:
 	void display(bool top_anims = false);
 
 	Screen *get_surface()            {
-		return (viewsurf);
+		return viewsurf;
 	}
 	void set_surface(Screen *screen) {
 		viewsurf = screen;
@@ -86,7 +86,7 @@ public:
 		tile_pitch = p;
 	}
 	uint8 get_tile_pitch() const {
-		return (tile_pitch);
+		return tile_pitch;
 	}
 
 //new_anim(new ExplosiveAnim(speed));
@@ -128,7 +128,7 @@ protected:
 
 	// return false if animation doesn't need redraw
 	virtual bool update() {
-		return (true);
+		return true;
 	}
 	virtual void display() = 0;
 
@@ -149,10 +149,10 @@ public:
 	}
 
 	virtual MapCoord get_location() {
-		return (MapCoord(px, py, 0));
+		return MapCoord(px, py, 0);
 	}
 	uint32 get_id() const {
-		return (id_n);
+		return id_n;
 	}
 
 	void set_safe_to_delete(bool val)       {
@@ -170,7 +170,7 @@ public:
 	virtual void start()                    { }
 	uint16 message(uint16 msg, void *msg_data = nullptr, void *my_data = nullptr) {
 		if (callback_target) return (CallBack::message(msg, msg_data, my_data));
-		else return (0);
+		else return 0;
 	}
 
 	virtual void move(uint32 x, uint32 y, uint32 add_x = 0, uint32 add_y = 0)    {
@@ -214,7 +214,7 @@ public:
 	~TileAnim() override;
 
 	MapCoord get_location() override {
-		return (MapCoord(_tx, _ty, 0));
+		return MapCoord(_tx, _ty, 0);
 	}
 	void get_offset(uint32 &x_add, uint32 &y_add) const {
 		x_add = _px;
diff --git a/engines/ultima/nuvie/core/converse.cpp b/engines/ultima/nuvie/core/converse.cpp
index 9f228cfaa5f..0fe0b158b1f 100644
--- a/engines/ultima/nuvie/core/converse.cpp
+++ b/engines/ultima/nuvie/core/converse.cpp
@@ -201,15 +201,15 @@ uint32 Converse::load_conv(uint8 a) {
  */
 const char *Converse::src_name() {
 	if (src_num == 0)
-		return ("");
+		return "";
 	if (gametype == NUVIE_GAME_U6)
 		return ((src_num == 1) ? "converse.a" : "converse.b");
 	if (gametype == NUVIE_GAME_MD)
-		return ("talk.lzc");
+		return "talk.lzc";
 	if (gametype == NUVIE_GAME_SE)
-		return ("talk.lzc");
+		return "talk.lzc";
 
-	return ("");
+	return "";
 }
 
 
@@ -224,7 +224,7 @@ ConvScript *Converse::load_script(uint32 n) {
 	} else
 		DEBUG(0, LEVEL_INFORMATIONAL, "Read %s npc script (%s:%d)\n",
 		      loaded->compressed ? "encoded" : "unencoded", src_name(), (unsigned int)n);
-	return (loaded);
+	return loaded;
 }
 
 
@@ -280,7 +280,7 @@ ConverseInterpret *Converse::new_interpreter() {
 		ci = (ConverseInterpret *)new SETalkInterpret(this);
 		break;
 	}
-	return (ci);
+	return ci;
 }
 
 
@@ -295,12 +295,12 @@ bool Converse::start(uint8 n) {
 	if (running())
 		stop();
 	if (!(npc = actors->get_actor(n)))
-		return (false);
+		return false;
 	// get script num for npc number (and open file)
 	script_num = get_script_num(n);
 	real_script_num = load_conv(script_num);
 	if (!src)
-		return (false);
+		return false;
 
 	script = load_script(real_script_num);
 
@@ -310,7 +310,7 @@ bool Converse::start(uint8 n) {
 		last_view = views->get_current_view();
 		if (!(conv_i = new_interpreter())) {
 			DEBUG(0, LEVEL_CRITICAL, "Can't talk: Unimplemented or unknown game type\n");
-			return (false);
+			return false;
 		}
 		views->close_all_gumps();
 		// set current NPC and start conversation
@@ -338,11 +338,11 @@ bool Converse::start(uint8 n) {
 		show_portrait(npc_num);
 		unwait();
 		DEBUG(0, LEVEL_INFORMATIONAL, "Begin conversation with \"%s\" (npc %d)\n", npc_name(n), n);
-		return (true);
+		return true;
 	}
 	DEBUG(0, LEVEL_ERROR, "Failed to load npc %d from %s:%d\n",
 	      n, src_name(), script_num);
-	return (false);
+	return false;
 }
 
 
@@ -403,9 +403,9 @@ bool Converse::input() {
 #ifdef CONVERSE_DEBUG
 		DEBUG(0, LEVEL_DEBUGGING, "Converse: INPUT \"%s\"\n\n", get_input().c_str());
 #endif
-		return (true);
+		return true;
 	}
-	return (false);
+	return false;
 }
 
 
@@ -429,8 +429,8 @@ void Converse::print_prompt() {
  */
 const char *Converse::get_svar(uint8 varnum) {
 	if (varnum <= U6TALK_VAR__LAST_ && variables[varnum].sv)
-		return ((const char *)variables[varnum].sv);
-	return ("");
+		return (const char *)variables[varnum].sv;
+	return "";
 }
 
 
@@ -494,7 +494,7 @@ const char *Converse::npc_name(uint8 num) {
 		temp_script = new ConvScript(src, num);
 		s_pt = temp_script->get_buffer();
 		if (!s_pt)
-			return (nullptr);
+			return nullptr;
 
 		// read name up to LOOK section, convert "_" to "."
 		uint32 c;
@@ -504,7 +504,7 @@ const char *Converse::npc_name(uint8 num) {
 		aname[c] = '\0';
 		delete temp_script;
 	}
-	return (aname);
+	return aname;
 }
 
 
@@ -554,14 +554,14 @@ bool Converse::override_input() {
 		if (!player->get_party()->contains_actor(npc))
 			player->get_party()->add_actor(npc);
 		print("\"Friends of Nuvie? Sure, I'll come along!\"\n*");
-		return (false);
+		return false;
 	} else if (overide_cheat && in_str == "leave") {
 		if (player->get_party()->contains_actor(npc))
 			player->get_party()->remove_actor(npc);
 		print("\"For Nuvie!\"\n*");
-		return (false);
+		return false;
 	}
-	return (true);
+	return true;
 }
 
 void Converse::collect_input() {
@@ -699,7 +699,7 @@ converse_value ConvScript::read(uint32 advance) {
 		val = *buf_pt;
 		++buf_pt;
 	}
-	return (val);
+	return val;
 }
 
 
@@ -709,7 +709,7 @@ converse_value ConvScript::read2() {
 	uint16 val = 0;
 	val = *(buf_pt++);
 	val += *(buf_pt++) << 8;
-	return (val);
+	return val;
 }
 
 
@@ -721,7 +721,7 @@ converse_value ConvScript::read4() {
 	val += *(buf_pt++) << 8;
 	val += *(buf_pt++) << 16;
 	val += *(buf_pt++) << 24;
-	return (val);
+	return val;
 }
 
 void ConvScript::write2(converse_value val) {
diff --git a/engines/ultima/nuvie/core/converse.h b/engines/ultima/nuvie/core/converse.h
index 0efc8162203..6c8d854dabb 100644
--- a/engines/ultima/nuvie/core/converse.h
+++ b/engines/ultima/nuvie/core/converse.h
@@ -148,14 +148,14 @@ public:
 	ConverseInterpret *new_interpreter();
 
 	bool start(Actor *a) {
-		return (start(a->get_actor_num()));
+		return start(a->get_actor_num());
 	}
 	bool start(uint8 n);
 	void continue_script();
 	void stop();
 
 	bool running() const {
-		return (active);
+		return active;
 	}
 	bool is_waiting_for_scroll() {
 		return scroll->get_page_break();
@@ -258,7 +258,7 @@ public:
 	}
 
 	uint32 pos()                    {
-		return (buf_pt - buf);
+		return buf_pt - buf;
 	}
 	bool overflow(uint32 ptadd = 0) {
 		return (((pos() + ptadd) >= buf_len));
diff --git a/engines/ultima/nuvie/core/converse_interpret.cpp b/engines/ultima/nuvie/core/converse_interpret.cpp
index 46812f515ce..0143340bff9 100644
--- a/engines/ultima/nuvie/core/converse_interpret.cpp
+++ b/engines/ultima/nuvie/core/converse_interpret.cpp
@@ -69,7 +69,7 @@ struct ConverseInterpret::in_val_s ConverseInterpret::read_value() {
 	struct in_val_s ival;
 	ival.v = nval;
 	ival.d = dtype;
-	return (ival);
+	return ival;
 }
 
 
@@ -381,7 +381,7 @@ converse_value ConverseInterpret::pop_val() {
 		ret = get_val(val_count() - 1);
 		in.resize(val_count() - 1);
 	}
-	return (ret);
+	return ret;
 }
 
 
@@ -394,7 +394,7 @@ uint8 ConverseInterpret::pop_val_size() {
 		ret = get_val_size(val_count() - 1);
 		in.resize(val_count() - 1);
 	}
-	return (ret);
+	return ret;
 }
 
 
@@ -402,8 +402,8 @@ uint8 ConverseInterpret::pop_val_size() {
  */
 converse_value ConverseInterpret::get_val(uint32 vi) {
 	if (vi < in.size())
-		return (in[vi].v);
-	return (0);
+		return in[vi].v;
+	return 0;
 }
 
 
@@ -412,8 +412,8 @@ converse_value ConverseInterpret::get_val(uint32 vi) {
  */
 uint8 ConverseInterpret::get_val_size(uint32 vi) {
 	if (vi < in.size())
-		return (in[vi].d);
-	return (0);
+		return in[vi].d;
+	return 0;
 }
 
 void ConverseInterpret::set_ystr(const char *s) {
@@ -435,7 +435,7 @@ void ConverseInterpret::set_rstr(uint32 sn, const char *s) {
  */
 converse_value ConverseInterpret::add_rstr(const char *s) {
 	rstrings.push_back(s ? s : "");
-	return (rstrings.size() - 1);
+	return rstrings.size() - 1;
 }
 
 
@@ -448,7 +448,7 @@ converse_value ConverseInterpret::pop_arg(Common::Stack<converse_typed_value> &v
 		ret = val.val;
 		vs.pop();
 	}
-	return (ret);
+	return ret;
 }
 
 converse_typed_value ConverseInterpret::pop_typed_arg(Common::Stack<converse_typed_value> &vs) {
@@ -457,7 +457,7 @@ converse_typed_value ConverseInterpret::pop_typed_arg(Common::Stack<converse_typ
 		ret = vs.top();
 		vs.pop();
 	}
-	return (ret);
+	return ret;
 }
 
 #if 0
@@ -470,7 +470,7 @@ bool MDTalkInterpret::op(Common::Stack<converse_value> &i) {
 		i.push(in);
 		success = ConverseInterpret::op(i);
 	}
-	return (success);
+	return success;
 }
 #endif
 
@@ -799,7 +799,7 @@ bool ConverseInterpret::op(Common::Stack<converse_typed_value> &i) {
 		DEBUG(0, LEVEL_ERROR, "Converse: UNK OP=%02x\n", inVal);
 		success = false;
 	}
-	return (success);
+	return success;
 }
 
 
@@ -1108,7 +1108,7 @@ bool ConverseInterpret::evop(Common::Stack<converse_typed_value> &i) {
 		success = false;
 	}
 	i.push(out);
-	return (success);
+	return success;
 }
 
 converse_value ConverseInterpret::evop_eq(Common::Stack<converse_typed_value> &vs) {
@@ -1185,7 +1185,7 @@ bool ConverseInterpret::check_keywords(string keystr, string instr) {
 	const char *strt_s = nullptr;
 	char *tok_s = nullptr, *cmp_s = nullptr;
 	if (keystr == "*")
-		return (true);
+		return true;
 	// check each comma-separated keyword
 	strt_s = keystr.c_str();
 	for (uint32 c = 0; c < strlen(strt_s); c++) {
@@ -1204,13 +1204,13 @@ bool ConverseInterpret::check_keywords(string keystr, string instr) {
 			if (!scumm_stricmp(tok_s, cmp_s)) {
 				free(cmp_s);
 				free(tok_s);
-				return (true);
+				return true;
 			}
 			free(cmp_s);
 			free(tok_s);
 		}
 	}
-	return (false);
+	return false;
 }
 
 
@@ -1237,7 +1237,7 @@ ConverseInterpret::get_db(uint32 loc, uint32 i) {
 	struct converse_db_s *item = nullptr;
 	uint32 d = 0, dbuf_len = 0, p = 0, e = 0;
 	if (!db)
-		return (nullptr);
+		return nullptr;
 
 //    item = (struct converse_db_s *)malloc(sizeof(struct converse_db_s));
 	item = new struct converse_db_s;
@@ -1264,7 +1264,7 @@ ConverseInterpret::get_db(uint32 loc, uint32 i) {
 		}
 		++p; // skip 0
 	}
-	return (item);
+	return item;
 }
 
 
@@ -1277,12 +1277,12 @@ char *ConverseInterpret::get_db_string(uint32 loc, uint32 i) {
 	uint32 d = 0, dbuf_len = 0, /* string pointer & length */
 	       p = 0; /* pointer into db */
 	if (!db)
-		return (nullptr);
+		return nullptr;
 	/* skip to index */
 	uint32 e = 0;
 	while (e++ < i) {
 		if (db[p] == U6OP_ENDDATA)
-			return (nullptr);
+			return nullptr;
 		while (is_print(db[p++]));
 	}
 
@@ -1295,7 +1295,7 @@ char *ConverseInterpret::get_db_string(uint32 loc, uint32 i) {
 		item[d++] = (char)(db[p]); // copy
 		item[d] = '\0';
 	} while (is_print(db[++p]));
-	return (item);
+	return item;
 }
 
 
@@ -1318,7 +1318,7 @@ converse_value ConverseInterpret::get_db_integer(uint32 loc, uint32 i) {
 		item = converse->script->read2();
 	converse->script->seek(old_pos);
 
-	return ((converse_value)item);
+	return (converse_value)item;
 }
 
 void ConverseInterpret::set_db_integer(uint32 loc, uint32 i, converse_value val) {
@@ -1375,7 +1375,7 @@ converse_value ConverseInterpret::find_db_string(uint32 loc, const char *dstring
 				if (item_str.size() > 4)
 					item_str.resize(4);
 				if (check_keywords(item_str, find_str))
-					return (i);
+					return i;
 			}
 		} else ++p;
 		++i;
@@ -1383,7 +1383,7 @@ converse_value ConverseInterpret::find_db_string(uint32 loc, const char *dstring
 #ifdef CONVERSE_DEBUG
 	DEBUG(0, LEVEL_DEBUGGING, "\nConverse: find_db_string: not found; returning %d\n", i);
 #endif
-	return (i);
+	return i;
 }
 
 const char *ConverseInterpret::evop_str(converse_value op) {
diff --git a/engines/ultima/nuvie/core/converse_interpret.h b/engines/ultima/nuvie/core/converse_interpret.h
index 97d2ad20183..1c113910ce5 100644
--- a/engines/ultima/nuvie/core/converse_interpret.h
+++ b/engines/ultima/nuvie/core/converse_interpret.h
@@ -161,8 +161,8 @@ protected:
 	const char *get_rstr(uint32 sn) const {
 		return ((sn < rstrings.size()) ? rstrings[sn].c_str() : "");
 	}
-	const char *get_ystr() const {
-		return (ystring.c_str());
+	const string &get_ystr() const {
+		return ystring;
 	}
 	void set_ystr(const char *s);
 	void set_rstr(uint32 sn, const char *s);
@@ -207,7 +207,7 @@ public:
 	virtual ~ConverseInterpret();
 
 	bool waiting() const {
-		return (is_waiting);
+		return is_waiting;
 	}
 	void wait()    {
 		is_waiting = true;
@@ -220,7 +220,7 @@ public:
 		wait();
 	}
 	bool end()     {
-		return (stopped);
+		return stopped;
 	}
 
 	void step();
@@ -236,7 +236,7 @@ protected:
 
 	/* manipulating collected input */
 	uint32 val_count() const {
-		return (in.size());
+		return in.size();
 	}
 	converse_value get_val(uint32 vi);
 	uint8 get_val_size(uint32 vi);
@@ -269,7 +269,7 @@ public:
 	virtual uint8 npc_num(uint32 n);//uint8 npc_num(uint32 n){return((n!=0xeb)?n:converse->npc_num);}
 	bool check_keywords(Std::string keystr, Std::string instr);
 	bool var_input() const {
-		return (decl_t != 0x00);
+		return decl_t != 0x00;
 	}
 	void assign_input(); // set declared variable to Converse input
 	struct converse_db_s *get_db(uint32 loc, uint32 i);
diff --git a/engines/ultima/nuvie/core/cursor.cpp b/engines/ultima/nuvie/core/cursor.cpp
index e6e843cd955..94d5e6cc6f9 100644
--- a/engines/ultima/nuvie/core/cursor.cpp
+++ b/engines/ultima/nuvie/core/cursor.cpp
@@ -74,8 +74,8 @@ bool Cursor::init(Configuration *c, Screen *s, nuvie_game_t game_type) {
 
 	if (filename != "")
 		if (load_all(filename, game_type) > 0)
-			return (true);
-	return (false);
+			return true;
+	return false;
 }
 
 
@@ -98,13 +98,13 @@ uint32 Cursor::load_all(Std::string filename, nuvie_game_t game_type) {
 	}
 
 	if (slib32_len == 0)
-		return (0);
+		return 0;
 	// FIXME: u6lib_n assumes u6 libs have no filesize header
 	iobuf.open(slib32_data, slib32_len);
 	free(slib32_data);
 
 	if (!pointer_list.open(&iobuf, 4, NUVIE_GAME_MD))
-		return (0);
+		return 0;
 
 
 	uint32 num_read = 0, num_total = pointer_list.get_num_items();
@@ -130,7 +130,7 @@ uint32 Cursor::load_all(Std::string filename, nuvie_game_t game_type) {
 	}
 	pointer_list.close();
 	iobuf.close();
-	return (num_read);
+	return num_read;
 }
 
 
@@ -151,10 +151,10 @@ void Cursor::unload_all() {
  */
 bool Cursor::set_pointer(uint8 ptr_num) {
 	if (ptr_num >= cursors.size() || !cursors[ptr_num])
-		return (false);
+		return false;
 
 	cursor_id = ptr_num;
-	return (true);
+	return true;
 }
 
 
@@ -163,9 +163,9 @@ bool Cursor::set_pointer(uint8 ptr_num) {
  */
 bool Cursor::display(int px, int py) {
 	if (cursors.empty() || !cursors[cursor_id])
-		return (false);
+		return false;
 	if (hidden)
-		return (true);
+		return true;
 	if (px == -1 || py == -1) {
 		screen->get_mouse_location(&px, &py);
 //        DEBUG(0,LEVEL_DEBUGGING,"mouse pos: %d,%d", px, py);
@@ -180,7 +180,7 @@ bool Cursor::display(int px, int py) {
 //    screen->update(px, py, ptr->w, ptr->h);
 	add_update(px, py, ptr->w, ptr->h);
 	update();
-	return (true);
+	return true;
 }
 
 
diff --git a/engines/ultima/nuvie/core/cursor.h b/engines/ultima/nuvie/core/cursor.h
index 11b05bec4b8..da8d2036ecd 100644
--- a/engines/ultima/nuvie/core/cursor.h
+++ b/engines/ultima/nuvie/core/cursor.h
@@ -95,7 +95,7 @@ public:
 		y = cursors[cursor_id]->point_y;
 	}
 	bool display()                         {
-		return (display(cur_x, cur_y));
+		return display(cur_x, cur_y);
 	}
 	bool display(int px, int py);
 	void clear();
diff --git a/engines/ultima/nuvie/core/effect.cpp b/engines/ultima/nuvie/core/effect.cpp
index 0942a190ec2..25fa934543f 100644
--- a/engines/ultima/nuvie/core/effect.cpp
+++ b/engines/ultima/nuvie/core/effect.cpp
@@ -180,7 +180,7 @@ uint16 CannonballEffect::callback(uint16 msg, CallBack *caller, void *msg_data)
 		usecode->message_obj(obj, MESG_EFFECT_COMPLETE, this);
 		delete_self();
 	}
-	return (0);
+	return 0;
 }
 
 #define EXP_EFFECT_SPEED 3
@@ -303,7 +303,7 @@ uint16 ProjectileEffect::callback(uint16 msg, CallBack *caller, void *msg_data)
 		delete_self();
 		// }
 	}
-	return (0);
+	return 0;
 }
 
 
@@ -361,10 +361,10 @@ QuakeEffect::~QuakeEffect() {
 uint16 QuakeEffect::callback(uint16 msg, CallBack *caller, void *msg_data) {
 	//  uint8 twice_strength = strength * 2;
 	if (msg != MESG_TIMED)
-		return (0);
+		return 0;
 	if (game->get_clock()->get_ticks() >= stop_time) {
 		stop_quake();
-		return (0);
+		return 0;
 	}
 	recenter_map();
 	map_window->shiftMapRelative(sx, sy);
@@ -380,7 +380,7 @@ uint16 QuakeEffect::callback(uint16 msg, CallBack *caller, void *msg_data) {
 
 	if (sx == 0 && sy == 0)
 		init_directions();
-	return (0);
+	return 0;
 }
 
 
@@ -466,7 +466,7 @@ uint16 HitEffect::callback(uint16 msg, CallBack *caller, void *msg_data) {
 		game->unpause_user();
 		delete_self();
 	}
-	return (0);
+	return 0;
 }
 
 TextEffect::TextEffect(Std::string text) { // default somewhat centered on player for cheat messages
@@ -493,7 +493,7 @@ uint16 TextEffect::callback(uint16 msg, CallBack *caller, void *msg_data) {
 	if (msg == MESG_ANIM_DONE) {
 		delete_self();
 	}
-	return (0);
+	return 0;
 }
 
 /*** ExplosiveEffect ***/
@@ -545,7 +545,7 @@ uint16 ExplosiveEffect::callback(uint16 msg, CallBack *caller, void *msg_data) {
 		game->unpause_user();
 		delete_self();
 	}
-	return (0);
+	return 0;
 }
 
 
@@ -573,7 +573,7 @@ bool UseCodeExplosiveEffect::hit_object(Obj *hit_obj) {
 		else // pass original_obj on to next effect
 			new UseCodeExplosiveEffect(nullptr, x, y, 2, hit_damage, original_obj);
 	}
-	return (false);
+	return false;
 }
 
 
@@ -650,14 +650,14 @@ void DropEffect::get_obj(Obj *obj, uint16 qty) {
 uint16 DropEffect::callback(uint16 msg, CallBack *caller, void *msg_data) {
 	// if throw_obj is nullptr, object already hit target
 	if (!throw_obj || (msg != MESG_ANIM_DONE && msg != MESG_ANIM_HIT_WORLD))
-		return (0);
+		return 0;
 
 	if (msg == MESG_ANIM_HIT_WORLD && stop_at == *(MapCoord *)msg_data
 	        && anim)
 		anim->stop();
 
 	hit_target();
-	return (0);
+	return 0;
 }
 
 
@@ -905,13 +905,13 @@ uint16 SleepEffect::callback(uint16 msg, CallBack *caller, void *data) {
 			game->unpause_user();
 			delete_self();
 		}
-		return (0);
+		return 0;
 	}
 	// assume msg == MESG_TIMED; will stop after effect completes
 	if (hour == stop_hour && minute >= stop_minute)
 		effect_manager->watch_effect(this, new FadeEffect(FADE_PIXELATED, FADE_IN));
 
-	return (0);
+	return 0;
 }
 
 
@@ -1048,9 +1048,9 @@ uint16 FadeEffect::callback(uint16 msg, CallBack *caller, void *data) {
 	// done
 	if (fade_complete == true) {
 		delete_self();
-		return (1);
+		return 1;
 	}
-	return (0);
+	return 0;
 }
 
 
@@ -1067,14 +1067,14 @@ inline bool FadeEffect::find_free_pixel(uint32 &rnum, uint32 pixelCount) {
 	for (uint32 p = rnum; p < pixelCount; p++) // check all pixels after rnum
 		if (pixels[p] == scan_color) {
 			rnum = p;
-			return (true);
+			return true;
 		}
 	for (uint32 q = 0; q < rnum; q++) // check all pixels before rnum
 		if (pixels[q] == scan_color) {
 			rnum = q;
-			return (true);
+			return true;
 		}
-	return (false);
+	return false;
 }
 
 
@@ -1144,8 +1144,8 @@ bool FadeEffect::pixelated_fade_core(uint32 pixels_to_check, sint16 fade_to) {
 			Common::Rect overlay_rect(fade_x, fade_y, fade_x + fade_from->w, fade_y + fade_from->h);
 			SDL_BlitSurface(fade_from, &fade_from_rect, overlay, &overlay_rect);
 		}
-		return (true);
-	} else return (false);
+		return true;
+	} else return false;
 }
 
 
@@ -1179,7 +1179,7 @@ uint32 FadeEffect::pixels_to_check() {
 	uint32 pixels_per_fraction = fade_speed / (fraction > 0 ? fraction : 1);
 	prev_evtime = evtime;
 	fade_iterations++;
-	return (pixels_per_fraction);
+	return pixels_per_fraction;
 }
 
 
@@ -1188,7 +1188,7 @@ uint32 FadeEffect::pixels_to_check() {
  */
 bool FadeEffect::circle_fade_out() {
 // FIXME
-	return (false);
+	return false;
 }
 
 
@@ -1197,7 +1197,7 @@ bool FadeEffect::circle_fade_out() {
  */
 bool FadeEffect::circle_fade_in() {
 // FIXME
-	return (false);
+	return false;
 }
 
 
@@ -1219,7 +1219,7 @@ uint16 GameFadeInEffect::callback(uint16 msg, CallBack *caller, void *data) {
 	// done
 	if (FadeEffect::callback(msg, caller, data) != 0)
 		game->unpause_user();
-	return (0);
+	return 0;
 }
 
 
@@ -1252,7 +1252,7 @@ FadeObjectEffect::~FadeObjectEffect() {
 /* Assume FadeEffect is complete. */
 uint16 FadeObjectEffect::callback(uint16 msg, CallBack *caller, void *data) {
 	delete_self();
-	return (0);
+	return 0;
 }
 
 
@@ -1282,7 +1282,7 @@ VanishEffect::~VanishEffect() {
 /* Assume FadeEffect is complete. */
 uint16 VanishEffect::callback(uint16 msg, CallBack *caller, void *data) {
 	delete_self();
-	return (0);
+	return 0;
 }
 
 
diff --git a/engines/ultima/nuvie/core/effect.h b/engines/ultima/nuvie/core/effect.h
index e886181fc46..c486de13500 100644
--- a/engines/ultima/nuvie/core/effect.h
+++ b/engines/ultima/nuvie/core/effect.h
@@ -92,10 +92,10 @@ public:
 	void add_anim(NuvieAnim *anim);
 
 	bool is_defunct() const {
-		return (defunct);
+		return defunct;
 	}
 	uint16 callback(uint16, CallBack *, void *) override {
-		return (0);
+		return 0;
 	}
 };
 
@@ -195,7 +195,7 @@ public:
 
 	uint16 callback(uint16 msg, CallBack *caller, void *data) override {
 		if (msg == MESG_TIMED) delete_self();    //= 0;
-		return (0);
+		return 0;
 	}
 };
 
@@ -264,7 +264,7 @@ public:
 		Effect::delete_self();
 	}
 	virtual bool hit_object(Obj *obj) {
-		return (false);    // explosion hit something
+		return false;    // explosion hit something
 	}
 	// true return=end effect
 };
diff --git a/engines/ultima/nuvie/core/effect_manager.cpp b/engines/ultima/nuvie/core/effect_manager.cpp
index 6425a689e1f..5658aa7c363 100644
--- a/engines/ultima/nuvie/core/effect_manager.cpp
+++ b/engines/ultima/nuvie/core/effect_manager.cpp
@@ -79,9 +79,9 @@ bool EffectManager::has_effects() const {
 		ConstEffectIterator i = effects.begin();
 		while (i != effects.end())
 			if (!(*i)->is_defunct()) // effect is still active
-				return (true);
+				return true;
 	}
-	return (false); // no effects, or all effects are complete
+	return false; // no effects, or all effects are complete
 }
 
 /* Add a watched effect. This will send effect completion message to the
@@ -128,7 +128,7 @@ EffectManager::EffectWatch *EffectManager::find_effect_watch(Effect *effect) {
 				return (&(*i));
 			else ++i;
 	}
-	return (nullptr);
+	return nullptr;
 }
 
 } // End of namespace Nuvie
diff --git a/engines/ultima/nuvie/core/events.cpp b/engines/ultima/nuvie/core/events.cpp
index 42418092440..1bca41f955b 100644
--- a/engines/ultima/nuvie/core/events.cpp
+++ b/engines/ultima/nuvie/core/events.cpp
@@ -671,14 +671,14 @@ bool Events::perform_talk(Actor *actor) {
 		pc->face_actor(actor);
 		if (!actor->is_immobile())
 			actor->face_actor(pc);
-		return (true);
+		return true;
 	} else {  // some actor that has no script
 		// always display look-string on failure
 		scroll->display_string(actor_manager->look_actor(actor));
 		scroll->display_string("\n");
 		scroll->display_string("Funny, no response.\n");
 	}
-	return (false);
+	return false;
 }
 
 /* Talk to `actor'. Return to the prompt if no conversation starts.
@@ -687,7 +687,7 @@ bool Events::perform_talk(Actor *actor) {
 bool Events::talk(Actor *actor) {
 	bool talking = true;
 	if (game->user_paused())
-		return (false);
+		return false;
 
 	endAction();
 
@@ -702,7 +702,7 @@ bool Events::talk(Actor *actor) {
 //        scroll->display_prompt();
 		endAction(true);
 	}
-	return (talking);
+	return talking;
 }
 
 bool Events::talk_cursor() {
@@ -714,7 +714,7 @@ bool Events::talk_cursor() {
 
 bool Events::talk_start() {
 	if (game->user_paused())
-		return (false);
+		return false;
 	close_gumps();
 	get_target("Talk-");
 	return true;
@@ -744,7 +744,7 @@ bool Events::talk(Obj *obj) {
 	endAction();
 	scroll->display_string("\n");
 	scroll->display_prompt();
-	return (false);
+	return false;
 }
 
 void Events::try_next_attack() {
@@ -842,7 +842,7 @@ bool Events::perform_get(Obj *obj, Obj *container_obj, Actor *actor) {
 	bool can_perform_get = false;
 	//float weight;
 	if (game->user_paused())
-		return (false);
+		return false;
 
 	if (obj) {
 		if (!actor)
@@ -882,7 +882,7 @@ bool Events::perform_get(Obj *obj, Obj *container_obj, Actor *actor) {
 			scroll->display_string("\n");
 			scroll->display_prompt();
 			map_window->updateBlacking();
-			return (false); // ???
+			return false; // ???
 		}
 
 		got_object = game->get_script()->call_actor_get_obj(actor, obj, container_obj);
@@ -891,7 +891,7 @@ bool Events::perform_get(Obj *obj, Obj *container_obj, Actor *actor) {
 	scroll->display_string("\n\n");
 	scroll->display_prompt();
 	map_window->updateBlacking();
-	return (got_object);
+	return got_object;
 }
 
 /* Get object at selected position, and end action. */
@@ -1009,7 +1009,7 @@ bool Events::use(Actor *actor, uint16 x, uint16 y) {
 	delete_obj(obj); // we were using an actor so free the temp Obj
 	if (mode == USE_MODE) // check mode because UseCode may have changed it
 		endAction(display_prompt);
-	return (true);
+	return true;
 }
 
 bool Events::use(sint16 rel_x, sint16 rel_y) {
@@ -1037,9 +1037,9 @@ bool Events::use(MapCoord coord) {
 		bool visible_actor = actor && actor->is_visible();
 
 		if (obj && (!visible_actor || !usecode->has_usecode(actor)))
-			return (use(obj));
+			return use(obj);
 		if (visible_actor) {
-			return (use(actor, coord.x, coord.y));
+			return use(actor, coord.x, coord.y);
 		}
 	}
 
@@ -1050,7 +1050,7 @@ bool Events::use(MapCoord coord) {
 
 bool Events::look_start() {
 	if (game->user_paused())
-		return (false);
+		return false;
 	get_target("Look-");
 	return true;
 }
@@ -1059,7 +1059,7 @@ bool Events::look_start() {
  */
 bool Events::look(Obj *obj) {
 	if (game->user_paused())
-		return (false);
+		return false;
 
 	if (obj) {
 		if (game->get_game_type() == NUVIE_GAME_U6) {
@@ -1102,7 +1102,7 @@ bool Events::look(Actor *actor) {
 	bool had_portrait = false;
 
 	if (game->user_paused())
-		return (false);
+		return false;
 
 	if (actor->get_actor_num() != 0) {
 		display_portrait(actor);
@@ -1117,7 +1117,7 @@ bool Events::look(Actor *actor) {
 	else
 		scroll->display_string(actor_manager->look_actor(actor, true));
 	scroll->display_string("\n");
-	return (had_portrait);
+	return had_portrait;
 }
 
 bool Events::search(Obj *obj) {
@@ -1125,7 +1125,7 @@ bool Events::search(Obj *obj) {
 	         target_loc = map_window->get_cursorCoord();
 
 	if (game->user_paused())
-		return (false);
+		return false;
 
 	if (obj->get_engine_loc() == OBJ_LOC_MAP && player_loc.distance(target_loc) <= 1) {
 		scroll->display_string("\nSearching here, you find ");
@@ -1135,9 +1135,9 @@ bool Events::search(Obj *obj) {
 			scroll->display_string(".\n");
 			map_window->updateBlacking(); // secret doors
 		}
-		return (true);
+		return true;
 	}
-	return (false);
+	return false;
 }
 
 // looks at the whatever is at MapWindow cursor location
@@ -1200,7 +1200,7 @@ bool Events::pushTo(Obj *obj, Actor *actor) {
 					obj_manager->moveto_container(push_obj, obj);
 				scroll->message("\n\n");
 				endAction();
-				return (true);
+				return true;
 			}
 			ok = obj_manager->moveto_container(push_obj, obj);
 		}
@@ -1216,7 +1216,7 @@ bool Events::pushTo(Obj *obj, Actor *actor) {
 				obj_manager->moveto_inventory(push_obj, actor);
 			scroll->message("\n\n");
 			endAction();
-			return (true);
+			return true;
 		} else {
 			scroll->message("nobody.\n\n");
 			endAction();
@@ -1251,7 +1251,7 @@ bool Events::pushTo(Obj *obj, Actor *actor) {
 
 	scroll->display_prompt();
 	endAction();
-	return (true);
+	return true;
 }
 
 /* Move selected object in direction relative to object.
@@ -1268,13 +1268,13 @@ bool Events::pushTo(sint16 rel_x, sint16 rel_y, bool push_from) {
 	Script *script = game->get_script();
 
 	if (game->user_paused())
-		return (false);
+		return false;
 
 	if (!push_actor && !push_obj) {
 		scroll->display_string("what?\n\n");
 		scroll->display_prompt();
 		endAction();
-		return (false);
+		return false;
 	}
 
 	if (push_actor) {
@@ -1303,7 +1303,7 @@ bool Events::pushTo(sint16 rel_x, sint16 rel_y, bool push_from) {
 			}
 			scroll->message("\n\n");
 			endAction();
-			return (true);
+			return true;
 		}
 	}
 
@@ -1424,7 +1424,7 @@ bool Events::pushTo(sint16 rel_x, sint16 rel_y, bool push_from) {
 	}
 	scroll->display_prompt();
 	endAction();
-	return (true);
+	return true;
 }
 
 bool Events::pushFrom(Obj *obj) {
@@ -1451,7 +1451,7 @@ bool Events::pushFrom(MapCoord target) {
 	MapCoord from = player->get_actor()->get_location();
 
 	if (game->user_paused())
-		return (false);
+		return false;
 
 	map_window->set_show_use_cursor(false);
 	if (from.x != target.x || from.y != target.y) {
@@ -1857,7 +1857,7 @@ bool Events::alt_code_teleport_to_person(uint32 npc) {
 	player->move(actor_location.x, actor_location.y, actor_location.z, true);
 	if (!actor_manager->toss_actor(player->get_actor(), 2, 2))
 		actor_manager->toss_actor(player->get_actor(), 4, 4);
-	return (true);
+	return true;
 }
 
 /* Display teleport destinations, get input. */
@@ -2408,11 +2408,11 @@ inline uint32 Events::TimeLeft() {
 
 	if (next_time <= now) {
 		next_time = now + NUVIE_INTERVAL;
-		return (0);
+		return 0;
 	}
 	uint32 delay = next_time - now;
 	next_time += NUVIE_INTERVAL;
-	return (delay);
+	return delay;
 }
 
 void Events::toggleFpsDisplay() {
@@ -2601,7 +2601,7 @@ bool Events::ready(Obj *obj, Actor *actor) {
 	bool readied = false;
 
 	if (game->user_paused())
-		return (false);
+		return false;
 
 	scroll->display_fmt_string("Ready-%s\n", obj_manager->look_obj(obj, false));
 	float obj_weight = obj_manager->get_obj_weight(obj, OBJ_WEIGHT_INCLUDE_CONTAINER_ITEMS,
@@ -2631,7 +2631,7 @@ bool Events::ready(Obj *obj, Actor *actor) {
 	}
 	scroll->display_string("\n");
 	scroll->display_prompt();
-	return (readied);
+	return readied;
 }
 
 /* Make actor hold an object they are wearing. */
@@ -2639,7 +2639,7 @@ bool Events::unready(Obj *obj) {
 	Actor *actor = game->get_actor_manager()->get_actor(obj->x);
 
 	if (game->user_paused())
-		return (false);
+		return false;
 
 	scroll->display_fmt_string("Unready-%s\n", obj_manager->look_obj(obj, false));
 
@@ -2654,7 +2654,7 @@ bool Events::unready(Obj *obj) {
 
 	scroll->display_string("\n");
 	scroll->display_prompt();
-	return (true);
+	return true;
 }
 
 bool Events::drop_start() {
@@ -2699,7 +2699,7 @@ bool Events::drop_select(Obj *obj, uint16 qty) {
 /* Select quantity of `drop_obj' to be dropped. (qty 0 = drop nothing) */
 bool Events::drop_count(uint16 qty) {
 	if (game->user_paused())
-		return (false);
+		return false;
 
 	drop_qty = qty;
 	scroll->display_string("\n");
@@ -3409,7 +3409,7 @@ bool Events::newAction(EventMode new_mode) {
 	map_window->set_walking(false);
 
 	if (game->user_paused())
-		return (false);
+		return false;
 	cursor_mode = false;
 // FIXME: make ATTACK_MODE use INPUT_MODE
 	if (mode == ATTACK_MODE && new_mode == ATTACK_MODE) {
@@ -3431,7 +3431,7 @@ bool Events::newAction(EventMode new_mode) {
 		return (!(mode == MOVE_MODE));
 	} else if (mode != MOVE_MODE && mode != EQUIP_MODE) { // already in another mode; exit
 		cancelAction();
-		return (false);
+		return false;
 	}
 	move_in_inventory = false;
 
@@ -3514,9 +3514,9 @@ bool Events::newAction(EventMode new_mode) {
 		break;
 	default:
 		cancelAction(); // "what?"
-		return (false);
+		return false;
 	}
-	return (true); // ready for object/direction
+	return true; // ready for object/direction
 }
 
 /* Revert to default MOVE_MODE. (walking)
diff --git a/engines/ultima/nuvie/core/events.h b/engines/ultima/nuvie/core/events.h
index 79f92fcee74..a133415709a 100644
--- a/engines/ultima/nuvie/core/events.h
+++ b/engines/ultima/nuvie/core/events.h
@@ -252,16 +252,16 @@ public:
 		return gamemenu_dialog;
 	}
 	TimeQueue *get_time_queue() {
-		return (time_queue);
+		return time_queue;
 	}
 	TimeQueue *get_game_time_queue() {
-		return (game_time_queue);
+		return game_time_queue;
 	}
 	EventMode get_mode() const {
-		return (mode);
+		return mode;
 	}
 	EventMode get_last_mode() const {
-		return (last_mode);
+		return last_mode;
 	}
 	void set_mode(EventMode new_mode);
 
diff --git a/engines/ultima/nuvie/core/game.h b/engines/ultima/nuvie/core/game.h
index e4f5c980a20..19c1b3bf234 100644
--- a/engines/ultima/nuvie/core/game.h
+++ b/engines/ultima/nuvie/core/game.h
@@ -157,7 +157,7 @@ public:
 		return script != nullptr;
 	}
 	GamePauseState get_pause_flags() const {
-		return (pause_flags);
+		return pause_flags;
 	}
 	void set_pause_flags(GamePauseState state);
 	void unpause_all();
@@ -169,19 +169,19 @@ public:
 	void pause_anims();
 	void pause_world();
 
-	bool paused()       {
-		return (pause_flags);
+	bool paused() const {
+		return pause_flags;
 	}
-	bool all_paused()   {
+	bool all_paused() const {
 		return (pause_flags & PAUSE_ALL);
 	}
-	bool user_paused()  {
+	bool user_paused() const {
 		return (pause_flags & PAUSE_USER);
 	}
-	bool anims_paused() {
+	bool anims_paused() const {
 		return (pause_flags & PAUSE_ANIMS);
 	}
-	bool world_paused() {
+	bool world_paused() const{
 		return (pause_flags & PAUSE_WORLD);
 	}
 
@@ -310,108 +310,108 @@ public:
 
 	/* Return instances of Game classes */
 	static Game *get_game()          {
-		return (game);
+		return game;
 	}
 	Configuration *get_config()       {
-		return (config);
+		return config;
 	}
 	Script *get_script()              {
-		return (script);
+		return script;
 	}
 	Screen *get_screen()              {
-		return (screen);
+		return screen;
 	}
 	Background *get_background()      {
-		return (background);
+		return background;
 	}
 	GamePalette *get_palette()        {
-		return (palette);
+		return palette;
 	}
 	Dither *get_dither()                  {
-		return (dither);
+		return dither;
 	}
 	FontManager *get_font_manager()   {
-		return (font_manager);
+		return font_manager;
 	}
 	TileManager *get_tile_manager()   {
-		return (tile_manager);
+		return tile_manager;
 	}
 	ObjManager *get_obj_manager()     {
-		return (obj_manager);
+		return obj_manager;
 	}
 	ActorManager *get_actor_manager() {
-		return (actor_manager);
+		return actor_manager;
 	}
 	EggManager *get_egg_manager()     {
-		return (egg_manager);
+		return egg_manager;
 	}
 	Magic *get_magic()                {
-		return (magic);
+		return magic;
 	}
 	Map *get_game_map()               {
-		return (game_map);
+		return game_map;
 	}
 	MapWindow *get_map_window()       {
-		return (map_window);
+		return map_window;
 	}
 	MsgScroll *get_scroll()           {
-		return (scroll);
+		return scroll;
 	}
 	Player *get_player()              {
-		return (player);
+		return player;
 	}
 	Party *get_party()                {
-		return (party);
+		return party;
 	}
 	Converse *get_converse()          {
-		return (converse);
+		return converse;
 	}
 	ConverseGump *get_converse_gump() {
-		return (conv_gump);
+		return conv_gump;
 	}
 	ViewManager *get_view_manager()   {
-		return (view_manager);
+		return view_manager;
 	}
 	GameClock *get_clock()            {
-		return (clock);
+		return clock;
 	}
 	Portrait *get_portrait()          {
-		return (portrait);
+		return portrait;
 	}
 	UseCode *get_usecode()            {
-		return (usecode);
+		return usecode;
 	}
 	Events *get_event()                {
-		return (event);
+		return event;
 	}
 	GUI *get_gui()                    {
-		return (gui);
+		return gui;
 	}
 	SoundManager *get_sound_manager() {
-		return (sound_manager);
+		return sound_manager;
 	}
 
 	Cursor *get_cursor()              {
-		return (cursor);
+		return cursor;
 	}
 	EffectManager *get_effect_manager() {
-		return (effect_manager);
+		return effect_manager;
 	}
 	CommandBar *get_command_bar()     {
-		return (command_bar);
+		return command_bar;
 	}
 	CommandBar *get_new_command_bar() {
-		return (new_command_bar);
+		return new_command_bar;
 	}
 	Weather *get_weather()            {
-		return (weather);
+		return weather;
 	}
 
 	Book *get_book()                  {
-		return (book);
+		return book;
 	}
 	KeyBinder *get_keybinder()        {
-		return (keybinder);
+		return keybinder;
 	}
 protected:
 	void init_converse();
diff --git a/engines/ultima/nuvie/core/game_clock.h b/engines/ultima/nuvie/core/game_clock.h
index d29d4c6e798..6b89d9406d8 100644
--- a/engines/ultima/nuvie/core/game_clock.h
+++ b/engines/ultima/nuvie/core/game_clock.h
@@ -114,14 +114,14 @@ public:
 	}
 
 	uint32 get_ticks() const {
-		return (SDL_GetTicks());    // milliseconds since start
+		return SDL_GetTicks();    // milliseconds since start
 	}
 	uint32 get_game_ticks() const {
-		return (time_counter/**GAMECLOCK_TICKS_PER_MINUTE+tick_counter*/);
+		return time_counter/**GAMECLOCK_TICKS_PER_MINUTE+tick_counter*/;
 	}
 // uint32 get_time()  { return(time_counter); } // get_game_ticks() is preferred
 	uint32 get_turn() const {
-		return (move_counter);
+		return move_counter;
 	}
 
 	void set_timer(uint8 timer_num, uint8 val);
diff --git a/engines/ultima/nuvie/core/map.h b/engines/ultima/nuvie/core/map.h
index e58d234bab2..260079aeea1 100644
--- a/engines/ultima/nuvie/core/map.h
+++ b/engines/ultima/nuvie/core/map.h
@@ -111,7 +111,7 @@ public:
 		return dist;
 	}
 	uint32 ydistance(const MapCoord &c2) const {
-		return (abs(c2.y - y));
+		return abs(c2.y - y);
 	}
 	// greatest 2D distance X or Y (estimate of shortest)
 	uint32 distance(const MapCoord &c2) const {
diff --git a/engines/ultima/nuvie/core/obj_manager.cpp b/engines/ultima/nuvie/core/obj_manager.cpp
index 7820140cd35..7a46dff5c78 100644
--- a/engines/ultima/nuvie/core/obj_manager.cpp
+++ b/engines/ultima/nuvie/core/obj_manager.cpp
@@ -2123,13 +2123,13 @@ inline void ObjManager::start_obj_usecode(iAVLTree *obj_tree) {
  */
 Obj *ObjManager::get_obj_from_stack(Obj *obj, uint32 count) {
 	if (count == 0 || obj->qty <= count || !is_stackable(obj))
-		return (obj);
+		return obj;
 	// requested is over 0, original quantity is greater than requested, object
 	//  is stackable
 	Obj *new_obj = copy_obj(obj);
 	new_obj->qty = count;
 	obj->qty -= count; // remove requested from original
-	return (new_obj);
+	return new_obj;
 }
 
 void clean_obj_tree_node(void *node) {
diff --git a/engines/ultima/nuvie/core/obj_manager.h b/engines/ultima/nuvie/core/obj_manager.h
index 35bf6a649e3..4ac9ae27ac0 100644
--- a/engines/ultima/nuvie/core/obj_manager.h
+++ b/engines/ultima/nuvie/core/obj_manager.h
@@ -130,10 +130,10 @@ public:
 		usecode = uc;
 	}
 	UseCode *get_usecode()        {
-		return (usecode);
+		return usecode;
 	}
 	EggManager *get_egg_manager() {
-		return (egg_manager);
+		return egg_manager;
 	}
 
 //U6LList *get_obj_superchunk(uint16 x, uint16 y, uint8 level);
@@ -196,7 +196,7 @@ public:
 
 	float get_obj_weight(Obj *obj, bool include_container_items = OBJ_WEIGHT_INCLUDE_CONTAINER_ITEMS, bool scale = true, bool include_qty = true);
 	uint8 get_obj_weight_unscaled(uint16 obj_n) {
-		return (obj_weight[obj_n]);
+		return obj_weight[obj_n];
 	}
 	float get_obj_weight(uint16 obj_n);
 
diff --git a/engines/ultima/nuvie/core/party.cpp b/engines/ultima/nuvie/core/party.cpp
index 7ef5483386a..c108bc431ff 100644
--- a/engines/ultima/nuvie/core/party.cpp
+++ b/engines/ultima/nuvie/core/party.cpp
@@ -286,9 +286,9 @@ const char *Party::get_actor_name(uint8 member_num) const {
 sint8 Party::get_member_num(const Actor *actor) const {
 	for (int i = 0; i < num_in_party; i++) {
 		if (member[i].actor->id_n == actor->id_n)
-			return (i);
+			return i;
 	}
-	return (-1);
+	return -1;
 }
 
 sint8 Party::get_member_num(uint8 a) const {
@@ -417,7 +417,7 @@ MapCoord Party::get_leader_location() const {
 	MapCoord loc;
 	if (m >= 0)
 		loc = member[m].actor->get_location();
-	return (loc);
+	return loc;
 }
 
 /* Returns absolute location where party member `m' SHOULD be (based on party
@@ -428,7 +428,7 @@ MapCoord Party::get_formation_coords(uint8 m) const {
 	MapCoord l = get_leader_location(); // leader location
 	sint8 leader = get_leader();
 	if (leader < 0)
-		return (a);
+		return a;
 	uint8 ldir = member[leader].actor->get_direction(); // leader direction
 	// intended location
 	uint16 x = (ldir == NUVIE_DIR_N) ? l.x + member[m].form_x : // X
@@ -540,7 +540,7 @@ Actor *Party::who_has_obj(uint16 obj_n, uint8 quality, bool match_qual_zero) {
 	uint16 i;
 	for (i = 0; i < num_in_party; i++) {
 		if (member[i].actor->inventory_get_object(obj_n, quality, match_qual_zero) != nullptr)
-			return (member[i].actor);
+			return member[i].actor;
 	}
 	return nullptr;
 }
@@ -561,13 +561,13 @@ bool Party::is_at(uint16 x, uint16 y, uint8 z, uint32 threshold) const {
 	for (uint32 p = 0; p < num_in_party; p++) {
 		MapCoord loc(x, y, z);
 		if (!member[p].actor->is_nearby(loc, threshold))
-			return (false);
+			return false;
 	}
-	return (true);
+	return true;
 }
 
-bool Party::is_at(MapCoord &xyz, uint32 threshold) const {
-	return (is_at(xyz.x, xyz.y, xyz.z, threshold));
+bool Party::is_at(const MapCoord &xyz, uint32 threshold) const {
+	return is_at(xyz.x, xyz.y, xyz.z, threshold);
 }
 
 /* Is ANYONE in the party at or near the coordinates? */
@@ -575,20 +575,20 @@ bool Party::is_anyone_at(uint16 x, uint16 y, uint8 z, uint32 threshold) const {
 	for (uint32 p = 0; p < num_in_party; p++) {
 		MapCoord loc(x, y, z);
 		if (member[p].actor->is_nearby(loc, threshold))
-			return (true);
+			return true;
 	}
-	return (false);
+	return false;
 }
 
-bool Party::is_anyone_at(MapCoord &xyz, uint32 threshold) const {
-	return (is_anyone_at(xyz.x, xyz.y, xyz.z, threshold));
+bool Party::is_anyone_at(const MapCoord &xyz, uint32 threshold) const {
+	return is_anyone_at(xyz.x, xyz.y, xyz.z, threshold);
 }
 
 bool Party::contains_actor(const Actor *actor) const {
 	if (get_member_num(actor) >= 0)
-		return (true);
+		return true;
 
-	return (false);
+	return false;
 }
 
 bool Party::contains_actor(uint8 actor_num) const {
@@ -690,8 +690,8 @@ void Party::hide() {
 bool Party::move(uint16 dx, uint16 dy, uint8 dz) {
 	for (sint32 m = 0; m < num_in_party; m++)
 		if (!member[m].actor->move(dx, dy, dz, ACTOR_FORCE_MOVE))
-			return (false);
-	return (true);
+			return false;
+	return true;
 }
 
 
diff --git a/engines/ultima/nuvie/core/party.h b/engines/ultima/nuvie/core/party.h
index 084faf0d675..b81026d5d3e 100644
--- a/engines/ultima/nuvie/core/party.h
+++ b/engines/ultima/nuvie/core/party.h
@@ -149,7 +149,7 @@ public:
 // Properties
 	uint8 get_party_size();
 	virtual uint8 get_party_max() {
-		return (8);    // U6
+		return 8;    // U6
 	}
 	sint8 get_leader() const; // returns -1 if party has no leader and can't move
 	MapCoord get_leader_location() const;
@@ -180,9 +180,9 @@ public:
 
 // Check entire party
 	bool is_at(uint16 x, uint16 y, uint8 z, uint32 threshold = 0) const;
-	bool is_at(MapCoord &xyz, uint32 threshold = 0) const;
+	bool is_at(const MapCoord &xyz, uint32 threshold = 0) const;
 	bool is_anyone_at(uint16 x, uint16 y, uint8 z, uint32 threshold = 0) const;
-	bool is_anyone_at(MapCoord &xyz, uint32 threshold = 0) const;
+	bool is_anyone_at(const MapCoord &xyz, uint32 threshold = 0) const;
 	bool has_obj(uint16 obj_n, uint8 quality, bool match_zero_qual = true) const;
 	bool remove_obj(uint16 obj_n, uint8 quality);
 	Actor *who_has_obj(uint16 obj_n, uint8 quality, bool match_zero_qual = true);
@@ -200,8 +200,8 @@ public:
 	void enter_vehicle(Obj *ship_obj, uint32 step_delay = 0);
 	void exit_vehicle(uint16 x, uint16 y, uint16 z);
 	void stop_walking(bool force_music_change);
-	bool get_autowalk() {
-		return (autowalk);
+	bool get_autowalk() const {
+		return autowalk;
 	}
 	void rest_gather();
 	void rest_sleep(uint8 hours, sint16 guard);
diff --git a/engines/ultima/nuvie/core/player.cpp b/engines/ultima/nuvie/core/player.cpp
index 2ba46abcddb..a263b7a2bda 100644
--- a/engines/ultima/nuvie/core/player.cpp
+++ b/engines/ultima/nuvie/core/player.cpp
@@ -165,7 +165,7 @@ Actor *Player::find_actor() {
 	for (uint32 p = 0; p < ACTORMANAGER_MAX_ACTORS; p++) {
 		Actor *theActor = actor_manager->get_actor(p);
 		if (theActor->get_worktype() == 0x02 && theActor->is_immobile() == false) // WT_U6_PLAYER
-			return (theActor);
+			return theActor;
 	}
 
 	sint8 party_leader = party->get_leader();
@@ -173,7 +173,7 @@ Actor *Player::find_actor() {
 	if (party_leader != -1)
 		return party->get_actor(party_leader);
 
-	return (actor_manager->get_avatar());
+	return actor_manager->get_avatar();
 }
 
 
@@ -230,11 +230,15 @@ Actor *Player::get_actor() {
 	return actor;
 }
 
-void Player::get_location(uint16 *ret_x, uint16 *ret_y, uint8 *ret_level) {
+const Actor *Player::get_actor() const {
+	return actor;
+}
+
+void Player::get_location(uint16 *ret_x, uint16 *ret_y, uint8 *ret_level) const {
 	actor->get_location(ret_x, ret_y, ret_level);
 }
 
-uint8 Player::get_location_level() {
+uint8 Player::get_location_level() const {
 	return actor->z;
 }
 
@@ -260,7 +264,7 @@ void Player::subtract_movement_points(uint8 points) {
 	Game::get_game()->get_script()->call_actor_subtract_movement_points(get_actor(), points);
 }
 
-const char *Player::get_gender_title() {
+const char *Player::get_gender_title() const {
 	switch (game_type) {
 	case NUVIE_GAME_U6 :
 		if (gender == 0)
@@ -535,9 +539,9 @@ bool Player::set_party_mode(Actor *new_actor) {
 	if (party->contains_actor(new_actor) || party->is_in_vehicle()) {
 		party_mode = true;
 		set_actor(new_actor);
-		return (true);
+		return true;
 	}
-	return (false);
+	return false;
 }
 
 
@@ -551,30 +555,30 @@ bool Player::set_solo_mode(Actor *new_actor) {
 		}
 		party_mode = false;
 		set_actor(new_actor);
-		return (true);
+		return true;
 	}
-	return (false);
+	return false;
 }
 
 
 /* Returns the delay in continuous movement for the actor type we control.
  */
-uint32 Player::get_walk_delay() {
+uint32 Player::get_walk_delay() const {
 	if (game_type != NUVIE_GAME_U6)
-		return (125); // normal movement about 8 spaces per second
+		return 125; // normal movement about 8 spaces per second
 
 	if (actor->obj_n == OBJ_U6_BALLOON_BASKET)
-		return (10); // 10x normal (wow!)
+		return 10; // 10x normal (wow!)
 	else if (actor->obj_n == OBJ_U6_SHIP)
-		return (20); // 5x normal
+		return 20; // 5x normal
 	else if (actor->obj_n == OBJ_U6_SKIFF)
-		return (50); // 2x normal
+		return 50; // 2x normal
 	else if (actor->obj_n == OBJ_U6_RAFT)
-		return (100); // normal
+		return 100; // normal
 	else if (actor->obj_n == OBJ_U6_HORSE_WITH_RIDER && party->is_everyone_horsed())
-		return (50); // 2x normal
+		return 50; // 2x normal
 	else
-		return (125); // normal movement about 8 spaces per second
+		return 125; // normal movement about 8 spaces per second
 }
 
 
@@ -595,9 +599,9 @@ bool Player::check_walk_delay() {
 	last_time = this_time; // set each call to get time_passed
 	if (walk_delay == 0) {
 		walk_delay = get_walk_delay(); // reset
-		return (true);
+		return true;
 	}
-	return (false); // not time yet
+	return false; // not time yet
 }
 
 bool Player::weapon_can_hit(uint16 x, uint16 y) {
diff --git a/engines/ultima/nuvie/core/player.h b/engines/ultima/nuvie/core/player.h
index a2f683b7181..2ac20d4741d 100644
--- a/engines/ultima/nuvie/core/player.h
+++ b/engines/ultima/nuvie/core/player.h
@@ -73,29 +73,29 @@ public:
 	Actor *find_actor();
 	void update_player(Actor *next_player);
 
-	bool is_mapwindow_centered()            {
-		return (mapwindow_centered);
+	bool is_mapwindow_centered() const {
+		return mapwindow_centered;
 	}
 	void set_mapwindow_centered(bool state);
 
-	bool is_in_vehicle() {
+	bool is_in_vehicle() const {
 		return (get_actor()->get_actor_num() == 0);
 	}
 
 	Party *get_party()      {
-		return (party);
+		return party;
 	}
 	bool set_party_mode(Actor *new_actor);
 	bool set_solo_mode(Actor *new_actor);
-	bool in_party_mode()    {
-		return (party_mode);
+	bool in_party_mode() const {
+		return party_mode;
 	}
 
 	void set_karma(uint8 val) {
 		karma = val;
 	}
-	uint8 get_karma()         {
-		return (karma);
+	uint8 get_karma() const {
+		return karma;
 	}
 	void add_karma(uint8 val = 1);
 	void subtract_karma(uint8 val = 1);
@@ -114,28 +114,29 @@ public:
 	void set_quest_flag(uint8 val) {
 		questf = val;
 	}
-	uint8 get_quest_flag()         {
-		return (questf);
+	uint8 get_quest_flag() const {
+		return questf;
 	}
 	void set_gargish_flag(uint8 val) {
 		gargishf = val;
 	}
-	uint8 get_gargish_flag()          {
-		return (gargishf);
+	uint8 get_gargish_flag() const {
+		return gargishf;
 	}
 
 	void set_actor(Actor *new_actor);
 	Actor *get_actor();
-	void get_location(uint16 *ret_x, uint16 *ret_y, uint8 *ret_level);
-	uint8 get_location_level();
+	const Actor *get_actor() const;
+	void get_location(uint16 *ret_x, uint16 *ret_y, uint8 *ret_level) const;
+	uint8 get_location_level() const;
 
 	const char *get_name();
 	void set_gender(uint8 val) {
 		gender = val;
 	}
-	const char *get_gender_title();
-	uint8 get_gender()         {
-		return (gender);
+	const char *get_gender_title() const;
+	uint8 get_gender() const {
+		return gender;
 	}
 
 	bool check_moveRelative(sint16 rel_x, sint16 rel_y);
@@ -149,7 +150,7 @@ public:
 	void pass();
 	void repairShip();
 
-	uint32 get_walk_delay();
+	uint32 get_walk_delay() const;
 	bool check_walk_delay();
 
 	bool weapon_can_hit(uint16 x, uint16 y);
@@ -157,7 +158,7 @@ public:
 	bool attack_select_next_weapon(bool add_newline = false, bool use_attack_text = true);
 
 	void attack(MapCoord target, Actor *target_actor);
-	sint8 get_current_weapon() {
+	sint8 get_current_weapon() const {
 		return current_weapon;
 	}
 
diff --git a/engines/ultima/nuvie/core/tile_manager.cpp b/engines/ultima/nuvie/core/tile_manager.cpp
index 695712422c1..b7aed2fb240 100644
--- a/engines/ultima/nuvie/core/tile_manager.cpp
+++ b/engines/ultima/nuvie/core/tile_manager.cpp
@@ -751,7 +751,7 @@ Tile *TileManager::get_rotated_tile(Tile *tile, float rotate) {
 
 	Tile *new_tile = new Tile(*tile); // retain properties of original tile
 	memcpy(&new_tile->data, &tile_data, 256); // replace data
-	return (new_tile);
+	return new_tile;
 }
 #endif
 
diff --git a/engines/ultima/nuvie/core/tile_manager.h b/engines/ultima/nuvie/core/tile_manager.h
index 2f9c6035441..279dedd36b9 100644
--- a/engines/ultima/nuvie/core/tile_manager.h
+++ b/engines/ultima/nuvie/core/tile_manager.h
@@ -168,7 +168,7 @@ public:
 	Tile *get_original_tile(uint16 tile_num);
 	void set_tile_index(uint16 tile_index, uint16 tile_num);
 	uint16 get_tile_index(uint16 tile_index) {
-		return (tileindex[tile_index]);
+		return tileindex[tile_index];
 	}
 	void set_anim_loop(uint16 tile_num, sint8 loopc, uint8 loop = 0);
 
diff --git a/engines/ultima/nuvie/core/timed_event.cpp b/engines/ultima/nuvie/core/timed_event.cpp
index 8b97fcac5fc..d8cf9e1ef4a 100644
--- a/engines/ultima/nuvie/core/timed_event.cpp
+++ b/engines/ultima/nuvie/core/timed_event.cpp
@@ -103,7 +103,7 @@ TimedEvent *TimeQueue::pop_timer() {
 		first = tq.front();
 		tq.pop_front(); // remove it
 	}
-	return (first);
+	return first;
 }
 
 
@@ -112,15 +112,15 @@ TimedEvent *TimeQueue::pop_timer() {
  */
 bool TimeQueue::call_timer(uint32 now) {
 	if (empty())
-		return (false);
+		return false;
 	TimedEvent *tevent = tq.front();
 	if (tevent->defunct) {
 		assert(pop_timer() == tevent);
 		delete_timer(tevent);
-		return (false);
+		return false;
 	}
 	if (tevent->time > now)
-		return (false);
+		return false;
 
 	//dequeue event here
 	pop_timer(); // remove timer in case we have recursion in the timed() call.
@@ -140,7 +140,7 @@ bool TimeQueue::call_timer(uint32 now) {
 	} else
 		delete_timer(tevent); // if not repeated, safe to delete
 
-	return (true);
+	return true;
 }
 
 
@@ -318,7 +318,7 @@ uint16 TimedPartyMove::callback(uint16 msg, CallBack *caller, void *data) {
 		Game::get_game()->unpause_anims();
 //        move_party();
 	}
-	return (0);
+	return 0;
 }
 
 /* Returns true if people are still walking.
@@ -365,7 +365,7 @@ bool TimedPartyMove::move_party() {
 
 	if (used_gate) // wait until now (instead of in loop) so others can catch up before effect
 		hide_actor(used_gate);
-	return (moving);
+	return moving;
 }
 
 /* Start a visual effect and hide the party member.
@@ -434,7 +434,7 @@ bool TimedPartyMove::fall_in() {
 		if (at != desired)
 			not_in_position = true;
 	}
-	return (not_in_position);
+	return not_in_position;
 }
 
 
@@ -630,8 +630,8 @@ void TimedAdvance::timed(uint32 evtime) {
 
 /* Returns true when the requested amount of time has passed.
  */
-bool TimedAdvance::time_passed() {
-	return (minutes >= advance);
+bool TimedAdvance::time_passed() const {
+	return minutes >= advance;
 }
 
 
diff --git a/engines/ultima/nuvie/core/timed_event.h b/engines/ultima/nuvie/core/timed_event.h
index da79ad7ed4b..41edb5e40b0 100644
--- a/engines/ultima/nuvie/core/timed_event.h
+++ b/engines/ultima/nuvie/core/timed_event.h
@@ -51,7 +51,7 @@ public:
 	}
 
 	bool empty() const {
-		return (tq.empty());
+		return tq.empty();
 	}
 	void clear();
 	void add_timer(TimedEvent *tevent);
@@ -245,7 +245,7 @@ public:
 	void init(uint16 min, uint16 r); // start time advance
 
 	void timed(uint32 evtime) override;
-	bool time_passed(); // returns true if stop time has passed
+	bool time_passed() const; // returns true if stop time has passed
 	void get_time_from_string(uint8 &hour, uint8 &minute, Std::string timestring);
 };
 
diff --git a/engines/ultima/nuvie/files/u6_lib_n.cpp b/engines/ultima/nuvie/files/u6_lib_n.cpp
index 9ce39bed3f9..2e4a3e6a311 100644
--- a/engines/ultima/nuvie/files/u6_lib_n.cpp
+++ b/engines/ultima/nuvie/files/u6_lib_n.cpp
@@ -94,12 +94,12 @@ bool U6Lib_n::create(Std::string &filename, uint8 size, uint8 type) {
 	if (!file->open(filename)) {
 		DEBUG(0, LEVEL_ERROR, "U6Lib: Error creating %s\n", filename.c_str());
 		delete file;
-		return (false);
+		return false;
 	}
 	game_type = type;
 	lib_size = size;
 	data = (NuvieIO *)file;
-	return (true);
+	return true;
 }
 
 
@@ -112,13 +112,13 @@ uint32 U6Lib_n::get_num_items(void) {
  */
 uint32 U6Lib_n::get_item_offset(uint32 item_number) {
 	if (item_number >= num_offsets)
-		return (0);
+		return 0;
 	return (items[item_number].offset);
 }
 
 uint32 U6Lib_n::get_item_size(uint32 item_number) {
 	if (item_number >= num_offsets)
-		return (0);
+		return 0;
 
 	return (items[item_number].uncomp_size);
 }
@@ -360,7 +360,7 @@ void U6Lib_n::add_item(uint32 offset32, const char *name) {
  */
 const char *U6Lib_n::get_item_name(uint32 item_number) {
 	if (item_number >= num_offsets)
-		return (nullptr);
+		return nullptr;
 	return (items[item_number].name ? items[item_number].name->c_str() : nullptr);
 }
 
diff --git a/engines/ultima/nuvie/files/u6_lzw.cpp b/engines/ultima/nuvie/files/u6_lzw.cpp
index a2e5fdd8f60..a9c3c2ff961 100644
--- a/engines/ultima/nuvie/files/u6_lzw.cpp
+++ b/engines/ultima/nuvie/files/u6_lzw.cpp
@@ -92,14 +92,14 @@ unsigned char *U6Lzw::compress_buffer(unsigned char *src, uint32 src_len,
 bool U6Lzw::is_valid_lzw_file(NuvieIOFileRead *input_file) {
 	// file must contain 4-byte size header and space for the 9-bit value 0x100
 	if (input_file->get_size() < 6) {
-		return (false);
+		return false;
 	}
 
 	// the last byte of the size header must be 0 (U6's files aren't *that* big)
 	input_file->seek(3);
 	unsigned char byte3 = input_file->read1();
 	if (byte3 != 0) {
-		return (false);
+		return false;
 	}
 	// the 9 bits after the size header must be 0x100
 	input_file->seek(4);
@@ -107,10 +107,10 @@ bool U6Lzw::is_valid_lzw_file(NuvieIOFileRead *input_file) {
 	unsigned char b1 = input_file->read1();
 	input_file->seekStart();
 	if ((b0 != 0) || ((b1 & 1) != 1)) {
-		return (false);
+		return false;
 	}
 
-	return (true);
+	return true;
 }
 
 bool U6Lzw::is_valid_lzw_buffer(unsigned char *buf, uint32 length) {
@@ -146,7 +146,7 @@ long U6Lzw::get_uncompressed_buffer_size(unsigned char *buf, uint32 length) {
 	if (is_valid_lzw_buffer(buf, length)) {
 		return (buf[0] + (buf[1] << 8) + (buf[2] << 16) + (buf[3] << 24));
 	} else {
-		return (-1);
+		return -1;
 	}
 }
 
@@ -162,7 +162,7 @@ unsigned char *U6Lzw::decompress_buffer(unsigned char *source, uint32 source_len
 
 	uncomp_size = this->get_uncompressed_buffer_size(source, source_length);
 	if (uncomp_size == -1)
-		return (nullptr);
+		return nullptr;
 	else
 		destination_length = uncomp_size;
 
@@ -242,7 +242,7 @@ bool U6Lzw::decompress_buffer(unsigned char *source, uint32 source_length, unsig
 				// if it doesn't, something is wrong with the lzw-compressed data.
 				if (cW != next_free_codeword) {
 					DEBUG(0, LEVEL_ERROR, "cW != next_free_codeword!\n");
-					return (false);
+					return false;
 				}
 				// add pW+C to the dictionary
 				dict->add(C, pW);
@@ -349,7 +349,7 @@ int U6Lzw::get_next_codeword(long *bits_read, unsigned char *source, int codewor
 	}
 	*bits_read += codeword_size;
 
-	return (codeword);
+	return codeword;
 }
 
 void U6Lzw::output_root(unsigned char root, unsigned char *destination, long *position) {
@@ -413,7 +413,7 @@ unsigned char U6LzwStack::pop(void) {
 	} else {
 		element = 0;
 	}
-	return (element);
+	return element;
 }
 
 unsigned char U6LzwStack::gettop(void) {
@@ -445,12 +445,12 @@ void U6LzwDict::add(unsigned char root, int codeword) {
 	contains++;
 }
 
-unsigned char U6LzwDict::get_root(int codeword) {
-	return (dict[codeword].root);
+unsigned char U6LzwDict::get_root(int codeword) const {
+	return dict[codeword].root;
 }
 
-int U6LzwDict::get_codeword(int codeword) {
-	return (dict[codeword].codeword);
+int U6LzwDict::get_codeword(int codeword) const {
+	return dict[codeword].codeword;
 }
 
 } // End of namespace Nuvie
diff --git a/engines/ultima/nuvie/files/u6_lzw.h b/engines/ultima/nuvie/files/u6_lzw.h
index cee13307c3c..6cc7d9ba211 100644
--- a/engines/ultima/nuvie/files/u6_lzw.h
+++ b/engines/ultima/nuvie/files/u6_lzw.h
@@ -69,8 +69,8 @@ public:
 
 	void reset(void);
 	void add(unsigned char root, int codeword);
-	unsigned char get_root(int codeword);
-	int get_codeword(int codeword);
+	unsigned char get_root(int codeword) const;
+	int get_codeword(int codeword) const;
 };
 
 class U6Lzw {
@@ -87,8 +87,8 @@ public:
 	unsigned char *decompress_file(Std::string filename, uint32 &destination_length);
 	unsigned char *compress_buffer(unsigned char *src, uint32 src_len,
 	                               uint32 &dest_len);
-	const char *strerror() {
-		return (const char *)errstr;    // get error string
+	const char *strerror() const {
+		return errstr;    // get error string
 	}
 protected:
 
diff --git a/engines/ultima/nuvie/gui/gui.cpp b/engines/ultima/nuvie/gui/gui.cpp
index f5711969ba0..5553fcf3a17 100644
--- a/engines/ultima/nuvie/gui/gui.cpp
+++ b/engines/ultima/nuvie/gui/gui.cpp
@@ -103,7 +103,7 @@ GUI:: AddWidget(GUI_Widget *widget) {
 			maxarray = maxwidgets + WIDGET_ARRAYCHUNK;
 			if ((newarray = (GUI_Widget **)realloc(widgets,
 			                                       maxarray * sizeof(*newarray))) == nullptr) {
-				return (-1);
+				return -1;
 			}
 			widgets = newarray;
 			maxwidgets = maxarray;
@@ -113,7 +113,7 @@ GUI:: AddWidget(GUI_Widget *widget) {
 	widgets[i] = widget;
 	widget->PlaceOnScreen(screen, gui_drag_manager, 0, 0);
 
-	return (0);
+	return 0;
 }
 
 /* remove widget from gui system but don't delete it */
diff --git a/engines/ultima/nuvie/gui/gui.h b/engines/ultima/nuvie/gui/gui.h
index 32109b81b03..849d5ca8fc5 100644
--- a/engines/ultima/nuvie/gui/gui.h
+++ b/engines/ultima/nuvie/gui/gui.h
@@ -108,7 +108,7 @@ public:
 	   function requested a quit.
 	 */
 	int Running(void) {
-		return (running);
+		return running;
 	}
 
 	/* Run the GUI.
diff --git a/engines/ultima/nuvie/gui/gui_console.cpp b/engines/ultima/nuvie/gui/gui_console.cpp
index 6a4ad5594ea..e330a512211 100644
--- a/engines/ultima/nuvie/gui/gui_console.cpp
+++ b/engines/ultima/nuvie/gui/gui_console.cpp
@@ -106,7 +106,7 @@ GUI_status GUI_Console::MouseMotion(int x, int y, uint8 state) {
 //GUI::get_gui()->moveWidget(this,dx,dy);
 // Redraw();
 
-	return (GUI_YUM);
+	return GUI_YUM;
 }
 
 } // End of namespace Nuvie
diff --git a/engines/ultima/nuvie/gui/gui_dialog.cpp b/engines/ultima/nuvie/gui/gui_dialog.cpp
index b56e2848b32..4527c08149b 100644
--- a/engines/ultima/nuvie/gui/gui_dialog.cpp
+++ b/engines/ultima/nuvie/gui/gui_dialog.cpp
@@ -236,7 +236,7 @@ GUI_status GUI_Dialog::MouseMotion(int x, int y, uint8 state) {
 	GUI::get_gui()->moveWidget(this, dx, dy);
 // Redraw();
 
-	return (GUI_YUM);
+	return GUI_YUM;
 }
 
 void GUI_Dialog::MoveRelative(int dx, int dy) {
diff --git a/engines/ultima/nuvie/gui/gui_load_image.cpp b/engines/ultima/nuvie/gui/gui_load_image.cpp
index 72f83b230fc..6399bc30e04 100644
--- a/engines/ultima/nuvie/gui/gui_load_image.cpp
+++ b/engines/ultima/nuvie/gui/gui_load_image.cpp
@@ -60,21 +60,21 @@ Graphics::ManagedSurface *GUI_DefaultFont(void) {
 	if (the_font == nullptr) {
 		the_font = GUI_LoadImage(font_w, font_h, font_pal, font_data);
 	}
-	return (the_font);
+	return the_font;
 }
 
 Graphics::ManagedSurface *GUI_Font6x8(void) {
 	if (the_font_6x8 == nullptr) {
 		the_font_6x8 = GUI_LoadImage(font_6x8_w, font_6x8_h, font_pal, font_6x8_data);
 	}
-	return (the_font_6x8);
+	return the_font_6x8;
 }
 
 Graphics::ManagedSurface *GUI_FontGump(void) {
 	if (the_font_gump == nullptr) {
 		the_font_gump = GUI_LoadImage(font_gump_w, font_gump_h, font_pal, font_gump_data);
 	}
-	return (the_font_gump);
+	return the_font_gump;
 }
 
 uint8 *GUI_FontGumpWData(void) {
diff --git a/engines/ultima/nuvie/gui/gui_scroll_bar.cpp b/engines/ultima/nuvie/gui/gui_scroll_bar.cpp
index 174392d75b9..fc9716c58cb 100644
--- a/engines/ultima/nuvie/gui/gui_scroll_bar.cpp
+++ b/engines/ultima/nuvie/gui/gui_scroll_bar.cpp
@@ -261,7 +261,7 @@ GUI_status GUI_ScrollBar::MouseMotion(int x, int y, uint8 state) {
 	}
 // Redraw();
 
-	return (GUI_YUM);
+	return GUI_YUM;
 }
 
 inline bool GUI_ScrollBar::move_slider(int new_slider_y) {
diff --git a/engines/ultima/nuvie/gui/gui_scroller.cpp b/engines/ultima/nuvie/gui/gui_scroller.cpp
index 6428603e042..531a0567711 100644
--- a/engines/ultima/nuvie/gui/gui_scroller.cpp
+++ b/engines/ultima/nuvie/gui/gui_scroller.cpp
@@ -134,7 +134,7 @@ GUI_status GUI_Scroller::MouseMotion(int x, int y, uint8 state) {
 //GUI::get_gui()->moveWidget(this,dx,dy);
 // Redraw();
 
-	return (GUI_YUM);
+	return GUI_YUM;
 }
 
 GUI_status GUI_Scroller::MouseWheel(sint32 x, sint32 y) {
@@ -143,7 +143,7 @@ GUI_status GUI_Scroller::MouseWheel(sint32 x, sint32 y) {
 	else if (y < 0)
 		move_down();
 
-	return (GUI_YUM);
+	return GUI_YUM;
 }
 
 void GUI_Scroller::move_up() {
diff --git a/engines/ultima/nuvie/gui/gui_text_input.cpp b/engines/ultima/nuvie/gui/gui_text_input.cpp
index dc8616f0618..6c80a03e145 100644
--- a/engines/ultima/nuvie/gui/gui_text_input.cpp
+++ b/engines/ultima/nuvie/gui/gui_text_input.cpp
@@ -68,7 +68,7 @@ GUI_status GUI_TextInput::MouseUp(int x, int y, Shared::MouseButton button) {
 		}
 	}
 
-	return (GUI_PASS);
+	return GUI_PASS;
 }
 
 GUI_status GUI_TextInput::KeyDown(const Common::KeyState &keyState) {
@@ -217,7 +217,7 @@ GUI_status GUI_TextInput::KeyDown(const Common::KeyState &keyState) {
 		break;
 	}
 
-	return (GUI_YUM);
+	return GUI_YUM;
 }
 
 void GUI_TextInput::add_char(char c) {
diff --git a/engines/ultima/nuvie/gui/widgets/command_bar.cpp b/engines/ultima/nuvie/gui/widgets/command_bar.cpp
index e9366e2e318..5701ac295d5 100644
--- a/engines/ultima/nuvie/gui/widgets/command_bar.cpp
+++ b/engines/ultima/nuvie/gui/widgets/command_bar.cpp
@@ -209,7 +209,7 @@ bool CommandBar::init_buttons() {
 		icon[10] = &placeholder_tile; // quick save
 		icon[11] = &placeholder_tile; // quick load
 	}
-	return (true);
+	return true;
 }
 
 bool CommandBar::load(NuvieIO *objlist) {
@@ -268,13 +268,13 @@ GUI_status CommandBar::MouseDown(int x, int y, Shared::MouseButton button) {
 				activate = 7;
 		}
 		if (button == COMMANDBAR_USE_BUTTON)
-			return (hit(activate));
+			return hit(activate);
 		else if (button == COMMANDBAR_ACTION_BUTTON) {
 			select_action(activate);
 		}
 	} else if (!game->is_orig_style())
 		return GUI_PASS;
-	return (GUI_YUM);
+	return GUI_YUM;
 }
 
 GUI_status CommandBar::hit(uint8 num) {
@@ -285,7 +285,7 @@ GUI_status CommandBar::hit(uint8 num) {
 
 	try_selected_action(num);
 
-	return (GUI_YUM);
+	return GUI_YUM;
 }
 
 static const EventMode U6_mode_tbl[] = { ATTACK_MODE, CAST_MODE, TALK_MODE, LOOK_MODE, GET_MODE,
diff --git a/engines/ultima/nuvie/gui/widgets/command_bar_new_ui.cpp b/engines/ultima/nuvie/gui/widgets/command_bar_new_ui.cpp
index ff8f47407bc..431d18ffb34 100644
--- a/engines/ultima/nuvie/gui/widgets/command_bar_new_ui.cpp
+++ b/engines/ultima/nuvie/gui/widgets/command_bar_new_ui.cpp
@@ -154,7 +154,7 @@ GUI_status CommandBarNewUI::MouseDown(int x, int y, Shared::MouseButton button)
 		}
 	}
 
-	return (GUI_YUM);
+	return GUI_YUM;
 }
 
 GUI_status CommandBarNewUI::MouseUp(int x, int y, Shared::MouseButton button) {
@@ -171,7 +171,7 @@ GUI_status CommandBarNewUI::MouseUp(int x, int y, Shared::MouseButton button) {
 	        }
 	    }
 	*/
-	return (GUI_YUM);
+	return GUI_YUM;
 }
 
 GUI_status CommandBarNewUI::KeyDown(const Common::KeyState &key) {
diff --git a/engines/ultima/nuvie/gui/widgets/converse_gump.cpp b/engines/ultima/nuvie/gui/widgets/converse_gump.cpp
index 081fa330d2e..956a2dcef40 100644
--- a/engines/ultima/nuvie/gui/widgets/converse_gump.cpp
+++ b/engines/ultima/nuvie/gui/widgets/converse_gump.cpp
@@ -596,7 +596,7 @@ GUI_status ConverseGump::KeyDown(const Common::KeyState &keyState) {
 			clear_scroll();
 			process_holding_buffer(); // Process any text in the holding buffer.
 		}
-		return (GUI_YUM);
+		return GUI_YUM;
 	}
 
 	if (!input_mode || !Common::isPrint(ascii)) {
@@ -662,7 +662,7 @@ GUI_status ConverseGump::KeyDown(const Common::KeyState &keyState) {
 			if (input_mode)
 				set_input_mode(false);
 		}
-		return (GUI_YUM);
+		return GUI_YUM;
 	case Common::KEYCODE_KP_ENTER:
 	case Common::KEYCODE_RETURN:
 		if (permit_inputescape || !cursor_at_input_section()
@@ -680,7 +680,7 @@ GUI_status ConverseGump::KeyDown(const Common::KeyState &keyState) {
 			cursor_reset();
 		}
 
-		return (GUI_YUM);
+		return GUI_YUM;
 	case Common::KEYCODE_BACKSPACE :
 		if (input_mode)
 			input_buf_remove_char();
@@ -718,7 +718,7 @@ GUI_status ConverseGump::MouseUp(int x, int y, Shared::MouseButton button) {
 			clear_scroll();
 			process_holding_buffer(); // Process any text in the holding buffer.
 		}
-		return (GUI_YUM);
+		return GUI_YUM;
 	} else if (button == 1) { // left click == select word
 		if (input_mode) {
 			token_str = get_token_string_at_pos(x, y);
@@ -738,7 +738,7 @@ GUI_status ConverseGump::MouseUp(int x, int y, Shared::MouseButton button) {
 	        return(GUI_YUM);
 	    }
 	 */
-	return (GUI_YUM);
+	return GUI_YUM;
 }
 
 void ConverseGump::input_add_string(Std::string token_str) {
diff --git a/engines/ultima/nuvie/gui/widgets/gui_widget.cpp b/engines/ultima/nuvie/gui/widgets/gui_widget.cpp
index e58e0dc2f86..a928eb48b36 100644
--- a/engines/ultima/nuvie/gui/widgets/gui_widget.cpp
+++ b/engines/ultima/nuvie/gui/widgets/gui_widget.cpp
@@ -174,7 +174,7 @@ void GUI_Widget::PlaceOnScreen(Screen *s, GUI_DragManager *dm, int x, int y) {
 
 /* Report status to GUI */
 int GUI_Widget:: Status(void) const {
-	return (status);
+	return status;
 }
 
 /* Set the bounds of the widget.
@@ -219,7 +219,7 @@ void GUI_Widget:: SetRect(Common::Rect **bounds) {
 /* Check to see if a point intersects the bounds of the widget.
  */
 int GUI_Widget::HitRect(int x, int y) {
-	return (HitRect(x, y, area));
+	return HitRect(x, y, area);
 }
 
 int GUI_Widget::HitRect(int x, int y, const Common::Rect &rect) {
@@ -230,7 +230,7 @@ int GUI_Widget::HitRect(int x, int y, const Common::Rect &rect) {
 	        (y < rect.top) || (y >= rect.bottom)) {
 		hit = 0;
 	}
-	return (hit);
+	return hit;
 }
 
 /* Set the display surface for this widget */
@@ -292,12 +292,12 @@ GUI_status GUI_Widget::Idle(void) {
 		for (child = children.begin(); child != children.end(); child++) {
 			GUI_status idleStatus = (*child)->Idle();
 			if (idleStatus != GUI_PASS)
-				return (idleStatus);
+				return idleStatus;
 		}
 	}
 	if (delayed_button != 0 || held_button != 0)
-		return (try_mouse_delayed());
-	return (GUI_PASS);
+		return try_mouse_delayed();
+	return GUI_PASS;
 }
 
 /* Widget event handlers.
@@ -306,28 +306,28 @@ GUI_status GUI_Widget::Idle(void) {
    These are called by the default HandleEvent function.
 */
 GUI_status GUI_Widget::KeyDown(const Common::KeyState &key) {
-	return (GUI_PASS);
+	return GUI_PASS;
 }
 
 GUI_status GUI_Widget::KeyUp(Common::KeyState key) {
-	return (GUI_PASS);
+	return GUI_PASS;
 }
 
 GUI_status GUI_Widget::MouseDown(int x, int y, Shared::MouseButton button) {
-	return (GUI_PASS);
+	return GUI_PASS;
 }
 
 GUI_status GUI_Widget::MouseUp(int x, int y, Shared::MouseButton button) {
-	return (GUI_PASS);
+	return GUI_PASS;
 }
 
 
 GUI_status GUI_Widget::MouseMotion(int x, int y, uint8 state) {
-	return (GUI_PASS);
+	return GUI_PASS;
 }
 
 GUI_status GUI_Widget::MouseWheel(sint32 x, sint32 y) {
-	return (GUI_PASS);
+	return GUI_PASS;
 }
 
 /* Main event handler function.
@@ -357,10 +357,10 @@ GUI_status GUI_Widget::HandleEvent(const Common::Event *event) {
 
 	switch (event->type) {
 	case Common::EVENT_KEYDOWN:
-		return (KeyDown(event->kbd.keycode));
+		return KeyDown(event->kbd.keycode);
 		break;
 	case Common::EVENT_KEYUP:
-		return (KeyUp(event->kbd.keycode));
+		return KeyUp(event->kbd.keycode);
 		break;
 	case Common::EVENT_LBUTTONDOWN:
 	case Common::EVENT_RBUTTONDOWN:
@@ -392,16 +392,16 @@ GUI_status GUI_Widget::HandleEvent(const Common::Event *event) {
 			if (do_mouseclick && accept_mouseclick[button - 1] && (rel_time - last_rel_time < GUI::mouseclick_delay)) {
 				// before a Double or Delayed click, mouseup_time is reset so another click isn't possible
 				set_mouseup(0, button);
-				return (MouseDouble(x, y, button));
+				return MouseDouble(x, y, button);
 			} else if (do_mouseclick && accept_mouseclick[button - 1])
-				return (MouseClick(x, y, button));
+				return MouseClick(x, y, button);
 			else
-				return (MouseUp(x, y, button));
+				return MouseUp(x, y, button);
 		}
 		/* if widget was clicked before we must let it deactivate itself*/
 		else if (ClickState(1)) {
 			set_mouseup(0, button);
-			return (MouseUp(-1, -1, button));
+			return MouseUp(-1, -1, button);
 		}
 		break;
 	}
@@ -419,14 +419,15 @@ GUI_status GUI_Widget::HandleEvent(const Common::Event *event) {
 				mouse_over = true;
 				MouseEnter(state);
 			}
-			return (MouseMotion(x, y, state));
+			return MouseMotion(x, y, state);
 		} else {
 			if (mouse_over) {
 				mouse_over = false;
 				MouseLeave(state);
 			}
 			/* if widget was clicked before we must let it react*/
-			if (ClickState(1)) return (MouseMotion(-1, -1, state));
+			if (ClickState(1))
+				return MouseMotion(-1, -1, state);
 		}
 	}
 	break;
@@ -442,7 +443,7 @@ GUI_status GUI_Widget::HandleEvent(const Common::Event *event) {
 	}
 	break;
 	}
-	return (GUI_PASS);
+	return GUI_PASS;
 }
 
 // iterate through children if present to hit the correct drag area.
@@ -480,25 +481,25 @@ void GUI_Widget::drag_perform_drop(int x, int y, int message, void *data) {
 /* Mouse button was pressed and released over the widget.
  */
 GUI_status GUI_Widget::MouseClick(int x, int y, Shared::MouseButton button) {
-	return (GUI_PASS);
+	return GUI_PASS;
 }
 
 /* Mouse button was clicked twice over the widget, within a certain time period.
  */
 GUI_status GUI_Widget::MouseDouble(int x, int y, Shared::MouseButton button) {
-	return (GUI_PASS);
+	return GUI_PASS;
 }
 
 /* Mouse cursor passed out of the widget area.
  */
 GUI_status GUI_Widget::MouseEnter(uint8 state) {
-	return (GUI_PASS);
+	return GUI_PASS;
 }
 
 /* Mouse cursor passed into the widget area.
  */
 GUI_status GUI_Widget::MouseLeave(uint8 state) {
-	return (GUI_PASS);
+	return GUI_PASS;
 }
 
 /* Returns false if any widget but this one is focused or locked.
@@ -508,12 +509,12 @@ bool GUI_Widget::widget_has_focus() {
 	GUI_Widget *locked_widget = GUI::get_gui()->get_locked_widget();
 
 	if (GUI::get_gui()->get_block_input())
-		return (false);
+		return false;
 	if (locked_widget != nullptr && locked_widget != this)
-		return (false);
+		return false;
 	if (focused_widget != nullptr && focused_widget != this)
-		return (false);
-	return (true);
+		return false;
+	return true;
 }
 
 // button 0 = all
@@ -575,19 +576,19 @@ GUI_status GUI_Widget::try_mouse_delayed() {
 		set_mouseup(0, button);
 		return (MouseDelayed(x, y, button));
 	}
-	return (GUI_PASS);
+	return GUI_PASS;
 }
 
 // like a MouseClick but called only after waiting for MouseDouble, if
 // wait_for_mouseclick(button) was called
 GUI_status GUI_Widget::MouseDelayed(int x, int y, Shared::MouseButton button) {
-	return (GUI_PASS);
+	return GUI_PASS;
 }
 
 // like a MouseDown but called only after waiting for MouseUp, if
 // wait_for_mousedown(button) was called
 GUI_status GUI_Widget::MouseHeld(int x, int y, Shared::MouseButton button) {
-	return (GUI_PASS);
+	return GUI_PASS;
 }
 
 } // End of namespace Nuvie
diff --git a/engines/ultima/nuvie/gui/widgets/gui_widget.h b/engines/ultima/nuvie/gui/widgets/gui_widget.h
index 2a80857c660..3a11e286153 100644
--- a/engines/ultima/nuvie/gui/widgets/gui_widget.h
+++ b/engines/ultima/nuvie/gui/widgets/gui_widget.h
@@ -193,7 +193,7 @@ public:
 
 	/* Returns nullptr if everything is okay, or an error message if not */
 	char *Error(void) {
-		return (errorptr);
+		return errorptr;
 	}
 
 	/* yields click state: none, pressed, intermediate */
@@ -228,11 +228,11 @@ protected:
 	void set_mousedown(int set, int button = 0);
 	int get_mouseup(int button) const {
 		if (button > 0 && button < 4) return (mouseup[button - 1]);
-		else return (0);
+		else return 0;
 	}
 	int get_mousedown(int button) const {
 		if (button > 0 && button < 4) return (mousedown[button - 1]);
-		else return (0);
+		else return 0;
 	}
 	void wait_for_mouseclick(int button) {
 		if (button >= Shared::BUTTON_NONE && button < Shared::BUTTON_MIDDLE)
diff --git a/engines/ultima/nuvie/gui/widgets/map_window.cpp b/engines/ultima/nuvie/gui/widgets/map_window.cpp
index 8f75f94dc8d..0836cbce51f 100644
--- a/engines/ultima/nuvie/gui/widgets/map_window.cpp
+++ b/engines/ultima/nuvie/gui/widgets/map_window.cpp
@@ -2047,7 +2047,7 @@ GUI_status MapWindow::MouseDelayed(int x, int y, Shared::MouseButton button) {
 	        || (event->get_mode() != MOVE_MODE && event->get_mode() != EQUIP_MODE)) {
 		look_obj = nullptr;
 		look_actor = nullptr;
-		return (GUI_PASS);
+		return GUI_PASS;
 	}
 	game->get_scroll()->display_string("Look-");
 	event->set_mode(LOOK_MODE);
@@ -2063,7 +2063,7 @@ GUI_status MapWindow::MouseHeld(int x, int y, Shared::MouseButton button) {
 	looking = false;
 	if (walk_with_left_button)
 		set_walking(true);
-	return (GUI_PASS);
+	return GUI_PASS;
 }
 
 // double-click
@@ -2481,7 +2481,7 @@ GUI_status MapWindow::MouseLeave(uint8 state) {
 	dragging = false;
 	// NOTE: Don't clear selected_obj here! It's used to remove the object after
 	// dragging.
-	return (GUI_PASS);
+	return GUI_PASS;
 }
 
 byte *MapWindow::make_thumbnail() {
@@ -2537,7 +2537,7 @@ Graphics::ManagedSurface *MapWindow::get_sdl_surface(uint16 x, uint16 y, uint16
 //                                               copy_area.w, copy_area.h,
 //                                               copy_area.w);
 	free(screen_area);
-	return (new_surface);
+	return new_surface;
 }
 
 /* Returns the overlay surface. A new 8bit overlay is created if necessary. */
@@ -2546,7 +2546,7 @@ Graphics::ManagedSurface *MapWindow::get_overlay() {
 		overlay = new Graphics::ManagedSurface(area.width(), area.height(),
 			Graphics::PixelFormat::createFormatCLUT8());
 
-	return (overlay);
+	return overlay;
 }
 
 /* Set the overlay surface. The current overlay is deleted if necessary. */
diff --git a/engines/ultima/nuvie/gui/widgets/msg_scroll.cpp b/engines/ultima/nuvie/gui/widgets/msg_scroll.cpp
index 15a95b571ff..221623e025b 100644
--- a/engines/ultima/nuvie/gui/widgets/msg_scroll.cpp
+++ b/engines/ultima/nuvie/gui/widgets/msg_scroll.cpp
@@ -719,7 +719,7 @@ GUI_status MsgScroll::KeyDown(const Common::KeyState &keyState) {
 	char ascii = get_ascii_char_from_keysym(key);
 
 	if (page_break == false && input_mode == false)
-		return (GUI_PASS);
+		return GUI_PASS;
 
 	bool is_printable = Common::isPrint(ascii);
 	KeyBinder *keybinder = Game::get_game()->get_keybinder();
@@ -764,29 +764,29 @@ GUI_status MsgScroll::KeyDown(const Common::KeyState &keyState) {
 	case Common::KEYCODE_UP :
 		if (input_mode) break; //will select printable ascii
 		move_scroll_up();
-		return (GUI_YUM);
+		return GUI_YUM;
 
 	case Common::KEYCODE_DOWN:
 		if (input_mode) break; //will select printable ascii
 		move_scroll_down();
-		return (GUI_YUM);
+		return GUI_YUM;
 	case Common::KEYCODE_PAGEUP:
 		if (Game::get_game()->is_new_style())
 			move_scroll_up();
 		else page_up();
-		return (GUI_YUM);
+		return GUI_YUM;
 	case Common::KEYCODE_PAGEDOWN:
 		if (Game::get_game()->is_new_style())
 			move_scroll_down();
 		else page_down();
-		return (GUI_YUM);
+		return GUI_YUM;
 	default :
 		break;
 	}
 
 	if (page_break) {
 		process_page_break();
-		return (GUI_YUM);
+		return GUI_YUM;
 	}
 
 	switch (key.keycode) {
@@ -797,7 +797,7 @@ GUI_status MsgScroll::KeyDown(const Common::KeyState &keyState) {
 			if (input_mode)
 				set_input_mode(false);
 		}
-		return (GUI_YUM);
+		return GUI_YUM;
 	case Common::KEYCODE_KP_ENTER:
 	case Common::KEYCODE_RETURN:
 		if (permit_inputescape || input_char != 0) { // input_char should only be permit_input
@@ -806,7 +806,7 @@ GUI_status MsgScroll::KeyDown(const Common::KeyState &keyState) {
 			if (input_mode)
 				set_input_mode(false);
 		}
-		return (GUI_YUM);
+		return GUI_YUM;
 	case Common::KEYCODE_RIGHT:
 		if (input_char != 0 && permit_input == nullptr)
 			input_buf_add_char(get_char_from_input_char());
@@ -827,9 +827,9 @@ GUI_status MsgScroll::KeyDown(const Common::KeyState &keyState) {
 		}
 		break;
 	case Common::KEYCODE_LSHIFT :
-		return (GUI_YUM);
+		return GUI_YUM;
 	case Common::KEYCODE_RSHIFT :
-		return (GUI_YUM);
+		return GUI_YUM;
 	default: // alphanumeric characters
 		if (input_mode && is_printable) {
 			if (permit_input == nullptr) {
@@ -846,14 +846,14 @@ GUI_status MsgScroll::KeyDown(const Common::KeyState &keyState) {
 		break;
 	}
 
-	return (GUI_YUM);
+	return GUI_YUM;
 }
 
 
 GUI_status MsgScroll::MouseWheel(sint32 x, sint32 y) {
 	if (page_break) { // any click == scroll-to-end
 		process_page_break();
-		return (GUI_YUM);
+		return GUI_YUM;
 	}
 
 	Game *game = Game::get_game();
@@ -880,7 +880,7 @@ GUI_status MsgScroll::MouseUp(int x, int y, Shared::MouseButton button) {
 
 	if (page_break) { // any click == scroll-to-end
 		process_page_break();
-		return (GUI_YUM);
+		return GUI_YUM;
 	}
 
 	if (button == 1) { // left click == select word
@@ -892,7 +892,7 @@ GUI_status MsgScroll::MouseUp(int x, int y, Shared::MouseButton button) {
 					input_buf_add_char(token_str[0]);
 					set_input_mode(false);
 				}
-				return (GUI_YUM);
+				return GUI_YUM;
 			}
 
 			for (i = 0; i < token_str.length(); i++) {
@@ -906,12 +906,12 @@ GUI_status MsgScroll::MouseUp(int x, int y, Shared::MouseButton button) {
 		if (input_mode) {
 			if (permit_inputescape) {
 				set_input_mode(false);
-				return (GUI_YUM);
+				return GUI_YUM;
 			}
 		} else if (!Game::get_game()->is_new_style())
 			Game::get_game()->get_event()->cancelAction();
 	}
-	return (GUI_PASS);
+	return GUI_PASS;
 }
 
 Std::string MsgScroll::get_token_string_at_pos(uint16 x, uint16 y) {
diff --git a/engines/ultima/nuvie/gui/widgets/msg_scroll.h b/engines/ultima/nuvie/gui/widgets/msg_scroll.h
index 823b5e72c55..f53dd7fafa4 100644
--- a/engines/ultima/nuvie/gui/widgets/msg_scroll.h
+++ b/engines/ultima/nuvie/gui/widgets/msg_scroll.h
@@ -187,7 +187,7 @@ public:
 		return holding_buffer.empty();
 	}
 	virtual bool can_display_prompt() const {
-		return (!just_displayed_prompt);
+		return !just_displayed_prompt;
 	}
 
 	virtual bool parse_token(MsgText *token);
@@ -239,7 +239,7 @@ public:
 	}
 
 	bool get_page_break() const {
-		return (page_break);
+		return page_break;
 	}
 
 	GUI_status KeyDown(const Common::KeyState &key) override;
diff --git a/engines/ultima/nuvie/gui/widgets/msg_scroll_new_ui.cpp b/engines/ultima/nuvie/gui/widgets/msg_scroll_new_ui.cpp
index 560e7e17920..bee7724f0ab 100644
--- a/engines/ultima/nuvie/gui/widgets/msg_scroll_new_ui.cpp
+++ b/engines/ultima/nuvie/gui/widgets/msg_scroll_new_ui.cpp
@@ -274,7 +274,7 @@ GUI_status MsgScrollNewUI::scroll_movement_event(MsgScrollEventType event) {
 		timer = new TimedCallback(this, nullptr, 2000);
 		if (position < msg_buf.size())
 			position++;
-		return (GUI_YUM);
+		return GUI_YUM;
 
 	default :
 		release_focus();
diff --git a/engines/ultima/nuvie/misc/u6_misc.cpp b/engines/ultima/nuvie/misc/u6_misc.cpp
index da677a3483c..87e458e9741 100644
--- a/engines/ultima/nuvie/misc/u6_misc.cpp
+++ b/engines/ultima/nuvie/misc/u6_misc.cpp
@@ -316,39 +316,39 @@ bool subtract_rect(Common::Rect *rect1, Common::Rect *rect2, Common::Rect *sub_r
 		x2 = rect2_x2 <= rect1_x2 ? rect2_x2 : rect1_x2;
 		y2 = rect2_y2 <= rect1_y2 ? rect2_y2 : rect1_y2;
 	} else
-		return (false);
+		return false;
 	if (sub_rect) { // you can perform test without returning a subtraction
 		sub_rect->left = x1;
 		sub_rect->top = y1;
 		sub_rect->setWidth(x2 - x1);
 		sub_rect->setHeight(y2 - y1);
 	}
-	return (true);
+	return true;
 }
 
 const char *get_direction_name(uint8 dir) {
 	switch (dir) {
 	case NUVIE_DIR_N:
-		return ("north");
+		return "north";
 	case NUVIE_DIR_NE:
-		return ("Northeast");
+		return "Northeast";
 	case NUVIE_DIR_E:
-		return ("East");
+		return "East";
 	case NUVIE_DIR_SE:
-		return ("Southeast");
+		return "Southeast";
 	case NUVIE_DIR_S:
-		return ("South");
+		return "South";
 	case NUVIE_DIR_SW:
-		return ("Southwest");
+		return "Southwest";
 	case NUVIE_DIR_W:
-		return ("West");
+		return "West";
 	case NUVIE_DIR_NW:
-		return ("Northwest");
+		return "Northwest";
 	default:
 		break;
 	}
 
-	return ("nowhere");
+	return "nowhere";
 }
 
 /* Returns name of relative direction. 0,0 prints "nowhere".
diff --git a/engines/ultima/nuvie/pathfinder/astar_path.cpp b/engines/ultima/nuvie/pathfinder/astar_path.cpp
index 1d4d175ef18..ef3c788edca 100644
--- a/engines/ultima/nuvie/pathfinder/astar_path.cpp
+++ b/engines/ultima/nuvie/pathfinder/astar_path.cpp
@@ -122,7 +122,7 @@ bool AStarPath::path_search(const MapCoord &start, const MapCoord &goal) {
 			final_node = nnode;
 			create_path();
 			delete_nodes();
-			return (true); // reached goal - success
+			return true; // reached goal - success
 		}
 		// check cardinal neighbors (starting at top going clockwise)
 		search_node_neighbors(nnode, goal, max_score);
@@ -131,29 +131,29 @@ bool AStarPath::path_search(const MapCoord &start, const MapCoord &goal) {
 	}
 //DEBUG(0,LEVEL_DEBUGGING,"FAIL\n");
 	delete_nodes();
-	return (false); // out of open nodes - failure
+	return false; // out of open nodes - failure
 }/* Return the cost of moving one step from `c1' to `c2', which is always 1. This
  * isn't very helpful, so subclasses should provide their own function.
  * Returns -1 if c2 is blocked. */
 sint32 AStarPath::step_cost(const MapCoord &c1, const MapCoord &c2) {
 	if (!pf->check_loc(c2.x, c2.y, c2.z)
 	        || c2.distance(c1) > 1)
-		return (-1);
-	return (1);
+		return -1;
+	return 1;
 }/* Return an item in the list of closed nodes whose location matches `ncmp'.
  */astar_node *AStarPath::find_closed_node(astar_node *ncmp) {
 	Std::list<astar_node *>::iterator n;
 	for (n = closed_nodes.begin(); n != closed_nodes.end(); n++)
 		if ((*n)->loc == ncmp->loc)
-			return (*n);
-	return (nullptr);
+			return *n;
+	return nullptr;
 }/* Return an item in the list of closed nodes whose location matches `ncmp'.
  */astar_node *AStarPath::find_open_node(astar_node *ncmp) {
 	Std::list<astar_node *>::iterator n;
 	for (n = open_nodes.begin(); n != open_nodes.end(); n++)
 		if ((*n)->loc == ncmp->loc)
-			return (*n);
-	return (nullptr);
+			return *n;
+	return nullptr;
 }/* Add new node pointer to the list of open nodes (sorting by score).
  */void AStarPath::push_open_node(astar_node *node) {
 	Std::list<astar_node *>::iterator n, next;
@@ -170,7 +170,7 @@ sint32 AStarPath::step_cost(const MapCoord &c1, const MapCoord &c2) {
  */astar_node *AStarPath::pop_open_node() {
 	astar_node *best = open_nodes.front();
 	open_nodes.pop_front(); // remove it
-	return (best);
+	return best;
 }
 
 /* Find item in the list of closed nodes whose location matched `ncmp', and
diff --git a/engines/ultima/nuvie/pathfinder/astar_path.h b/engines/ultima/nuvie/pathfinder/astar_path.h
index c714c1834a6..e2a6280607a 100644
--- a/engines/ultima/nuvie/pathfinder/astar_path.h
+++ b/engines/ultima/nuvie/pathfinder/astar_path.h
@@ -57,13 +57,13 @@ public:
 	~AStarPath() override { }
 	bool path_search(const MapCoord &start, const MapCoord &goal) override;
 	uint32 path_cost_est(const MapCoord &s, const MapCoord &g) override  {
-		return (Path::path_cost_est(s, g));
+		return Path::path_cost_est(s, g);
 	}
 	uint32 get_max_score(uint32 cost) override {
-		return (Path::get_max_score(cost));
+		return Path::get_max_score(cost);
 	}
 	uint32 path_cost_est(const astar_node &n1, const astar_node &n2) {
-		return (Path::path_cost_est(n1.loc, n2.loc));
+		return Path::path_cost_est(n1.loc, n2.loc);
 	}
 	sint32 step_cost(const MapCoord &c1, const MapCoord &c2) override;
 protected:
diff --git a/engines/ultima/nuvie/pathfinder/dir_finder.cpp b/engines/ultima/nuvie/pathfinder/dir_finder.cpp
index 0a12b9a87bc..8d530b0bed8 100644
--- a/engines/ultima/nuvie/pathfinder/dir_finder.cpp
+++ b/engines/ultima/nuvie/pathfinder/dir_finder.cpp
@@ -56,7 +56,7 @@ uint8 DirFinder::get_nuvie_dir(sint16 xrel, sint16 yrel) {
 	uint8 direction = NUVIE_DIR_N; // default
 
 	if (xrel == 0 && yrel == 0) // nowhere
-		return (direction);
+		return direction;
 	if (xrel == 0) // up or down
 		direction = (yrel < 0) ? NUVIE_DIR_N : NUVIE_DIR_S;
 	else if (yrel == 0) // left or right
@@ -69,7 +69,7 @@ uint8 DirFinder::get_nuvie_dir(sint16 xrel, sint16 yrel) {
 		direction = NUVIE_DIR_SW;
 	else if (xrel > 0 && yrel > 0)
 		direction = NUVIE_DIR_SE;
-	return (direction);
+	return direction;
 }
 
 uint8 DirFinder::get_nuvie_dir(uint16 sx, uint16 sy, uint16 tx, uint16 ty, uint8 z) {
@@ -95,7 +95,7 @@ sint8 DirFinder::get_turn_towards_dir(sint16 oxdir, sint16 oydir, sint8 txdir, s
 	sint8 turn = t - o;
 	if (turn > 4)
 		turn = -(8 - turn);
-	return (clamp(turn, -1, 1));
+	return clamp(turn, -1, 1);
 }
 
 // xdir,ydir = normal direction from->to (simple method)
diff --git a/engines/ultima/nuvie/pathfinder/party_path_finder.cpp b/engines/ultima/nuvie/pathfinder/party_path_finder.cpp
index 940d749a12f..cd48e70e0d5 100644
--- a/engines/ultima/nuvie/pathfinder/party_path_finder.cpp
+++ b/engines/ultima/nuvie/pathfinder/party_path_finder.cpp
@@ -424,7 +424,7 @@ bool PartyPathFinder::move_member(uint32 member_num, sint16 relx, sint16 rely, b
 			return true;
 		}
 		if (actor->get_error()->err == ACTOR_BLOCKED_BY_ACTOR) {
-			Actor *blocking_actor = actor->get_error()->blocking_actor;
+			const Actor *blocking_actor = actor->get_error()->blocking_actor;
 			sint8 blocking_member_num = -1;
 			if (blocking_actor)
 				blocking_member_num = party->get_member_num(blocking_actor);
diff --git a/engines/ultima/nuvie/pathfinder/path.cpp b/engines/ultima/nuvie/pathfinder/path.cpp
index e3f73653774..c3347278118 100644
--- a/engines/ultima/nuvie/pathfinder/path.cpp
+++ b/engines/ultima/nuvie/pathfinder/path.cpp
@@ -48,7 +48,7 @@ uint32 Path::get_max_score(uint32 cost) {
 	//                           low of a maximum score to move around walls)
 	if (max_score < 8 * 2 * 3)
 		max_score = 8 * 2 * 3;
-	return (max_score);
+	return max_score;
 }
 
 /* Return a weighted estimate of the highest cost from location `s' to `g'.
@@ -72,11 +72,11 @@ void Path::delete_path() {
 }
 
 const MapCoord &Path::get_first_step() {
-	return (Path::get_step(0));
+	return Path::get_step(0);
 }
 
 const MapCoord &Path::get_last_step() {
-	return (Path::get_step(step_count - 1));
+	return Path::get_step(step_count - 1);
 }
 
 const MapCoord &Path::get_step(uint32 step_index) {
diff --git a/engines/ultima/nuvie/pathfinder/u6_astar_path.cpp b/engines/ultima/nuvie/pathfinder/u6_astar_path.cpp
index 94783082697..aa170af5cbc 100644
--- a/engines/ultima/nuvie/pathfinder/u6_astar_path.cpp
+++ b/engines/ultima/nuvie/pathfinder/u6_astar_path.cpp
@@ -38,7 +38,7 @@ sint32 U6AStarPath::step_cost(const MapCoord &c1, const MapCoord &c2) {
 
 	// FIXME: need an actor->check_move(loc2, loc1) to check one step only
 	if (c2.distance(c1) > 1)
-		return (-1);
+		return -1;
 	if (!pf->check_loc(c2.x, c2.y, c2.z)) {
 		// check for door
 		Obj *block = game->get_obj_manager()->get_obj(c2.x, c2.y, c2.z);
@@ -47,7 +47,7 @@ sint32 U6AStarPath::step_cost(const MapCoord &c1, const MapCoord &c2) {
 		if (!real || !game->get_usecode()->is_unlocked_door(real))
 			real = game->get_obj_manager()->get_obj(c2.x, c2.y + 1, c2.z);
 		if (!block || !game->get_usecode()->is_unlocked_door(block) || real)
-			return (-1);
+			return -1;
 		c += 2;
 	}
 	// add cost of *original* step
@@ -55,12 +55,12 @@ sint32 U6AStarPath::step_cost(const MapCoord &c1, const MapCoord &c2) {
 
 	if (c1.x != c2.x && c1.y != c2.y) // prefer non-diagonal
 		c *= 2;
-	return (c);
+	return c;
 }
 
 // Possible step cost is 1 to 16.
 uint32 U6AStarPath::path_cost_est(const MapCoord &s, const MapCoord &g) {
-	return (Path::path_cost_est(s, g));
+	return Path::path_cost_est(s, g);
 }
 
 } // End of namespace Nuvie
diff --git a/engines/ultima/nuvie/portraits/portrait.cpp b/engines/ultima/nuvie/portraits/portrait.cpp
index da63cdad609..65d942a289d 100644
--- a/engines/ultima/nuvie/portraits/portrait.cpp
+++ b/engines/ultima/nuvie/portraits/portrait.cpp
@@ -49,13 +49,13 @@ Portrait *newPortrait(nuvie_game_t gametype, Configuration *cfg) {
 	// Correct portrait class for each game
 	switch (gametype) {
 	case NUVIE_GAME_U6 :
-		return (Portrait *) new PortraitU6(cfg);
+		return new PortraitU6(cfg);
 		break;
 	case NUVIE_GAME_MD :
-		return (Portrait *) new PortraitMD(cfg);
+		return new PortraitMD(cfg);
 		break;
 	case NUVIE_GAME_SE :
-		return (Portrait *) new PortraitSE(cfg);
+		return new PortraitSE(cfg);
 		break;
 	}
 	return nullptr;
@@ -89,7 +89,7 @@ unsigned char *Portrait::get_wou_portrait_data(U6Lib_n *lib, uint8 num) {
 
 	if (shp_buf.get_size() == 0) { // no portrait at that index
 		free(shp_data);
-		return (nullptr);
+		return nullptr;
 	}
 	shp = new U6Shape();
 	shp_lib.open(&shp_buf, 4, NUVIE_GAME_SE);
diff --git a/engines/ultima/nuvie/portraits/portrait_u6.cpp b/engines/ultima/nuvie/portraits/portrait_u6.cpp
index e90e4bb76f7..d0ae1f6c4e3 100644
--- a/engines/ultima/nuvie/portraits/portrait_u6.cpp
+++ b/engines/ultima/nuvie/portraits/portrait_u6.cpp
@@ -103,7 +103,7 @@ uint8 PortraitU6::get_portrait_num(Actor *actor) const {
 		if (num == (188 - 1))
 			num = PORTRAIT_U6_EXODUS - 1; // Exodus
 		else if (num >= (192 - 1) && num <= (200 - 1)) // Shrines, Temple of Singularity
-			return (NO_PORTRAIT_FOUND);
+			return NO_PORTRAIT_FOUND;
 		else if (num > 194) { // there are 194 npc portraits
 			switch (actor->get_obj_n()) { //check for temporary actors with portraits. eg guards and wisps
 			case OBJ_U6_GUARD :
diff --git a/engines/ultima/nuvie/screen/screen.cpp b/engines/ultima/nuvie/screen/screen.cpp
index 5a12dfb4e45..0ba880617e7 100644
--- a/engines/ultima/nuvie/screen/screen.cpp
+++ b/engines/ultima/nuvie/screen/screen.cpp
@@ -1123,7 +1123,7 @@ Graphics::ManagedSurface *Screen::create_sdl_surface_8(byte *src_buf, uint16 src
 					break;
 				}
 	}
-	return (new_surface);
+	return new_surface;
 }
 
 
@@ -1252,9 +1252,9 @@ bool Screen::set_fullscreen(bool value) {
 //Note! assumes area divides evenly by down_scale factor
 byte *Screen::copy_area(Common::Rect *area, uint16 down_scale) {
 	if (_renderSurface->bits_per_pixel == 16)
-		return (copy_area16(area, down_scale));
+		return copy_area16(area, down_scale);
 
-	return (copy_area32(area, down_scale));
+	return copy_area32(area, down_scale);
 }
 
 byte *Screen::copy_area16(Common::Rect *area, uint16 down_scale) {
@@ -1381,8 +1381,8 @@ byte *Screen::copy_area(Common::Rect *area, byte *buf) {
 		area = &screen_area;
 
 	if (_renderSurface->bits_per_pixel == 16)
-		return (copy_area16(area, buf));
-	return (copy_area32(area, buf));
+		return copy_area16(area, buf);
+	return copy_area32(area, buf);
 }
 
 
diff --git a/engines/ultima/nuvie/script/script.h b/engines/ultima/nuvie/script/script.h
index 183fadf9da9..2ab303fcdc5 100644
--- a/engines/ultima/nuvie/script/script.h
+++ b/engines/ultima/nuvie/script/script.h
@@ -114,11 +114,11 @@ public:
 	bool init();
 
 	/* Return instance of self */
-	static Script *get_script()           {
-		return (script);
+	static Script *get_script() {
+		return script;
 	}
 	Configuration *get_config() {
-		return (config);
+		return config;
 	}
 	SoundManager *get_sound_manager() {
 		return soundManager;
diff --git a/engines/ultima/nuvie/sound/adplug/mid.cpp b/engines/ultima/nuvie/sound/adplug/mid.cpp
index f29a7527209..3a0f97d85b7 100644
--- a/engines/ultima/nuvie/sound/adplug/mid.cpp
+++ b/engines/ultima/nuvie/sound/adplug/mid.cpp
@@ -72,8 +72,8 @@ CmidPlayer::~CmidPlayer() {
 }
 
 unsigned char CmidPlayer::datalook(long pos_) {
-	if (pos_ < 0 || pos_ >= flen) return (0);
-	return (data[pos_]);
+	if (pos_ < 0 || pos_ >= flen) return 0;
+	return data[pos_];
 }
 
 unsigned long CmidPlayer::getnexti(unsigned long num) {
@@ -84,7 +84,7 @@ unsigned long CmidPlayer::getnexti(unsigned long num) {
 		v += (datalook(pos) << (8 * i));
 		pos++;
 	}
-	return (v);
+	return v;
 }
 
 unsigned long CmidPlayer::getnext(unsigned long num) {
@@ -96,7 +96,7 @@ unsigned long CmidPlayer::getnext(unsigned long num) {
 		v += datalook(pos);
 		pos++;
 	}
-	return (v);
+	return v;
 }
 
 unsigned long CmidPlayer::getval() {
@@ -109,7 +109,7 @@ unsigned long CmidPlayer::getval() {
 		b = (unsigned char)getnext(1);
 		v = (v << 7) + (b & 0x7F);
 	}
-	return (v);
+	return v;
 }
 
 bool CmidPlayer::load(const Std::string &filename) {
diff --git a/engines/ultima/nuvie/sound/adplug/u6m.cpp b/engines/ultima/nuvie/sound/adplug/u6m.cpp
index f9aefd0b683..eb26436ff93 100644
--- a/engines/ultima/nuvie/sound/adplug/u6m.cpp
+++ b/engines/ultima/nuvie/sound/adplug/u6m.cpp
@@ -42,7 +42,7 @@ bool Cu6mPlayer::load(const Std::string &filename) {
 	song_data = lzw.decompress_file(filename, decompressed_filesize);
 
 	rewind(0);
-	return (true);
+	return true;
 }
 
 
@@ -467,7 +467,7 @@ unsigned char Cu6mPlayer::read_song_byte() {
 	unsigned char song_byte;
 	song_byte = song_data[song_pos];
 	song_pos++;
-	return (song_byte);
+	return song_byte;
 }
 
 
@@ -511,7 +511,7 @@ Cu6mPlayer::byte_pair Cu6mPlayer::expand_freq_byte(unsigned char freq_byte) {
 	freq_word.hi = freq_table[packed_freq].hi + (octave << 2);
 	freq_word.lo = freq_table[packed_freq].lo;
 
-	return (freq_word);
+	return freq_word;
 }
 
 
diff --git a/engines/ultima/nuvie/sound/decoder/fm_towns_decoder_stream.h b/engines/ultima/nuvie/sound/decoder/fm_towns_decoder_stream.h
index 43172c237bb..1d13addd35b 100644
--- a/engines/ultima/nuvie/sound/decoder/fm_towns_decoder_stream.h
+++ b/engines/ultima/nuvie/sound/decoder/fm_towns_decoder_stream.h
@@ -64,7 +64,7 @@ public:
 	 * converting data or stop.
 	 */
 	bool endOfData() const override {
-		return (buf_pos >= buf_len);
+		return buf_pos >= buf_len;
 	}
 
 	bool rewind() override {
diff --git a/engines/ultima/nuvie/usecode/u6_usecode.cpp b/engines/ultima/nuvie/usecode/u6_usecode.cpp
index f2657c0f4e6..b41ab4e1485 100644
--- a/engines/ultima/nuvie/usecode/u6_usecode.cpp
+++ b/engines/ultima/nuvie/usecode/u6_usecode.cpp
@@ -229,15 +229,15 @@ bool U6UseCode::is_readable(const Obj *obj) const {
 bool U6UseCode::has_usecode(Obj *obj, UseCodeEvent ev) {
 	const U6ObjectType *type = get_object_type(obj->obj_n, obj->frame_n, ev);
 	if (!type && !UseCode::has_usecode(obj, ev))
-		return (false);
-	return (true);
+		return false;
+	return true;
 }
 
 bool U6UseCode::has_usecode(Actor *actor, UseCodeEvent ev) {
 	const U6ObjectType *type = get_object_type(actor->get_obj_n(), actor->get_frame_n(), ev);
 	if (!type || type->flags == OBJTYPE_CONTAINER)
-		return (false);
-	return (true);
+		return false;
+	return true;
 }
 
 /* USE object. Actor is the actor using the object. */
@@ -285,7 +285,7 @@ uint16 U6UseCode::callback(uint16 msg, CallBack *caller, void *msg_data) {
 	Obj *obj = (Obj *)callback_user_data;
 	if (!obj) {
 		DEBUG(0, LEVEL_ERROR, "UseCode: internal message %d sent to nullptr object\n", msg);
-		return (0);
+		return 0;
 	}
 	return (message_obj(obj, (CallbackMessage)msg, msg_data));
 }
@@ -385,10 +385,10 @@ inline const U6ObjectType *U6UseCode::get_object_type(uint16 n, uint8 f, UseCode
 	while (type->obj_n != OBJ_U6_NOTHING) {
 		if (type->obj_n == n && (type->frame_n == 0xFF || type->frame_n == f)
 		        && ((type->trigger & ev) || ev == 0))
-			return (type);
+			return type;
 		++type;
 	}
-	return (nullptr);
+	return nullptr;
 }
 
 
@@ -398,14 +398,14 @@ inline const U6ObjectType *U6UseCode::get_object_type(uint16 n, uint8 f, UseCode
  */
 bool U6UseCode::uc_event(const U6ObjectType *type, UseCodeEvent ev, Obj *obj) {
 	if (!type || type->obj_n == OBJ_U6_NOTHING)
-		return (false);
+		return false;
 	if (type->trigger & ev) {
 		dbg_print_event(ev, obj);
 		bool ucret = (this->*type->usefunc)(obj, ev);
 		clear_items(); // clear references for next call
 		return (ucret); // return from usecode function
 	}
-	return (false); // doesn't respond to event
+	return false; // doesn't respond to event
 }
 
 
@@ -620,7 +620,7 @@ bool U6UseCode::use_switch(Obj *obj, UseCodeEvent ev) {
  */
 bool U6UseCode::use_firedevice(Obj *obj, UseCodeEvent ev) {
 	if (obj->obj_n == OBJ_U6_BRAZIER && obj->frame_n == 2)
-		return (true); // holy flames can't be doused
+		return true; // holy flames can't be doused
 	if (obj->obj_n == OBJ_U6_FIREPLACE) {
 		if (obj->frame_n == 1 || obj->frame_n == 3) {
 			use_firedevice_message(obj, false);
@@ -633,7 +633,7 @@ bool U6UseCode::use_firedevice(Obj *obj, UseCodeEvent ev) {
 		toggle_frame(obj);
 		use_firedevice_message(obj, (bool)obj->frame_n);
 	}
-	return (true);
+	return true;
 }
 
 
@@ -646,14 +646,14 @@ bool U6UseCode::use_secret_door(Obj *obj, UseCodeEvent ev) {
 			obj->frame_n--;
 		else
 			obj->frame_n++;
-		return (true);
+		return true;
 	} else if (ev == USE_EVENT_SEARCH) {
 		scroll->display_string("a secret door");
 		if (obj->frame_n == 0 || obj->frame_n == 2)
 			obj->frame_n++;
-		return (true);
+		return true;
 	}
-	return (true);
+	return true;
 }
 
 
@@ -693,9 +693,9 @@ bool U6UseCode::use_container(Obj *obj, UseCodeEvent ev) {
 				scroll->display_string(found_objects ? ".\n" : "nothing.\n");
 			}
 		}
-		return (true);
+		return true;
 	} else if (ev == USE_EVENT_SEARCH) { // search message already printed
-		return (UseCode::search_container(obj));
+		return UseCode::search_container(obj);
 //        if(obj->container && obj->container->end())
 //        {
 //            new TimedContainerSearch(obj);
@@ -706,7 +706,7 @@ bool U6UseCode::use_container(Obj *obj, UseCodeEvent ev) {
 			obj->frame_n = 1; //close the chest
 		return true;
 	}
-	return (false);
+	return false;
 }
 
 /* Use rune to free shrine */
@@ -725,7 +725,7 @@ bool U6UseCode::use_rune(Obj *obj, UseCodeEvent ev) {
 		scroll->set_input_mode(true, nullptr, true);
 		scroll->request_input(this, obj);
 
-		return (false);
+		return false;
 	} else if (ev == USE_EVENT_MESSAGE && items.string_ref) {
 		scroll->display_string("\n");
 
@@ -841,7 +841,7 @@ bool U6UseCode::use_vortex_cube(Obj *obj, UseCodeEvent ev) {
 					game->get_script()->play_cutscene("/ending.lua");
 					game->quit();
 
-					return (true);
+					return true;
 				}
 			}
 		}
@@ -859,7 +859,7 @@ bool U6UseCode::use_vortex_cube(Obj *obj, UseCodeEvent ev) {
 bool U6UseCode::use_bell(Obj *obj, UseCodeEvent ev) {
 	Obj *bell = nullptr;
 	if (ev != USE_EVENT_USE)
-		return (false);
+		return false;
 	if (obj->obj_n == OBJ_U6_BELL)
 		bell = obj;
 	else
@@ -869,7 +869,7 @@ bool U6UseCode::use_bell(Obj *obj, UseCodeEvent ev) {
 	}
 	Game::get_game()->get_sound_manager()->playSfx(NUVIE_SFX_BELL);
 
-	return (true);
+	return true;
 }
 
 
@@ -880,7 +880,7 @@ Obj *U6UseCode::bell_find(Obj *chain_obj) {
 	for (uint16 x = chain_obj->x - 8; x <= chain_obj->x + 8; x++)
 		for (uint16 y = chain_obj->y - 8; y <= chain_obj->y + 8 && !bell; y++)
 			bell = obj_manager->get_obj_of_type_from_location(OBJ_U6_BELL, x, y, chain_obj->z);
-	return (bell);
+	return bell;
 }
 
 
@@ -1240,7 +1240,7 @@ bool U6UseCode::use_shovel(Obj *obj, UseCodeEvent ev) {
 	if (!items.mapcoord_ref) { // get direction (FIXME: should return relative dir)
 		if (!obj->is_readied()) {
 			scroll->display_string("\nNot readied.\n");
-			return (true);
+			return true;
 		}
 		if (items.actor_ref == nullptr) { // happens when you use on a widget
 			scroll->display_string("nowhere.\n");
@@ -1254,7 +1254,7 @@ bool U6UseCode::use_shovel(Obj *obj, UseCodeEvent ev) {
 		if (game->get_map_window()->get_interface() == INTERFACE_NORMAL)
 			game->get_event()->do_not_show_target_cursor = true;
 		game->get_event()->request_input(this, obj);
-		return (false);
+		return false;
 	}
 
 	Actor *parent = obj->get_actor_holding_obj();
@@ -1270,7 +1270,7 @@ bool U6UseCode::use_shovel(Obj *obj, UseCodeEvent ev) {
 	scroll->display_string(get_direction_name(dig_at.x, dig_at.y));
 	if (dig_at.sx == 0 && dig_at.sy == 0) {
 		scroll->display_string(".\n");
-		return (true); // display prompt
+		return true; // display prompt
 	}
 	scroll->display_string(".\n\n");
 
@@ -1298,7 +1298,7 @@ bool U6UseCode::use_shovel(Obj *obj, UseCodeEvent ev) {
 	        || game->get_map_window()->tile_is_black(dig_at.x, dig_at.y)
 	        || (dig_at.z == 0 && (dig_at.x != 0x2c3 || dig_at.y != 0x343))) {
 		scroll->display_string("No effect\n");
-		return (true); // ??
+		return true; // ??
 	}
 
 	// try to conenct with a ladder on a lower level.
@@ -1325,14 +1325,14 @@ bool U6UseCode::use_shovel(Obj *obj, UseCodeEvent ev) {
 	if (/*(!dug_up_obj && dig_at.z == 0) ||*/ !tile // original might have checked for earth desc and no wall mask
 	        || !((tile->tile_num <= 111 && tile->tile_num >= 108) || tile->tile_num == 540)) {
 		scroll->display_string("No Effect.\n");
-		return (true);
+		return true;
 	}
 
 	if (!dug_up_obj) {
 		// 10% chance of anything
 		if (NUVIE_RAND() % 10) {
 			scroll->display_string("Failed\n");
-			return (true);
+			return true;
 		}
 
 		// Door #1 or Door #2?
@@ -1351,7 +1351,7 @@ bool U6UseCode::use_shovel(Obj *obj, UseCodeEvent ev) {
 		dug_up_obj->set_temporary();
 		obj_manager->add_obj(dug_up_obj, true);
 	}
-	return (true);
+	return true;
 }
 
 
@@ -1369,7 +1369,7 @@ bool U6UseCode::use_fountain(Obj *obj, UseCodeEvent ev) {
 		scroll->request_input(this, obj);
 		wish_actor = items.actor_ref;
 		assert(wish_actor);
-		return (false);
+		return false;
 	} else if (ev == USE_EVENT_MESSAGE && items.string_ref) {
 		scroll->display_string("\n");
 		if (!get_wish) { // answered with Y/N
@@ -1398,20 +1398,20 @@ bool U6UseCode::use_fountain(Obj *obj, UseCodeEvent ev) {
 			if (!wished_for_food) {
 				scroll->display_string("\nFailed\n\n");
 				scroll->display_prompt();
-				return (true);
+				return true;
 			}
 			// 25% chance of anything
 			if ((NUVIE_RAND() % 4) != 0) {
 				scroll->display_string("\nNo effect\n\n");
 				scroll->display_prompt();
-				return (true);
+				return true;
 			}
 			scroll->display_string("\nYou got food");
 			// must be able to carry it
 			if (!wish_actor->can_carry_object(OBJ_U6_MEAT_PORTION, 1)) {
 				scroll->display_string(", but you can't carry it.\n\n");
 				scroll->display_prompt();
-				return (true);
+				return true;
 			}
 			scroll->display_string(".\n\n");
 			scroll->display_prompt();
@@ -1420,7 +1420,7 @@ bool U6UseCode::use_fountain(Obj *obj, UseCodeEvent ev) {
 		}
 	} else
 		get_wish = false;
-	return (false);
+	return false;
 }
 
 
@@ -1429,7 +1429,7 @@ bool U6UseCode::use_rubber_ducky(Obj *obj, UseCodeEvent ev) {
 	if (items.actor_ref == player->get_actor())
 		scroll->display_string("\nSqueak!\n");
 	Game::get_game()->get_sound_manager()->playSfx(NUVIE_SFX_RUBBER_DUCK); //FIXME towns says "Quack! Quack!" and plays sfx twice.
-	return (true);
+	return true;
 }
 
 sint16 U6UseCode::parseLatLongString(U6UseCodeLatLonEnum mode, Std::string *input) {
@@ -1485,7 +1485,7 @@ bool U6UseCode::use_crystal_ball(Obj *obj, UseCodeEvent ev) {
 		scroll->set_input_mode(true);
 		scroll->request_input(this, obj);
 
-		return (false);
+		return false;
 	} else if (ev == USE_EVENT_MESSAGE && items.string_ref) {
 		if (mode == GET_LAT) {
 			sint16 lat = parseLatLongString(LAT, items.string_ref);
@@ -1526,7 +1526,7 @@ bool U6UseCode::use_crystal_ball(Obj *obj, UseCodeEvent ev) {
 
 	}
 
-	return (false);
+	return false;
 }
 
 /* USE: Enter instrument playing mode, with sound for used object. */
@@ -1590,7 +1590,7 @@ bool U6UseCode::use_food(Obj *obj, UseCodeEvent ev) {
 		}
 		destroy_obj(obj, 1);
 	}
-	return (true);
+	return true;
 }
 
 
@@ -1605,7 +1605,7 @@ bool U6UseCode::use_potion(Obj *obj, UseCodeEvent ev) {
 			game->get_event()->request_input(this, obj);
 		} else if (!items.actor2_ref) { // no selection
 			scroll->display_string("nobody\n");
-			return (true);
+			return true;
 		} else { // use potion
 			sint8 party_num = party->get_member_num(items.actor2_ref);
 			scroll->display_string(party_num >= 0 ? party->get_actor_name(party_num)
@@ -1753,7 +1753,7 @@ bool U6UseCode::use_key(Obj *obj, UseCodeEvent ev) {
 		UseCode::search_container(obj, false);
 		return true;
 	} else if (ev == USE_EVENT_SEARCH && obj->obj_n == OBJ_U6_LOCK_PICK) //need to remove rolling pin if there is one
-		return (UseCode::search_container(obj));
+		return UseCode::search_container(obj);
 
 	return false;
 }
@@ -1767,7 +1767,7 @@ bool U6UseCode::use_boat(Obj *obj, UseCodeEvent ev) {
 	uint8 lz;
 
 	if (ev == USE_EVENT_SEARCH)
-		return (UseCode::search_container(obj));
+		return UseCode::search_container(obj);
 	else if (ev == USE_EVENT_USE && obj->has_container())
 		return use_container(obj, USE_EVENT_USE);
 	else if (ev == USE_EVENT_LOOK || ev == USE_EVENT_GET) {
@@ -1781,7 +1781,7 @@ bool U6UseCode::use_boat(Obj *obj, UseCodeEvent ev) {
 	}
 
 	if (ev != USE_EVENT_USE)
-		return (false);
+		return false;
 	ship_actor = actor_manager->get_actor(0); //get the vehicle actor.
 
 // get out of boat
@@ -1805,7 +1805,7 @@ bool U6UseCode::use_boat(Obj *obj, UseCodeEvent ev) {
 
 	if (obj->is_on_map() == false) {
 		scroll->display_string("\nNot usable\n");
-		return (true);
+		return true;
 	}
 	if ((obj->obj_n == OBJ_U6_SKIFF || obj->obj_n == OBJ_U6_RAFT)
 	        && !map->is_water(obj->x, obj->y, obj->z, true)) {
@@ -1814,7 +1814,7 @@ bool U6UseCode::use_boat(Obj *obj, UseCodeEvent ev) {
 	}
 	if (!player->in_party_mode()) {
 		scroll->display_string("\nNot in solo mode.\n");
-		return (true);
+		return true;
 	}
 
 	if (obj->obj_n == OBJ_U6_SHIP) { //If we are using a ship we need to use its center object.
@@ -1841,7 +1841,7 @@ bool U6UseCode::use_boat(Obj *obj, UseCodeEvent ev) {
 // walk to vehicle if necessary
 	if (!party->is_at(obj->x, obj->y, obj->z)) {
 		party->enter_vehicle(obj);
-		return (true);
+		return true;
 	}
 
 // use it (replace ship with vehicle actor)
@@ -1855,7 +1855,7 @@ bool U6UseCode::use_boat(Obj *obj, UseCodeEvent ev) {
 	party->hide(); // set in-vehicle
 	player->set_actor(ship_actor);
 	party->set_in_vehicle(true);
-	return (true);
+	return true;
 }
 
 inline Obj *U6UseCode::use_boat_find_center(Obj *obj) {
@@ -1942,7 +1942,7 @@ bool U6UseCode::use_balloon_plans(Obj *obj, UseCodeEvent ev) {
 	Obj *balloon;
 
 	if (ev != USE_EVENT_USE)
-		return (false);
+		return false;
 
 	scroll->display_string("\n");
 
@@ -1997,7 +1997,7 @@ bool U6UseCode::use_balloon(Obj *obj, UseCodeEvent ev) {
 	uint8 lz;
 
 	if (ev != USE_EVENT_USE)
-		return (false);
+		return false;
 
 	if (Game::get_game()->get_player()->in_party_mode()) {
 		balloonist = Game::get_game()->get_party()->get_leader_actor();
@@ -2007,7 +2007,7 @@ bool U6UseCode::use_balloon(Obj *obj, UseCodeEvent ev) {
 	spot = balloonist->get_location();
 	if ((spot.z > 0) && (spot.z < 5)) {
 		scroll->display_string("\nNot usable\n");
-		return (true);
+		return true;
 	}
 
 	if (obj->obj_n == OBJ_U6_BALLOON) {
@@ -2090,7 +2090,7 @@ bool U6UseCode::use_balloon(Obj *obj, UseCodeEvent ev) {
 
 	if (!player->in_party_mode()) {
 		scroll->display_string("\nNot in solo mode.\n");
-		return (true);
+		return true;
 	}
 
 	if (UseCode::out_of_use_range(obj, true))
@@ -2098,7 +2098,7 @@ bool U6UseCode::use_balloon(Obj *obj, UseCodeEvent ev) {
 // walk to vehicle if necessary
 	if (!party->is_at(obj->x, obj->y, obj->z)) {
 		party->enter_vehicle(obj);
-		return (true); // display prompt
+		return true; // display prompt
 	}
 
 // use it (replace ship with vehicle actor)
@@ -2110,14 +2110,14 @@ bool U6UseCode::use_balloon(Obj *obj, UseCodeEvent ev) {
 	party->hide(); // set in-vehicle
 	player->set_actor(balloon_actor);
 	party->set_in_vehicle(true);
-	return (true);
+	return true;
 }
 
 
 /* using a cow fills an empty bucket in the player's inventory with milk */
 bool U6UseCode::use_cow(Obj *obj, UseCodeEvent ev) {
 	if (ev != USE_EVENT_USE)
-		return (false);
+		return false;
 
 // return fill_bucket(OBJ_U6_BUCKET_OF_MILK);
 	fill_bucket(OBJ_U6_BUCKET_OF_MILK);
@@ -2127,7 +2127,7 @@ bool U6UseCode::use_cow(Obj *obj, UseCodeEvent ev) {
 /* using a well fills an empty bucket in the player's inventory with water */
 bool U6UseCode::use_well(Obj *obj, UseCodeEvent ev) {
 	if (ev != USE_EVENT_USE)
-		return (false);
+		return false;
 
 // return fill_bucket(OBJ_U6_BUCKET_OF_WATER);
 	fill_bucket(OBJ_U6_BUCKET_OF_WATER);
@@ -2243,7 +2243,7 @@ bool U6UseCode::use_horse(Obj *obj, UseCodeEvent ev) {
 	Obj *actor_obj;
 
 	if (ev != USE_EVENT_USE)
-		return (false);
+		return false;
 
 	actor = actor_manager->get_actor(obj->quality); // horse or horse with rider
 	if (!actor)
@@ -2353,7 +2353,7 @@ bool U6UseCode::use_sextant(Obj *obj, UseCodeEvent ev) {
 	} else
 		scroll->display_string("\nNot usable\n");
 
-	return (true);
+	return true;
 }
 
 bool U6UseCode::use_staff(Obj *obj, UseCodeEvent ev) {
@@ -2387,9 +2387,9 @@ bool U6UseCode::pass_quest_barrier(Obj *obj, UseCodeEvent ev) {
 			if (items.actor_ref == player->get_actor())
 				scroll->message("\n\"Thou art not upon a Sacred Quest!\n"
 				                "Passage denied!\"\n\n");
-			return (false);
+			return false;
 		}
-	return (true);
+	return true;
 }
 
 
@@ -2480,13 +2480,13 @@ bool U6UseCode::look_clock(Obj *obj, UseCodeEvent ev) {
 	GameClock *clock = game->get_clock();
 	if (obj->obj_n == OBJ_U6_SUNDIAL
 	        && (clock->get_hour() < 5 || clock->get_hour() > 19))
-		return (true); // don't get time from sundial at night
+		return true; // don't get time from sundial at night
 	if (ev == USE_EVENT_LOOK && items.actor_ref == player->get_actor()) {
 		scroll->display_string("\nThe time is ");
 		scroll->display_string(clock->get_time_string());
 		scroll->display_string("\n");
 	}
-	return (true);
+	return true;
 }
 
 
@@ -2503,9 +2503,9 @@ bool U6UseCode::look_mirror(Obj *obj, UseCodeEvent ev) {
 			game->get_event()->display_portrait(items.actor_ref);
 		}
 		scroll->display_string("\n");
-		return (true);
+		return true;
 	}
-	return (false);
+	return false;
 }
 
 
@@ -2525,7 +2525,7 @@ bool U6UseCode::enter_dungeon(Obj *obj, UseCodeEvent ev) {
 
 	if (!player->in_party_mode()) {
 		scroll->display_string("\n\nNot in solo mode.\n");
-		return (true);
+		return true;
 	}
 
 	if (ev == USE_EVENT_USE && UseCode::out_of_use_range(obj, true))
@@ -2571,10 +2571,10 @@ bool U6UseCode::enter_dungeon(Obj *obj, UseCodeEvent ev) {
 //            party->walk(&entrance, &exitPos);
 		party->walk(&entrance, &exitPos, 100);
 		game->get_weather()->set_wind_dir(NUVIE_DIR_NONE);
-		return (true);
+		return true;
 	} else if ((ev == USE_EVENT_PASS || ev == USE_EVENT_USE) && party->get_autowalk()) // party can use now
-		return (true);
-	return (false);
+		return true;
+	return false;
 }
 
 bool U6UseCode::enter_moongate(Obj *obj, UseCodeEvent ev) {
@@ -2594,7 +2594,7 @@ bool U6UseCode::enter_moongate(Obj *obj, UseCodeEvent ev) {
 	if (!player->in_party_mode()) {
 		scroll->display_string("\nYou must be in party mode to enter.\n\n");
 		scroll->display_prompt();
-		return (true);
+		return true;
 	}
 
 	// don't activate if autowalking from linking exitPos
@@ -2644,11 +2644,11 @@ bool U6UseCode::enter_moongate(Obj *obj, UseCodeEvent ev) {
 			}
 		}
 		party->walk(obj, &exitPos);
-		return (true);
+		return true;
 	} else if (ev == USE_EVENT_PASS && party->get_autowalk()) // party can use now
 		if (party->contains_actor(items.actor_ref))
-			return (true);
-	return (true);
+			return true;
+	return true;
 }
 
 
@@ -2675,20 +2675,20 @@ bool U6UseCode::use_cannon(Obj *obj, UseCodeEvent ev) {
 // FIXME: new UseCodeEffect(obj, cannonballtile, dir) // sets WAIT mode
 		new CannonballEffect(obj); // sets WAIT mode
 		// Note: waits for effect to complete and sends MESG_EFFECT_COMPLETE
-		return (false);
+		return false;
 	} else if (ev == USE_EVENT_MESSAGE) {
 		if (*items.msg_ref == MESG_EFFECT_COMPLETE) {
 			scroll->display_string("\n");
 			scroll->display_prompt();
 		}
-		return (true);
+		return true;
 	} else if (ev == USE_EVENT_MOVE) {
 		// allow normal move
 		if ((obj->frame_n == 0 && mapcoord_ref->sy < 0)
 		        || (obj->frame_n == 1 && mapcoord_ref->sx > 0)
 		        || (obj->frame_n == 2 && mapcoord_ref->sy > 0)
 		        || (obj->frame_n == 3 && mapcoord_ref->sx < 0))
-			return (true);
+			return true;
 		else { // aim cannon in new direction
 			if (mapcoord_ref->sy < 0)
 				obj->frame_n = 0;
@@ -2698,10 +2698,10 @@ bool U6UseCode::use_cannon(Obj *obj, UseCodeEvent ev) {
 				obj->frame_n = 3;
 			else if (mapcoord_ref->sx > 0)
 				obj->frame_n = 1;
-			return (false);
+			return false;
 		}
 	}
-	return (false);
+	return false;
 }
 
 
@@ -2712,7 +2712,7 @@ bool U6UseCode::use_egg(Obj *obj, UseCodeEvent ev) {
 	bool success = egg_manager->spawn_egg(obj, NUVIE_RAND() % 100);
 	if (items.actor_ref)
 		scroll->display_string(success ? "\nSpawned!\n" : "\nNo effect.\n");
-	return (true);
+	return true;
 }
 
 /* USE: Open spellbook for casting, if equipped.
@@ -2731,7 +2731,7 @@ bool U6UseCode::use_spellbook(Obj *obj, UseCodeEvent ev) {
 		/* TODO open spellbook for reading */
 
 	}
-	return (true);
+	return true;
 }
 
 /* Use: Light torch if readied or on the ground.
@@ -2744,7 +2744,7 @@ bool U6UseCode::torch(Obj *obj, UseCodeEvent ev) {
 	if (ev == USE_EVENT_USE) {
 		if (obj->frame_n == 1) {
 			extinguish_torch(obj);
-			return (true);
+			return true;
 		}
 		// light
 		if (obj->is_on_map()) {
@@ -2791,7 +2791,7 @@ bool U6UseCode::torch(Obj *obj, UseCodeEvent ev) {
 		if (obj->is_readied()) { // remove
 			if (obj->frame_n == 1) {
 				extinguish_torch(obj);
-				return (false); // destroyed
+				return false; // destroyed
 			}
 		} else { // equip (get one from the stack)
 			if (obj->qty > 1 && obj->frame_n == 0) { // don't change the quantity of lit torches
@@ -2804,25 +2804,25 @@ bool U6UseCode::torch(Obj *obj, UseCodeEvent ev) {
 				}
 			}
 		}
-		return (true); // equip or remove to inventory
+		return true; // equip or remove to inventory
 	} else if (ev == USE_EVENT_GET) {
 		if (obj->frame_n == 0) // unlit: may get normally
-			return (true);
+			return true;
 		toggle_frame(obj); // unlight
 		obj->qty = 1;
 		obj_manager->remove_obj_from_map(obj); // add to inventory and USE
 		items.actor_ref->inventory_add_object(obj); // will unstack in USE
 		scroll->display_string("\n");
 		torch(obj, USE_EVENT_USE);
-		return (false); // ready or not, handled by usecode
+		return false; // ready or not, handled by usecode
 	} else if (ev == USE_EVENT_DROP) {
 		if (obj->frame_n == 0) // unlit: normal drop
-			return (true);
+			return true;
 		extinguish_torch(obj);
-		return (false); // destroyed
+		return false; // destroyed
 	}
 
-	return (true);
+	return true;
 }
 
 /* Torches disappear when extinguished. */
diff --git a/engines/ultima/nuvie/usecode/usecode.cpp b/engines/ultima/nuvie/usecode/usecode.cpp
index b661f48598e..b64b305ab28 100644
--- a/engines/ultima/nuvie/usecode/usecode.cpp
+++ b/engines/ultima/nuvie/usecode/usecode.cpp
@@ -198,9 +198,9 @@ Obj *UseCode::get_obj_from_container(Obj *obj) {
 	if (obj->container && obj->container->end()) {
 		temp_obj = (Obj *)obj->container->end()->data;
 		obj->container->remove(temp_obj); // a pop_back() may be more efficient
-		return (temp_obj);
+		return temp_obj;
 	}
-	return (nullptr);
+	return nullptr;
 }
 
 
@@ -270,7 +270,7 @@ Obj *UseCode::destroy_obj(Obj *obj, uint32 count, bool run_usecode) {
 		obj = nullptr;
 	}
 
-	return (obj);
+	return obj;
 }
 
 /*
diff --git a/engines/ultima/nuvie/usecode/usecode.h b/engines/ultima/nuvie/usecode/usecode.h
index 1c20da1475d..133b1110b7d 100644
--- a/engines/ultima/nuvie/usecode/usecode.h
+++ b/engines/ultima/nuvie/usecode/usecode.h
@@ -191,85 +191,85 @@ public:
 
 	virtual bool use_obj(Obj *obj, Actor *actor);
 	virtual bool look_obj(Obj *obj, Actor *actor)   {
-		return (false);
+		return false;
 	}
 	virtual bool pass_obj(Obj *obj, Actor *actor, uint16 x, uint16 y) {
-		return (false);
+		return false;
 	}
 	virtual bool search_obj(Obj *obj, Actor *actor) {
-		return (false);
+		return false;
 	}
 	virtual bool move_obj(Obj *obj, sint16 rel_x, sint16 rel_y);
 	virtual bool load_obj(Obj *obj)                 {
-		return (false);
+		return false;
 	}
 	virtual bool message_obj(Obj *obj, CallbackMessage msg, void *msg_data) {
-		return (false);
+		return false;
 	}
 	virtual bool ready_obj(Obj *obj, Actor *actor);
 	virtual bool get_obj(Obj *obj, Actor *actor)    {
-		return (false);
+		return false;
 	}
 	virtual bool drop_obj(Obj *obj, Actor *actor, uint16 x, uint16 y, uint16 qty = 0) {
-		return (false);
+		return false;
 	}
 
 	virtual bool has_usecode(Obj *obj, UseCodeEvent ev = USE_EVENT_USE);
 	virtual bool has_usecode(Actor *actor, UseCodeEvent ev = USE_EVENT_USE) {
-		return (false);
+		return false;
 	}
 	virtual bool has_lookcode(Obj *obj) {
-		return (has_usecode(obj, USE_EVENT_LOOK));
+		return has_usecode(obj, USE_EVENT_LOOK);
 	}
 	virtual bool has_passcode(Obj *obj) {
-		return (has_usecode(obj, USE_EVENT_PASS));
+		return has_usecode(obj, USE_EVENT_PASS);
 	}
 	virtual bool has_movecode(Obj *obj) {
-		return (has_usecode(obj, USE_EVENT_MOVE));
+		return has_usecode(obj, USE_EVENT_MOVE);
 	}
 	virtual bool has_loadcode(Obj *obj) {
-		return (has_usecode(obj, USE_EVENT_LOAD));
+		return has_usecode(obj, USE_EVENT_LOAD);
 	}
 	virtual bool has_readycode(Obj *obj) {
-		return (has_usecode(obj, USE_EVENT_READY));
+		return has_usecode(obj, USE_EVENT_READY);
 	}
 	virtual bool cannot_unready(const Obj *obj) const {
 		return false;
 	}
 	virtual bool has_getcode(Obj *obj)  {
-		return (has_usecode(obj, USE_EVENT_GET));
+		return has_usecode(obj, USE_EVENT_GET);
 	}
 	virtual bool has_dropcode(Obj *obj) {
-		return (has_usecode(obj, USE_EVENT_DROP));
+		return has_usecode(obj, USE_EVENT_DROP);
 	}
 
 	bool is_door(const Obj *obj) const {
 		return (is_locked_door(obj) || is_unlocked_door(obj));
 	}
 	virtual bool is_locked_door(const Obj *obj) const {
-		return (false);
+		return false;
 	}
 	virtual bool is_unlocked_door(const Obj *obj) const {
-		return (false);
+		return false;
 	}
 	virtual bool is_closed_door(const Obj *obj) const {
-		return (false);
+		return false;
 	}
 	virtual bool process_effects(Obj *container_obj, Actor *actor) {
-		return (false);
+		return false;
 	}
 	virtual bool is_food(const Obj *obj) const {
-		return (false);
+		return false;
 	}
 	virtual bool is_container(const Obj *obj) const;
 	virtual bool is_container(uint16 obj_n, uint8 frame_n) const {
-		return (false);
+		return false;
 	}
 	virtual bool is_readable(const Obj *obj) const {
-		return (false);
+		return false;
 	}
 	virtual bool is_chest(const Obj *obj) const {
-		return (false);
+		return false;
 	}
 
 	void set_itemref(sint32 *val) {
diff --git a/engines/ultima/nuvie/views/actor_view.cpp b/engines/ultima/nuvie/views/actor_view.cpp
index 6a48af84821..e19cf2f6b46 100644
--- a/engines/ultima/nuvie/views/actor_view.cpp
+++ b/engines/ultima/nuvie/views/actor_view.cpp
@@ -282,7 +282,7 @@ GUI_status ActorView::MouseDown(int x, int y, Shared::MouseButton button) {
  */
 GUI_status ActorView::KeyDown(const Common::KeyState &key) {
 	if (!show_cursor) // FIXME: don't rely on show_cursor to get/pass focus
-		return (GUI_PASS);
+		return GUI_PASS;
 	KeyBinder *keybinder = Game::get_game()->get_keybinder();
 	ActionType a = keybinder->get_ActionType(key);
 
@@ -307,7 +307,7 @@ GUI_status ActorView::KeyDown(const Common::KeyState &key) {
 //			set_show_cursor(false); // newAction() can move cursor here
 		return GUI_PASS;
 	}
-	return (GUI_YUM);
+	return GUI_YUM;
 }
 
 /* Put cursor over one of the command icons. */
diff --git a/engines/ultima/nuvie/views/container_view_gump.h b/engines/ultima/nuvie/views/container_view_gump.h
index 71e47b72360..250929e8b64 100644
--- a/engines/ultima/nuvie/views/container_view_gump.h
+++ b/engines/ultima/nuvie/views/container_view_gump.h
@@ -72,7 +72,7 @@ public:
 	}
 
 	bool is_actor_container() const {
-		return (container_obj == nullptr);
+		return container_obj == nullptr;
 	}
 
 	GUI_status KeyDown(const Common::KeyState &key) override;
diff --git a/engines/ultima/nuvie/views/container_widget.cpp b/engines/ultima/nuvie/views/container_widget.cpp
index d4f9d761fee..ae93c907923 100644
--- a/engines/ultima/nuvie/views/container_widget.cpp
+++ b/engines/ultima/nuvie/views/container_widget.cpp
@@ -520,7 +520,7 @@ void ContainerWidget::try_click() {
 GUI_status ContainerWidget::MouseDouble(int x, int y, Shared::MouseButton button) {
 	// we have to check if double-clicks are allowed here, since we use single-clicks
 	if (!Game::get_game()->get_map_window()->is_doubleclick_enabled())
-		return (GUI_PASS);
+		return GUI_PASS;
 	Obj *obj = selected_obj;
 
 	ready_obj = nullptr;
@@ -529,13 +529,13 @@ GUI_status ContainerWidget::MouseDouble(int x, int y, Shared::MouseButton button
 //    if(!actor)
 //        return(GUI_YUM);
 	if (!obj)
-		return (MouseUp(x, y, button)); // probably hit an arrow
+		return MouseUp(x, y, button); // probably hit an arrow
 	Game::get_game()->get_view_manager()->double_click_obj(obj);
-	return (GUI_PASS);
+	return GUI_PASS;
 }
 
 GUI_status ContainerWidget::MouseClick(int x, int y, Shared::MouseButton button) {
-	return (MouseUp(x, y, button));
+	return MouseUp(x, y, button);
 }
 
 // change container, ready/unready object, activate arrows
diff --git a/engines/ultima/nuvie/views/container_widget.h b/engines/ultima/nuvie/views/container_widget.h
index 4d043a9bfa1..9c5a11da4bc 100644
--- a/engines/ultima/nuvie/views/container_widget.h
+++ b/engines/ultima/nuvie/views/container_widget.h
@@ -69,10 +69,10 @@ public:
 	bool init(Actor *a, uint16 x, uint16 y, TileManager *tm, ObjManager *om, Font *f);
 	virtual void set_actor(Actor *a);
 	const Actor *get_actor() const {
-		return (actor);
+		return actor;
 	}
 	Obj *get_container() {
-		return (container_obj);
+		return container_obj;
 	}
 	void set_container(Obj *obj) {
 		container_obj = obj;
diff --git a/engines/ultima/nuvie/views/doll_widget.cpp b/engines/ultima/nuvie/views/doll_widget.cpp
index f7b322ed06a..e503757a780 100644
--- a/engines/ultima/nuvie/views/doll_widget.cpp
+++ b/engines/ultima/nuvie/views/doll_widget.cpp
@@ -232,10 +232,10 @@ void DollWidget::load_md_doll_shp() {
 	}
 }
 
-Common::Rect *DollWidget::get_item_hit_rect(uint8 location) {
+const Common::Rect *DollWidget::get_item_hit_rect(uint8 location) const {
 	if (location < 8)
-		return (&item_hit_rects[location]);
-	return (nullptr);
+		return &item_hit_rects[location];
+	return nullptr;
 }
 
 
@@ -398,7 +398,7 @@ GUI_status DollWidget::MouseUp(int x, int y, Shared::MouseButton button) {
 }
 
 GUI_status DollWidget::MouseClick(int x, int y, Shared::MouseButton button) {
-	return (MouseUp(x, y, button));
+	return MouseUp(x, y, button);
 }
 
 GUI_status DollWidget::MouseMotion(int x, int y, uint8 state) {
@@ -527,7 +527,7 @@ void DollWidget::drag_draw(int x, int y, int message, void *data) {
 GUI_status DollWidget::MouseDouble(int x, int y, Shared::MouseButton button) {
 	// we have to check if double-clicks are allowed here, since we use single-clicks
 	if (!Game::get_game()->get_map_window()->is_doubleclick_enabled())
-		return (GUI_PASS);
+		return GUI_PASS;
 	Events *event = Game::get_game()->get_event();
 	Obj *obj = selected_obj;
 
@@ -535,11 +535,11 @@ GUI_status DollWidget::MouseDouble(int x, int y, Shared::MouseButton button) {
 	selected_obj = nullptr;
 
 	if (!(actor && obj))
-		return (GUI_YUM);
+		return GUI_YUM;
 
 	if (event->newAction(USE_MODE))
 		event->select_obj(obj);
-	return (GUI_YUM);
+	return GUI_YUM;
 }
 
 // change container, ready/unready object, activate arrows
diff --git a/engines/ultima/nuvie/views/doll_widget.h b/engines/ultima/nuvie/views/doll_widget.h
index 7026528a671..2d364d57f1e 100644
--- a/engines/ultima/nuvie/views/doll_widget.h
+++ b/engines/ultima/nuvie/views/doll_widget.h
@@ -78,7 +78,7 @@ public:
 
 	void drag_draw(int x, int y, int message, void *data) override;
 
-	Common::Rect *get_item_hit_rect(uint8 location);
+	const Common::Rect *get_item_hit_rect(uint8 location) const;
 
 protected:
 
diff --git a/engines/ultima/nuvie/views/draggable_view.cpp b/engines/ultima/nuvie/views/draggable_view.cpp
index 78ea3969825..0a13cd46510 100644
--- a/engines/ultima/nuvie/views/draggable_view.cpp
+++ b/engines/ultima/nuvie/views/draggable_view.cpp
@@ -105,7 +105,7 @@ GUI_status DraggableView::MouseMotion(int x, int y, uint8 state) {
 	GUI::get_gui()->moveWidget(this, dx, dy);
 // Redraw();
 
-	return (GUI_YUM);
+	return GUI_YUM;
 }
 
 void DraggableView::force_full_redraw_if_needed() {
diff --git a/engines/ultima/nuvie/views/inventory_view.cpp b/engines/ultima/nuvie/views/inventory_view.cpp
index f355e6a5682..3c4b28f710e 100644
--- a/engines/ultima/nuvie/views/inventory_view.cpp
+++ b/engines/ultima/nuvie/views/inventory_view.cpp
@@ -318,7 +318,7 @@ void InventoryView::display_combat_mode() {
  */
 GUI_status InventoryView::KeyDown(const Common::KeyState &key) {
 	if (!show_cursor) // FIXME: don't rely on show_cursor to get/pass focus
-		return (GUI_PASS);
+		return GUI_PASS;
 	KeyBinder *keybinder = Game::get_game()->get_keybinder();
 	ActionType a = keybinder->get_ActionType(key);
 
@@ -365,7 +365,7 @@ GUI_status InventoryView::KeyDown(const Common::KeyState &key) {
 //            set_show_cursor(false); // newAction() can move cursor here
 		return GUI_PASS;
 	}
-	return (GUI_YUM);
+	return GUI_YUM;
 }
 
 
@@ -491,7 +491,7 @@ void InventoryView::moveCursorRelative(sint8 new_x, sint8 new_y) {
 /* Update on-screen location (px,py) of cursor.
  */
 void InventoryView::update_cursor() {
-	Common::Rect *ready_loc;
+	const Common::Rect *ready_loc;
 	nuvie_game_t gametype = Game::get_game()->get_game_type();
 	switch (cursor_pos.area) {
 	case INVAREA_LIST:
@@ -557,7 +557,7 @@ Obj *InventoryView::get_objAtCursor() {
 	else if (cursor_pos.area == INVAREA_DOLL)
 		return (inventory_widget->get_actor()->inventory_get_readied_object(cursor_pos.x));
 
-	return (nullptr);
+	return nullptr;
 }
 
 
diff --git a/engines/ultima/nuvie/views/inventory_view.h b/engines/ultima/nuvie/views/inventory_view.h
index d7f694f44c2..eec2910b49a 100644
--- a/engines/ultima/nuvie/views/inventory_view.h
+++ b/engines/ultima/nuvie/views/inventory_view.h
@@ -78,7 +78,7 @@ public:
 	void select_objAtCursor();
 	Obj *get_objAtCursor();
 	InventoryWidget *get_inventory_widget() {
-		return (inventory_widget);
+		return inventory_widget;
 	};
 
 	void Display(bool full_redraw) override;
diff --git a/engines/ultima/nuvie/views/inventory_widget.cpp b/engines/ultima/nuvie/views/inventory_widget.cpp
index f8cbc6094fb..fffa781efe3 100644
--- a/engines/ultima/nuvie/views/inventory_widget.cpp
+++ b/engines/ultima/nuvie/views/inventory_widget.cpp
@@ -638,23 +638,23 @@ void InventoryWidget::try_click() {
 GUI_status InventoryWidget::MouseDouble(int x, int y, Shared::MouseButton button) {
 	// we have to check if double-clicks are allowed here, since we use single-clicks
 	if (!Game::get_game()->get_map_window()->is_doubleclick_enabled())
-		return (GUI_PASS);
+		return GUI_PASS;
 	Obj *obj = selected_obj;
 
 	ready_obj = nullptr;
 	selected_obj = nullptr;
 
 	if (!actor)
-		return (GUI_YUM);
+		return GUI_YUM;
 	if (!obj)
-		return (MouseUp(x, y, button)); // probably hit an arrow
+		return MouseUp(x, y, button); // probably hit an arrow
 
 	Game::get_game()->get_view_manager()->double_click_obj(obj);
-	return (GUI_PASS);
+	return GUI_PASS;
 }
 
 GUI_status InventoryWidget::MouseClick(int x, int y, Shared::MouseButton button) {
-	return (MouseUp(x, y, button));
+	return MouseUp(x, y, button);
 }
 
 // change container, ready/unready object, activate arrows
diff --git a/engines/ultima/nuvie/views/inventory_widget.h b/engines/ultima/nuvie/views/inventory_widget.h
index 654b20411a4..2a51fc8e1f0 100644
--- a/engines/ultima/nuvie/views/inventory_widget.h
+++ b/engines/ultima/nuvie/views/inventory_widget.h
@@ -66,10 +66,10 @@ public:
 	bool init(Actor *a, uint16 x, uint16 y, TileManager *tm, ObjManager *om, Font *f);
 	void set_actor(Actor *a);
 	Actor *get_actor() {
-		return (actor);
+		return actor;
 	}
 	Obj *get_container() {
-		return (container_obj);
+		return container_obj;
 	}
 	void set_container(Obj *obj) {
 		container_obj = obj;
diff --git a/engines/ultima/nuvie/views/map_editor_view.cpp b/engines/ultima/nuvie/views/map_editor_view.cpp
index 9b1c87190cb..85716c0fbf9 100644
--- a/engines/ultima/nuvie/views/map_editor_view.cpp
+++ b/engines/ultima/nuvie/views/map_editor_view.cpp
@@ -232,7 +232,7 @@ GUI_status MapEditorView::KeyDown(const Common::KeyState &key) {
 		keybinder->handle_always_available_keys(a);
 		break; // was GUI_PASS pefore action_type change
 	}
-	return (GUI_YUM);
+	return GUI_YUM;
 }
 
 GUI_status MapEditorView::MouseDown(int x, int y, Shared::MouseButton button) {
diff --git a/engines/ultima/nuvie/views/party_view.cpp b/engines/ultima/nuvie/views/party_view.cpp
index f21309e3eb1..fd59863e279 100644
--- a/engines/ultima/nuvie/views/party_view.cpp
+++ b/engines/ultima/nuvie/views/party_view.cpp
@@ -351,18 +351,18 @@ void PartyView::Display(bool full_redraw) {
 bool PartyView::up_arrow() {
 	if (row_offset > 0) {
 		row_offset--;
-		return (true);
+		return true;
 	}
-	return (false);
+	return false;
 }
 
 
 bool PartyView::down_arrow() {
 	if ((row_offset + (SE ? 7 : 5)) < party->get_party_size()) {
 		row_offset++;
-		return (true);
+		return true;
 	}
-	return (false);
+	return false;
 }
 
 
diff --git a/engines/ultima/nuvie/views/party_view.h b/engines/ultima/nuvie/views/party_view.h
index 9eb514f1839..4aa32985c07 100644
--- a/engines/ultima/nuvie/views/party_view.h
+++ b/engines/ultima/nuvie/views/party_view.h
@@ -51,7 +51,7 @@ public:
 	bool init(void *vm, uint16 x, uint16 y, Font *f, Party *p, Player *pl, TileManager *tm, ObjManager *om);
 	GUI_status MouseUp(int x, int y, Shared::MouseButton button) override;
 	GUI_status MouseDown(int x, int y, Shared::MouseButton button) override {
-		return (GUI_YUM);
+		return GUI_YUM;
 	}
 	GUI_status MouseWheel(sint32 x, sint32 y) override;
 	bool drag_accept_drop(int x, int y, int message, void *data) override;
diff --git a/engines/ultima/nuvie/views/portrait_view.cpp b/engines/ultima/nuvie/views/portrait_view.cpp
index 3abc31535e7..1a305ca747f 100644
--- a/engines/ultima/nuvie/views/portrait_view.cpp
+++ b/engines/ultima/nuvie/views/portrait_view.cpp
@@ -220,9 +220,9 @@ GUI_status PortraitView::HandleEvent(const Common::Event *event) {
 		// Game::get_game()->get_scroll()->set_input_mode(false);
 		Game::get_game()->get_scroll()->message("\n");
 		set_waiting(false);
-		return (GUI_YUM);
+		return GUI_YUM;
 	}
-	return (GUI_PASS);
+	return GUI_PASS;
 }
 
 
diff --git a/engines/ultima/nuvie/views/portrait_view.h b/engines/ultima/nuvie/views/portrait_view.h
index c75b359c602..c9d1a1542f9 100644
--- a/engines/ultima/nuvie/views/portrait_view.h
+++ b/engines/ultima/nuvie/views/portrait_view.h
@@ -73,7 +73,7 @@ public:
 	}
 	void set_waiting(bool state);
 	bool get_waiting() const {
-		return (waiting);
+		return waiting;
 	}
 
 protected:
diff --git a/engines/ultima/nuvie/views/scroll_widget_gump.cpp b/engines/ultima/nuvie/views/scroll_widget_gump.cpp
index 27214f74a95..4a05e089239 100644
--- a/engines/ultima/nuvie/views/scroll_widget_gump.cpp
+++ b/engines/ultima/nuvie/views/scroll_widget_gump.cpp
@@ -240,7 +240,7 @@ GUI_status ScrollWidgetGump::scroll_movement_event(ScrollEventType event) {
 			position++;
 			update_arrows();
 		}
-		return (GUI_YUM);
+		return GUI_YUM;
 	case SCROLL_PAGE_UP:
 		if (position > 0) {
 			position = position > scroll_height ? position - scroll_height : 0;
diff --git a/engines/ultima/nuvie/views/spell_view.cpp b/engines/ultima/nuvie/views/spell_view.cpp
index 6dcff430bcc..c508df922a7 100644
--- a/engines/ultima/nuvie/views/spell_view.cpp
+++ b/engines/ultima/nuvie/views/spell_view.cpp
@@ -389,7 +389,7 @@ GUI_status SpellView::KeyDown(const Common::KeyState &key) {
 	default:
 		return GUI_PASS;
 	}
-	return (GUI_YUM);
+	return GUI_YUM;
 }
 
 GUI_status SpellView::cancel_spell() {
diff --git a/engines/ultima/nuvie/views/view.cpp b/engines/ultima/nuvie/views/view.cpp
index 8530bd9385e..e8a2607dd9b 100644
--- a/engines/ultima/nuvie/views/view.cpp
+++ b/engines/ultima/nuvie/views/view.cpp
@@ -151,7 +151,7 @@ void View::set_combat_mode(Actor *actor) {
 uint8 View::get_combat_mode_index(const Actor *actor) const {
 	uint8 combat_mode = actor->get_combat_mode();
 	if (Game::get_game()->get_game_type() == NUVIE_GAME_U6)
-		return (combat_mode - 2);
+		return combat_mode - 2;
 	else {
 		uint8 combat_mode_index = 0;
 		if (combat_mode == ACTOR_WT_PLAYER)
diff --git a/engines/ultima/nuvie/views/view_manager.h b/engines/ultima/nuvie/views/view_manager.h
index 36dd152488b..4e5c13599a1 100644
--- a/engines/ultima/nuvie/views/view_manager.h
+++ b/engines/ultima/nuvie/views/view_manager.h
@@ -104,22 +104,22 @@ public:
 	void close_spell_mode();
 
 	View *get_current_view() {
-		return (current_view);
+		return current_view;
 	}
 	ActorView *get_actor_view() {
-		return (actor_view);
+		return actor_view;
 	}
 	InventoryView *get_inventory_view() {
-		return (inventory_view);
+		return inventory_view;
 	}
 	PortraitView *get_portrait_view() {
-		return (portrait_view);
+		return portrait_view;
 	}
 	PartyView *get_party_view() {
-		return (party_view);
+		return party_view;
 	}
 	SpellView *get_spell_view() {
-		return (spell_view);
+		return spell_view;
 	}
 	MDSkyStripWidget *get_mdSkyWidget() {
 		return mdSkyWidget;


Commit: a19279f90ecdcd91029843fb0710b30996017e6e
    https://github.com/scummvm/scummvm/commit/a19279f90ecdcd91029843fb0710b30996017e6e
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2023-12-09T13:56:06+11:00

Commit Message:
ULTIMA: NUVIE: Further improve const correctness

Changed paths:
    engines/ultima/nuvie/actors/actor.cpp
    engines/ultima/nuvie/actors/actor.h
    engines/ultima/nuvie/actors/actor_manager.cpp
    engines/ultima/nuvie/actors/actor_manager.h
    engines/ultima/nuvie/conf/config_node.h
    engines/ultima/nuvie/conf/configuration.cpp
    engines/ultima/nuvie/conf/configuration.h
    engines/ultima/nuvie/core/anim_manager.cpp
    engines/ultima/nuvie/core/anim_manager.h
    engines/ultima/nuvie/core/converse.h
    engines/ultima/nuvie/core/converse_speech.cpp
    engines/ultima/nuvie/core/converse_speech.h
    engines/ultima/nuvie/core/effect.cpp
    engines/ultima/nuvie/core/effect.h
    engines/ultima/nuvie/core/egg_manager.cpp
    engines/ultima/nuvie/core/egg_manager.h
    engines/ultima/nuvie/core/events.cpp
    engines/ultima/nuvie/core/events.h
    engines/ultima/nuvie/core/magic.cpp
    engines/ultima/nuvie/core/magic.h
    engines/ultima/nuvie/core/map.cpp
    engines/ultima/nuvie/core/map.h
    engines/ultima/nuvie/core/obj.cpp
    engines/ultima/nuvie/core/obj.h
    engines/ultima/nuvie/core/obj_manager.cpp
    engines/ultima/nuvie/core/obj_manager.h
    engines/ultima/nuvie/core/tile_manager.h
    engines/ultima/nuvie/core/weather.cpp
    engines/ultima/nuvie/files/u6_lib_n.cpp
    engines/ultima/nuvie/files/u6_lib_n.h
    engines/ultima/nuvie/gui/gui_console.cpp
    engines/ultima/nuvie/gui/gui_console.h
    engines/ultima/nuvie/gui/widgets/console.cpp
    engines/ultima/nuvie/gui/widgets/console.h
    engines/ultima/nuvie/gui/widgets/map_window.cpp
    engines/ultima/nuvie/gui/widgets/map_window.h
    engines/ultima/nuvie/misc/u6_misc.cpp
    engines/ultima/nuvie/misc/u6_misc.h
    engines/ultima/nuvie/pathfinder/party_path_finder.cpp
    engines/ultima/nuvie/pathfinder/party_path_finder.h
    engines/ultima/nuvie/screen/screen.cpp
    engines/ultima/nuvie/screen/screen.h
    engines/ultima/nuvie/script/script.cpp
    engines/ultima/nuvie/script/script.h


diff --git a/engines/ultima/nuvie/actors/actor.cpp b/engines/ultima/nuvie/actors/actor.cpp
index abae5c2b647..8c83d429aa8 100644
--- a/engines/ultima/nuvie/actors/actor.cpp
+++ b/engines/ultima/nuvie/actors/actor.cpp
@@ -255,7 +255,7 @@ void Actor::set_direction(sint16 rel_x, sint16 rel_y) {
 	set_direction(new_direction);
 }
 
-void Actor::face_location(MapCoord &loc) {
+void Actor::face_location(const MapCoord &loc) {
 	face_location(loc.x, loc.y);
 }
 
@@ -594,7 +594,7 @@ void Actor::set_in_party(bool state) {
 	}
 }
 
-/*void Actor::attack(MapCoord pos)
+/*void Actor::attack(const MapCoord &pos)
 {
  return;
 }*/
@@ -1176,14 +1176,13 @@ void Actor::all_items_to_container(Obj *container_obj, bool stack) {
 	return;
 }
 
-void Actor::loadSchedule(unsigned char *sched_data, uint16 num) {
-	uint16 i;
-	unsigned char *sched_data_ptr;
+void Actor::loadSchedule(const unsigned char *sched_data, uint16 num) {
 
 	sched = (Schedule **)malloc(sizeof(Schedule *) * (num + 1));
 	num_schedules = num;
-	sched_data_ptr = sched_data;
+	const unsigned char *sched_data_ptr = sched_data;
 
+	uint16 i;
 	for (i = 0; i < num; i++) {
 		sched[i] = (Schedule *)malloc(sizeof(Schedule));
 
@@ -1517,7 +1516,7 @@ void Actor::die(bool create_body) {
 		game->get_actor_manager()->clear_actor(this);
 }
 
-void Actor::resurrect(MapCoord new_position, Obj *body_obj) {
+void Actor::resurrect(const MapCoord &new_position, Obj *body_obj) {
 	U6Link *link;
 	bool remove_obj = false;
 
diff --git a/engines/ultima/nuvie/actors/actor.h b/engines/ultima/nuvie/actors/actor.h
index 16b9fae9144..bf99fa278d0 100644
--- a/engines/ultima/nuvie/actors/actor.h
+++ b/engines/ultima/nuvie/actors/actor.h
@@ -546,7 +546,7 @@ public:
 	}
 	void set_direction(sint16 rel_x, sint16 rel_y);
 	virtual void set_direction(uint8 d);
-	void face_location(MapCoord &loc);
+	void face_location(const MapCoord &loc);
 	virtual void face_location(uint16 lx, uint16 ly);
 	void face_actor(Actor *a);
 
@@ -590,7 +590,7 @@ public:
 	}
 
 // combat methods
-//void attack(MapCoord pos); // attack at a given map location
+	//void attack(const MapCoord &pos); // attack at a given map location
 	Obj *get_weapon_obj(sint8 readied_obj_location);
 	void attack(sint8 readied_obj_location, MapCoord target, Actor *foe = nullptr);
 	const CombatType *get_weapon(sint8 readied_obj_location);
@@ -600,7 +600,7 @@ public:
 	void hit(uint8 dmg, bool force_hit = false);
 	void reduce_hp(uint8 amount);
 	virtual void die(bool create_body = true);
-	void resurrect(MapCoord new_position, Obj *body_obj = nullptr);
+	void resurrect(const MapCoord &new_position, Obj *body_obj = nullptr);
 	uint8 get_range(uint16 target_x, uint16 target_y);
 	bool weapon_can_hit(const CombatType *weapon, uint16 target_x, uint16 target_y);
 	virtual bool weapon_can_hit(const CombatType *weapon, Actor *target, uint16 *hit_x, uint16 *hit_y) {
@@ -684,7 +684,7 @@ public:
 	uint16 get_custom_tile_num(uint16 obj_num) const;
 protected:
 
-	void loadSchedule(unsigned char *schedule_data, uint16 num);
+	void loadSchedule(const unsigned char *schedule_data, uint16 num);
 	virtual bool updateSchedule(uint8 hour, bool teleport = false);
 	uint16 getSchedulePos(uint8 hour);
 // uint16 getSchedulePos(uint8 hour, uint8 day_of_week);
diff --git a/engines/ultima/nuvie/actors/actor_manager.cpp b/engines/ultima/nuvie/actors/actor_manager.cpp
index 257051b53da..1837a1fa942 100644
--- a/engines/ultima/nuvie/actors/actor_manager.cpp
+++ b/engines/ultima/nuvie/actors/actor_manager.cpp
@@ -1048,7 +1048,7 @@ void ActorManager::print_actor(Actor *actor) {
 	actor->print();
 }
 
-bool ActorManager::can_put_actor(MapCoord location) {
+bool ActorManager::can_put_actor(const MapCoord &location) {
 	if (!map->is_passable(location.x, location.y, location.z))
 		return false;
 
@@ -1108,7 +1108,7 @@ bool ActorManager::loadCustomTiles(nuvie_game_t game_type) {
 	return true;
 }
 
-void ActorManager::loadCustomBaseTiles(Std::string datadir) {
+void ActorManager::loadCustomBaseTiles(const Std::string &datadir) {
 	Std::string imagefile;
 	build_path(datadir, "custom_tiles.bmp", imagefile);
 
@@ -1116,7 +1116,7 @@ void ActorManager::loadCustomBaseTiles(Std::string datadir) {
 	tile_manager->loadCustomTiles(Game::get_game()->get_data_file_path(imagefile), true, true, 0);
 }
 
-void ActorManager::loadAvatarTiles(Std::string datadir) {
+void ActorManager::loadAvatarTiles(const Std::string &datadir) {
 	Std::string imagefile;
 
 	uint8 avatar_portrait = Game::get_game()->get_portrait()->get_avatar_portrait_num();
@@ -1147,7 +1147,7 @@ void ActorManager::loadAvatarTiles(Std::string datadir) {
 	return;
 }
 
-void ActorManager::loadNPCTiles(Std::string datadir) {
+void ActorManager::loadNPCTiles(const Std::string &datadir) {
 	Std::string imagefile;
 
 	Std::set<Std::string> files = getCustomTileFilenames(datadir, "actor_");
@@ -1174,7 +1174,7 @@ void ActorManager::loadNPCTiles(Std::string datadir) {
 	return;
 }
 
-Std::set<Std::string> ActorManager::getCustomTileFilenames(Std::string datadir, Std::string filenamePrefix) {
+Std::set<Std::string> ActorManager::getCustomTileFilenames(const Std::string &datadir, const Std::string &filenamePrefix) {
 	NuvieFileList filelistDataDir;
 	NuvieFileList filelistSaveGameDir;
 	Std::string path;
diff --git a/engines/ultima/nuvie/actors/actor_manager.h b/engines/ultima/nuvie/actors/actor_manager.h
index 35240f33d84..d7a1efce3ea 100644
--- a/engines/ultima/nuvie/actors/actor_manager.h
+++ b/engines/ultima/nuvie/actors/actor_manager.h
@@ -114,7 +114,7 @@ public:
 	bool toss_actor(Actor *actor, uint16 xrange, uint16 yrange);
 	bool toss_actor_get_location(uint16 start_x, uint16 start_y, uint8 start_z, uint16 xrange, uint16 yrange, MapCoord *location);
 	void print_actor(Actor *actor);
-	bool can_put_actor(MapCoord location);
+	bool can_put_actor(const MapCoord &location);
 	void enable_temp_actor_cleaning(bool value) {
 		should_clean_temp_actors = value;
 	}
@@ -136,10 +136,10 @@ protected:
 private:
 
 	bool loadCustomTiles(nuvie_game_t game_type);
-	void loadNPCTiles(Std::string datadir);
-	void loadAvatarTiles(Std::string datadir);
-	void loadCustomBaseTiles(Std::string datadir);
-	Std::set<Std::string> getCustomTileFilenames(Std::string datadir, Std::string filenamePrefix);
+	void loadNPCTiles(const Std::string &datadir);
+	void loadAvatarTiles(const Std::string &datadir);
+	void loadCustomBaseTiles(const Std::string &datadir);
+	Std::set<Std::string> getCustomTileFilenames(const Std::string &datadir, const Std::string &filenamePrefix);
 };
 
 } // End of namespace Nuvie
diff --git a/engines/ultima/nuvie/conf/config_node.h b/engines/ultima/nuvie/conf/config_node.h
index ce8d8dc97d1..1e11de3796e 100644
--- a/engines/ultima/nuvie/conf/config_node.h
+++ b/engines/ultima/nuvie/conf/config_node.h
@@ -60,7 +60,7 @@ public:
 		return b;
 	}
 
-	void set(Std::string value) {
+	void set(const Std::string &value) {
 		config.set(key, value);
 	}
 	void set(const char *value) {
diff --git a/engines/ultima/nuvie/conf/configuration.cpp b/engines/ultima/nuvie/conf/configuration.cpp
index 75c1a0a1cef..11da12923ad 100644
--- a/engines/ultima/nuvie/conf/configuration.cpp
+++ b/engines/ultima/nuvie/conf/configuration.cpp
@@ -50,7 +50,7 @@ Configuration::~Configuration() {
 		ConfMan.flushToDisk();
 }
 
-bool Configuration::readConfigFile(Std::string fname, Std::string root,
+bool Configuration::readConfigFile(const Std::string &fname, const Std::string &root,
 								   bool readonly) {
 	_configFilename = fname;
 	Shared::XMLTree *tree = new Shared::XMLTree();
@@ -167,7 +167,7 @@ void Configuration::value(const Std::string &key, bool &ret, bool defaultvalue)
 	ret = defaultvalue;
 }
 
-void Configuration::pathFromValue(const Std::string &key, Std::string file, Std::string &full_path) {
+void Configuration::pathFromValue(const Std::string &key, const Std::string &file, Std::string &full_path) {
 	value(key, full_path);
 
 	if (full_path.length() > 0 && full_path[full_path.length() - 1] != U6PATH_DELIMITER)
@@ -282,7 +282,7 @@ Std::set<Std::string> Configuration::listKeys(const Std::string &key, bool longf
 	return keys;
 }
 
-void Configuration::getSubkeys(KeyTypeList &ktl, Std::string basekey) {
+void Configuration::getSubkeys(KeyTypeList &ktl, const Std::string &basekey) {
 	for (Std::vector<Shared::XMLTree *>::iterator tree = _trees.begin();
 	        tree != _trees.end(); ++tree) {
 		Shared::XMLTree::KeyTypeList l;
diff --git a/engines/ultima/nuvie/conf/configuration.h b/engines/ultima/nuvie/conf/configuration.h
index 5f22cf71265..338fef1dbf8 100644
--- a/engines/ultima/nuvie/conf/configuration.h
+++ b/engines/ultima/nuvie/conf/configuration.h
@@ -81,7 +81,7 @@ public:
 	~Configuration();
 
 	// read config file. Multiple files may be read. Order is important.
-	bool readConfigFile(Std::string fname, Std::string root, bool readonly = true);
+	bool readConfigFile(const Std::string &fname, const Std::string &root, bool readonly = true);
 
 	// Returns true if default settings for game have previously been set
 	bool isDefaultsSet() const;
@@ -104,7 +104,7 @@ public:
 	void value(const Std::string &key, int &ret, int defaultvalue = 0);
 	void value(const Std::string &key, bool &ret, bool defaultvalue = false);
 
-	void pathFromValue(const Std::string &key, Std::string file, Std::string &full_path);
+	void pathFromValue(const Std::string &key, const Std::string &file, Std::string &full_path);
 
 	// set value
 	bool set(const Std::string &key, const Std::string &value);
@@ -121,7 +121,7 @@ public:
 	typedef Common::Pair<Common::String, Common::String> KeyType;
 	typedef Common::Array<KeyType> KeyTypeList;
 
-	void getSubkeys(KeyTypeList &ktl, Std::string basekey);
+	void getSubkeys(KeyTypeList &ktl, const Std::string &basekey);
 };
 
 } // End of namespace Nuvie
diff --git a/engines/ultima/nuvie/core/anim_manager.cpp b/engines/ultima/nuvie/core/anim_manager.cpp
index 83ad769ecd3..1546790d4bb 100644
--- a/engines/ultima/nuvie/core/anim_manager.cpp
+++ b/engines/ultima/nuvie/core/anim_manager.cpp
@@ -407,11 +407,11 @@ void TileAnim::move_tile(PositionedTile *ptile, uint32 x, uint32 y) {
 
 /* Construct TimedEvent with effect duration as time.
  */
-HitAnim::HitAnim(MapCoord *loc) {
+HitAnim::HitAnim(const MapCoord &loc) {
 	hit_actor = nullptr;
 	add_tile(_mapWindow->get_tile_manager()->get_tile(257), // U6 HIT_EFFECT
 	         0, 0);
-	move(loc->x, loc->y);
+	move(loc.x, loc.y);
 }
 
 
@@ -670,11 +670,13 @@ void TossAnim::hit_actor(Actor *actor) {
 		message(MESG_ANIM_HIT, &actor_ent);
 }
 
-void TossAnim::hit_blocking(MapCoord obj_loc) {
+void TossAnim::hit_blocking(const MapCoord &obj_loc) {
 	assert(running == true);
 
-	if (blocking & TOSS_TO_BLOCKING)
-		message(MESG_ANIM_HIT_WORLD, &obj_loc);
+	if (blocking & TOSS_TO_BLOCKING) {
+		MapCoord loc = obj_loc;
+		message(MESG_ANIM_HIT_WORLD, &loc);
+	}
 }
 
 
@@ -743,10 +745,10 @@ void TossAnim::accumulate_moves(float moves, sint32 &x_move, sint32 &y_move, sin
 
 
 /*** ExplosiveAnim ***/
-ExplosiveAnim::ExplosiveAnim(MapCoord *start, uint32 size) {
+ExplosiveAnim::ExplosiveAnim(const MapCoord &start, uint32 size) {
 	exploding_tile_num = 393; // U6 FIREBALL_EFFECT
 
-	center = *start;
+	center = start;
 	radius = size;
 }
 
@@ -906,7 +908,7 @@ bool ExplosiveAnim::update() {
 /* Returns true if the explosion has already the particular thing this MapEntity
  * points to. (and shouldn't hit it again)
  */
-bool ExplosiveAnim::already_hit(MapEntity ent) {
+bool ExplosiveAnim::already_hit(const MapEntity &ent) {
 	for (uint32 e = 0; e < hit_items.size(); e++)
 		if (hit_items[e].entity_type == ent.entity_type)
 			if (hit_items[e].data == ent.data)
@@ -1083,7 +1085,7 @@ void ProjectileAnim::hit_entity(MapEntity entity) {
 /* Returns true if the explosion has already the particular thing this MapEntity
  * points to. (and shouldn't hit it again)
  */
-bool ProjectileAnim::already_hit(MapEntity ent) {
+bool ProjectileAnim::already_hit(const MapEntity &ent) {
 	for (uint32 e = 0; e < hit_items.size(); e++)
 		if (hit_items[e].entity_type == ent.entity_type)
 			if (hit_items[e].data == ent.data)
@@ -1092,7 +1094,7 @@ bool ProjectileAnim::already_hit(MapEntity ent) {
 }
 
 /*** WingAnim ***/
-WingAnim::WingAnim(MapCoord t) {
+WingAnim::WingAnim(const MapCoord &t) {
 	TileManager *tile_manager = _mapWindow->get_tile_manager();
 
 	p_tile_top = nullptr;
@@ -1182,7 +1184,7 @@ bool WingAnim::update() {
 	return true;
 }
 
-HailstormAnim::HailstormAnim(MapCoord t) : target(t) {
+HailstormAnim::HailstormAnim(const MapCoord &t) : target(t) {
 	ARRAYCLEAR(hailstones);
 	hailstone_tile = Game::get_game()->get_tile_manager()->get_tile(0x18e); //hailstone tile.
 
@@ -1274,7 +1276,7 @@ sint8 HailstormAnim::find_free_hailstone() {
 	return -1;
 }
 
-TileFadeAnim::TileFadeAnim(MapCoord *loc, Tile *from, Tile *to, uint16 speed) {
+TileFadeAnim::TileFadeAnim(const MapCoord &loc, Tile *from, Tile *to, uint16 speed) {
 	init(speed);
 
 	if (from != nullptr) {
@@ -1296,10 +1298,10 @@ TileFadeAnim::TileFadeAnim(MapCoord *loc, Tile *from, Tile *to, uint16 speed) {
 	}
 
 	add_tile(anim_tile, 0, 0);
-	move(loc->x, loc->y);
+	move(loc.x, loc.y);
 }
 
-TileFadeAnim::TileFadeAnim(MapCoord *loc, Tile *from, uint8 color_from, uint8 color_to, bool reverse, uint16 speed) {
+TileFadeAnim::TileFadeAnim(const MapCoord &loc, Tile *from, uint8 color_from, uint8 color_to, bool reverse, uint16 speed) {
 	init(speed);
 
 	if (reverse) {
@@ -1321,7 +1323,7 @@ TileFadeAnim::TileFadeAnim(MapCoord *loc, Tile *from, uint8 color_from, uint8 co
 	}
 
 	add_tile(anim_tile, 0, 0);
-	move(loc->x, loc->y);
+	move(loc.x, loc.y);
 }
 
 TileFadeAnim::~TileFadeAnim() {
diff --git a/engines/ultima/nuvie/core/anim_manager.h b/engines/ultima/nuvie/core/anim_manager.h
index 2bb751130af..2c2a8c68903 100644
--- a/engines/ultima/nuvie/core/anim_manager.h
+++ b/engines/ultima/nuvie/core/anim_manager.h
@@ -316,7 +316,7 @@ public:
 	virtual void hit_target();
 	virtual void hit_object(Obj *obj);
 	virtual void hit_actor(Actor *actor);
-	virtual void hit_blocking(MapCoord obj_loc);
+	virtual void hit_blocking(const MapCoord &obj_loc);
 };
 
 // This is for off-center tiles. The tile will be moved down by the
@@ -344,12 +344,12 @@ class ExplosiveAnim : public TimedAnim {
 	vector<MapEntity> hit_items; // things the explosion has hit
 
 public:
-	ExplosiveAnim(MapCoord *start, uint32 size);
+	ExplosiveAnim(const MapCoord &start, uint32 size);
 	~ExplosiveAnim() override;
 	void start() override;
 	uint16 callback(uint16 msg, CallBack *caller, void *data) override;
 	bool update() override;
-	bool already_hit(MapEntity ent);
+	bool already_hit(const MapEntity &ent);
 	void hit_object(Obj *obj);
 	void hit_actor(Actor *actor);
 	void get_shifted_location(uint16 &x, uint16 &y, uint16 &px, uint16 &py,
@@ -386,7 +386,7 @@ public:
 
 protected:
 	void hit_entity(MapEntity entity);
-	bool already_hit(MapEntity ent);
+	bool already_hit(const MapEntity &ent);
 
 };
 
@@ -401,7 +401,7 @@ class WingAnim : public TileAnim {
 	PositionedTile *p_tile_bottom;
 
 public:
-	WingAnim(MapCoord target);
+	WingAnim(const MapCoord &target);
 	~WingAnim() override;
 	void start() override;
 	bool update() override;
@@ -425,7 +425,7 @@ class HailstormAnim : public TileAnim {
 	uint8 num_active;
 
 public:
-	HailstormAnim(MapCoord t);
+	HailstormAnim(const MapCoord &t);
 	~HailstormAnim() override;
 	void start() override;
 	bool update() override;
@@ -443,7 +443,7 @@ class HitAnim : public TimedAnim {
 	bool update() override;
 
 public:
-	HitAnim(MapCoord *loc);
+	HitAnim(const MapCoord &loc);
 	HitAnim(Actor *actor);
 
 	uint16 callback(uint16 msg, CallBack *caller, void *msg_data) override;
@@ -478,8 +478,8 @@ class TileFadeAnim : public TileAnim {
 
 public:
 	TileFadeAnim();
-	TileFadeAnim(MapCoord *loc, Tile *from, Tile *to, uint16 speed);
-	TileFadeAnim(MapCoord *loc, Tile *from, uint8 color_from, uint8 color_to, bool reverse, uint16 speed);
+	TileFadeAnim(const MapCoord &loc, Tile *from, Tile *to, uint16 speed);
+	TileFadeAnim(const MapCoord &loc, Tile *from, uint8 color_from, uint8 color_to, bool reverse, uint16 speed);
 	~TileFadeAnim() override;
 
 	bool update() override;
diff --git a/engines/ultima/nuvie/core/converse.h b/engines/ultima/nuvie/core/converse.h
index 6c8d854dabb..dbb18941375 100644
--- a/engines/ultima/nuvie/core/converse.h
+++ b/engines/ultima/nuvie/core/converse.h
@@ -230,7 +230,7 @@ public:
 	~ConvScript();
 
 	void read_script();
-	bool loaded() {
+	bool loaded() const {
 		return ((buf && buf_len));    // script is loaded?
 	}
 
@@ -257,10 +257,10 @@ public:
 		skip(offset);
 	}
 
-	uint32 pos()                    {
+	uint32 pos() const {
 		return buf_pt - buf;
 	}
-	bool overflow(uint32 ptadd = 0) {
+	bool overflow(uint32 ptadd = 0) const {
 		return (((pos() + ptadd) >= buf_len));
 	}
 	convscript_buffer get_buffer(uint32 ptadd = 0) {
diff --git a/engines/ultima/nuvie/core/converse_speech.cpp b/engines/ultima/nuvie/core/converse_speech.cpp
index f720646d82c..28b51938c70 100644
--- a/engines/ultima/nuvie/core/converse_speech.cpp
+++ b/engines/ultima/nuvie/core/converse_speech.cpp
@@ -194,7 +194,7 @@ inline sint16 ConverseSpeech::convert_sample(uint16 raw_sample) {
 	return sample;
 }
 
-void ConverseSpeech::wav_init_header(NuvieIOBuffer *wav_buffer, uint32 audio_length) {
+void ConverseSpeech::wav_init_header(NuvieIOBuffer *wav_buffer, uint32 audio_length) const {
 	wav_buffer->writeBuf((const unsigned char *)"RIFF", 4);
 	wav_buffer->write4(36 + audio_length * 2); //length of RIFF chunk
 	wav_buffer->writeBuf((const unsigned char *)"WAVE", 4);
diff --git a/engines/ultima/nuvie/core/converse_speech.h b/engines/ultima/nuvie/core/converse_speech.h
index 224107dfa55..c1a205fac88 100644
--- a/engines/ultima/nuvie/core/converse_speech.h
+++ b/engines/ultima/nuvie/core/converse_speech.h
@@ -57,7 +57,7 @@ public:
 protected:
 	NuvieIOBuffer *load_speech(Std::string filename, uint16 sample_num);
 	inline sint16 convert_sample(uint16 raw_sample);
-	void wav_init_header(NuvieIOBuffer *wav_buffer, uint32 audio_length);
+	void wav_init_header(NuvieIOBuffer *wav_buffer, uint32 audio_length) const;
 };
 
 } // End of namespace Nuvie
diff --git a/engines/ultima/nuvie/core/effect.cpp b/engines/ultima/nuvie/core/effect.cpp
index 25fa934543f..f20c4dea84c 100644
--- a/engines/ultima/nuvie/core/effect.cpp
+++ b/engines/ultima/nuvie/core/effect.cpp
@@ -125,7 +125,7 @@ uint16 CannonballEffect::callback(uint16 msg, CallBack *caller, void *msg_data)
 
 	switch (msg) {
 	case MESG_ANIM_HIT_WORLD: {
-		MapCoord *hit_loc = static_cast<MapCoord *>(msg_data);
+		const MapCoord *hit_loc = static_cast<const MapCoord *>(msg_data);
 		const Tile *obj_tile = game->get_obj_manager()->get_obj_tile(hit_loc->x, hit_loc->y, hit_loc->z);
 		const Tile *tile = game->get_game_map()->get_tile(hit_loc->x, hit_loc->y,
 		             hit_loc->z);
@@ -133,7 +133,7 @@ uint16 CannonballEffect::callback(uint16 msg, CallBack *caller, void *msg_data)
 		if ((tile->flags2 & TILEFLAG_MISSILE_BOUNDARY)
 		        || (obj_tile && (obj_tile->flags2 & TILEFLAG_MISSILE_BOUNDARY))) {
 			//new ExplosiveEffect(hit_loc->x, hit_loc->y, 2);
-			new ExpEffect(EXP_EFFECT_TILE_NUM, MapCoord(hit_loc->x, hit_loc->y, hit_loc->z));
+			new ExpEffect(EXP_EFFECT_TILE_NUM, *hit_loc);
 			stop_effect = true;
 		}
 		break;
@@ -186,7 +186,7 @@ uint16 CannonballEffect::callback(uint16 msg, CallBack *caller, void *msg_data)
 #define EXP_EFFECT_SPEED 3
 
 
-ExpEffect::ExpEffect(uint16 tileNum, MapCoord location) : ProjectileEffect(),
+ExpEffect::ExpEffect(uint16 tileNum, const MapCoord &location) : ProjectileEffect(),
 		exp_tile_num(tileNum), usecode(nullptr), obj(nullptr) {
 	start_loc = location;
 	start_anim();
@@ -453,9 +453,9 @@ HitEffect::HitEffect(Actor *target, uint32 duration) {
 	Game::get_game()->get_sound_manager()->playSfx(NUVIE_SFX_HIT); //FIXME use NUVIE_SFX_SAMPLE defines here.
 }
 
-HitEffect::HitEffect(MapCoord location) {
+HitEffect::HitEffect(const MapCoord &location) {
 	game->pause_user();
-	add_anim(new HitAnim(&location));
+	add_anim(new HitAnim(location));
 	Game::get_game()->get_sound_manager()->playSfx(NUVIE_SFX_HIT); //FIXME use NUVIE_SFX_SAMPLE defines here.
 }
 
@@ -483,7 +483,7 @@ TextEffect::TextEffect(Std::string text) { // default somewhat centered on playe
 /*** TextEffect ***/
 /* Print Text to MapWindow for duration
  */
-TextEffect::TextEffect(Std::string text, MapCoord location) {
+TextEffect::TextEffect(Std::string text, const MapCoord &location) {
 	add_anim(new TextAnim(text, location, 1500));
 }
 
@@ -513,7 +513,7 @@ ExplosiveEffect::ExplosiveEffect(uint16 x, uint16 y, uint32 size, uint16 dmg)
 void ExplosiveEffect::start_anim() {
 	game->pause_world();
 	game->pause_user();
-	add_anim(new ExplosiveAnim(&start_at, radius));
+	add_anim(new ExplosiveAnim(start_at, radius));
 }
 
 
@@ -1287,28 +1287,18 @@ uint16 VanishEffect::callback(uint16 msg, CallBack *caller, void *data) {
 
 
 /* TileFadeEffect */
-TileFadeEffect::TileFadeEffect(MapCoord loc, Tile *from, Tile *to, FadeType type, uint16 speed) {
-	anim = nullptr;
-	to_tile = nullptr;
-	anim_tile = nullptr;
-	actor = nullptr;
-	color_from = color_to = 0;
-	inc_reverse = false;
-	spd = 0;
-	add_anim(new TileFadeAnim(&loc, from, to, speed));
+TileFadeEffect::TileFadeEffect(const MapCoord &loc, Tile *from, Tile *to, FadeType type, uint16 speed)
+		: anim(nullptr), to_tile(nullptr), anim_tile(nullptr), actor(nullptr),
+		  color_from(0), color_to(0), inc_reverse(false), spd(0) {
+	add_anim(new TileFadeAnim(loc, from, to, speed));
 	num_anim_running = 1;
 }
 
 //Fade out actor.
-TileFadeEffect::TileFadeEffect(Actor *a, uint16 speed) {
-	inc_reverse = false;
-	anim = nullptr;
-	to_tile = nullptr;
-	anim_tile = nullptr;
-	actor = a;
-	color_from = color_to = 0;
-	spd = speed;
-	num_anim_running = 0;
+TileFadeEffect::TileFadeEffect(Actor *a, uint16 speed)
+		: anim(nullptr), to_tile(nullptr), anim_tile(nullptr), actor(a),
+		  color_from(0), color_to(0), inc_reverse(false), spd(speed),
+		  num_anim_running(0) {
 	add_actor_anim();
 	actor->hide();
 }
@@ -1338,12 +1328,13 @@ void TileFadeEffect::add_obj_anim(Obj *obj) {
 	add_tile_anim(loc, obj_manager->get_obj_tile(obj->obj_n, obj->frame_n));
 }
 
-void TileFadeEffect::add_fade_anim(MapCoord loc, Tile *tile) {
-	add_anim(new TileFadeAnim(&loc, tile, nullptr, spd));
+void TileFadeEffect::add_fade_anim(const MapCoord &loc, Tile *tile) {
+	add_anim(new TileFadeAnim(loc, tile, nullptr, spd));
 	num_anim_running++;
 }
 
-void TileFadeEffect::add_tile_anim(MapCoord loc, Tile *tile) {
+void TileFadeEffect::add_tile_anim(const MapCoord &loc_, Tile *tile) {
+	MapCoord loc = loc_;
 	TileManager *tile_manager = Game::get_game()->get_tile_manager();
 	uint16 tile_num = tile->tile_num;
 
@@ -1443,17 +1434,18 @@ void TileBlackFadeEffect::add_obj_anim(Obj *o) {
 	add_tile_anim(loc, from);
 }
 
-void TileBlackFadeEffect::add_tile_anim(MapCoord loc, Tile *tile) {
+void TileBlackFadeEffect::add_tile_anim(const MapCoord &loc_, Tile *tile) {
 	TileManager *tile_manager = Game::get_game()->get_tile_manager();
 	uint16 tile_num = tile->tile_num;
 
-	add_anim(new TileFadeAnim(&loc, tile, 0, color, reverse, fade_speed));
+	add_anim(new TileFadeAnim(loc_, tile, 0, color, reverse, fade_speed));
 	num_anim_running++;
 
+	MapCoord loc = loc_;
 	if (tile->dbl_width) {
 		tile_num--;
 		loc.x -= 1;
-		add_anim(new TileFadeAnim(&loc, tile_manager->get_tile(tile_num), 0, color, reverse, fade_speed));
+		add_anim(new TileFadeAnim(loc, tile_manager->get_tile(tile_num), 0, color, reverse, fade_speed));
 		num_anim_running++;
 		loc.x += 1;
 	}
@@ -1461,7 +1453,7 @@ void TileBlackFadeEffect::add_tile_anim(MapCoord loc, Tile *tile) {
 	if (tile->dbl_height) {
 		tile_num--;
 		loc.y -= 1;
-		add_anim(new TileFadeAnim(&loc, tile_manager->get_tile(tile_num), 0, color, reverse, fade_speed));
+		add_anim(new TileFadeAnim(loc, tile_manager->get_tile(tile_num), 0, color, reverse, fade_speed));
 		num_anim_running++;
 		loc.y += 1;
 	}
@@ -1470,7 +1462,7 @@ void TileBlackFadeEffect::add_tile_anim(MapCoord loc, Tile *tile) {
 		tile_num--;
 		loc.x -= 1;
 		loc.y -= 1;
-		add_anim(new TileFadeAnim(&loc, tile_manager->get_tile(tile_num), 0, color, reverse, fade_speed));
+		add_anim(new TileFadeAnim(loc, tile_manager->get_tile(tile_num), 0, color, reverse, fade_speed));
 		num_anim_running++;
 		loc.x += 1;
 		loc.y += 1;
@@ -1642,7 +1634,7 @@ uint16 PauseEffect::callback(uint16 msg, CallBack *caller, void *data) {
 	return 0;
 }
 
-WizardEyeEffect::WizardEyeEffect(MapCoord location, uint16 duration) {
+WizardEyeEffect::WizardEyeEffect(const MapCoord &location, uint16 duration) {
 	game->get_map_window()->wizard_eye_start(location, duration, this);
 }
 
@@ -1821,7 +1813,7 @@ uint16 WingStrikeEffect::callback(uint16 msg, CallBack *caller, void *data) {
 	return 0;
 }
 
-HailStormEffect::HailStormEffect(MapCoord target) {
+HailStormEffect::HailStormEffect(const MapCoord &target) {
 	add_anim(new HailstormAnim(target));
 }
 
diff --git a/engines/ultima/nuvie/core/effect.h b/engines/ultima/nuvie/core/effect.h
index c486de13500..1761ea567e4 100644
--- a/engines/ultima/nuvie/core/effect.h
+++ b/engines/ultima/nuvie/core/effect.h
@@ -163,7 +163,7 @@ class ExpEffect : public ProjectileEffect {
 protected:
 	void start_anim() override;
 public:
-	ExpEffect(uint16 tileNum, MapCoord location);
+	ExpEffect(uint16 tileNum, const MapCoord &location);
 
 };
 
@@ -227,7 +227,7 @@ public:
 class HitEffect : public Effect {
 public:
 	HitEffect(Actor *target, uint32 duration = 300);
-	HitEffect(MapCoord location);
+	HitEffect(const MapCoord &location);
 	uint16 callback(uint16 msg, CallBack *caller, void *data) override;
 };
 
@@ -237,7 +237,7 @@ class TextEffect : public Effect {
 
 public:
 	TextEffect(Std::string text);
-	TextEffect(Std::string text, MapCoord location);
+	TextEffect(Std::string text, const MapCoord &location);
 	uint16 callback(uint16 msg, CallBack *caller, void *data) override;
 };
 
@@ -502,7 +502,7 @@ class TileFadeEffect : public TimedEffect {
 
 	uint16 num_anim_running;
 public:
-	TileFadeEffect(MapCoord loc, Tile *from, Tile *to, FadeType type, uint16 speed);
+	TileFadeEffect(const MapCoord &loc, Tile *from, Tile *to, FadeType type, uint16 speed);
 	//TileFadeEffect(MapCoord loc, Tile *from, uint8 color_from, uint8 color_to, bool reverse, uint16 speed);
 	TileFadeEffect(Actor *a, uint16 speed);
 	~TileFadeEffect() override;
@@ -510,8 +510,8 @@ public:
 
 protected:
 	void add_actor_anim();
-	void add_fade_anim(MapCoord loc, Tile *tile);
-	void add_tile_anim(MapCoord loc, Tile *tile);
+	void add_fade_anim(const MapCoord &loc, Tile *tile);
+	void add_tile_anim(const MapCoord &loc, Tile *tile);
 	void add_obj_anim(Obj *obj);
 };
 
@@ -532,7 +532,7 @@ protected:
 	void init(uint8 fade_color, uint16 speed);
 	void add_actor_anim();
 	void add_obj_anim(Obj *o);
-	void add_tile_anim(MapCoord loc, Tile *tile);
+	void add_tile_anim(const MapCoord &loc, Tile *tile);
 };
 
 /* Briefly modify the mapwindow colors, disable map-blacking and player
@@ -622,7 +622,7 @@ public:
 	virtual void delete_self() {
 		Effect::delete_self();
 	}
-	WizardEyeEffect(MapCoord location, uint16 duration);
+	WizardEyeEffect(const MapCoord &location, uint16 duration);
 	~WizardEyeEffect() override { }
 };
 
@@ -682,7 +682,7 @@ class HailStormEffect : public Effect {
 protected:
 
 public:
-	HailStormEffect(MapCoord target);
+	HailStormEffect(const MapCoord &target);
 
 	uint16 callback(uint16 msg, CallBack *caller, void *data) override;
 };
diff --git a/engines/ultima/nuvie/core/egg_manager.cpp b/engines/ultima/nuvie/core/egg_manager.cpp
index 2128dd4bdbd..9cb25eb78d6 100644
--- a/engines/ultima/nuvie/core/egg_manager.cpp
+++ b/engines/ultima/nuvie/core/egg_manager.cpp
@@ -234,7 +234,7 @@ bool EggManager::spawn_egg(Obj *egg, uint8 hatch_probability) {
 	return false;
 }
 
-uint8 EggManager::get_worktype(Obj *embryo) {
+uint8 EggManager::get_worktype(const Obj *embryo) {
 	if (gametype == NUVIE_GAME_U6
 	        && (embryo->obj_n == OBJ_U6_WINGED_GARGOYLE || embryo->obj_n == OBJ_U6_GARGOYLE)
 	        && (Game::get_game()->get_party()->has_obj(OBJ_U6_AMULET_OF_SUBMISSION, 0, false)
diff --git a/engines/ultima/nuvie/core/egg_manager.h b/engines/ultima/nuvie/core/egg_manager.h
index bc1b5ebe3de..650bee8303b 100644
--- a/engines/ultima/nuvie/core/egg_manager.h
+++ b/engines/ultima/nuvie/core/egg_manager.h
@@ -82,7 +82,7 @@ public:
 
 protected:
 
-	uint8 get_worktype(Obj *embryo);
+	uint8 get_worktype(const Obj *embryo);
 	bool not_spawning_actors;
 };
 
diff --git a/engines/ultima/nuvie/core/events.cpp b/engines/ultima/nuvie/core/events.cpp
index 1bca41f955b..d52ca1f524c 100644
--- a/engines/ultima/nuvie/core/events.cpp
+++ b/engines/ultima/nuvie/core/events.cpp
@@ -68,7 +68,7 @@ EventInput_s::~EventInput_s() {
 	if (loc) delete loc;
 }
 
-void EventInput_s::set_loc(MapCoord c) {
+void EventInput_s::set_loc(const MapCoord &c) {
 	if ((type == EVENTINPUT_MAPCOORD || type == EVENTINPUT_MAPCOORD_DIR) && loc != 0) delete loc;
 	loc = new MapCoord(c);
 }
@@ -903,7 +903,7 @@ bool Events::get(sint16 rel_x, sint16 rel_y) {
 	return get(MapCoord((uint16)(x + rel_x), (uint16)(y + rel_y), level));
 }
 
-bool Events::get(MapCoord coord) {
+bool Events::get(const MapCoord &coord) {
 	Obj *obj = obj_manager->get_obj(coord.x, coord.y, coord.z, OBJ_SEARCH_TOP, OBJ_EXCLUDE_IGNORED);
 	bool got_object;
 	if (!game->is_new_style())
@@ -1018,7 +1018,7 @@ bool Events::use(sint16 rel_x, sint16 rel_y) {
 	return use(map_window->get_cursorCoord());
 }
 
-bool Events::use(MapCoord coord) {
+bool Events::use(const MapCoord &coord) {
 	if (game->user_paused())
 		return false;
 
@@ -1445,7 +1445,7 @@ bool Events::pushFrom(sint16 rel_x, sint16 rel_y) {
 }
 
 /* Select object to move. */
-bool Events::pushFrom(MapCoord target) {
+bool Events::pushFrom(const MapCoord &target) {
 	ActorManager *actor_manager = game->get_actor_manager();
 	Script *script = game->get_script();
 	MapCoord from = player->get_actor()->get_location();
diff --git a/engines/ultima/nuvie/core/events.h b/engines/ultima/nuvie/core/events.h
index a133415709a..9751894eec3 100644
--- a/engines/ultima/nuvie/core/events.h
+++ b/engines/ultima/nuvie/core/events.h
@@ -162,7 +162,7 @@ struct EventInput_s {
 	MapCoord *loc; // target location, or direction if relative ???
 	Std::string *str; // ???
 //    };
-	void set_loc(MapCoord c);
+	void set_loc(const MapCoord &c);
 	EventInput_s() : loc(0), str(0), obj(0), actor(0), get_direction(false), get_text(false),
 		target_init(0), select_from_inventory(false), select_range(0), key(Common::KEYCODE_INVALID),
 		action_key_type(ActionKeyType::CANCEL_ACTION_KEY), spell_num(0), type(0) {
@@ -265,7 +265,7 @@ public:
 	}
 	void set_mode(EventMode new_mode);
 
-	bool is_direction_selecting_targets() {
+	bool is_direction_selecting_targets() const {
 		return direction_selects_target;
 	}
 	void set_direction_selects_target(bool val) {
@@ -321,12 +321,12 @@ public:
 
 	bool use_start();
 	bool use(sint16 rel_x, sint16 rel_y);
-	bool use(MapCoord coord);
+	bool use(const MapCoord &coord);
 	bool use(Obj *obj);
 	bool use(Actor *actor, uint16 x, uint16 y);
 
 	bool get_start();
-	bool get(MapCoord coord);
+	bool get(const MapCoord &coord);
 	bool get(sint16 rel_x, sint16 rel_y);
 	bool perform_get(Obj *obj, Obj *container_obj = nullptr, Actor *actor = nullptr);
 
@@ -347,7 +347,7 @@ public:
 	bool push_start();
 	bool pushFrom(Obj *obj);
 	bool pushFrom(sint16 rel_x, sint16 rel_y);
-	bool pushFrom(MapCoord target);
+	bool pushFrom(const MapCoord &target);
 	bool pushTo(Obj *obj, Actor *actor);
 	bool pushTo(sint16 rel_x, sint16 rel_y, bool push_from = PUSH_FROM_PLAYER);
 
diff --git a/engines/ultima/nuvie/core/magic.cpp b/engines/ultima/nuvie/core/magic.cpp
index df1e17a5cf2..f027df09f73 100644
--- a/engines/ultima/nuvie/core/magic.cpp
+++ b/engines/ultima/nuvie/core/magic.cpp
@@ -337,7 +337,7 @@ void Magic::cast_spell_directly(uint8 spell_num) {
 		process_script_return(magic_script->start());
 }
 
-bool Magic::resume(MapCoord location) {
+bool Magic::resume(const MapCoord &location) {
 	if (magic_script) {
 		process_script_return(magic_script->resume_with_location(location));
 	}
diff --git a/engines/ultima/nuvie/core/magic.h b/engines/ultima/nuvie/core/magic.h
index 866fffeab8f..753bbb188ab 100644
--- a/engines/ultima/nuvie/core/magic.h
+++ b/engines/ultima/nuvie/core/magic.h
@@ -108,7 +108,7 @@ public:
 
 	uint16 callback(uint16 msg, CallBack *caller, void *data = nullptr) override;
 	bool process_script_return(uint8 ret);
-	bool resume(MapCoord location);
+	bool resume(const MapCoord &location);
 	bool resume(uint8 dir);
 	bool resume_with_spell_num(uint8 spell_num);
 	bool resume(Obj *obj);
diff --git a/engines/ultima/nuvie/core/map.cpp b/engines/ultima/nuvie/core/map.cpp
index d3bb671572b..fd91ce43a88 100644
--- a/engines/ultima/nuvie/core/map.cpp
+++ b/engines/ultima/nuvie/core/map.cpp
@@ -297,10 +297,10 @@ uint8 Map::get_impedance(uint16 x, uint16 y, uint8 level, bool ignore_objects) {
 	uint8 impedance = 0;
 
 	if (!ignore_objects) {
-		U6LList *obj_list = obj_manager->get_obj_list(x, y, level);
+		const U6LList *obj_list = obj_manager->get_obj_list(x, y, level);
 		if (obj_list) {
-			for (U6Link *link = obj_list->start(); link != nullptr; link = link->next) {
-				Obj *obj = (Obj *)link->data;
+			for (const U6Link *link = obj_list->start(); link != nullptr; link = link->next) {
+				const Obj *obj = (Obj *)link->data;
 				if (obj != nullptr) {
 					uint8 tile_flag = obj_manager->get_obj_tile(obj->obj_n, obj->frame_n)->flags1;
 					if ((tile_flag & TILEFLAG_BLOCKING) == 0) {
@@ -456,7 +456,7 @@ bool Map::loadMap(TileManager *tm, ObjManager *om) {
 	return true;
 }
 
-bool Map::has_roof(uint16 x, uint16 y, uint8 level) {
+bool Map::has_roof(uint16 x, uint16 y, uint8 level) const {
 	if (!roof_mode || level != 0)
 		return false;
 
diff --git a/engines/ultima/nuvie/core/map.h b/engines/ultima/nuvie/core/map.h
index 260079aeea1..4b89bb658c6 100644
--- a/engines/ultima/nuvie/core/map.h
+++ b/engines/ultima/nuvie/core/map.h
@@ -181,7 +181,7 @@ public:
 	bool is_passable(uint16 x, uint16 y, uint8 level, uint8 dir);
 	bool is_passable(uint16 x1, uint16 y1, uint16 x2, uint16 y2, uint8 level);
 	bool is_passable_from_dir(uint16 x, uint16 y, uint8 level, uint8 dir);
-	bool has_roof(uint16 x, uint16 y, uint8 level);
+	bool has_roof(uint16 x, uint16 y, uint8 level) const;
 	void set_roof_mode(bool roofs);
 
 	const char *look(uint16 x, uint16 y, uint8 level);
diff --git a/engines/ultima/nuvie/core/obj.cpp b/engines/ultima/nuvie/core/obj.cpp
index 4b3d2a3f9d8..d1bc071581d 100644
--- a/engines/ultima/nuvie/core/obj.cpp
+++ b/engines/ultima/nuvie/core/obj.cpp
@@ -328,7 +328,7 @@ uint32 Obj::container_count_objects() {
 	return count;
 }
 
-bool Obj::is_ok_to_take() {
+bool Obj::is_ok_to_take() const {
 	return ((status & OBJ_STATUS_OK_TO_TAKE) || Game::get_game()->using_hackmove());
 }
 
diff --git a/engines/ultima/nuvie/core/obj.h b/engines/ultima/nuvie/core/obj.h
index 5251cc03cd9..341f69f0720 100644
--- a/engines/ultima/nuvie/core/obj.h
+++ b/engines/ultima/nuvie/core/obj.h
@@ -110,7 +110,7 @@ public:
 		return (nuvie_status & NUVIE_OBJ_STATUS_ACTOR_OBJ);
 	}
 
-	bool is_ok_to_take();
+	bool is_ok_to_take() const;
 	bool is_invisible() const {
 		return (status & OBJ_STATUS_INVISIBLE);
 	}
diff --git a/engines/ultima/nuvie/core/obj_manager.cpp b/engines/ultima/nuvie/core/obj_manager.cpp
index 7a46dff5c78..4cc0e0387c1 100644
--- a/engines/ultima/nuvie/core/obj_manager.cpp
+++ b/engines/ultima/nuvie/core/obj_manager.cpp
@@ -634,7 +634,7 @@ bool ObjManager::is_damaging(uint16 x, uint16 y, uint8 level) {
 	return false;
 }
 
-bool ObjManager::is_stackable(Obj *obj) {
+bool ObjManager::is_stackable(const Obj *obj) {
 // Tile *tile;
 
 	if (obj == nullptr)
@@ -769,7 +769,7 @@ bool ObjManager::is_stackable(Obj *obj) {
 	return (bool)obj_stackable[obj->obj_n];
 }
 
-bool ObjManager::is_breakable(Obj *obj) {
+bool ObjManager::is_breakable(const Obj *obj) {
 	if (game_type == NUVIE_GAME_U6) {
 		switch (obj->obj_n) {
 		case OBJ_U6_FLASK_OF_OIL:
@@ -993,7 +993,7 @@ bool ObjManager::has_reduced_weight(uint16 obj_n) {
 	return false;
 }
 
-bool ObjManager::has_toptile(Obj *obj) {
+bool ObjManager::has_toptile(const Obj *obj) {
 	Tile *tile;
 	uint8 i = 1;
 
@@ -1077,7 +1077,7 @@ const Tile *ObjManager::get_obj_dmg_tile(uint16 x, uint16 y, uint8 level) {
 	return nullptr;
 }
 
-bool ObjManager::obj_is_damaging(Obj *obj, Actor *actor) {
+bool ObjManager::obj_is_damaging(const Obj *obj, Actor *actor) {
 	if (!obj)
 		return false;
 
@@ -1311,7 +1311,7 @@ bool ObjManager::remove_obj_type_from_location(uint16 obj_n, uint16 x, uint16 y,
 	return objects_deleted;
 }
 
-Obj *ObjManager::copy_obj(Obj *obj) {
+Obj *ObjManager::copy_obj(const Obj *obj) {
 	Obj *new_obj;
 
 	if (obj == nullptr)
@@ -1419,7 +1419,7 @@ uint16 ObjManager::get_obj_tile_num(uint16 obj_num) { //assume obj_num is < 1024
 	return obj_to_tile[obj_num];
 }
 
-inline bool ObjManager::is_corpse(Obj *obj) {
+inline bool ObjManager::is_corpse(const Obj *obj) {
 	if (game_type == NUVIE_GAME_U6) {
 		switch (obj->obj_n) {
 		case OBJ_U6_DEAD_BODY:
@@ -1450,7 +1450,7 @@ inline bool ObjManager::is_corpse(Obj *obj) {
 	return false;
 }
 
-uint16 ObjManager::get_obj_tile_num(Obj *obj) { //assume obj_num is < 1024 :)
+uint16 ObjManager::get_obj_tile_num(const Obj *obj) { //assume obj_num is < 1024 :)
 	if (custom_actor_tiles && is_corpse(obj)) {
 		return Game::get_game()->get_actor_manager()->get_actor(obj->quality)->get_custom_tile_num(obj->obj_n);
 	}
@@ -1864,7 +1864,7 @@ inline void ObjManager::print_egg_tree(iAVLTree *obj_tree) {
 	return;
 }
 
-void ObjManager::print_obj(Obj *obj, bool in_container, uint8 indent) {
+void ObjManager::print_obj(const Obj *obj, bool in_container, uint8 indent) {
 	U6Link *link;
 	Obj *container_obj;
 	const CombatType *c_type = nullptr;
diff --git a/engines/ultima/nuvie/core/obj_manager.h b/engines/ultima/nuvie/core/obj_manager.h
index 4ac9ae27ac0..914e19e1aa6 100644
--- a/engines/ultima/nuvie/core/obj_manager.h
+++ b/engines/ultima/nuvie/core/obj_manager.h
@@ -142,16 +142,16 @@ public:
 	bool is_damaging(uint16 x, uint16 y, uint8 level);
 	uint8 is_passable(uint16 x, uint16 y, uint8 level);
 	bool is_forced_passable(uint16 x, uint16 y, uint8 level);
-	bool is_stackable(Obj *obj);
-	bool is_breakable(Obj *obj);
+	bool is_stackable(const Obj *obj);
+	bool is_breakable(const Obj *obj);
 	bool can_store_obj(Obj *target, Obj *src); // Bag, open chest, spellbook.
 	bool can_get_obj(Obj *obj);
 	bool has_reduced_weight(uint16 obj_n);
-	bool has_reduced_weight(Obj *obj) {
+	bool has_reduced_weight(const Obj *obj) {
 		return has_reduced_weight(obj->obj_n);
 	}
-	bool has_toptile(Obj *obj);
-	bool obj_is_damaging(Obj *obj, Actor *actor = nullptr); // if actor, it will damage and display text
+	bool has_toptile(const Obj *obj);
+	bool obj_is_damaging(const Obj *obj, Actor *actor = nullptr); // if actor, it will damage and display text
 	bool is_door(uint16 x, uint16 y, uint8 level);
 
 	U6LList *get_obj_list(uint16 x, uint16 y, uint8 level);
@@ -168,8 +168,8 @@ public:
 	Obj *get_tile_obj(uint16 obj_n);
 
 	uint16 get_obj_tile_num(uint16 obj_num);
-	inline bool is_corpse(Obj *obj);
-	uint16 get_obj_tile_num(Obj *obj);
+	inline bool is_corpse(const Obj *obj);
+	uint16 get_obj_tile_num(const Obj *obj);
 	void set_obj_tile_num(uint16 obj_num, uint16 tile_num);
 
 	U6LList *get_actor_inventory(uint16 actor_num);
@@ -184,7 +184,7 @@ public:
 	bool remove_obj_type_from_location(uint16 obj_n, uint16 x, uint16 y, uint8 z);
 
 
-	Obj *copy_obj(Obj *obj);
+	Obj *copy_obj(const Obj *obj);
 	const char *look_obj(Obj *obj, bool show_prefix = false);
 	Obj *get_obj_from_stack(Obj *obj, uint32 count);
 
@@ -242,7 +242,7 @@ protected:
 public:
 	void print_object_list();
 	void print_egg_list();
-	void print_obj(Obj *obj, bool in_container, uint8 indent = 0);
+	void print_obj(const Obj *obj, bool in_container, uint8 indent = 0);
 };
 
 } // End of namespace Nuvie
diff --git a/engines/ultima/nuvie/core/tile_manager.h b/engines/ultima/nuvie/core/tile_manager.h
index 279dedd36b9..8f566c682ec 100644
--- a/engines/ultima/nuvie/core/tile_manager.h
+++ b/engines/ultima/nuvie/core/tile_manager.h
@@ -167,7 +167,7 @@ public:
 	Tile *get_anim_base_tile(uint16 tile_num);
 	Tile *get_original_tile(uint16 tile_num);
 	void set_tile_index(uint16 tile_index, uint16 tile_num);
-	uint16 get_tile_index(uint16 tile_index) {
+	uint16 get_tile_index(uint16 tile_index) const {
 		return tileindex[tile_index];
 	}
 	void set_anim_loop(uint16 tile_num, sint8 loopc, uint8 loop = 0);
@@ -177,13 +177,13 @@ public:
 	void update();
 	void update_timed_tiles(uint8 hour);
 
-	uint8 get_number_of_animations() {
+	uint8 get_number_of_animations() const {
 		return animdata.number_of_tiles_to_animate;
 	}
-	uint16 get_anim_tile(uint8 anim_index) {
+	uint16 get_anim_tile(uint8 anim_index) const {
 		return anim_index < animdata.number_of_tiles_to_animate ? animdata.tile_to_animate[anim_index] : 0;
 	}
-	uint16 get_anim_first_frame(uint8 anim_index) {
+	uint16 get_anim_first_frame(uint8 anim_index) const {
 		return anim_index < animdata.number_of_tiles_to_animate ? animdata.first_anim_frame[anim_index] : 0;
 	}
 	void set_anim_first_frame(uint16 anim_index, uint16 new_start_tile_num);
diff --git a/engines/ultima/nuvie/core/weather.cpp b/engines/ultima/nuvie/core/weather.cpp
index b2af1cc2f2a..26f81ac342d 100644
--- a/engines/ultima/nuvie/core/weather.cpp
+++ b/engines/ultima/nuvie/core/weather.cpp
@@ -186,10 +186,10 @@ bool Weather::is_moon_visible() const {
 
 string Weather::get_wind_dir_str() const {
 	if (display_from_wind_dir) {
-		const char from_names[9][3] = {"N", "E", "S", "W", "NE", "SE", "SW", "NW", "C"};
+		static const char from_names[9][3] = {"N", "E", "S", "W", "NE", "SE", "SW", "NW", "C"};
 		return from_names[wind_dir];
 	} else {
-		const char to_names[9][3] = {"S", "W", "N", "E", "SW", "NW", "NE", "SE", "C"};
+		static const char to_names[9][3] = {"S", "W", "N", "E", "SW", "NW", "NE", "SE", "C"};
 		return to_names[wind_dir];
 	}
 }
diff --git a/engines/ultima/nuvie/files/u6_lib_n.cpp b/engines/ultima/nuvie/files/u6_lib_n.cpp
index 2e4a3e6a311..fad8335b7dd 100644
--- a/engines/ultima/nuvie/files/u6_lib_n.cpp
+++ b/engines/ultima/nuvie/files/u6_lib_n.cpp
@@ -38,7 +38,7 @@ U6Lib_n::~U6Lib_n(void) {
 }
 
 // load u6lib from `filename'
-bool U6Lib_n::open(Std::string &filename, uint8 size, uint8 type) {
+bool U6Lib_n::open(const Std::string &filename, uint8 size, uint8 type) {
 	NuvieIOFileRead *file;
 
 	file = new NuvieIOFileRead();
@@ -89,7 +89,7 @@ void U6Lib_n::close() {
 
 /* Open a ^new^ file for writing, with lib_size and type.
  */
-bool U6Lib_n::create(Std::string &filename, uint8 size, uint8 type) {
+bool U6Lib_n::create(const Std::string &filename, uint8 size, uint8 type) {
 	NuvieIOFileWrite *file = new NuvieIOFileWrite();
 	if (!file->open(filename)) {
 		DEBUG(0, LEVEL_ERROR, "U6Lib: Error creating %s\n", filename.c_str());
diff --git a/engines/ultima/nuvie/files/u6_lib_n.h b/engines/ultima/nuvie/files/u6_lib_n.h
index 1378ebc448f..217d19f6f2a 100644
--- a/engines/ultima/nuvie/files/u6_lib_n.h
+++ b/engines/ultima/nuvie/files/u6_lib_n.h
@@ -56,10 +56,10 @@ public:
 	U6Lib_n();
 	~U6Lib_n();
 
-	bool open(Std::string &filename, uint8 size, uint8 type = NUVIE_GAME_U6);
+	bool open(const Std::string &filename, uint8 size, uint8 type = NUVIE_GAME_U6);
 	bool open(NuvieIO *new_data, uint8 size, uint8 type = NUVIE_GAME_U6);
 	void close();
-	bool create(Std::string &filename, uint8 size, uint8 type = NUVIE_GAME_U6);
+	bool create(const Std::string &filename, uint8 size, uint8 type = NUVIE_GAME_U6);
 	uint8 get_game_type() {
 		return game_type;
 	}
diff --git a/engines/ultima/nuvie/gui/gui_console.cpp b/engines/ultima/nuvie/gui/gui_console.cpp
index e330a512211..e44ed77738a 100644
--- a/engines/ultima/nuvie/gui/gui_console.cpp
+++ b/engines/ultima/nuvie/gui/gui_console.cpp
@@ -67,7 +67,7 @@ void GUI_Console:: Display(bool full_redraw) {
 	return;
 }
 
-void GUI_Console::AddLine(Std::string line) {
+void GUI_Console::AddLine(const Std::string &line) {
 	uint16 len = line.length();
 	uint16 i;
 
diff --git a/engines/ultima/nuvie/gui/gui_console.h b/engines/ultima/nuvie/gui/gui_console.h
index 497a99b7e6c..8ba9d5afedc 100644
--- a/engines/ultima/nuvie/gui/gui_console.h
+++ b/engines/ultima/nuvie/gui/gui_console.h
@@ -55,7 +55,7 @@ public:
 	GUI_status MouseUp(int x, int y, Shared::MouseButton button) override;
 	GUI_status MouseMotion(int x, int y, uint8 state) override;
 
-	virtual void AddLine(Std::string line);
+	virtual void AddLine(const Std::string &line);
 
 protected:
 
diff --git a/engines/ultima/nuvie/gui/widgets/console.cpp b/engines/ultima/nuvie/gui/widgets/console.cpp
index 6a5b09eff94..7bb4952d4a8 100644
--- a/engines/ultima/nuvie/gui/widgets/console.cpp
+++ b/engines/ultima/nuvie/gui/widgets/console.cpp
@@ -49,7 +49,7 @@ Console::~Console() {
 
 }
 
-void Console::AddLine(Std::string line) {
+void Console::AddLine(const Std::string &line) {
 	GUI_Console::AddLine(line);
 
 	if (status == WIDGET_VISIBLE) {
@@ -88,7 +88,7 @@ void ConsoleAddInfo(const char *format, ...) {
 	}
 }
 
-void ConsoleAddError(Std::string s) {
+void ConsoleAddError(const Std::string &s) {
 	if (g_console != nullptr) {
 		DEBUG(0, LEVEL_ERROR, "%s\n", s.c_str());
 		g_console->Show();
@@ -96,7 +96,7 @@ void ConsoleAddError(Std::string s) {
 	}
 }
 
-void ConsoleAddWarning(Std::string s) {
+void ConsoleAddWarning(const Std::string &s) {
 	if (g_console != nullptr) {
 		DEBUG(0, LEVEL_WARNING, "%s\n", s.c_str());
 		g_console->AddLine("Warning: " + s);
diff --git a/engines/ultima/nuvie/gui/widgets/console.h b/engines/ultima/nuvie/gui/widgets/console.h
index c053725d8be..49ed919a9c1 100644
--- a/engines/ultima/nuvie/gui/widgets/console.h
+++ b/engines/ultima/nuvie/gui/widgets/console.h
@@ -42,7 +42,7 @@ public:
 	Console(Configuration *c, Screen *s, GUI *g, uint16 x, uint16 y, uint16 w, uint16 h);
 	~Console() override;
 
-	void AddLine(Std::string line) override;
+	void AddLine(const Std::string &line) override;
 
 protected:
 
@@ -51,8 +51,8 @@ protected:
 void ConsoleInit(Configuration *c, Screen *s, GUI *gui, uint16 w, uint16 h);
 void ConsoleDelete();
 void ConsoleAddInfo(const char *s, ...);
-void ConsoleAddError(Std::string s);
-void ConsoleAddWarning(Std::string s);
+void ConsoleAddError(const Std::string &s);
+void ConsoleAddWarning(const Std::string &s);
 void ConsolePause();
 void ConsoleShow();
 void ConsoleHide();
diff --git a/engines/ultima/nuvie/gui/widgets/map_window.cpp b/engines/ultima/nuvie/gui/widgets/map_window.cpp
index 0836cbce51f..868e36beb89 100644
--- a/engines/ultima/nuvie/gui/widgets/map_window.cpp
+++ b/engines/ultima/nuvie/gui/widgets/map_window.cpp
@@ -559,11 +559,11 @@ MapCoord MapWindow::get_cursorCoord() {
 	return (MapCoord(WRAPPED_COORD(cur_x + cursor_x, cur_level), cur_y + cursor_y, cur_level));
 }
 
-void MapWindow::get_level(uint8 *level) {
+void MapWindow::get_level(uint8 *level) const {
 	*level = cur_level;
 }
 
-void MapWindow::get_pos(uint16 *x, uint16 *y, uint8 *px, uint8 *py) {
+void MapWindow::get_pos(uint16 *x, uint16 *y, uint8 *px, uint8 *py) const {
 	*x = cur_x;
 	*y = cur_y;
 	if (px)
@@ -572,14 +572,14 @@ void MapWindow::get_pos(uint16 *x, uint16 *y, uint8 *px, uint8 *py) {
 		*py = cur_y_add;
 }
 
-void MapWindow::get_windowSize(uint16 *width, uint16 *height) {
+void MapWindow::get_windowSize(uint16 *width, uint16 *height) const {
 	*width = win_width;
 	*height = win_height;
 }
 
 /* Returns true if the location at the coordinates is visible on the map window.
  */
-bool MapWindow::in_window(uint16 x, uint16 y, uint8 z) {
+bool MapWindow::in_window(uint16 x, uint16 y, uint8 z) const {
 	return ((z == cur_level && WRAP_VIEWP(cur_x, x, map_width) < win_width
 	         && y >= cur_y && y <= (cur_y + win_height)));
 }
@@ -2557,10 +2557,10 @@ void MapWindow::set_overlay(Graphics::ManagedSurface *surfpt) {
 }
 
 /* Returns true if town tiles are within 5 tiles of the player */
-bool MapWindow::in_town() {
-	MapCoord player_loc = actor_manager->get_player()->get_location();
+bool MapWindow::in_town() const {
+	const MapCoord player_loc = actor_manager->get_player()->get_location();
 
-	for (Std::vector<TileInfo>::iterator ti = m_ViewableMapTiles.begin();
+	for (Std::vector<TileInfo>::const_iterator ti = m_ViewableMapTiles.begin();
 	        ti != m_ViewableMapTiles.end(); ti++)
 		if (MapCoord((*ti).x + cur_x, (*ti).y + cur_y, cur_level).distance(player_loc) <= 5 && // make sure tile is close enough
 		        ((*ti).t->flags1 & TILEFLAG_WALL) && ((*ti).t->flags1 & TILEFLAG_WALL_MASK)) { //only wall tiles with wall direction bits set.
@@ -2569,7 +2569,7 @@ bool MapWindow::in_town() {
 	return false;
 }
 
-void MapWindow::wizard_eye_start(MapCoord location, uint16 duration, CallBack *caller) {
+void MapWindow::wizard_eye_start(const MapCoord &location, uint16 duration, CallBack *caller) {
 	wizard_eye_info.moves_left = duration;
 	wizard_eye_info.caller = caller;
 
@@ -2619,14 +2619,14 @@ void MapWindow::set_roof_mode(bool roofs) {
 }
 
 void MapWindow::loadRoofTiles() {
-	Std::string imagefile = map->getRoofTilesetFilename();
+	const Std::string imagefile = map->getRoofTilesetFilename();
 	roof_tiles = SDL_LoadBMP(imagefile.c_str());
 	if (roof_tiles) {
 		SDL_SetColorKey(roof_tiles, SDL_TRUE, SDL_MapRGB(roof_tiles->format, 0, 0x70, 0xfc));
 	}
 }
 
-bool MapWindow::in_dungeon_level() {
+bool MapWindow::in_dungeon_level() const {
 	if (game_type == NUVIE_GAME_MD) {
 		return (cur_level == 1 || cur_level > 3); //FIXME this should probably be moved into script.
 	}
diff --git a/engines/ultima/nuvie/gui/widgets/map_window.h b/engines/ultima/nuvie/gui/widgets/map_window.h
index abd512fa2e1..8715f677a85 100644
--- a/engines/ultima/nuvie/gui/widgets/map_window.h
+++ b/engines/ultima/nuvie/gui/widgets/map_window.h
@@ -264,22 +264,22 @@ public:
 	AnimManager *get_anim_manager() {
 		return anim_manager;
 	}
-	Common::Rect *get_clip_rect()       {
+	const Common::Rect *get_clip_rect() const {
 		return &clip_rect;
 	}
 	Graphics::ManagedSurface *get_overlay();
 
-	void get_level(uint8 *level);
-	void get_pos(uint16 *x, uint16 *y, uint8 *px = nullptr, uint8 *py = nullptr);
-	void get_velocity(sint16 *vx, sint16 *vy) {
+	void get_level(uint8 *level) const;
+	void get_pos(uint16 *x, uint16 *y, uint8 *px = nullptr, uint8 *py = nullptr) const;
+	void get_velocity(sint16 *vx, sint16 *vy) const {
 		*vx = vel_x;
 		*vy = vel_y;
 	}
-	void get_windowSize(uint16 *width, uint16 *height);
+	void get_windowSize(uint16 *width, uint16 *height) const;
 
-	bool in_window(uint16 x, uint16 y, uint8 z);
-	bool in_dungeon_level();
-	bool in_town();
+	bool in_window(uint16 x, uint16 y, uint8 z) const;
+	bool in_dungeon_level() const;
+	bool in_town() const;
 // can put object at world location x,y?
 	CanDropOrMoveMsg can_drop_or_move_obj(uint16 x, uint16 y, Actor *actor, Obj *obj);
 	void display_can_drop_or_move_msg(CanDropOrMoveMsg msg, Std::string msg_text = "");
@@ -329,7 +329,7 @@ public:
 
 	Std::vector<Obj *> m_ViewableObjects; //^^ dodgy public buffer
 
-	void wizard_eye_start(MapCoord location, uint16 duration, CallBack *caller);
+	void wizard_eye_start(const MapCoord &location, uint16 duration, CallBack *caller);
 
 	bool using_map_tile_lighting;
 
diff --git a/engines/ultima/nuvie/misc/u6_misc.cpp b/engines/ultima/nuvie/misc/u6_misc.cpp
index 87e458e9741..07b8a7517ec 100644
--- a/engines/ultima/nuvie/misc/u6_misc.cpp
+++ b/engines/ultima/nuvie/misc/u6_misc.cpp
@@ -76,7 +76,7 @@ const char *get_game_tag(int game_type) {
 	return "";
 }
 
-void config_get_path(Configuration *config, Std::string filename, Std::string &path) {
+void config_get_path(Configuration *config, const Std::string &filename, Std::string &path) {
 	Std::string key, game_name, game_dir, tmp_path;
 
 	config->value("config/GameName", game_name);
@@ -92,7 +92,7 @@ void config_get_path(Configuration *config, Std::string filename, Std::string &p
 	path = tmp_path;
 }
 
-bool find_casesensitive_path(Std::string path, Std::string filename, Std::string &new_path) {
+bool find_casesensitive_path(const Std::string &path, const Std::string &filename, Std::string &new_path) {
 	vector<string> directories;
 	string tmp_path = path;
 
@@ -122,7 +122,7 @@ bool find_casesensitive_path(Std::string path, Std::string filename, Std::string
 	return true;
 }
 
-bool find_path(Std::string path, Std::string &dir_str) {
+static bool find_path(const Std::string &path, Std::string &dir_str) {
 	dir_str = path;
 	return true;
 #if 0
@@ -302,7 +302,7 @@ void print_flags(DebugLevelType level, uint8 num, const char *f[8]) {
 /* Where rect1 and rect2 merge, subtract and copy that rect to sub_rect.
  * Returns false if the rectangles don't intersect.
  */
-bool subtract_rect(Common::Rect *rect1, Common::Rect *rect2, Common::Rect *sub_rect) {
+bool subtract_rect(const Common::Rect *rect1, const Common::Rect *rect2, Common::Rect *sub_rect) {
 	uint16 rect1_x2 = rect1->right, rect1_y2 = rect1->bottom;
 	uint16 rect2_x2 = rect2->right, rect2_y2 = rect2->bottom;
 	uint16 x1, x2, y1, y2;
@@ -674,10 +674,10 @@ void *nuvie_realloc(void *ptr, size_t size) {
 }
 
 
-uint32 sdl_getpixel(Graphics::ManagedSurface *surface, int x, int y) {
+uint32 sdl_getpixel(const Graphics::ManagedSurface *surface, int x, int y) {
 	int bpp = surface->format.bytesPerPixel;
 	/* Here p is the address to the pixel we want to retrieve */
-	byte *p = (byte *)surface->getBasePtr(x, y);
+	const byte *p = (const byte *)surface->getBasePtr(x, y);
 
 	switch (bpp) {
 	case 1:
@@ -685,7 +685,7 @@ uint32 sdl_getpixel(Graphics::ManagedSurface *surface, int x, int y) {
 		break;
 
 	case 2:
-		return *(uint16 *)p;
+		return *(const uint16 *)p;
 		break;
 
 	case 3:
@@ -693,7 +693,7 @@ uint32 sdl_getpixel(Graphics::ManagedSurface *surface, int x, int y) {
 		break;
 
 	case 4:
-		return *(uint32 *)p;
+		return *(const uint32 *)p;
 		break;
 
 	default:
@@ -702,7 +702,7 @@ uint32 sdl_getpixel(Graphics::ManagedSurface *surface, int x, int y) {
 }
 
 
-void scaleLine8Bit(unsigned char *Target, unsigned char *Source, int SrcWidth, int TgtWidth) {
+static void scaleLine8Bit(unsigned char *Target, const unsigned char *Source, int SrcWidth, int TgtWidth) {
 	int NumPixels = TgtWidth;
 	int IntPart = SrcWidth / TgtWidth;
 	int FractPart = SrcWidth % TgtWidth;
@@ -720,13 +720,13 @@ void scaleLine8Bit(unsigned char *Target, unsigned char *Source, int SrcWidth, i
 }
 
 // Coarse 2D scaling from https://web.archive.org/web/20111011173251/http://www.compuphase.com/graphic/scale.htm
-void scale_rect_8bit(unsigned char *Source, unsigned char *Target, int SrcWidth, int SrcHeight,
+void scale_rect_8bit(const unsigned char *Source, unsigned char *Target, int SrcWidth, int SrcHeight,
 					 int TgtWidth, int TgtHeight) {
 	int NumPixels = TgtHeight;
 	int IntPart = (SrcHeight / TgtHeight) * SrcWidth;
 	int FractPart = SrcHeight % TgtHeight;
 	int E = 0;
-	unsigned char *PrevSource = nullptr;
+	const unsigned char *PrevSource = nullptr;
 
 	while (NumPixels-- > 0) {
 		if (Source == PrevSource) {
diff --git a/engines/ultima/nuvie/misc/u6_misc.h b/engines/ultima/nuvie/misc/u6_misc.h
index f2270ad3c72..0fa2e31deb6 100644
--- a/engines/ultima/nuvie/misc/u6_misc.h
+++ b/engines/ultima/nuvie/misc/u6_misc.h
@@ -48,7 +48,7 @@ typedef enum {
 
 Std::string config_get_game_key(Configuration *config);
 const char *get_game_tag(int game_type);
-void config_get_path(Configuration *config, Std::string filename, Std::string &path);
+void config_get_path(Configuration *config, const Std::string &filename, Std::string &path);
 uint8 get_game_type(const char *string);
 nuvie_game_t get_game_type(Configuration *config);
 void build_path(Std::string path, Std::string filename, Std::string &full_path);
@@ -59,7 +59,7 @@ void print_b16(DebugLevelType level, uint16 num);
 void print_indent(DebugLevelType level, uint8 indent);
 void print_bool(DebugLevelType level, bool state, const char *yes = "true", const char *no = "false");
 void print_flags(DebugLevelType level, uint8 num, const char *f[8]);
-bool subtract_rect(Common::Rect *rect1, Common::Rect *rect2, Common::Rect *sub_rect);
+bool subtract_rect(const Common::Rect *rect1, const Common::Rect *rect2, Common::Rect *sub_rect);
 uint8 get_nuvie_dir_code(uint8 original_dir_code);
 sint8 get_original_dir_code(uint8 nuvie_dir_code);
 uint8 get_direction_code(sint16 rel_x, sint16 rel_y);
@@ -78,7 +78,7 @@ inline bool point_in_rect(uint16 x, uint16 y, Common::Rect *rect) {
 
 /* Does line xy->x2y2 cross rect, to any extent?
  */
-inline bool line_in_rect(uint16 x1, uint16 y1, uint16 x2, uint16 y2, Common::Rect *rect) {
+inline bool line_in_rect(uint16 x1, uint16 y1, uint16 x2, uint16 y2, const Common::Rect *rect) {
 	uint16 rx2 = rect->right, ry2 = rect->bottom;
 	return (((y1 >= rect->top && y1 <= ry2 && x1 <= rx2 && x2 >= rect->left)
 	         || (x1 >= rect->left && x1 <= rx2 && y1 <= ry2 && y2 >= rect->top)));
@@ -105,9 +105,9 @@ bool string_i_compare(const Std::string &s1, const Std::string &s2);
 
 void *nuvie_realloc(void *ptr, size_t size);
 
-uint32 sdl_getpixel(Graphics::ManagedSurface *surface, int x, int y);
+uint32 sdl_getpixel(const Graphics::ManagedSurface *surface, int x, int y);
 
-void scale_rect_8bit(unsigned char *Source, unsigned char *Target, int SrcWidth, int SrcHeight, int TgtWidth, int TgtHeight);
+void scale_rect_8bit(const unsigned char *Source, unsigned char *Target, int SrcWidth, int SrcHeight, int TgtWidth, int TgtHeight);
 
 bool has_file_extension(const char *filename, const char *extension);
 
diff --git a/engines/ultima/nuvie/pathfinder/party_path_finder.cpp b/engines/ultima/nuvie/pathfinder/party_path_finder.cpp
index cd48e70e0d5..5a2cf579175 100644
--- a/engines/ultima/nuvie/pathfinder/party_path_finder.cpp
+++ b/engines/ultima/nuvie/pathfinder/party_path_finder.cpp
@@ -334,7 +334,7 @@ bool PartyPathFinder::try_all_directions(uint32 p, MapCoord target_loc) {
  * distance to 'target'. (near to far)
  */
 vector<MapCoord>
-PartyPathFinder::get_neighbor_tiles(MapCoord &center, MapCoord &target) {
+PartyPathFinder::get_neighbor_tiles(const MapCoord &center, const MapCoord &target) {
 	sint8 rel_x = get_wrapped_rel_dir(target.x, center.x, target.z);
 	sint8 rel_y = get_wrapped_rel_dir(target.y, center.y, target.z);
 	vector<MapCoord> neighbors;
diff --git a/engines/ultima/nuvie/pathfinder/party_path_finder.h b/engines/ultima/nuvie/pathfinder/party_path_finder.h
index 937ea053443..a6094397da8 100644
--- a/engines/ultima/nuvie/pathfinder/party_path_finder.h
+++ b/engines/ultima/nuvie/pathfinder/party_path_finder.h
@@ -84,7 +84,7 @@ protected:
 	bool leader_moved_diagonally();
 	bool leader_moved();
 
-	Std::vector<MapCoord> get_neighbor_tiles(MapCoord &center, MapCoord &target);
+	Std::vector<MapCoord> get_neighbor_tiles(const MapCoord &center, const MapCoord &target);
 
 	// use party
 	struct PartyMember get_member(uint32 p) {
diff --git a/engines/ultima/nuvie/screen/screen.cpp b/engines/ultima/nuvie/screen/screen.cpp
index 0ba880617e7..5fd087cea5f 100644
--- a/engines/ultima/nuvie/screen/screen.cpp
+++ b/engines/ultima/nuvie/screen/screen.cpp
@@ -429,7 +429,7 @@ Graphics::ManagedSurface *Screen::get_sdl_surface() {
 
 bool Screen::blit(int32 dest_x, int32 dest_y, const byte *src_buf, uint16 src_bpp,
 		uint16 src_w, uint16 src_h, uint16 src_pitch, bool trans,
-		Common::Rect *clip_rect, uint8 opacity) {
+		const Common::Rect *clip_rect, uint8 opacity) {
 	uint16 src_x = 0;
 	uint16 src_y = 0;
 
diff --git a/engines/ultima/nuvie/screen/screen.h b/engines/ultima/nuvie/screen/screen.h
index f4b174b16b3..f0983133243 100644
--- a/engines/ultima/nuvie/screen/screen.h
+++ b/engines/ultima/nuvie/screen/screen.h
@@ -110,7 +110,7 @@ public:
 	void stipple_8bit(uint8 color_num, uint16 x, uint16 y, uint16 w, uint16 h);
 	void put_pixel(uint8 colour_num, uint16 x, uint16 y);
 
-	bool blit(int32 dest_x, int32 dest_y, const byte *src_buf, uint16 src_bpp, uint16 src_w, uint16 src_h, uint16 src_pitch, bool trans = false, Common::Rect *clip_rect = nullptr, uint8 opacity = 255);
+	bool blit(int32 dest_x, int32 dest_y, const byte *src_buf, uint16 src_bpp, uint16 src_w, uint16 src_h, uint16 src_pitch, bool trans = false, const Common::Rect *clip_rect = nullptr, uint8 opacity = 255);
 	void blitbitmap(uint16 dest_x, uint16 dest_y, const byte *src_buf, uint16 src_w, uint16 src_h, uint8 fg_color, uint8 bg_color);
 
 	void buildalphamap8();
diff --git a/engines/ultima/nuvie/script/script.cpp b/engines/ultima/nuvie/script/script.cpp
index a9f0532bead..e10e0e07b41 100644
--- a/engines/ultima/nuvie/script/script.cpp
+++ b/engines/ultima/nuvie/script/script.cpp
@@ -417,7 +417,7 @@ static bool get_tbl_field_string(lua_State *L, const char *index, char *field, u
 	return true;
 }
 
-uint8 ScriptThread::resume_with_location(MapCoord loc) {
+uint8 ScriptThread::resume_with_location(const MapCoord &loc) {
 	lua_newtable(L);
 	lua_pushstring(L, "x");
 	lua_pushinteger(L, loc.x);
diff --git a/engines/ultima/nuvie/script/script.h b/engines/ultima/nuvie/script/script.h
index 2ab303fcdc5..c49192081b1 100644
--- a/engines/ultima/nuvie/script/script.h
+++ b/engines/ultima/nuvie/script/script.h
@@ -77,7 +77,7 @@ public:
 	uint8 start() {
 		return resume(start_nargs);
 	}
-	uint8 resume_with_location(MapCoord loc);
+	uint8 resume_with_location(const MapCoord &loc);
 	uint8 resume_with_direction(uint8 dir);
 	uint8 resume_with_spell_num(uint8 spell_num);
 	uint8 resume_with_obj(Obj *obj);


Commit: 4f3cb346d30c623dce4101e482977608dd22d688
    https://github.com/scummvm/scummvm/commit/4f3cb346d30c623dce4101e482977608dd22d688
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2023-12-09T13:56:06+11:00

Commit Message:
ULTIMA: NUVIE: Use initializer list in more constructors

Round 3, almost finished.

Changed paths:
    engines/ultima/nuvie/core/egg_manager.cpp
    engines/ultima/nuvie/core/game.cpp
    engines/ultima/nuvie/core/game.h
    engines/ultima/nuvie/core/game_clock.cpp
    engines/ultima/nuvie/core/look.cpp
    engines/ultima/nuvie/core/magic.cpp
    engines/ultima/nuvie/core/map.cpp
    engines/ultima/nuvie/core/map.h
    engines/ultima/nuvie/core/obj.cpp
    engines/ultima/nuvie/core/obj_manager.cpp
    engines/ultima/nuvie/core/player.cpp
    engines/ultima/nuvie/core/player.h
    engines/ultima/nuvie/core/tile_manager.cpp
    engines/ultima/nuvie/core/tile_manager.h
    engines/ultima/nuvie/core/timed_event.cpp
    engines/ultima/nuvie/core/weather.cpp
    engines/ultima/nuvie/core/weather.h
    engines/ultima/nuvie/files/nuvie_bmp_file.cpp
    engines/ultima/nuvie/files/nuvie_io.cpp
    engines/ultima/nuvie/files/tmx_map.cpp
    engines/ultima/nuvie/files/u6_bmp.cpp
    engines/ultima/nuvie/files/u6_lzw.cpp
    engines/ultima/nuvie/files/u6_shape.cpp
    engines/ultima/nuvie/fonts/bmp_font.cpp
    engines/ultima/nuvie/fonts/conv_font.cpp
    engines/ultima/nuvie/fonts/font.cpp
    engines/ultima/nuvie/fonts/font_manager.cpp
    engines/ultima/nuvie/fonts/u6_font.cpp
    engines/ultima/nuvie/fonts/wou_font.cpp
    engines/ultima/nuvie/gui/gui.cpp
    engines/ultima/nuvie/gui/gui_button.cpp
    engines/ultima/nuvie/gui/gui_button.h
    engines/ultima/nuvie/gui/gui_dialog.cpp
    engines/ultima/nuvie/gui/gui_drag_manager.cpp
    engines/ultima/nuvie/gui/gui_font.cpp
    engines/ultima/nuvie/gui/gui_scroller.cpp
    engines/ultima/nuvie/gui/gui_text.cpp
    engines/ultima/nuvie/gui/gui_text_toggle_button.cpp
    engines/ultima/nuvie/gui/gui_yes_no_dialog.cpp
    engines/ultima/nuvie/gui/widgets/console.cpp
    engines/ultima/nuvie/gui/widgets/map_window.cpp
    engines/ultima/nuvie/gui/widgets/msg_scroll.cpp
    engines/ultima/nuvie/gui/widgets/msg_scroll.h
    engines/ultima/nuvie/menus/audio_dialog.cpp
    engines/ultima/nuvie/menus/cheats_dialog.cpp
    engines/ultima/nuvie/menus/game_menu_dialog.cpp
    engines/ultima/nuvie/menus/gameplay_dialog.cpp
    engines/ultima/nuvie/menus/input_dialog.cpp
    engines/ultima/nuvie/menus/video_dialog.cpp
    engines/ultima/nuvie/misc/u6_line_walker.cpp
    engines/ultima/nuvie/misc/u6_list.cpp
    engines/ultima/nuvie/misc/u6_misc.cpp
    engines/ultima/nuvie/misc/u6_misc.h
    engines/ultima/nuvie/pathfinder/astar_path.cpp
    engines/ultima/nuvie/pathfinder/combat_path_finder.cpp
    engines/ultima/nuvie/pathfinder/party_path_finder.cpp
    engines/ultima/nuvie/portraits/portrait.cpp
    engines/ultima/nuvie/save/save_game.cpp
    engines/ultima/nuvie/screen/dither.cpp
    engines/ultima/nuvie/screen/game_palette.cpp
    engines/ultima/nuvie/script/script.cpp
    engines/ultima/nuvie/usecode/usecode.cpp
    engines/ultima/nuvie/views/actor_view.cpp
    engines/ultima/nuvie/views/container_view_gump.cpp
    engines/ultima/nuvie/views/doll_view_gump.cpp
    engines/ultima/nuvie/views/inventory_view.cpp
    engines/ultima/nuvie/views/md_sky_strip_widget.cpp
    engines/ultima/nuvie/views/md_sky_strip_widget.h
    engines/ultima/nuvie/views/party_view.cpp
    engines/ultima/nuvie/views/portrait_view_gump.cpp
    engines/ultima/nuvie/views/scroll_view_gump.cpp
    engines/ultima/nuvie/views/sign_view_gump.cpp
    engines/ultima/nuvie/views/spell_view.cpp
    engines/ultima/nuvie/views/spell_view_gump.cpp
    engines/ultima/nuvie/views/sun_moon_ribbon.cpp
    engines/ultima/nuvie/views/sun_moon_strip_widget.cpp
    engines/ultima/nuvie/views/view.cpp
    engines/ultima/nuvie/views/view_manager.cpp


diff --git a/engines/ultima/nuvie/core/egg_manager.cpp b/engines/ultima/nuvie/core/egg_manager.cpp
index 9cb25eb78d6..1f8cd48dfd1 100644
--- a/engines/ultima/nuvie/core/egg_manager.cpp
+++ b/engines/ultima/nuvie/core/egg_manager.cpp
@@ -48,13 +48,9 @@ typedef enum {
 	: (EQ < 30) ? EGG_HATCH_NIGHT : EGG_HATCH_ALWAYS;
 
 
-EggManager::EggManager(Configuration *cfg, nuvie_game_t type, Map *m) {
-	config = cfg;
-	gametype = type;
-	map = m;
-	actor_manager = nullptr;
-	obj_manager = nullptr;
-	not_spawning_actors = false;
+EggManager::EggManager(Configuration *cfg, nuvie_game_t type, Map *m)
+		: config(cfg), gametype(type), map(m), actor_manager(nullptr),
+		  obj_manager(nullptr), not_spawning_actors(false) {
 }
 
 EggManager::~EggManager() {
diff --git a/engines/ultima/nuvie/core/game.cpp b/engines/ultima/nuvie/core/game.cpp
index d541ea7c5ce..044c6540d4b 100644
--- a/engines/ultima/nuvie/core/game.cpp
+++ b/engines/ultima/nuvie/core/game.cpp
@@ -72,59 +72,25 @@ namespace Nuvie {
 
 Game *Game::game = nullptr;
 
-Game::Game(Configuration *cfg, Events *evt, Screen *scr, GUI *g, nuvie_game_t type, SoundManager *sm) {
+Game::Game(Configuration *cfg, Events *evt, Screen *scr, GUI *g, nuvie_game_t type, SoundManager *sm)
+		: config(cfg), event(evt), gui(g), screen(scr), game_type(type),
+		  sound_manager(sm), script(nullptr), background(nullptr),
+		  cursor(nullptr), dither(nullptr), tile_manager(nullptr),
+		  obj_manager(nullptr), palette(nullptr), font_manager(nullptr),
+		  scroll(nullptr), game_map(nullptr), map_window(nullptr),
+		  actor_manager(nullptr), player(nullptr), converse(nullptr),
+		  conv_gump(nullptr), command_bar(nullptr), new_command_bar(nullptr),
+		  _clock(nullptr), party(nullptr), portrait(nullptr),
+		  view_manager(nullptr), egg_manager(nullptr), usecode(nullptr),
+		  effect_manager(nullptr), weather(nullptr), magic(nullptr),
+		  book(nullptr), keybinder(nullptr), _playing(true),
+		  converse_gump_type(CONVERSE_GUMP_DEFAULT),
+		  pause_flags(PAUSE_UNPAUSED), pause_user_count(0),
+		  ignore_event_delay(0), unlimited_casting(false),
+		  god_mode_enabled(false), armageddon(false), ethereal(false),
+		  free_balloon_movement(false), converse_gump_width(0),
+		  min_converse_gump_width(0), force_solid_converse_bg(false) {
 	game = this;
-	config = cfg;
-	event = evt;
-
-	gui = g;
-
-	screen = scr;
-	game_type = type;
-	sound_manager = sm;
-
-	script = nullptr;
-	background = nullptr;
-	cursor = nullptr;
-	dither = nullptr;
-	tile_manager = nullptr;
-	obj_manager = nullptr;
-	palette = nullptr;
-	font_manager = nullptr;
-	scroll = nullptr;
-	game_map = nullptr;
-	map_window = nullptr;
-	actor_manager = nullptr;
-	player = nullptr;
-	converse = nullptr;
-	conv_gump = nullptr;
-	command_bar = nullptr;
-	new_command_bar = nullptr;
-	clock = nullptr;
-	party = nullptr;
-	portrait = nullptr;
-	view_manager = nullptr;
-	egg_manager = nullptr;
-	usecode = nullptr;
-	effect_manager = nullptr;
-	weather = nullptr;
-	magic = nullptr;
-	book = nullptr;
-	keybinder = nullptr;
-
-	_playing = true;
-	converse_gump_type = CONVERSE_GUMP_DEFAULT;
-	pause_flags = PAUSE_UNPAUSED;
-	pause_user_count = 0;
-	ignore_event_delay = 0;
-	unlimited_casting = false;
-	god_mode_enabled = false;
-	armageddon = false;
-	ethereal = false;
-	free_balloon_movement = false;
-	converse_gump_width = 0;
-	min_converse_gump_width = 0;
-	force_solid_converse_bg = false;
 
 	config->value("config/cheats/enabled", cheats_enabled, false);
 	config->value("config/cheats/enable_hackmove", is_using_hackmove, false);
@@ -185,7 +151,7 @@ Game::~Game() {
 	if (player) delete player;
 	//delete background;
 	if (converse) delete converse;
-	if (clock) delete clock;
+	if (_clock) delete _clock;
 	if (party) delete party;
 	if (portrait) delete portrait;
 	if (view_manager) delete view_manager;
@@ -214,8 +180,7 @@ bool Game::loadGame(Script *s) {
 
 	palette = new GamePalette(screen, config);
 
-	clock = new GameClock(config, game_type);
-
+	_clock = new GameClock(config, game_type);
 
 	background = new Background(config);
 	background->init();
@@ -270,7 +235,7 @@ bool Game::loadGame(Script *s) {
 	egg_manager->set_obj_manager(obj_manager);
 
 	ConsoleAddInfo("Loading actor data.");
-	actor_manager = new ActorManager(config, game_map, tile_manager, obj_manager, clock);
+	actor_manager = new ActorManager(config, game_map, tile_manager, obj_manager, _clock);
 
 	game_map->set_actor_manager(actor_manager);
 	egg_manager->set_actor_manager(actor_manager);
@@ -282,7 +247,7 @@ bool Game::loadGame(Script *s) {
 	if (is_original_plus_full_map()) // need to render after map window
 		gui->AddWidget(background);
 
-	weather = new Weather(config, clock, game_type);
+	weather = new Weather(config, _clock, game_type);
 
 //   if(!is_new_style()) // Everyone always uses original style command bar now.
 	{
@@ -301,7 +266,7 @@ bool Game::loadGame(Script *s) {
 
 	player = new Player(config);
 	party = new Party(config);
-	player->init(obj_manager, actor_manager, map_window, clock, party);
+	player->init(obj_manager, actor_manager, map_window, _clock, party);
 	party->init(this, actor_manager);
 
 	portrait = newPortrait(game_type, config);
@@ -327,7 +292,7 @@ bool Game::loadGame(Script *s) {
 		magic = new Magic();
 	}
 
-	event->init(obj_manager, map_window, scroll, player, magic, clock, view_manager, usecode, gui, keybinder);
+	event->init(obj_manager, map_window, scroll, player, magic, _clock, view_manager, usecode, gui, keybinder);
 	if (game_type == NUVIE_GAME_U6) {
 		magic->init(event);
 	}
@@ -427,14 +392,14 @@ void Game::init_converse() {
 		conv_gump->Hide();
 		gui->AddWidget(conv_gump);
 
-		converse->init(config, game_type, conv_gump, actor_manager, clock, player, view_manager, obj_manager);
+		converse->init(config, game_type, conv_gump, actor_manager, _clock, player, view_manager, obj_manager);
 	} else if (game_type == NUVIE_GAME_U6 && converse_gump_type == CONVERSE_GUMP_DEFAULT) {
-		converse->init(config, game_type, scroll, actor_manager, clock, player, view_manager, obj_manager);
+		converse->init(config, game_type, scroll, actor_manager, _clock, player, view_manager, obj_manager);
 	} else {
 		ConverseGumpWOU *gump = new ConverseGumpWOU(config, font_manager->get_font(0), screen);
 		gump->Hide();
 		gui->AddWidget(gump);
-		converse->init(config, game_type, gump, actor_manager, clock, player, view_manager, obj_manager);
+		converse->init(config, game_type, gump, actor_manager, _clock, player, view_manager, obj_manager);
 	}
 
 }
@@ -638,7 +603,7 @@ void Game::play() {
 		if (cursor) cursor->clear(); // restore cursor area before GUI events
 
 		event->update();
-		if (clock->get_timer(GAMECLOCK_TIMER_U6_TIME_STOP) == 0) {
+		if (_clock->get_timer(GAMECLOCK_TIMER_U6_TIME_STOP) == 0) {
 			palette->rotatePalette();
 			tile_manager->update();
 			actor_manager->twitchActors();
@@ -682,7 +647,7 @@ void Game::update_once(bool process_gui_input, bool run_converse) {
 			gui->HandleEvent(&evt);
 	}
 
-	if (clock->get_timer(GAMECLOCK_TIMER_U6_TIME_STOP) == 0) {
+	if (_clock->get_timer(GAMECLOCK_TIMER_U6_TIME_STOP) == 0) {
 		palette->rotatePalette();
 		tile_manager->update();
 		actor_manager->twitchActors();
diff --git a/engines/ultima/nuvie/core/game.h b/engines/ultima/nuvie/core/game.h
index 19c1b3bf234..7039519ac48 100644
--- a/engines/ultima/nuvie/core/game.h
+++ b/engines/ultima/nuvie/core/game.h
@@ -101,7 +101,7 @@ private:
 	SoundManager *sound_manager;
 	EggManager *egg_manager;
 
-	GameClock *clock;
+	GameClock *_clock;
 	Portrait *portrait;
 	UseCode *usecode;
 
@@ -373,7 +373,7 @@ public:
 		return view_manager;
 	}
 	GameClock *get_clock()            {
-		return clock;
+		return _clock;
 	}
 	Portrait *get_portrait()          {
 		return portrait;
diff --git a/engines/ultima/nuvie/core/game_clock.cpp b/engines/ultima/nuvie/core/game_clock.cpp
index 2993e958a77..ba614111954 100644
--- a/engines/ultima/nuvie/core/game_clock.cpp
+++ b/engines/ultima/nuvie/core/game_clock.cpp
@@ -30,11 +30,8 @@
 namespace Ultima {
 namespace Nuvie {
 
-GameClock::GameClock(Configuration *cfg, nuvie_game_t type) {
-	config = cfg;
-	game_type = type;
-
-	day_of_week = 0;
+GameClock::GameClock(Configuration *cfg, nuvie_game_t type) : config(cfg),
+		game_type(type), day_of_week(0) {
 	date_string[10] = '\0';
 	time_string[10] = '\0';
 
diff --git a/engines/ultima/nuvie/core/look.cpp b/engines/ultima/nuvie/core/look.cpp
index 17cce67183c..785a804d511 100644
--- a/engines/ultima/nuvie/core/look.cpp
+++ b/engines/ultima/nuvie/core/look.cpp
@@ -31,11 +31,8 @@ namespace Ultima {
 namespace Nuvie {
 
 Look::Look(Configuration *cfg)
-	: look_data(nullptr), desc_buf(nullptr) {
-	config = cfg;
-
+	: look_data(nullptr), desc_buf(nullptr), config(cfg), max_len(0) {
 	look_tbl[2047] = nullptr;
-	max_len = 0;
 }
 
 Look::~Look() {
diff --git a/engines/ultima/nuvie/core/magic.cpp b/engines/ultima/nuvie/core/magic.cpp
index f027df09f73..5549532208b 100644
--- a/engines/ultima/nuvie/core/magic.cpp
+++ b/engines/ultima/nuvie/core/magic.cpp
@@ -68,14 +68,9 @@ const char *reagent[8] = {"mandrake root", "nightshade", "black pearl", "blood m
 const int obj_n_reagent[8] = {OBJ_U6_MANDRAKE_ROOT, OBJ_U6_NIGHTSHADE, OBJ_U6_BLACK_PEARL, OBJ_U6_BLOOD_MOSS, OBJ_U6_SPIDER_SILK, OBJ_U6_GARLIC, OBJ_U6_GINSENG, OBJ_U6_SULFUROUS_ASH};
 
 
-Magic::Magic() {
-	event = nullptr;
-	target_object = nullptr;
-	magic_script = nullptr;
-	spellbook_obj = nullptr;
-	state = 0;
-
-	for (uint16 index = 0; index < 256; index++) spell[index] = nullptr;
+Magic::Magic() : event(nullptr), target_object(nullptr), magic_script(nullptr),
+		spellbook_obj(nullptr), state(0) {
+	ARRAYCLEAR(spell);
 	clear_cast_buffer();
 }
 
diff --git a/engines/ultima/nuvie/core/map.cpp b/engines/ultima/nuvie/core/map.cpp
index fd91ce43a88..75a84631468 100644
--- a/engines/ultima/nuvie/core/map.cpp
+++ b/engines/ultima/nuvie/core/map.cpp
@@ -36,15 +36,10 @@
 namespace Ultima {
 namespace Nuvie {
 
-Map::Map(Configuration *cfg) {
-	config = cfg;
-
-	tile_manager = nullptr;
-	obj_manager = nullptr;
-	actor_manager = nullptr;
-	surface = nullptr;
-	roof_surface = nullptr;
-	dungeons[4] = nullptr;
+Map::Map(Configuration *cfg) : config(cfg), tile_manager(nullptr),
+		obj_manager(nullptr), actor_manager(nullptr), surface(nullptr),
+		roof_surface(nullptr) {
+	ARRAYCLEAR(dungeons);
 
 	config->value(config_get_game_key(config) + "/roof_mode", roof_mode, false);
 }
@@ -573,7 +568,7 @@ void Map::saveRoofData() {
 	}
 }
 
-void Map::insertSurfaceSuperChunk(unsigned char *schunk, unsigned char *chunk_data, uint8 schunk_num) {
+void Map::insertSurfaceSuperChunk(const unsigned char *schunk, const unsigned char *chunk_data, uint8 schunk_num) {
 	uint16 world_x, world_y;
 	uint16 c1, c2;
 	uint8 i, j;
@@ -597,7 +592,7 @@ void Map::insertSurfaceSuperChunk(unsigned char *schunk, unsigned char *chunk_da
 	}
 }
 
-void Map::insertSurfaceChunk(unsigned char *chunk, uint16 x, uint16 y) {
+void Map::insertSurfaceChunk(const unsigned char *chunk, uint16 x, uint16 y) {
 	unsigned char *map_ptr;
 	uint8 i;
 
@@ -611,7 +606,7 @@ void Map::insertSurfaceChunk(unsigned char *chunk, uint16 x, uint16 y) {
 
 }
 
-void Map::insertDungeonSuperChunk(unsigned char *schunk, unsigned char *chunk_data, uint8 level) {
+void Map::insertDungeonSuperChunk(const unsigned char *schunk, const unsigned char *chunk_data, uint8 level) {
 	uint16 c1, c2;
 	uint8 i, j;
 
@@ -628,7 +623,7 @@ void Map::insertDungeonSuperChunk(unsigned char *schunk, unsigned char *chunk_da
 	}
 }
 
-void Map::insertDungeonChunk(unsigned char *chunk, uint16 x, uint16 y, uint8 level) {
+void Map::insertDungeonChunk(const unsigned char *chunk, uint16 x, uint16 y, uint8 level) {
 	unsigned char *map_ptr;
 	uint8 i;
 
diff --git a/engines/ultima/nuvie/core/map.h b/engines/ultima/nuvie/core/map.h
index 4b89bb658c6..43f70ea4873 100644
--- a/engines/ultima/nuvie/core/map.h
+++ b/engines/ultima/nuvie/core/map.h
@@ -196,11 +196,11 @@ public:
 
 protected:
 	Std::string getRoofDataFilename();
-	void insertSurfaceSuperChunk(unsigned char *schunk_ptr, unsigned char *chunk_data, uint8 schunk_num);
-	void insertSurfaceChunk(unsigned char *chunk, uint16 x, uint16 y);
+	void insertSurfaceSuperChunk(const unsigned char *schunk_ptr, const unsigned char *chunk_data, uint8 schunk_num);
+	void insertSurfaceChunk(const unsigned char *chunk, uint16 x, uint16 y);
 
-	void insertDungeonSuperChunk(unsigned char *schunk_ptr, unsigned char *chunk_data, uint8 level);
-	void insertDungeonChunk(unsigned char *chunk, uint16 x, uint16 y, uint8 level);
+	void insertDungeonSuperChunk(const unsigned char *schunk_ptr, const unsigned char *chunk_data, uint8 level);
+	void insertDungeonChunk(const unsigned char *chunk, uint16 x, uint16 y, uint8 level);
 
 
 	void loadRoofData();
diff --git a/engines/ultima/nuvie/core/obj.cpp b/engines/ultima/nuvie/core/obj.cpp
index d1bc071581d..465876b2cf1 100644
--- a/engines/ultima/nuvie/core/obj.cpp
+++ b/engines/ultima/nuvie/core/obj.cpp
@@ -27,18 +27,8 @@
 namespace Ultima {
 namespace Nuvie {
 
-Obj::Obj() {
-	obj_n = 0;
-	status = 0;
-	nuvie_status = 0;
-	frame_n = 0;
-	qty = 0;
-	quality = 0;
-	parent = nullptr;
-	container = nullptr;
-	x = 0;
-	y = 0;
-	z = 0;
+Obj::Obj() : obj_n(0), status(0), nuvie_status(0), frame_n(0), qty(0),
+		quality(0), parent(nullptr), container(nullptr), x(0), y(0), z(0) {
 }
 
 Obj::Obj(Obj *sobj) {
diff --git a/engines/ultima/nuvie/core/obj_manager.cpp b/engines/ultima/nuvie/core/obj_manager.cpp
index 4cc0e0387c1..44ed47d7ed6 100644
--- a/engines/ultima/nuvie/core/obj_manager.cpp
+++ b/engines/ultima/nuvie/core/obj_manager.cpp
@@ -49,26 +49,19 @@ static iAVLKey get_iAVLKey(const void *item) {
 	return ((const ObjTreeNode *)item)->key;
 }
 
-ObjManager::ObjManager(Configuration *cfg, TileManager *tm, EggManager *em) {
-	uint8 i;
-	Std::string show_eggs_key;
-
-	config = cfg;
-	tile_manager = tm;
-	egg_manager = em;
-	usecode = nullptr;
-	obj_save_count = 0;
-
+ObjManager::ObjManager(Configuration *cfg, TileManager *tm, EggManager *em)
+	: config(cfg), tile_manager(tm), egg_manager(em), usecode(nullptr),
+	  obj_save_count(0) {
 	load_basetile();
 	load_weight_table();
 
 	memset(actor_inventories, 0, sizeof(actor_inventories));
 
-	for (i = 0; i < 64; i++) {
+	for (uint8 i = 0; i < 64; i++) {
 		surface[i] = iAVLAllocTree(get_iAVLKey);
 	}
 
-	for (i = 0; i < 5; i++) {
+	for (uint8 i = 0; i < 5; i++) {
 		dungeon[i] = iAVLAllocTree(get_iAVLKey);
 	}
 
@@ -81,7 +74,7 @@ ObjManager::ObjManager(Configuration *cfg, TileManager *tm, EggManager *em) {
 //save the egg tile_num incase we want to switch egg display on again.
 	egg_tile_num = get_obj_tile_num(obj_egg_table[game_type]);
 
-	show_eggs_key = config_get_game_key(config);
+	Std::string show_eggs_key = config_get_game_key(config);
 	show_eggs_key.append("/show_eggs");
 
 	config->value(show_eggs_key, show_eggs);
diff --git a/engines/ultima/nuvie/core/player.cpp b/engines/ultima/nuvie/core/player.cpp
index a263b7a2bda..2bbc8cb15e2 100644
--- a/engines/ultima/nuvie/core/player.cpp
+++ b/engines/ultima/nuvie/core/player.cpp
@@ -42,29 +42,16 @@ namespace Nuvie {
 
 #define PLAYER_BASE_MOVEMENT_COST 5
 
-Player::Player(Configuration *cfg) {
-	config = cfg;
+Player::Player(Configuration *cfg) : config(cfg), _clock(nullptr),
+		party(nullptr), actor(nullptr), actor_manager(nullptr), obj_manager(nullptr),
+		map_window(nullptr), karma(0), gender(0), questf(0), gargishf(0), alcohol(0),
+		current_weapon(0), party_mode(false), mapwindow_centered(false) {
 	config->value("config/GameType", game_type);
-
-	clock = nullptr;
-	party = nullptr;
-	actor = nullptr;
-	actor_manager = nullptr;
-	obj_manager = nullptr;
-	map_window = nullptr;
-	karma = 0;
-	gender = 0;
-	questf = 0;
-	gargishf = 0;
-	alcohol = 0;
-	current_weapon = 0;
-	party_mode = false;
-	mapwindow_centered = false;
 }
 
 bool Player::init(ObjManager *om, ActorManager *am, MapWindow *mw, GameClock *c, Party *p) {
 
-	clock = c;
+	_clock = c;
 	actor_manager = am;
 	obj_manager = om;
 	map_window = mw;
@@ -455,7 +442,7 @@ void Player::moveRelative(sint16 rel_x, sint16 rel_y, bool mouse_movement) {
 	// update world around player
 	actor_manager->updateActors(x, y, z);
 	obj_manager->update(x, y, z); // remove temporary objs, hatch eggs
-	clock->inc_move_counter(); // doesn't update time
+	_clock->inc_move_counter(); // doesn't update time
 	actor_manager->startActors(); // end player turn
 }
 
@@ -525,7 +512,7 @@ void Player::pass() {
 	if (party_mode && party->is_leader(actor)) // lead party
 		party->follow(0, 0);
 // actor_manager->updateActors(x, y, z); // not needed because position is unchanged
-	clock->inc_move_counter_by_a_minute(); // doesn't update time
+	_clock->inc_move_counter_by_a_minute(); // doesn't update time
 	actor_manager->startActors(); // end player turn
 //actor_manager->moveActors();
 	Game::get_game()->time_changed();
@@ -587,8 +574,8 @@ uint32 Player::get_walk_delay() const {
  */
 bool Player::check_walk_delay() {
 	static uint32 walk_delay = 0, // start with no delay
-	              last_time = clock->get_ticks();
-	uint32 this_time = clock->get_ticks();
+	              last_time = _clock->get_ticks();
+	uint32 this_time = _clock->get_ticks();
 	uint32 time_passed = this_time - last_time;
 
 	// subtract time_passed until delay is 0
diff --git a/engines/ultima/nuvie/core/player.h b/engines/ultima/nuvie/core/player.h
index 2ac20d4741d..ae1fa3f36cb 100644
--- a/engines/ultima/nuvie/core/player.h
+++ b/engines/ultima/nuvie/core/player.h
@@ -41,7 +41,7 @@ class NuvieIO;
 class Player {
 	Configuration *config;
 	int game_type;
-	GameClock *clock;
+	GameClock *_clock;
 	Party *party;
 	bool party_mode;
 	bool mapwindow_centered;
diff --git a/engines/ultima/nuvie/core/tile_manager.cpp b/engines/ultima/nuvie/core/tile_manager.cpp
index b7aed2fb240..f94402def9b 100644
--- a/engines/ultima/nuvie/core/tile_manager.cpp
+++ b/engines/ultima/nuvie/core/tile_manager.cpp
@@ -88,18 +88,13 @@ static const Tile gump_cursor = {
 	}
 };
 
-TileManager::TileManager(Configuration *cfg)
-	: desc_buf(nullptr) {
-	config = cfg;
-	look = nullptr;
-	game_counter = rgame_counter = 0;
+TileManager::TileManager(Configuration *cfg) : desc_buf(nullptr), config(cfg),
+		look(nullptr), game_counter(0), rgame_counter(0), extendedTiles(nullptr),
+		numTiles(NUM_ORIGINAL_TILES) {
 	memset(tileindex, 0, sizeof(tileindex));
 	memset(tile, 0, sizeof(tile));
 	memset(&animdata, 0, sizeof animdata);
 
-	extendedTiles = nullptr;
-	numTiles = NUM_ORIGINAL_TILES;
-
 	config->value("config/GameType", game_type);
 }
 
@@ -513,11 +508,11 @@ bool TileManager::loadAnimData() {
 	return true;
 }
 
-void TileManager::decodePixelBlockTile(unsigned char *tile_data, uint16 tile_num) {
+void TileManager::decodePixelBlockTile(const unsigned char *tile_data, uint16 tile_num) {
 	uint8 len;
 	uint16 disp;
 	uint8 x;
-	unsigned char *ptr;
+	const unsigned char *ptr;
 	unsigned char *data_ptr;
 
 // num_blocks = tile_data[0];
@@ -926,7 +921,7 @@ void TileManager::exportTilesetToBmpFile(Std::string filename, bool fixupU6Shore
 	bmp.save(filename);
 }
 
-void TileManager::writeBmpTileData(unsigned char *data, Tile *t, bool transparent) {
+void TileManager::writeBmpTileData(unsigned char *data, const Tile *t, bool transparent) {
 	for (uint8 y = 0; y < 16; y++) {
 		for (uint8 x = 0; x < 16; x++) {
 			if (!transparent || t->data[y * 16 + x] != 255) {
diff --git a/engines/ultima/nuvie/core/tile_manager.h b/engines/ultima/nuvie/core/tile_manager.h
index 8f566c682ec..dfeca0cebea 100644
--- a/engines/ultima/nuvie/core/tile_manager.h
+++ b/engines/ultima/nuvie/core/tile_manager.h
@@ -205,7 +205,7 @@ protected:
 
 	bool loadAnimData();
 	bool loadTileFlag();
-	void decodePixelBlockTile(unsigned char *tile_data, uint16 tile_num);
+	void decodePixelBlockTile(const unsigned char *tile_data, uint16 tile_num);
 
 	bool loadAnimMask();
 
@@ -215,7 +215,7 @@ private:
 	void copyTileMetaData(Tile *dest, Tile *src);
 	Tile *addNewTiles(uint16 num_tiles);
 
-	void writeBmpTileData(unsigned char *data, Tile *t, bool transparent);
+	void writeBmpTileData(unsigned char *data, const Tile *t, bool transparent);
 };
 
 } // End of namespace Nuvie
diff --git a/engines/ultima/nuvie/core/timed_event.cpp b/engines/ultima/nuvie/core/timed_event.cpp
index d8cf9e1ef4a..76de64917c5 100644
--- a/engines/ultima/nuvie/core/timed_event.cpp
+++ b/engines/ultima/nuvie/core/timed_event.cpp
@@ -161,9 +161,7 @@ bool TimeQueue::delete_timer(TimedEvent *tevent) {
  */
 TimedEvent::TimedEvent(uint32 reltime, bool immediate, bool realtime)
 	: delay(reltime), repeat_count(0), ignore_pause(false),
-	  real_time(realtime), tq_can_delete(true), defunct(false) {
-	tq = nullptr;
-
+	  real_time(realtime), tq_can_delete(true), defunct(false), tq(nullptr) {
 	if (immediate) // start now (useful if repeat is true)
 		time = 0;
 	else
@@ -223,16 +221,9 @@ TimedPartyMove::TimedPartyMove(MapCoord *d, MapCoord *t, Obj *use_obj, uint32 st
 }
 
 TimedPartyMove::TimedPartyMove(uint32 step_delay)
-	: TimedEvent(step_delay, true) {
-	map_window = nullptr;
-	party = nullptr;
-	dest = nullptr;
-	target = nullptr;
-	moongate = nullptr;
-	actor_to_hide = nullptr;
-	moves_left = 0;
-	wait_for_effect = 0;
-	falling_in = false;
+	: TimedEvent(step_delay, true), map_window(nullptr), party(nullptr),
+	  dest(nullptr), target(nullptr), moongate(nullptr), actor_to_hide(nullptr),
+	  moves_left(0), wait_for_effect(0), falling_in(false) {
 }
 
 TimedPartyMove::~TimedPartyMove() {
@@ -744,10 +735,8 @@ bool TimedRestGather::move_party() {
 TimedRest::TimedRest(uint8 hours, Actor *who_will_guard, Obj *campfire_obj)
 	: TimedAdvance(hours, 80), party(Game::get_game()->get_party()),
 	  scroll(Game::get_game()->get_scroll()), sleeping(0),
-	  print_message(0) {
-	lookout = who_will_guard;
-	campfire = campfire_obj;
-	number_that_had_food = 0;
+	  print_message(0), lookout(who_will_guard), campfire(campfire_obj),
+	  number_that_had_food(0) {
 }
 
 /* This is the only place we know that the TimedAdvance has completed. */
diff --git a/engines/ultima/nuvie/core/weather.cpp b/engines/ultima/nuvie/core/weather.cpp
index 26f81ac342d..1901c06f669 100644
--- a/engines/ultima/nuvie/core/weather.cpp
+++ b/engines/ultima/nuvie/core/weather.cpp
@@ -41,13 +41,9 @@ namespace Nuvie {
 //the longest we will go before having a change in wind direction
 #define WEATHER_MAX_WIND 30
 
-Weather::Weather(Configuration *cfg, GameClock *c, nuvie_game_t type) {
-	config = cfg;
-	clock = c;
-	gametype = type;
-
-	wind_dir = NUVIE_DIR_NONE;
-	wind_timer = nullptr;
+Weather::Weather(Configuration *cfg, GameClock *c, nuvie_game_t type)
+		: config(cfg), _clock(c), gametype(type), wind_dir(NUVIE_DIR_NONE),
+		  wind_timer(nullptr) {
 	string s;
 	config->value(config_get_game_key(config) + "/displayed_wind_dir", s, "from");
 	if (s == "to")
@@ -154,7 +150,7 @@ bool Weather::save_wind(NuvieIO *objlist) {
 }
 
 bool Weather::is_eclipse() const {
-	if (gametype != NUVIE_GAME_U6 || clock->get_timer(GAMECLOCK_TIMER_U6_ECLIPSE) == 0)
+	if (gametype != NUVIE_GAME_U6 || _clock->get_timer(GAMECLOCK_TIMER_U6_ECLIPSE) == 0)
 		return false;
 
 	return true;
@@ -163,8 +159,8 @@ bool Weather::is_eclipse() const {
 bool Weather::is_moon_visible() const {
 	//FIXME this is duplicated logic. Maybe we should look at how the original works out moon locations
 
-	uint8 day = clock->get_day();
-	uint8 hour = clock->get_hour();
+	uint8 day = _clock->get_day();
+	uint8 hour = _clock->get_hour();
 	uint8 phase = 0;
 	// trammel (starts 1 hour ahead of sun)
 	phase = uint8(nearbyint((day - 1) / TRAMMEL_PHASE)) % 8;
diff --git a/engines/ultima/nuvie/core/weather.h b/engines/ultima/nuvie/core/weather.h
index 9878c7dce1a..d6e05b3f46e 100644
--- a/engines/ultima/nuvie/core/weather.h
+++ b/engines/ultima/nuvie/core/weather.h
@@ -46,7 +46,7 @@ using Std::string;
 
 class Weather: public CallBack {
 	Configuration *config;
-	GameClock *clock;
+	GameClock *_clock;
 	nuvie_game_t gametype; // what game is being played?
 
 	uint8 wind_dir;
diff --git a/engines/ultima/nuvie/files/nuvie_bmp_file.cpp b/engines/ultima/nuvie/files/nuvie_bmp_file.cpp
index 18cad29cd4c..72c5133632a 100644
--- a/engines/ultima/nuvie/files/nuvie_bmp_file.cpp
+++ b/engines/ultima/nuvie/files/nuvie_bmp_file.cpp
@@ -27,14 +27,11 @@ namespace Nuvie {
 
 #define NUVIEBMPFILE_MAGIC 0x4d42 // 'BM'
 
-NuvieBmpFile::NuvieBmpFile() {
-	data = nullptr;
-	prev_width = 0;
-	prev_height = 0;
-	prev_bits = 0;
-	bmp_line_width = 0;
+NuvieBmpFile::NuvieBmpFile() : data(nullptr), prev_width(0), prev_height(0),
+		prev_bits(0), bmp_line_width(0) {
 	memset(&header, 0, sizeof(header));
 	memset(&infoHeader, 0, sizeof(infoHeader));
+	ARRAYCLEAR(palette);
 }
 
 NuvieBmpFile::~NuvieBmpFile() {
diff --git a/engines/ultima/nuvie/files/nuvie_io.cpp b/engines/ultima/nuvie/files/nuvie_io.cpp
index 65dad37e3dc..dfa3206fac4 100644
--- a/engines/ultima/nuvie/files/nuvie_io.cpp
+++ b/engines/ultima/nuvie/files/nuvie_io.cpp
@@ -25,9 +25,7 @@
 namespace Ultima {
 namespace Nuvie {
 
-NuvieIO::NuvieIO() {
-	size = 0;
-	pos = 0;
+NuvieIO::NuvieIO() : size(0), pos(0) {
 }
 
 NuvieIO::~NuvieIO() {
diff --git a/engines/ultima/nuvie/files/tmx_map.cpp b/engines/ultima/nuvie/files/tmx_map.cpp
index 029ac92905a..203e2a770ab 100644
--- a/engines/ultima/nuvie/files/tmx_map.cpp
+++ b/engines/ultima/nuvie/files/tmx_map.cpp
@@ -28,12 +28,8 @@
 namespace Ultima {
 namespace Nuvie {
 
-TMXMap::TMXMap(TileManager *tm, Map *m, ObjManager *om) {
-	tile_manager = tm;
-	map = m;
-	obj_manager = om;
-	mapdata = nullptr;
-	game_type = NUVIE_GAME_NONE;
+TMXMap::TMXMap(TileManager *tm, Map *m, ObjManager *om) : tile_manager(tm),
+		map(m), obj_manager(om), mapdata(nullptr), game_type(NUVIE_GAME_NONE) {
 }
 
 TMXMap::~TMXMap() {
diff --git a/engines/ultima/nuvie/files/u6_bmp.cpp b/engines/ultima/nuvie/files/u6_bmp.cpp
index 15cffd43ac6..15d0f4d563c 100644
--- a/engines/ultima/nuvie/files/u6_bmp.cpp
+++ b/engines/ultima/nuvie/files/u6_bmp.cpp
@@ -27,8 +27,7 @@
 namespace Ultima {
 namespace Nuvie {
 
-U6Bmp::U6Bmp(): U6Shape() {
-	data = nullptr;
+U6Bmp::U6Bmp(): U6Shape(), data(nullptr) {
 }
 
 U6Bmp::~U6Bmp() {
diff --git a/engines/ultima/nuvie/files/u6_lzw.cpp b/engines/ultima/nuvie/files/u6_lzw.cpp
index a9c3c2ff961..0ce9c05ed7a 100644
--- a/engines/ultima/nuvie/files/u6_lzw.cpp
+++ b/engines/ultima/nuvie/files/u6_lzw.cpp
@@ -37,10 +37,7 @@
 namespace Ultima {
 namespace Nuvie {
 
-U6Lzw::U6Lzw() {
-	dict = new U6LzwDict;
-	stack = new U6LzwStack;
-	errstr = "unknown error";
+U6Lzw::U6Lzw() : dict(new U6LzwDict), stack(new U6LzwStack), errstr("unknown error") {
 }
 
 U6Lzw::~U6Lzw() {
diff --git a/engines/ultima/nuvie/files/u6_shape.cpp b/engines/ultima/nuvie/files/u6_shape.cpp
index ba583220fed..ed89a0b0965 100644
--- a/engines/ultima/nuvie/files/u6_shape.cpp
+++ b/engines/ultima/nuvie/files/u6_shape.cpp
@@ -85,10 +85,7 @@ namespace Nuvie {
  *
  * Just intializes all structures to 0.
  */
-U6Shape::U6Shape() {
-	raw = nullptr;
-	hotx = hoty = 0;
-	width = height = 0;
+U6Shape::U6Shape() : raw(nullptr), hotx(0), hoty(0), width(0), height(0) {
 }
 
 /*
diff --git a/engines/ultima/nuvie/fonts/bmp_font.cpp b/engines/ultima/nuvie/fonts/bmp_font.cpp
index 0547406e7b6..844db5142fa 100644
--- a/engines/ultima/nuvie/fonts/bmp_font.cpp
+++ b/engines/ultima/nuvie/fonts/bmp_font.cpp
@@ -29,15 +29,8 @@
 namespace Ultima {
 namespace Nuvie {
 
-BMPFont::BMPFont() {
-	num_chars = 0;
-	offset = 0;
-	char_w = 0;
-	char_h = 0;
-	font_width_data = nullptr;
-	sdl_font_data = nullptr;
-	rune_mode = false;
-	dual_font_mode = false;
+BMPFont::BMPFont() : char_w(0), char_h(0), font_width_data(nullptr),
+		sdl_font_data(nullptr), rune_mode(false), dual_font_mode(false) {
 }
 
 BMPFont::~BMPFont() {
diff --git a/engines/ultima/nuvie/fonts/conv_font.cpp b/engines/ultima/nuvie/fonts/conv_font.cpp
index 178c5d2d0b6..dcd58c7be48 100644
--- a/engines/ultima/nuvie/fonts/conv_font.cpp
+++ b/engines/ultima/nuvie/fonts/conv_font.cpp
@@ -27,12 +27,7 @@
 namespace Ultima {
 namespace Nuvie {
 
-ConvFont::ConvFont() {
-	data_offset = 0;
-	num_chars = 0;
-	offset = 0;
-	f_data = nullptr;
-	f_w_data = nullptr;
+ConvFont::ConvFont() : data_offset(0), f_data(nullptr), f_w_data(nullptr) {
 }
 
 ConvFont::~ConvFont() {
diff --git a/engines/ultima/nuvie/fonts/font.cpp b/engines/ultima/nuvie/fonts/font.cpp
index 13b0dfe794a..e9a2e40ebda 100644
--- a/engines/ultima/nuvie/fonts/font.cpp
+++ b/engines/ultima/nuvie/fonts/font.cpp
@@ -30,12 +30,8 @@
 namespace Ultima {
 namespace Nuvie {
 
-Font::Font() {
-	num_chars = 0;
-	offset = 0;
-
-	default_color = FONT_COLOR_U6_NORMAL;
-	default_highlight_color = FONT_COLOR_U6_HIGHLIGHT;
+Font::Font() : num_chars(0), offset(0), default_color(FONT_COLOR_U6_NORMAL),
+		default_highlight_color(FONT_COLOR_U6_HIGHLIGHT) {
 }
 
 Font::~Font() {
diff --git a/engines/ultima/nuvie/fonts/font_manager.cpp b/engines/ultima/nuvie/fonts/font_manager.cpp
index 151b2905ecd..cd832cb9308 100644
--- a/engines/ultima/nuvie/fonts/font_manager.cpp
+++ b/engines/ultima/nuvie/fonts/font_manager.cpp
@@ -35,14 +35,9 @@
 namespace Ultima {
 namespace Nuvie {
 
-FontManager::FontManager(Configuration *cfg) {
-	config = cfg;
-	num_fonts = 0;
-
-	conv_font = nullptr;
-	conv_garg_font = nullptr;
-	conv_font_data = nullptr;
-	conv_font_widths = nullptr;
+FontManager::FontManager(Configuration *cfg) : config(cfg), num_fonts(0),
+		conv_font(nullptr), conv_garg_font(nullptr), conv_font_data(nullptr),
+		conv_font_widths(nullptr) {
 }
 
 FontManager::~FontManager() {
diff --git a/engines/ultima/nuvie/fonts/u6_font.cpp b/engines/ultima/nuvie/fonts/u6_font.cpp
index df4d0ddb791..8013b387de4 100644
--- a/engines/ultima/nuvie/fonts/u6_font.cpp
+++ b/engines/ultima/nuvie/fonts/u6_font.cpp
@@ -27,10 +27,7 @@
 namespace Ultima {
 namespace Nuvie {
 
-U6Font::U6Font() {
-	font_data = nullptr;
-	num_chars = 0;
-	offset = 0;
+U6Font::U6Font() : font_data(nullptr) {
 }
 
 U6Font::~U6Font() {
diff --git a/engines/ultima/nuvie/fonts/wou_font.cpp b/engines/ultima/nuvie/fonts/wou_font.cpp
index f4d122d3fbb..3964dcba2ce 100644
--- a/engines/ultima/nuvie/fonts/wou_font.cpp
+++ b/engines/ultima/nuvie/fonts/wou_font.cpp
@@ -30,15 +30,8 @@
 namespace Ultima {
 namespace Nuvie {
 
-WOUFont::WOUFont() {
-	font_data = nullptr;
-	char_buf = nullptr;
-	num_chars = 0;
-	offset = 0;
-	height = 0;
-	pixel_char = 0;
-	default_color = FONT_COLOR_U6_NORMAL;
-	default_highlight_color = FONT_COLOR_U6_HIGHLIGHT;
+WOUFont::WOUFont() : font_data(nullptr), char_buf(nullptr), height(0),
+		pixel_char(0) {
 }
 
 WOUFont::~WOUFont() {
diff --git a/engines/ultima/nuvie/gui/gui.cpp b/engines/ultima/nuvie/gui/gui.cpp
index 5553fcf3a17..a5e11cf7126 100644
--- a/engines/ultima/nuvie/gui/gui.cpp
+++ b/engines/ultima/nuvie/gui/gui.cpp
@@ -38,25 +38,15 @@ const int GUI::mouseclick_delay = 300; /* SB-X */
 
 GUI *GUI::gui = nullptr;
 
-GUI:: GUI(Configuration *c, Screen *s) {
+GUI::GUI(Configuration *c, Screen *s) : config(c), screen(s), numwidgets(0),
+		maxwidgets(0), widgets(nullptr), display(1), running(0), dragging(false),
+		full_redraw(true), focused_widget(nullptr), locked_widget(nullptr),
+		block_input(false) {
 	Graphics::ManagedSurface *sdl_surface;
 
 	gui = this;
-	config = c;
-	screen = s;
-	numwidgets = 0;
-	maxwidgets = 0;
-	widgets = nullptr;
-	display = 1;
-	running = 0;
-
 	screen_scale_factor = screen->get_scale_factor();
 
-	dragging = false;
-	full_redraw = true;
-	focused_widget = locked_widget = nullptr;
-	block_input = false;
-
 	sdl_surface = screen->get_sdl_surface();
 
 	selected_color = new GUI_Color(10, 10, 50);
@@ -66,7 +56,7 @@ GUI:: GUI(Configuration *c, Screen *s) {
 	gui_drag_manager = new GUI_DragManager(screen);
 }
 
-GUI:: ~GUI() {
+GUI::~GUI() {
 	if (widgets != nullptr) {
 		for (int i = 0; i < numwidgets; ++i) {
 			delete widgets[i];
@@ -83,8 +73,7 @@ GUI:: ~GUI() {
 /* Add a widget to the GUI.
    The widget will be automatically deleted when the GUI is deleted.
  */
-int
-GUI:: AddWidget(GUI_Widget *widget) {
+int GUI::AddWidget(GUI_Widget *widget) {
 	int i;
 
 	/* Look for deleted widgets */
@@ -205,7 +194,7 @@ void GUI::Display() {
 
 /* Function to handle a GUI status */
 void
-GUI:: HandleStatus(GUI_status status) {
+GUI::HandleStatus(GUI_status status) {
 	switch (status) {
 	case GUI_QUIT:
 		running = 0;
@@ -222,7 +211,7 @@ GUI:: HandleStatus(GUI_status status) {
 }
 
 /* Handle an event, passing it to widgets until they return a status */
-GUI_status GUI:: HandleEvent(Common::Event *event) {
+GUI_status GUI::HandleEvent(Common::Event *event) {
 	int i;
 	int hit;
 	GUI_status status = GUI_PASS;
diff --git a/engines/ultima/nuvie/gui/gui_button.cpp b/engines/ultima/nuvie/gui/gui_button.cpp
index ea9d2a85a75..60b874fce91 100644
--- a/engines/ultima/nuvie/gui/gui_button.cpp
+++ b/engines/ultima/nuvie/gui/gui_button.cpp
@@ -32,59 +32,39 @@ Graphics::ManagedSurface *checkmarks = nullptr;
 
 GUI_Button:: GUI_Button(void *data, int x, int y, Graphics::ManagedSurface *image,
 						Graphics::ManagedSurface *image2, GUI_CallBack *callback, bool free_surfaces)
-	: GUI_Widget(data, x, y, image->w, image->h) {
-	callback_object = callback;
-
-	button = image;
-	button2 = image2;
-	freebutton = free_surfaces;
+	: GUI_Widget(data, x, y, image->w, image->h), callback_object(callback), button(image),
+	  button2(image2), freebutton(free_surfaces), enabled(true), buttonFont(nullptr),
+	  freefont(false), flatbutton(false), is_checkable(false), checked(0), is_highlighted(false) {
 	for (int i = 0; i < 3; ++i) {
 		pressed[i] = 0;
 	}
-	enabled = 1;
-	buttonFont = nullptr;
-	freefont = 0;
-	flatbutton = 0;
-	is_checkable = 0;
-	checked = 0;
-	is_highlighted = false;
 }
 
-GUI_Button:: GUI_Button(void *data, int x, int y, int w, int h,
+GUI_Button::GUI_Button(void *data, int x, int y, int w, int h,
 						GUI_CallBack *callback)
-	: GUI_Widget(data, x, y, w, h) {
-	callback_object = callback;
-
-	button = nullptr;
-	button2 = nullptr;
-	freebutton = 0;
+	: GUI_Widget(data, x, y, w, h), callback_object(callback), button(nullptr),
+	  button2(nullptr), freebutton(false), enabled(true), buttonFont(nullptr),
+	  freefont(false), flatbutton(false), is_checkable(false), checked(0), is_highlighted(false) {
 	for (int i = 0; i < 3; ++i) {
 		pressed[i] = 0;
 	}
-	enabled = 1;
-	buttonFont = nullptr;
-	freefont = 0;
-	flatbutton = 0;
-	is_checkable = 0;
-	checked = 0;
-	is_highlighted = false;
 }
 
 GUI_Button::GUI_Button(void *data, int x, int y, int w, int h, const char *text,
-					   GUI_Font *font, int alignment, int is_checkbutton,
-					   GUI_CallBack *callback, int flat)
+					   GUI_Font *font, int alignment, bool is_checkbutton,
+					   GUI_CallBack *callback, bool flat)
 	: GUI_Widget(data, x, y, w, h) {
 	callback_object = callback;
 
 	if (font != nullptr) {
 		buttonFont = font;
-		freefont = 0;
+		freefont = false;
 	} else {
 		buttonFont = new GUI_Font();
-		freefont = 1;
+		freefont = true;
 	}
 	flatbutton = flat;
-	freebutton = 1;
+	freebutton = true;
 	button = nullptr;
 	button2 = nullptr;
 
@@ -103,7 +83,7 @@ GUI_Button::GUI_Button(void *data, int x, int y, int w, int h, const char *text,
 	for (int i = 0; i < 3; ++i) {
 		pressed[i] = 0;
 	}
-	enabled = 1;
+	enabled = true;
 }
 
 GUI_Button::~GUI_Button() {
@@ -252,11 +232,11 @@ GUI_status GUI_Button::MouseMotion(int x, int y, uint8 state) {
 }
 
 void GUI_Button::Disable() {
-	enabled = 0;
+	enabled = false;
 	Redraw();
 }
 
-void GUI_Button::Enable(int flag) {
+void GUI_Button::Enable(bool flag) {
 	enabled = flag;
 	Redraw();
 }
@@ -282,8 +262,9 @@ Graphics::ManagedSurface *GUI_Button::CreateTextButtonImage(int style, const cha
 	buttonFont->setColoring(0, 0, 0);
 	buttonFont->setTransparency(true);
 	buttonFont->textExtent(text, &tw, &th);
-	if (tw > (area.width() - (4 + is_checkable * 16))) {
-		int n = (area.width() - (4 + is_checkable * 16)) / buttonFont->charWidth();
+	int checkable = (is_checkable ? 1 : 0);
+	if (tw > (area.width() - (4 + checkable * 16))) {
+		int n = (area.width() - (4 + checkable * 16)) / buttonFont->charWidth();
 		duptext = new char[n + 1];
 		strncpy(duptext, text, n);
 		duptext[n] = 0;
@@ -295,7 +276,7 @@ Graphics::ManagedSurface *GUI_Button::CreateTextButtonImage(int style, const cha
 	}
 	switch (alignment) {
 	case BUTTON_TEXTALIGN_LEFT:
-		tx = 4 + (is_checkable * 16);
+		tx = 4 + (checkable * 16);
 		break;
 	case BUTTON_TEXTALIGN_CENTER:
 		tx = (area.width() - tw) >> 1;
diff --git a/engines/ultima/nuvie/gui/gui_button.h b/engines/ultima/nuvie/gui/gui_button.h
index 9e5feb4a4db..06039e06cc1 100644
--- a/engines/ultima/nuvie/gui/gui_button.h
+++ b/engines/ultima/nuvie/gui/gui_button.h
@@ -80,8 +80,8 @@ public:
 	   an alignment (one of the constants above), if it should be a checkbutton (1/0),
 	   the callback and a flag if it should be 2D (1) or 3D (0) */
 	GUI_Button(void *data, int x, int y, int w, int h, const char *text,
-	           GUI_Font *font, int alignment, int is_checkbutton,
-	           GUI_CallBack *callback, int flat = 0);
+	           GUI_Font *font, int alignment, bool is_checkbutton,
+	           GUI_CallBack *callback, bool flat = false);
 
 	~GUI_Button() override;
 
@@ -98,15 +98,15 @@ public:
 
 	/* Clickable or not ... */
 	virtual void Disable();
-	virtual void Enable(int flag = 1);
+	virtual void Enable(bool flag = true);
 
 	/* yields current state */
-	virtual int Enabled() {
+	virtual bool Enabled() {
 		return enabled;
 	}
 
 	/* yields flag if button is a checkbutton */
-	virtual int IsCheckButton() {
+	virtual bool IsCheckButton() {
 		return is_checkable;
 	}
 	virtual void set_highlighted(bool val) {
@@ -128,12 +128,13 @@ protected:
 	GUI_CallBack *callback_object;
 
 	/* remember me! - flags */
-	int enabled;
-	int flatbutton;
-	int freebutton, freefont;
+	bool enabled;
+	bool flatbutton;
+	bool freebutton;
+	bool freefont;
 
 	/* Checkbutton flags */
-	int is_checkable;
+	bool is_checkable;
 	int checked;
 	bool is_highlighted;
 };
diff --git a/engines/ultima/nuvie/gui/gui_dialog.cpp b/engines/ultima/nuvie/gui/gui_dialog.cpp
index 4527c08149b..2648de0ed5a 100644
--- a/engines/ultima/nuvie/gui/gui_dialog.cpp
+++ b/engines/ultima/nuvie/gui/gui_dialog.cpp
@@ -29,17 +29,9 @@ namespace Ultima {
 namespace Nuvie {
 
 GUI_Dialog::GUI_Dialog(int x, int y, int w, int h, uint8 r, uint8 g, uint8 b, bool is_moveable)
-	: GUI_Widget(nullptr, x, y, w, h) {
-
-	R = r;
-	G = g;
-	B = b;
-	bg_color = 0;
-	drag = false;
-	can_drag = is_moveable;
-	button_x = button_y = 0;
-	old_x = old_y = -1;
-	backingstore = nullptr;
+	: GUI_Widget(nullptr, x, y, w, h), R(r), G(g), B(b), bg_color(0), drag(false),
+	  can_drag(is_moveable), button_x(0), button_y(0), old_x(-1), old_y(-1),
+	  backingstore(nullptr) {
 	backingstore_rect.setWidth(w);
 	backingstore_rect.setHeight(h);
 	loadBorderImages();
diff --git a/engines/ultima/nuvie/gui/gui_drag_manager.cpp b/engines/ultima/nuvie/gui/gui_drag_manager.cpp
index 00c8131cc1a..b03fd414c0c 100644
--- a/engines/ultima/nuvie/gui/gui_drag_manager.cpp
+++ b/engines/ultima/nuvie/gui/gui_drag_manager.cpp
@@ -29,13 +29,8 @@
 namespace Ultima {
 namespace Nuvie {
 
-GUI_DragManager::GUI_DragManager(Screen *s) {
-	screen = s;
-
-	message = 0;
-	data = nullptr;
-	drag_source = nullptr;
-	is_out_of_range = false;
+GUI_DragManager::GUI_DragManager(Screen *s): screen(s), message(0),
+		data(nullptr), drag_source(nullptr), is_out_of_range(false) {
 }
 
 GUI_status GUI_DragManager::start_drag(GUI_DragArea *src, int msg, void *d, unsigned char *icon_buf, uint16 w, uint16 h, uint8 bpp, bool out_of_range) {
diff --git a/engines/ultima/nuvie/gui/gui_font.cpp b/engines/ultima/nuvie/gui/gui_font.cpp
index 54d35eaa2a5..4b9aaec301e 100644
--- a/engines/ultima/nuvie/gui/gui_font.cpp
+++ b/engines/ultima/nuvie/gui/gui_font.cpp
@@ -29,11 +29,9 @@ namespace Ultima {
 namespace Nuvie {
 
 /* use default 8x8 font */
-GUI_Font::GUI_Font(uint8 fontType) {
+GUI_Font::GUI_Font(uint8 fontType) : _wData(nullptr) {
 	Graphics::ManagedSurface *temp;
 
-	_wData = nullptr;
-
 	if (fontType == GUI_FONT_6X8)
 		temp = GUI_Font6x8();
 	else if (fontType == GUI_FONT_GUMP) {
@@ -42,7 +40,6 @@ GUI_Font::GUI_Font(uint8 fontType) {
 	} else
 		temp = GUI_DefaultFont();
 
-
 	_fontStore = SDL_ConvertSurface(temp, temp->format, SDL_SWSURFACE);
 	_charH = _fontStore->h / 16;
 	_charW = _fontStore->w / 16;
diff --git a/engines/ultima/nuvie/gui/gui_scroller.cpp b/engines/ultima/nuvie/gui/gui_scroller.cpp
index 531a0567711..2fb94b10e28 100644
--- a/engines/ultima/nuvie/gui/gui_scroller.cpp
+++ b/engines/ultima/nuvie/gui/gui_scroller.cpp
@@ -31,16 +31,9 @@ namespace Ultima {
 namespace Nuvie {
 
 GUI_Scroller::GUI_Scroller(int x, int y, int w, int h, uint8 r, uint8 g, uint8 b, uint16 r_height)
-	: GUI_Widget(nullptr, x, y, w, h) {
-
-	R = r;
-	G = g;
-	B = b;
-	bg_color = 0;
-	row_height = r_height;
+	: GUI_Widget(nullptr, x, y, w, h), R(r), G(g), B(b), bg_color(0),
+	  row_height(r_height), num_rows(0), disp_offset(0) {
 	rows_per_page = h / row_height;
-	num_rows = 0;
-	disp_offset = 0;
 	scroll_bar = new GUI_ScrollBar(area.width() - SCROLLBAR_WIDTH, 0, area.height(), this);
 
 	GUI_Widget::AddWidget(scroll_bar); // we call the GUI_Widget::AddWidget method our method is for scroller container items.
diff --git a/engines/ultima/nuvie/gui/gui_text.cpp b/engines/ultima/nuvie/gui/gui_text.cpp
index 612d8ca74b4..b99cae5b302 100644
--- a/engines/ultima/nuvie/gui/gui_text.cpp
+++ b/engines/ultima/nuvie/gui/gui_text.cpp
@@ -39,21 +39,13 @@ GUI_Text:: GUI_Text(int x, int y, uint8 r, uint8 g, uint8 b, GUI_Font *gui_font,
 
 
 GUI_Text:: GUI_Text(int x, int y, uint8 r, uint8 g, uint8 b, const char *str, GUI_Font *gui_font, uint16 line_length)
-	: GUI_Widget(nullptr, x, y, 0, 0) {
-	int w, h;
-
-	R = r;
-	G = g;
-	B = b;
-	max_width = line_length;
-
-	font = gui_font;
-
+	: GUI_Widget(nullptr, x, y, 0, 0), R(r), G(g), B(b), max_width(line_length),
+	  font(gui_font) {
 	text = scumm_strdup(str);
-
 	if (text == nullptr)
 		error("GUI_Text: failed to allocate memory for text\n");
 
+	int w, h;
 	font->textExtent(text, &w, &h, max_width);
 
 	area.setWidth(w);
diff --git a/engines/ultima/nuvie/gui/gui_text_toggle_button.cpp b/engines/ultima/nuvie/gui/gui_text_toggle_button.cpp
index 10a36568f37..91669ccbc2e 100644
--- a/engines/ultima/nuvie/gui/gui_text_toggle_button.cpp
+++ b/engines/ultima/nuvie/gui/gui_text_toggle_button.cpp
@@ -29,15 +29,11 @@ GUI_TextToggleButton::GUI_TextToggleButton(void *data, int x, int y, int w, int
 		const char *const *texts_, int count_, int selection_,
 		GUI_Font *font, int alignment_,
 		GUI_CallBack *callback, int flat)
-	: GUI_Button(data, x, y, w, h, "", font, alignment_, 0, callback, flat) {
-	count = count_;
+	: GUI_Button(data, x, y, w, h, "", font, alignment_, 0, callback, flat), count(count_),
+	  selection(selection_), alignment(alignment_) {
 	assert(count > 0);
-
-	selection = selection_;
 	assert(selection >= 0 && selection < count);
 
-	alignment = alignment_;
-
 	texts = new char *[count];
 	for (int i = 0; i < count; ++i) {
 		int l = strlen(texts_[i]) + 1;
diff --git a/engines/ultima/nuvie/gui/gui_yes_no_dialog.cpp b/engines/ultima/nuvie/gui/gui_yes_no_dialog.cpp
index bec79742a56..afd8bb254d9 100644
--- a/engines/ultima/nuvie/gui/gui_yes_no_dialog.cpp
+++ b/engines/ultima/nuvie/gui/gui_yes_no_dialog.cpp
@@ -34,13 +34,10 @@ namespace Ultima {
 namespace Nuvie {
 
 GUI_YesNoDialog::GUI_YesNoDialog(GUI *gui, int x, int y, int w, int h, const char *msg,
-		CallBack *yesCallback, CallBack *noCallback) :
-	GUI_Dialog(x, y, w, h, 244, 216, 131, GUI_DIALOG_MOVABLE) {
+		CallBack *yesCallback, CallBack *noCallback)
+	: GUI_Dialog(x, y, w, h, 244, 216, 131, GUI_DIALOG_MOVABLE), b_index_num(-1),
+	  yes_callback_object(yesCallback), no_callback_object(noCallback) {
 	GUI_Widget *widget;
-	b_index_num = -1;
-
-	yes_callback_object = yesCallback;
-	no_callback_object = noCallback;
 
 	yes_button = new GUI_Button(this, 100, 50, 40, 18, "Yes", gui->get_font(), BUTTON_TEXTALIGN_CENTER, 0, this, 0);
 	AddWidget(yes_button);
diff --git a/engines/ultima/nuvie/gui/widgets/console.cpp b/engines/ultima/nuvie/gui/widgets/console.cpp
index 7bb4952d4a8..961b024f8d5 100644
--- a/engines/ultima/nuvie/gui/widgets/console.cpp
+++ b/engines/ultima/nuvie/gui/widgets/console.cpp
@@ -31,12 +31,7 @@ namespace Nuvie {
 static Console *g_console = nullptr;
 
 Console::Console(Configuration *c, Screen *s, GUI *g, uint16 x, uint16 y, uint16 w, uint16 h)
-	: GUI_Console(x, y, w, h) {
-	config = c;
-	screen = s;
-	gui = g;
-	displayConsole = true;
-
+	: GUI_Console(x, y, w, h), config(c), screen(s), gui(g), displayConsole(true) {
 	config->value("config/general/show_console", displayConsole, true);
 
 	if (displayConsole == false)
diff --git a/engines/ultima/nuvie/gui/widgets/map_window.cpp b/engines/ultima/nuvie/gui/widgets/map_window.cpp
index 868e36beb89..6eaa4c2c80d 100644
--- a/engines/ultima/nuvie/gui/widgets/map_window.cpp
+++ b/engines/ultima/nuvie/gui/widgets/map_window.cpp
@@ -120,7 +120,7 @@ MapWindow::MapWindow(Configuration *cfg, Map *m): GUI_Widget(nullptr, 0, 0, 0, 0
 		custom_actor_tiles(false), tmp_map_width(0), tmp_map_height(0), tile_manager(nullptr),
 		obj_manager(nullptr), actor_manager(nullptr), map_center_xoff(0), cursor_tile(nullptr),
 		use_tile(nullptr), win_width(0), win_height(0), border_width(0), hackmove(false),
-		wizard_eye_info({nullptr, 0, 0, 0, nullptr}) {
+		game_started(false), wizard_eye_info({nullptr, 0, 0, 0, nullptr}) {
 
 	config->value("config/GameType", game_type);
 
@@ -143,8 +143,6 @@ MapWindow::MapWindow(Configuration *cfg, Map *m): GUI_Widget(nullptr, 0, 0, 0, 0
 
 	roof_mode = Game::get_game()->is_roof_mode();
 
-	game_started = false;
-
 	set_interface();
 }
 
diff --git a/engines/ultima/nuvie/gui/widgets/msg_scroll.cpp b/engines/ultima/nuvie/gui/widgets/msg_scroll.cpp
index 221623e025b..ed91dae8515 100644
--- a/engines/ultima/nuvie/gui/widgets/msg_scroll.cpp
+++ b/engines/ultima/nuvie/gui/widgets/msg_scroll.cpp
@@ -37,15 +37,11 @@ namespace Ultima {
 namespace Nuvie {
 
 // MsgText Class
-MsgText::MsgText() {
-	font = nullptr;
-	color = 0;
+MsgText::MsgText() : font(nullptr), color(0) {
 }
 
-MsgText::MsgText(Std::string new_string, Font *f) {
+MsgText::MsgText(const Std::string &new_string, Font *f) : font(f), color(0) {
 	s.assign(new_string);
-	font = f;
-	color = 0;
 	if (font) {
 		color = font->getDefaultColor();
 	}
@@ -54,7 +50,7 @@ MsgText::MsgText(Std::string new_string, Font *f) {
 MsgText::~MsgText() {
 }
 
-void MsgText::append(Std::string new_string) {
+void MsgText::append(const Std::string &new_string) {
 	s.append(new_string);
 }
 
diff --git a/engines/ultima/nuvie/gui/widgets/msg_scroll.h b/engines/ultima/nuvie/gui/widgets/msg_scroll.h
index f53dd7fafa4..9de59a117b0 100644
--- a/engines/ultima/nuvie/gui/widgets/msg_scroll.h
+++ b/engines/ultima/nuvie/gui/widgets/msg_scroll.h
@@ -59,10 +59,10 @@ public:
 	uint8 color;
 
 	MsgText();
-	MsgText(Std::string new_string, Font *f);
+	MsgText(const Std::string &new_string, Font *f);
 	~MsgText();
 
-	void append(Std::string new_string);
+	void append(const Std::string &new_string);
 	void copy(MsgText *msg_text);
 	uint32 length();
 
diff --git a/engines/ultima/nuvie/menus/audio_dialog.cpp b/engines/ultima/nuvie/menus/audio_dialog.cpp
index 163fd60fa2f..de9e6242a07 100644
--- a/engines/ultima/nuvie/menus/audio_dialog.cpp
+++ b/engines/ultima/nuvie/menus/audio_dialog.cpp
@@ -47,8 +47,7 @@ namespace Nuvie {
 AudioDialog::AudioDialog(GUI_CallBack *callback)
 	: GUI_Dialog(Game::get_game()->get_game_x_offset() + (Game::get_game()->get_game_width() - AD_WIDTH) / 2,
 	             Game::get_game()->get_game_y_offset() + (Game::get_game()->get_game_height() - AD_HEIGHT) / 2,
-	             AD_WIDTH, AD_HEIGHT, 244, 216, 131, GUI_DIALOG_UNMOVABLE) {
-	callback_object = callback;
+	             AD_WIDTH, AD_HEIGHT, 244, 216, 131, GUI_DIALOG_UNMOVABLE), callback_object(callback) {
 	init();
 	grab_focus();
 }
diff --git a/engines/ultima/nuvie/menus/cheats_dialog.cpp b/engines/ultima/nuvie/menus/cheats_dialog.cpp
index 441afc320b4..17bacd4e9ad 100644
--- a/engines/ultima/nuvie/menus/cheats_dialog.cpp
+++ b/engines/ultima/nuvie/menus/cheats_dialog.cpp
@@ -47,8 +47,7 @@ namespace Nuvie {
 CheatsDialog::CheatsDialog(GUI_CallBack *callback)
 	: GUI_Dialog(Game::get_game()->get_game_x_offset() + (Game::get_game()->get_game_width() - CD_WIDTH) / 2,
 	             Game::get_game()->get_game_y_offset() + (Game::get_game()->get_game_height() - CD_HEIGHT) / 2,
-	             CD_WIDTH, CD_HEIGHT, 244, 216, 131, GUI_DIALOG_UNMOVABLE) {
-	callback_object = callback;
+	             CD_WIDTH, CD_HEIGHT, 244, 216, 131, GUI_DIALOG_UNMOVABLE), callback_object(callback) {
 	init();
 	grab_focus();
 }
diff --git a/engines/ultima/nuvie/menus/game_menu_dialog.cpp b/engines/ultima/nuvie/menus/game_menu_dialog.cpp
index 24bf10fb95d..6a20895c976 100644
--- a/engines/ultima/nuvie/menus/game_menu_dialog.cpp
+++ b/engines/ultima/nuvie/menus/game_menu_dialog.cpp
@@ -45,8 +45,7 @@ namespace Nuvie {
 GameMenuDialog::GameMenuDialog(CallBack *callback)
 	: GUI_Dialog(Game::get_game()->get_game_x_offset() + (Game::get_game()->get_game_width() - GMD_WIDTH) / 2,
 	             Game::get_game()->get_game_y_offset() + (Game::get_game()->get_game_height() - GMD_HEIGHT) / 2,
-	             GMD_WIDTH, GMD_HEIGHT, 244, 216, 131, GUI_DIALOG_UNMOVABLE) {
-	callback_object = callback;
+	             GMD_WIDTH, GMD_HEIGHT, 244, 216, 131, GUI_DIALOG_UNMOVABLE), callback_object(callback) {
 	init();
 	grab_focus();
 }
diff --git a/engines/ultima/nuvie/menus/gameplay_dialog.cpp b/engines/ultima/nuvie/menus/gameplay_dialog.cpp
index 6dc32171ba3..e2f31f9144c 100644
--- a/engines/ultima/nuvie/menus/gameplay_dialog.cpp
+++ b/engines/ultima/nuvie/menus/gameplay_dialog.cpp
@@ -48,8 +48,7 @@ namespace Nuvie {
 GameplayDialog::GameplayDialog(GUI_CallBack *callback)
 	: GUI_Dialog(Game::get_game()->get_game_x_offset() + (Game::get_game()->get_game_width() - GD_WIDTH) / 2,
 	             Game::get_game()->get_game_y_offset() + (Game::get_game()->get_game_height() - GD_HEIGHT) / 2,
-	             GD_WIDTH, GD_HEIGHT, 244, 216, 131, GUI_DIALOG_UNMOVABLE) {
-	callback_object = callback;
+	             GD_WIDTH, GD_HEIGHT, 244, 216, 131, GUI_DIALOG_UNMOVABLE), callback_object(callback) {
 	init();
 	grab_focus();
 }
diff --git a/engines/ultima/nuvie/menus/input_dialog.cpp b/engines/ultima/nuvie/menus/input_dialog.cpp
index e5b2e5494ff..cff91825830 100644
--- a/engines/ultima/nuvie/menus/input_dialog.cpp
+++ b/engines/ultima/nuvie/menus/input_dialog.cpp
@@ -48,8 +48,7 @@ namespace Nuvie {
 InputDialog::InputDialog(GUI_CallBack *callback)
 	: GUI_Dialog(Game::get_game()->get_game_x_offset() + (Game::get_game()->get_game_width() - ID_WIDTH) / 2,
 	             Game::get_game()->get_game_y_offset() + (Game::get_game()->get_game_height() - ID_HEIGHT) / 2,
-	             ID_WIDTH, ID_HEIGHT, 244, 216, 131, GUI_DIALOG_UNMOVABLE) {
-	callback_object = callback;
+	             ID_WIDTH, ID_HEIGHT, 244, 216, 131, GUI_DIALOG_UNMOVABLE), callback_object(callback) {
 	init();
 	grab_focus();
 }
diff --git a/engines/ultima/nuvie/menus/video_dialog.cpp b/engines/ultima/nuvie/menus/video_dialog.cpp
index 6b606f6d141..bbad067b8e7 100644
--- a/engines/ultima/nuvie/menus/video_dialog.cpp
+++ b/engines/ultima/nuvie/menus/video_dialog.cpp
@@ -49,9 +49,8 @@ namespace Nuvie {
 VideoDialog::VideoDialog(GUI_CallBack *callback)
 	: GUI_Dialog(Game::get_game()->get_game_x_offset() + (Game::get_game()->get_game_width() - VD_WIDTH) / 2,
 	             Game::get_game()->get_game_y_offset() + (Game::get_game()->get_game_height() - VD_HEIGHT) / 2,
-	             VD_WIDTH, VD_HEIGHT, 244, 216, 131, GUI_DIALOG_UNMOVABLE) {
-	callback_object = callback;
-	non_square_pixels_button = nullptr;
+	             VD_WIDTH, VD_HEIGHT, 244, 216, 131, GUI_DIALOG_UNMOVABLE), callback_object(callback),
+	             non_square_pixels_button(nullptr) {
 	init();
 	grab_focus();
 }
diff --git a/engines/ultima/nuvie/misc/u6_line_walker.cpp b/engines/ultima/nuvie/misc/u6_line_walker.cpp
index b0dba51361e..c64122a1dc2 100644
--- a/engines/ultima/nuvie/misc/u6_line_walker.cpp
+++ b/engines/ultima/nuvie/misc/u6_line_walker.cpp
@@ -24,16 +24,8 @@
 namespace Ultima {
 namespace Nuvie {
 
-U6LineWalker::U6LineWalker(uint32 sx, uint32 sy, uint32 ex, uint32 ey) {
-
-	start_x = sx;
-	start_y = sy;
-	end_x = ex;
-	end_y = ey;
-
-	cur_x = start_x;
-	cur_y = start_y;
-
+U6LineWalker::U6LineWalker(uint32 sx, uint32 sy, uint32 ex, uint32 ey)
+	: start_x(sx), start_y(sy), end_x(ex), end_y(ey), cur_x(sx), cur_y(sy), cur_step(0) {
 	sint32 delta_x = end_x - start_x;
 	sint32 delta_y = end_y - start_y;
 
@@ -68,8 +60,6 @@ U6LineWalker::U6LineWalker(uint32 sx, uint32 sy, uint32 ex, uint32 ey) {
 	line_counter = delta_y + delta_y - delta_x;
 	line_inc[0] = delta_y + delta_y;
 	line_inc[1] = (delta_y - delta_x) * 2;
-
-	cur_step = 0;
 }
 
 U6LineWalker::~U6LineWalker() {
diff --git a/engines/ultima/nuvie/misc/u6_list.cpp b/engines/ultima/nuvie/misc/u6_list.cpp
index 2fef4ba5cee..2f1ab923b6f 100644
--- a/engines/ultima/nuvie/misc/u6_list.cpp
+++ b/engines/ultima/nuvie/misc/u6_list.cpp
@@ -50,9 +50,7 @@ inline void deleteU6Link(U6Link *link) {
 	}
 }
 
-U6LList::U6LList() {
-	head = nullptr;
-	tail = nullptr;
+U6LList::U6LList() : head(nullptr), tail(nullptr) {
 }
 
 U6LList::~U6LList() {
diff --git a/engines/ultima/nuvie/misc/u6_misc.cpp b/engines/ultima/nuvie/misc/u6_misc.cpp
index 07b8a7517ec..6c4b26c8897 100644
--- a/engines/ultima/nuvie/misc/u6_misc.cpp
+++ b/engines/ultima/nuvie/misc/u6_misc.cpp
@@ -157,7 +157,7 @@ void stringToLower(Std::string &str) {
 	}
 }
 
-int mkdir_recursive(Std::string path, int mode) {
+int mkdir_recursive(const Std::string &path, int mode) {
 #ifdef TODO
 	vector<string> directories;
 	string tmp_path;
@@ -215,7 +215,7 @@ nuvie_game_t get_game_type(Configuration *config) {
 	return (nuvie_game_t)game_type;
 }
 
-void build_path(Std::string path, Std::string filename, Std::string &full_path) {
+void build_path(const Std::string &path, const Std::string &filename, Std::string &full_path) {
 	full_path = path;
 
 	if (full_path.length() > 0 && full_path[full_path.length() - 1] != U6PATH_DELIMITER)
diff --git a/engines/ultima/nuvie/misc/u6_misc.h b/engines/ultima/nuvie/misc/u6_misc.h
index 0fa2e31deb6..bdea061a95c 100644
--- a/engines/ultima/nuvie/misc/u6_misc.h
+++ b/engines/ultima/nuvie/misc/u6_misc.h
@@ -51,7 +51,7 @@ const char *get_game_tag(int game_type);
 void config_get_path(Configuration *config, const Std::string &filename, Std::string &path);
 uint8 get_game_type(const char *string);
 nuvie_game_t get_game_type(Configuration *config);
-void build_path(Std::string path, Std::string filename, Std::string &full_path);
+void build_path(const Std::string &path, const Std::string &filename, Std::string &full_path);
 bool directory_exists(const char *directory);
 bool file_exists(const char *path);
 void print_b(DebugLevelType level, uint8 num);
@@ -97,7 +97,7 @@ inline uint32 divide_time(uint32 this_time, uint32 &last_time, uint32 *passed_ti
 	return (fraction);
 }
 
-int mkdir_recursive(Std::string path, int mode);
+int mkdir_recursive(const Std::string &path, int mode);
 
 void draw_line_8bit(int sx, int sy, int ex, int ey, uint8 col, uint8 *pixels, uint16 w, uint16 h);
 
diff --git a/engines/ultima/nuvie/pathfinder/astar_path.cpp b/engines/ultima/nuvie/pathfinder/astar_path.cpp
index ef3c788edca..e732e090df7 100644
--- a/engines/ultima/nuvie/pathfinder/astar_path.cpp
+++ b/engines/ultima/nuvie/pathfinder/astar_path.cpp
@@ -28,7 +28,9 @@ namespace Ultima {
 namespace Nuvie {
 
 AStarPath::AStarPath() : final_node(0) {
-} void AStarPath::create_path() {
+}
+
+void AStarPath::create_path() {
 	astar_node *i = final_node; // iterator through steps, from back
 	delete_path();
 	Std::vector<astar_node *> reverse_list;
diff --git a/engines/ultima/nuvie/pathfinder/combat_path_finder.cpp b/engines/ultima/nuvie/pathfinder/combat_path_finder.cpp
index 232d685ce6f..dc68b4d6980 100644
--- a/engines/ultima/nuvie/pathfinder/combat_path_finder.cpp
+++ b/engines/ultima/nuvie/pathfinder/combat_path_finder.cpp
@@ -26,18 +26,14 @@ namespace Ultima {
 namespace Nuvie {
 
 CombatPathFinder::CombatPathFinder(Actor *a)
-	: ActorPathFinder(a, a->get_location()) {
-	target_mode = PATHFINDER_NONE;
-	max_dist = 0;
-	target = nullptr;
+	: ActorPathFinder(a, a->get_location()), target_mode(PATHFINDER_NONE),
+	  max_dist(0), target(nullptr) {
 }
 
 /* Without a mode set, CombatPathFinder is identical to ActorPathFinder. */
 CombatPathFinder::CombatPathFinder(Actor *a, Actor *t)
-	: ActorPathFinder(a, t->get_location()) {
-	target_mode = PATHFINDER_CHASE;
-	target = t;
-	max_dist = 0;
+	: ActorPathFinder(a, t->get_location()), target_mode(PATHFINDER_CHASE),
+	  target(t), max_dist(0) {
 }
 
 CombatPathFinder::~CombatPathFinder() {
diff --git a/engines/ultima/nuvie/pathfinder/party_path_finder.cpp b/engines/ultima/nuvie/pathfinder/party_path_finder.cpp
index 5a2cf579175..dfdeaac0fa7 100644
--- a/engines/ultima/nuvie/pathfinder/party_path_finder.cpp
+++ b/engines/ultima/nuvie/pathfinder/party_path_finder.cpp
@@ -32,9 +32,8 @@ namespace Nuvie {
 
 using Std::vector;
 
-PartyPathFinder::PartyPathFinder(Party *p) {
+PartyPathFinder::PartyPathFinder(Party *p) : party(p) {
 	assert(p);
-	party = p;
 }
 
 PartyPathFinder::~PartyPathFinder() {
diff --git a/engines/ultima/nuvie/portraits/portrait.cpp b/engines/ultima/nuvie/portraits/portrait.cpp
index 65d942a289d..f2a82f0986d 100644
--- a/engines/ultima/nuvie/portraits/portrait.cpp
+++ b/engines/ultima/nuvie/portraits/portrait.cpp
@@ -62,11 +62,7 @@ Portrait *newPortrait(nuvie_game_t gametype, Configuration *cfg) {
 }
 
 
-Portrait::Portrait(Configuration *cfg) {
-	config = cfg;
-	avatar_portrait_num = 0;
-	width = 0;
-	height = 0;
+Portrait::Portrait(Configuration *cfg) : config(cfg), avatar_portrait_num(0), width(0), height(0) {
 }
 
 uint8 Portrait::get_avatar_portrait_num() const {
diff --git a/engines/ultima/nuvie/save/save_game.cpp b/engines/ultima/nuvie/save/save_game.cpp
index 75e74132458..20e644d37e9 100644
--- a/engines/ultima/nuvie/save/save_game.cpp
+++ b/engines/ultima/nuvie/save/save_game.cpp
@@ -59,9 +59,7 @@ namespace Nuvie {
 #define GAME_ID(GT) ((GT == GAME_SAVAGE_EMPIRE) ? MKTAG16('S', 'E') : \
 	((GT == GAME_MARTIAN_DREAMS) ? MKTAG16('M', 'D') : MKTAG16('U', '6')))
 
-SaveGame::SaveGame(Configuration *cfg) {
-	config = cfg;
-
+SaveGame::SaveGame(Configuration *cfg) : config(cfg) {
 	// We don't need ObjManager here as there will be nothing to clean at this stage
 	init(nullptr);
 }
diff --git a/engines/ultima/nuvie/screen/dither.cpp b/engines/ultima/nuvie/screen/dither.cpp
index 9f541008041..f9b34c54be5 100644
--- a/engines/ultima/nuvie/screen/dither.cpp
+++ b/engines/ultima/nuvie/screen/dither.cpp
@@ -32,11 +32,7 @@ namespace Nuvie {
 static const uint8 dither_cga_tbl[0x10] =   {0, 3, 3, 3, 13, 13, 13, 3, 3, 13, 15, 3, 13, 13, 15, 15};
 //static const uint8 dither_cga_tbl[0x10] = {0,1,1,1,2 ,2 ,2 ,1,1,2 ,3 ,1,2 ,2 ,3, 3};
 
-Dither::Dither(Configuration *cfg) {
-	config = cfg;
-	dither = nullptr;
-	mode = DITHER_NONE;
-
+Dither::Dither(Configuration *cfg) : config(cfg), dither(nullptr), mode(DITHER_NONE) {
 	set_mode();
 
 	if (mode != DITHER_NONE)
diff --git a/engines/ultima/nuvie/screen/game_palette.cpp b/engines/ultima/nuvie/screen/game_palette.cpp
index fa57cd51ec5..937c55dd313 100644
--- a/engines/ultima/nuvie/screen/game_palette.cpp
+++ b/engines/ultima/nuvie/screen/game_palette.cpp
@@ -30,18 +30,13 @@
 namespace Ultima {
 namespace Nuvie {
 
-GamePalette::GamePalette(Screen *s, Configuration *cfg) {
-	screen = s;
-	config = cfg;
-
+GamePalette::GamePalette(Screen *s, Configuration *cfg) : screen(s), config(cfg), counter(0) {
 	palette = (uint8 *)malloc(768);
 	memset(palette, 0, 768);
 
-	this->loadPalette();
+	loadPalette();
 
 	set_palette();
-
-	counter = 0;
 }
 
 GamePalette::~GamePalette() {
diff --git a/engines/ultima/nuvie/script/script.cpp b/engines/ultima/nuvie/script/script.cpp
index e10e0e07b41..74f2ae60d5b 100644
--- a/engines/ultima/nuvie/script/script.cpp
+++ b/engines/ultima/nuvie/script/script.cpp
@@ -3214,7 +3214,7 @@ static int nscript_tileset_export(lua_State *L) {
 	build_path(path, get_game_tag(game->get_game_type()), path);
 
 	if (!directory_exists(path.c_str())) {
-		mkdir_recursive(path.c_str(), 0700);
+		mkdir_recursive(path, 0700);
 	}
 
 	build_path(path, "custom_tiles.bmp", path);
diff --git a/engines/ultima/nuvie/usecode/usecode.cpp b/engines/ultima/nuvie/usecode/usecode.cpp
index b64b305ab28..e4c781e2e78 100644
--- a/engines/ultima/nuvie/usecode/usecode.cpp
+++ b/engines/ultima/nuvie/usecode/usecode.cpp
@@ -32,20 +32,9 @@
 namespace Ultima {
 namespace Nuvie {
 
-UseCode::UseCode(Game *g, Configuration *cfg) {
-	game = g;
-	config = cfg;
-	obj_manager = nullptr;
-	map = nullptr;
-	player = nullptr;
-	scroll = nullptr;
-	actor_manager = nullptr;
-	obj_manager = nullptr;
-	party = nullptr;
-	script = nullptr;
-
-	script_thread = nullptr;
-
+UseCode::UseCode(Game *g, Configuration *cfg) : game(g), config(cfg),
+		obj_manager(nullptr), map(nullptr), player(nullptr), scroll(nullptr),
+		actor_manager(nullptr), party(nullptr), script(nullptr), script_thread(nullptr) {
 	clear_items();
 }
 
diff --git a/engines/ultima/nuvie/views/actor_view.cpp b/engines/ultima/nuvie/views/actor_view.cpp
index e19cf2f6b46..a2c7e5bb291 100644
--- a/engines/ultima/nuvie/views/actor_view.cpp
+++ b/engines/ultima/nuvie/views/actor_view.cpp
@@ -41,14 +41,11 @@ extern GUI_status partyViewButtonCallback(void *data);
 #define MD Game::get_game()->get_game_type()==NUVIE_GAME_MD
 
 
-ActorView::ActorView(Configuration *cfg) : View(cfg) {
-	portrait = nullptr;
-	portrait_data = nullptr;
-	in_party = false;
+ActorView::ActorView(Configuration *cfg) : View(cfg), portrait(nullptr),
+		portrait_data(nullptr), in_party(false), cursor_tile(nullptr),
+		show_cursor(false) {
 	cursor_pos.x = 2;
 	cursor_pos.px = cursor_pos.py = 0;
-	cursor_tile = nullptr;
-	show_cursor = false;
 }
 
 ActorView::~ActorView() {
diff --git a/engines/ultima/nuvie/views/container_view_gump.cpp b/engines/ultima/nuvie/views/container_view_gump.cpp
index a78d07c8a96..bee8428f4df 100644
--- a/engines/ultima/nuvie/views/container_view_gump.cpp
+++ b/engines/ultima/nuvie/views/container_view_gump.cpp
@@ -45,7 +45,6 @@ ContainerViewGump::ContainerViewGump(Configuration *cfg) : DraggableView(cfg),
 		doll_button(nullptr), left_arrow_button(nullptr),
 		right_arrow_button(nullptr), container_widget(nullptr), font(nullptr),
 		actor(nullptr), container_obj(nullptr), container_widget_y_offset(0) {
-	bg_image = nullptr;
 }
 
 ContainerViewGump::~ContainerViewGump() {
diff --git a/engines/ultima/nuvie/views/doll_view_gump.cpp b/engines/ultima/nuvie/views/doll_view_gump.cpp
index 06f3232038d..fe3ff5a7f88 100644
--- a/engines/ultima/nuvie/views/doll_view_gump.cpp
+++ b/engines/ultima/nuvie/views/doll_view_gump.cpp
@@ -35,16 +35,12 @@
 namespace Ultima {
 namespace Nuvie {
 
-DollViewGump::DollViewGump(Configuration *cfg) : DraggableView(cfg),
-	gump_button(nullptr), combat_button(nullptr), heart_button(nullptr), party_button(nullptr), inventory_button(nullptr),
-	doll_widget(nullptr), font(nullptr), actor(nullptr), cursor_tile(nullptr) {
-	bg_image = nullptr;
-	actor_doll = nullptr;
-	is_avatar = false;
-	show_cursor = true;
-	cursor_pos = CURSOR_HEAD;
-	cursor_xoff = 50;
-	cursor_yoff = 16;
+DollViewGump::DollViewGump(Configuration *cfg)
+    : DraggableView(cfg), gump_button(nullptr), combat_button(nullptr),
+      heart_button(nullptr), party_button(nullptr), inventory_button(nullptr),
+	  doll_widget(nullptr), actor_doll(nullptr), font(nullptr), actor(nullptr),
+	  cursor_tile(nullptr), is_avatar(false), show_cursor(true),
+	  cursor_pos(CURSOR_HEAD), cursor_xoff(50), cursor_yoff(16) {
 }
 
 DollViewGump::~DollViewGump() {
diff --git a/engines/ultima/nuvie/views/inventory_view.cpp b/engines/ultima/nuvie/views/inventory_view.cpp
index 3c4b28f710e..6179e9f187d 100644
--- a/engines/ultima/nuvie/views/inventory_view.cpp
+++ b/engines/ultima/nuvie/views/inventory_view.cpp
@@ -43,17 +43,14 @@ static const char combat_mode_tbl_se[][6] = {"CMND", "RANGE", "FLEE", "CLOSE"};
 static const char combat_mode_tbl_md[][6] = {"CMND", "RANGE", "FLEE", "ATTK"};
 #define MD Game::get_game()->get_game_type()==NUVIE_GAME_MD
 
-InventoryView::InventoryView(Configuration *cfg) : View(cfg),
-	doll_widget(nullptr), inventory_widget(nullptr), combat_button(nullptr) {
+InventoryView::InventoryView(Configuration *cfg)
+	: View(cfg), doll_widget(nullptr), inventory_widget(nullptr),
+	  combat_button(nullptr), cursor_tile(nullptr), show_cursor(false),
+	  is_party_member(false), picking_pocket(false), outside_actor(nullptr),
+	  lock_actor(false) {
 	cursor_pos.area = INVAREA_LIST;
 	cursor_pos.x = cursor_pos.y = 0;
 	cursor_pos.px = cursor_pos.py = 0;
-	cursor_tile = nullptr;
-	show_cursor = false;
-	is_party_member = false;
-	picking_pocket = false;
-	outside_actor = nullptr;
-	lock_actor = false;
 }
 
 InventoryView::~InventoryView() {
diff --git a/engines/ultima/nuvie/views/md_sky_strip_widget.cpp b/engines/ultima/nuvie/views/md_sky_strip_widget.cpp
index 3707291de72..0998baaea88 100644
--- a/engines/ultima/nuvie/views/md_sky_strip_widget.cpp
+++ b/engines/ultima/nuvie/views/md_sky_strip_widget.cpp
@@ -30,10 +30,8 @@
 namespace Ultima {
 namespace Nuvie {
 
-MDSkyStripWidget::MDSkyStripWidget(Configuration *cfg, GameClock *c, Player *p): GUI_Widget(nullptr, 0, 0, 0, 0) {
-	config = cfg;
-	clock = c;
-	player = p;
+MDSkyStripWidget::MDSkyStripWidget(Configuration *cfg, GameClock *c, Player *p)
+	: GUI_Widget(nullptr, 0, 0, 0, 0), config(cfg), player(p), _clock(c) {
 }
 
 MDSkyStripWidget::~MDSkyStripWidget() {
@@ -72,8 +70,8 @@ void MDSkyStripWidget::Display(bool full_redraw) {
 void MDSkyStripWidget::display_surface() {
 	uint16 w, h;
 	strip1.get_size(&w, &h);
-	uint8 hour = clock->get_hour();
-	uint8 minute = clock->get_minute();
+	uint8 hour = _clock->get_hour();
+	uint8 minute = _clock->get_minute();
 	unsigned char *shp_data = hour < 12 ? strip1.get_data() : strip2.get_data();
 
 	if (hour >= 12) {
diff --git a/engines/ultima/nuvie/views/md_sky_strip_widget.h b/engines/ultima/nuvie/views/md_sky_strip_widget.h
index 643cbc126c4..204007d1a66 100644
--- a/engines/ultima/nuvie/views/md_sky_strip_widget.h
+++ b/engines/ultima/nuvie/views/md_sky_strip_widget.h
@@ -36,7 +36,7 @@ class MDSkyStripWidget : public GUI_Widget {
 
 protected:
 	Configuration *config;
-	GameClock *clock;
+	GameClock *_clock;
 	U6Shape strip1, strip2;
 	Player *player;
 
diff --git a/engines/ultima/nuvie/views/party_view.cpp b/engines/ultima/nuvie/views/party_view.cpp
index fd59863e279..82994f37d70 100644
--- a/engines/ultima/nuvie/views/party_view.cpp
+++ b/engines/ultima/nuvie/views/party_view.cpp
@@ -46,12 +46,9 @@ extern GUI_status actorViewButtonCallback(void *data);
 #define SE Game::get_game()->get_game_type()==NUVIE_GAME_SE
 #define MD Game::get_game()->get_game_type()==NUVIE_GAME_MD
 
-PartyView::PartyView(Configuration *cfg) : View(cfg) {
-	player = nullptr;
-	view_manager = nullptr;
-	party_view_targeting = false;
-	row_offset = 0;
-	sun_moon_widget = nullptr;
+PartyView::PartyView(Configuration *cfg) : View(cfg), player(nullptr),
+		view_manager(nullptr), party_view_targeting(false), row_offset(0),
+		sun_moon_widget(nullptr) {
 }
 
 PartyView::~PartyView() {
diff --git a/engines/ultima/nuvie/views/portrait_view_gump.cpp b/engines/ultima/nuvie/views/portrait_view_gump.cpp
index ead7d6f99f4..7d07a2a7d8c 100644
--- a/engines/ultima/nuvie/views/portrait_view_gump.cpp
+++ b/engines/ultima/nuvie/views/portrait_view_gump.cpp
@@ -35,17 +35,10 @@
 namespace Ultima {
 namespace Nuvie {
 
-PortraitViewGump::PortraitViewGump(Configuration *cfg) : DraggableView(cfg) {
-	portrait = nullptr;
-	font = nullptr;
-	gump_button = nullptr;
-	portrait_data = nullptr;
-	actor = nullptr;
-	cursor_tile = nullptr;
-	show_cursor = true;
-	cursor_pos = CURSOR_CHECK;
-	cursor_xoff = 1;
-	cursor_yoff = 67;
+PortraitViewGump::PortraitViewGump(Configuration *cfg) : DraggableView(cfg),
+		portrait(nullptr), font(nullptr), gump_button(nullptr), portrait_data(nullptr),
+		actor(nullptr), cursor_tile(nullptr), show_cursor(true),
+		cursor_pos(CURSOR_CHECK), cursor_xoff(1), cursor_yoff(67) {
 }
 
 PortraitViewGump::~PortraitViewGump() {
diff --git a/engines/ultima/nuvie/views/scroll_view_gump.cpp b/engines/ultima/nuvie/views/scroll_view_gump.cpp
index b41721196d5..1dee1a856f0 100644
--- a/engines/ultima/nuvie/views/scroll_view_gump.cpp
+++ b/engines/ultima/nuvie/views/scroll_view_gump.cpp
@@ -34,8 +34,7 @@ namespace Nuvie {
 #define SIGN_BG_W (SCROLLWIDGETGUMP_W + 16)
 #define SIGN_BG_H (SCROLLWIDGETGUMP_H + 16)
 
-ScrollViewGump::ScrollViewGump(Configuration *cfg) : DraggableView(cfg) {
-	scroll_widget = nullptr;
+ScrollViewGump::ScrollViewGump(Configuration *cfg) : DraggableView(cfg), scroll_widget(nullptr) {
 }
 
 ScrollViewGump::~ScrollViewGump() {
diff --git a/engines/ultima/nuvie/views/sign_view_gump.cpp b/engines/ultima/nuvie/views/sign_view_gump.cpp
index ca09d5751ed..d7e1db9ccaf 100644
--- a/engines/ultima/nuvie/views/sign_view_gump.cpp
+++ b/engines/ultima/nuvie/views/sign_view_gump.cpp
@@ -33,7 +33,7 @@ namespace Nuvie {
 #define SIGN_BG_W 246
 #define SIGN_BG_H 101
 
-SignViewGump::SignViewGump(Configuration *cfg) : DraggableView(cfg) {
+SignViewGump::SignViewGump(Configuration *cfg) : DraggableView(cfg), sign_text(nullptr) {
 	font = new BMPFont();
 
 	Std::string datadir = GUI::get_gui()->get_data_dir();
@@ -50,8 +50,6 @@ SignViewGump::SignViewGump(Configuration *cfg) : DraggableView(cfg) {
 	build_path(datadir, "sign_font", imagefile);
 
 	((BMPFont *)font)->init(imagefile, true);
-
-	sign_text = nullptr;
 }
 
 SignViewGump::~SignViewGump() {
diff --git a/engines/ultima/nuvie/views/spell_view.cpp b/engines/ultima/nuvie/views/spell_view.cpp
index c508df922a7..ddae192e4b2 100644
--- a/engines/ultima/nuvie/views/spell_view.cpp
+++ b/engines/ultima/nuvie/views/spell_view.cpp
@@ -48,18 +48,12 @@ namespace Nuvie {
 static const char circle_num_tbl[][8] = {"1ST", "2ND", "3RD", "4TH", "5TH", "6TH", "7TH", "8TH"};
 static const int obj_n_reagent[8] = {OBJ_U6_MANDRAKE_ROOT, OBJ_U6_NIGHTSHADE, OBJ_U6_BLACK_PEARL, OBJ_U6_BLOOD_MOSS, OBJ_U6_SPIDER_SILK, OBJ_U6_GARLIC, OBJ_U6_GINSENG, OBJ_U6_SULFUROUS_ASH};
 
-#define NEWMAGIC_BMP_W 144
-#define NEWMAGIC_BMP_H 82
-
-SpellView::SpellView(Configuration *cfg) : DraggableView(cfg) {
-	spell_container = nullptr;
-	background = nullptr;
-	level = 1;
-	all_spells_mode = false;
-	spell_num = 0;
-	event_mode = false;
-	num_spells_per_page = 8;
-	caster = nullptr;
+static const int NEWMAGIC_BMP_W = 144;
+static const int NEWMAGIC_BMP_H = 82;
+
+SpellView::SpellView(Configuration *cfg) : DraggableView(cfg), spell_container(nullptr),
+		background(nullptr), level(1), all_spells_mode(false), spell_num(0),
+		event_mode(false), num_spells_per_page(8), caster(nullptr) {
 }
 
 SpellView::~SpellView() {
diff --git a/engines/ultima/nuvie/views/spell_view_gump.cpp b/engines/ultima/nuvie/views/spell_view_gump.cpp
index 5d290334b59..1789884aad6 100644
--- a/engines/ultima/nuvie/views/spell_view_gump.cpp
+++ b/engines/ultima/nuvie/views/spell_view_gump.cpp
@@ -32,15 +32,10 @@
 namespace Ultima {
 namespace Nuvie {
 
-#define NEWMAGIC_BMP_W 144
-#define NEWMAGIC_BMP_H 82
-
-SpellViewGump::SpellViewGump(Configuration *cfg) : SpellView(cfg) {
+SpellViewGump::SpellViewGump(Configuration *cfg) : SpellView(cfg),
+		gump_button(nullptr), font(nullptr), selected_spell(-1) {
 	num_spells_per_page = 10;
 	bg_image = nullptr;
-	gump_button = nullptr;
-	font = nullptr;
-	selected_spell = -1;
 }
 
 SpellViewGump::~SpellViewGump() {
diff --git a/engines/ultima/nuvie/views/sun_moon_ribbon.cpp b/engines/ultima/nuvie/views/sun_moon_ribbon.cpp
index dfbb465b54d..50346261700 100644
--- a/engines/ultima/nuvie/views/sun_moon_ribbon.cpp
+++ b/engines/ultima/nuvie/views/sun_moon_ribbon.cpp
@@ -37,11 +37,9 @@ namespace Nuvie {
 #define SUNMOON_RIBBON_DIR_WIDTH 14
 #define SUNMOON_RIBBON_TOTAL_WIDTH (SUNMOON_RIBBON_WIDTH + SUNMOON_RIBBON_DIR_WIDTH)
 
-SunMoonRibbon::SunMoonRibbon(Player *p, Weather *w, TileManager *tm): SunMoonStripWidget(p, tm) {
-	bg_data = nullptr;
-	weather = w;
-	retracted = true;
-	current_time = 0;
+SunMoonRibbon::SunMoonRibbon(Player *p, Weather *w, TileManager *tm)
+	: SunMoonStripWidget(p, tm), bg_data(nullptr), weather(w), retracted(true),
+	  current_time(0) {
 }
 
 SunMoonRibbon::~SunMoonRibbon() {
@@ -104,8 +102,8 @@ void SunMoonRibbon::Display(bool full_redraw) {
 }
 
 void SunMoonRibbon::update_hour(uint16 time) {
-	uint8 dawn_tbl[] = {8, 7, 7, 6, 5, 4, 3, 2, 1, 0};
-	uint8 dusk_tbl[] = {1, 2, 3, 4, 5, 6, 7, 7, 7, 8};
+	static const uint8 dawn_tbl[] = {8, 7, 7, 6, 5, 4, 3, 2, 1, 0};
+	static const uint8 dusk_tbl[] = {1, 2, 3, 4, 5, 6, 7, 7, 7, 8};
 
 	time = time / 6;
 
@@ -124,7 +122,7 @@ void SunMoonRibbon::update_hour(uint16 time) {
 }
 
 void SunMoonRibbon::display_sun_moon(const Tile *tile, uint8 pos) {
-	struct {
+	static const struct {
 		sint16 x, y;
 	} skypos[15] = { // sky positions relative to area
 		{ SUNMOON_RIBBON_WIDTH - 0 * 3, 7 },
@@ -150,12 +148,8 @@ void SunMoonRibbon::display_sun_moon(const Tile *tile, uint8 pos) {
 }
 
 void SunMoonRibbon::display_surface_strip() {
-	Common::Rect src;
-	Common::Rect dest;
-
-	src = Common::Rect(SUNMOON_RIBBON_WIDTH, SUNMOON_RIBBON_HEIGHT);
-
-	dest = area;
+	Common::Rect src = Common::Rect(SUNMOON_RIBBON_WIDTH, SUNMOON_RIBBON_HEIGHT);
+	Common::Rect dest = area;
 	dest.setWidth(SUNMOON_RIBBON_WIDTH);
 	dest.setHeight(SUNMOON_RIBBON_HEIGHT);
 
diff --git a/engines/ultima/nuvie/views/sun_moon_strip_widget.cpp b/engines/ultima/nuvie/views/sun_moon_strip_widget.cpp
index 88e19cbb63c..b9825b5527e 100644
--- a/engines/ultima/nuvie/views/sun_moon_strip_widget.cpp
+++ b/engines/ultima/nuvie/views/sun_moon_strip_widget.cpp
@@ -28,9 +28,8 @@
 namespace Ultima {
 namespace Nuvie {
 
-SunMoonStripWidget::SunMoonStripWidget(Player *p, TileManager *tm): GUI_Widget(nullptr, 0, 0, 0, 0) {
-	player = p;
-	tile_manager = tm;
+SunMoonStripWidget::SunMoonStripWidget(Player *p, TileManager *tm)
+	: GUI_Widget(nullptr, 0, 0, 0, 0), player(p), tile_manager(tm) {
 }
 
 SunMoonStripWidget::~SunMoonStripWidget() {
diff --git a/engines/ultima/nuvie/views/view.cpp b/engines/ultima/nuvie/views/view.cpp
index e8a2607dd9b..d2ba37ee3e7 100644
--- a/engines/ultima/nuvie/views/view.cpp
+++ b/engines/ultima/nuvie/views/view.cpp
@@ -33,20 +33,11 @@
 namespace Ultima {
 namespace Nuvie {
 
-View::View(Configuration *cfg) : GUI_Widget(nullptr, 0, 0, 0, 0) {
-	config = cfg;
-	new_ui_mode = false;
-	left_button = nullptr;
-	font = nullptr;
-	tile_manager = nullptr;
-	right_button = nullptr;
-	obj_manager = nullptr;
-	party = nullptr;
-	party_button = nullptr;
-	inventory_button = nullptr;
-	actor_button = nullptr;
-	bg_color = 0;
-	cur_party_member = 0;
+View::View(Configuration *cfg) : GUI_Widget(nullptr, 0, 0, 0, 0),
+		config(cfg), new_ui_mode(false), left_button(nullptr), font(nullptr),
+		tile_manager(nullptr), right_button(nullptr), obj_manager(nullptr),
+		party(nullptr), party_button(nullptr), inventory_button(nullptr),
+		actor_button(nullptr), bg_color(0), cur_party_member(0) {
 }
 
 View::~View() {
diff --git a/engines/ultima/nuvie/views/view_manager.cpp b/engines/ultima/nuvie/views/view_manager.cpp
index 2ff788bc475..7b0e00a4611 100644
--- a/engines/ultima/nuvie/views/view_manager.cpp
+++ b/engines/ultima/nuvie/views/view_manager.cpp
@@ -50,24 +50,13 @@
 namespace Ultima {
 namespace Nuvie {
 
-ViewManager::ViewManager(Configuration *cfg) {
-	config = cfg;
+ViewManager::ViewManager(Configuration *cfg) : config(cfg),
+		current_view(nullptr), gui(nullptr), font(nullptr), tile_manager(nullptr),
+		obj_manager(nullptr), party(nullptr), portrait(nullptr), actor_view(nullptr),
+		inventory_view(nullptr), portrait_view(nullptr), party_view(nullptr),
+		spell_view(nullptr), doll_next_party_member(0), ribbon(nullptr),
+		mdSkyWidget(nullptr) {
 	config->value("config/GameType", game_type);
-	current_view = nullptr;
-	gui = nullptr;
-	font = nullptr;
-	tile_manager = nullptr;
-	obj_manager = nullptr;
-	party = nullptr;
-	portrait = nullptr;
-	actor_view = nullptr;
-	inventory_view = nullptr;
-	portrait_view = nullptr;
-	party_view = nullptr;
-	spell_view = nullptr;
-	doll_next_party_member = 0;
-	ribbon = nullptr;
-	mdSkyWidget = nullptr;
 }
 
 ViewManager::~ViewManager() {


Commit: 112238ef18d22548f901e7284ee7d6bf5793cd7c
    https://github.com/scummvm/scummvm/commit/112238ef18d22548f901e7284ee7d6bf5793cd7c
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2023-12-09T13:56:06+11:00

Commit Message:
ULTIMA: NUVIE: Remove redundant casts for new widgets

These should all be subclasses of GUI_Widget so the explicit casts are not
needed.

Changed paths:
    engines/ultima/nuvie/core/events.cpp
    engines/ultima/nuvie/gui/gui_yes_no_dialog.cpp
    engines/ultima/nuvie/menus/audio_dialog.cpp
    engines/ultima/nuvie/menus/cheats_dialog.cpp
    engines/ultima/nuvie/menus/game_menu_dialog.cpp
    engines/ultima/nuvie/menus/gameplay_dialog.cpp
    engines/ultima/nuvie/menus/input_dialog.cpp
    engines/ultima/nuvie/menus/video_dialog.cpp


diff --git a/engines/ultima/nuvie/core/events.cpp b/engines/ultima/nuvie/core/events.cpp
index d52ca1f524c..3309f6687b8 100644
--- a/engines/ultima/nuvie/core/events.cpp
+++ b/engines/ultima/nuvie/core/events.cpp
@@ -2437,7 +2437,7 @@ void Events::quitDialog() {
 
 		x_off += (game->get_game_width() - 170) / 2;
 		y_off += (game->get_game_height() - 80) / 2;
-		quit_dialog = (GUI_Widget *) new GUI_YesNoDialog(gui,
+		quit_dialog = new GUI_YesNoDialog(gui,
 		              x_off,
 		              y_off,
 		              170,
diff --git a/engines/ultima/nuvie/gui/gui_yes_no_dialog.cpp b/engines/ultima/nuvie/gui/gui_yes_no_dialog.cpp
index afd8bb254d9..1f11e624037 100644
--- a/engines/ultima/nuvie/gui/gui_yes_no_dialog.cpp
+++ b/engines/ultima/nuvie/gui/gui_yes_no_dialog.cpp
@@ -47,7 +47,7 @@ GUI_YesNoDialog::GUI_YesNoDialog(GUI *gui, int x, int y, int w, int h, const cha
 	AddWidget(no_button);
 	button_index[1] = no_button;
 
-	widget = (GUI_Widget *) new GUI_Text(10, 25, 0, 0, 0, msg, gui->get_font());
+	widget = new GUI_Text(10, 25, 0, 0, 0, msg, gui->get_font());
 	AddWidget(widget);
 }
 
diff --git a/engines/ultima/nuvie/menus/audio_dialog.cpp b/engines/ultima/nuvie/menus/audio_dialog.cpp
index de9e6242a07..96573c23c6c 100644
--- a/engines/ultima/nuvie/menus/audio_dialog.cpp
+++ b/engines/ultima/nuvie/menus/audio_dialog.cpp
@@ -65,27 +65,27 @@ bool AudioDialog::init() {
 	GUI_Widget *widget;
 	GUI_Font *font = GUI::get_gui()->get_font();
 
-	widget = (GUI_Widget *) new GUI_Text(textX[0], textY, 0, 0, 0, "Audio:", font);
+	widget = new GUI_Text(textX[0], textY, 0, 0, 0, "Audio:", font);
 	AddWidget(widget);
-	widget = (GUI_Widget *) new GUI_Text(textX[1], textY += row_h, 0, 0, 0, "Enable music:", font);
+	widget = new GUI_Text(textX[1], textY += row_h, 0, 0, 0, "Enable music:", font);
 	AddWidget(widget);
-	widget = (GUI_Widget *) new GUI_Text(textX[2], textY += row_h, 0, 0, 0, "Music volume:", font);
+	widget = new GUI_Text(textX[2], textY += row_h, 0, 0, 0, "Music volume:", font);
 	AddWidget(widget);
-	widget = (GUI_Widget *) new GUI_Text(textX[2], textY += row_h, 0, 0, 0, "Combat changes music:", font);
+	widget = new GUI_Text(textX[2], textY += row_h, 0, 0, 0, "Combat changes music:", font);
 	AddWidget(widget);
-	widget = (GUI_Widget *) new GUI_Text(textX[2], textY += row_h, 0, 0, 0, "Vehicle changes music:", font);
+	widget = new GUI_Text(textX[2], textY += row_h, 0, 0, 0, "Vehicle changes music:", font);
 	AddWidget(widget);
-	widget = (GUI_Widget *) new GUI_Text(textX[2], textY += row_h, 0, 0, 0, "Conversations stop music:", font);
+	widget = new GUI_Text(textX[2], textY += row_h, 0, 0, 0, "Conversations stop music:", font);
 	AddWidget(widget);
-	widget = (GUI_Widget *) new GUI_Text(textX[2], textY += row_h, 0, 0, 0, "Stop music on group change:", font);
+	widget = new GUI_Text(textX[2], textY += row_h, 0, 0, 0, "Stop music on group change:", font);
 	AddWidget(widget);
-	widget = (GUI_Widget *) new GUI_Text(textX[1], textY += row_h, 0, 0, 0, "Enable sfx:", font);
+	widget = new GUI_Text(textX[1], textY += row_h, 0, 0, 0, "Enable sfx:", font);
 	AddWidget(widget);
-	widget = (GUI_Widget *) new GUI_Text(textX[2], textY += row_h, 0, 0, 0, "Sfx volume:", font);
+	widget = new GUI_Text(textX[2], textY += row_h, 0, 0, 0, "Sfx volume:", font);
 	AddWidget(widget);
 	bool use_speech_b = (Game::get_game()->get_game_type() == NUVIE_GAME_U6 && has_fmtowns_support(Game::get_game()->get_config()));
 	if (use_speech_b) {
-		widget = (GUI_Widget *) new GUI_Text(textX[1], textY += row_h, 0, 0, 0, "Enable speech:", font);
+		widget = new GUI_Text(textX[1], textY += row_h, 0, 0, 0, "Enable speech:", font);
 		AddWidget(widget);
 	}
 	char musicBuff[5], sfxBuff[5];
diff --git a/engines/ultima/nuvie/menus/cheats_dialog.cpp b/engines/ultima/nuvie/menus/cheats_dialog.cpp
index 17bacd4e9ad..b32b27058aa 100644
--- a/engines/ultima/nuvie/menus/cheats_dialog.cpp
+++ b/engines/ultima/nuvie/menus/cheats_dialog.cpp
@@ -62,15 +62,15 @@ bool CheatsDialog::init() {
 	GUI_Widget *widget;
 	GUI *gui = GUI::get_gui();
 
-	widget = (GUI_Widget *) new GUI_Text(colX[0], textY[0], 0, 0, 0, "Cheats:", gui->get_font());
+	widget = new GUI_Text(colX[0], textY[0], 0, 0, 0, "Cheats:", gui->get_font());
 	AddWidget(widget);
-	widget = (GUI_Widget *) new GUI_Text(colX[0], textY[1], 0, 0, 0, "Show eggs:", gui->get_font());
+	widget = new GUI_Text(colX[0], textY[1], 0, 0, 0, "Show eggs:", gui->get_font());
 	AddWidget(widget);
-	widget = (GUI_Widget *) new GUI_Text(colX[0], textY[2], 0, 0, 0, "Enable hackmove:", gui->get_font());
+	widget = new GUI_Text(colX[0], textY[2], 0, 0, 0, "Enable hackmove:", gui->get_font());
 	AddWidget(widget);
-	widget = (GUI_Widget *) new GUI_Text(colX[0], textY[3], 0, 0, 0, "Anyone will join:", gui->get_font());
+	widget = new GUI_Text(colX[0], textY[3], 0, 0, 0, "Anyone will join:", gui->get_font());
 	AddWidget(widget);
-	widget = (GUI_Widget *) new GUI_Text(colX[0], textY[4], 0, 0, 0, "Minimum brightness:", gui->get_font());
+	widget = new GUI_Text(colX[0], textY[4], 0, 0, 0, "Minimum brightness:", gui->get_font());
 	AddWidget(widget);
 
 	bool party_all_the_time;
diff --git a/engines/ultima/nuvie/menus/game_menu_dialog.cpp b/engines/ultima/nuvie/menus/game_menu_dialog.cpp
index 6a20895c976..d113a6c3f71 100644
--- a/engines/ultima/nuvie/menus/game_menu_dialog.cpp
+++ b/engines/ultima/nuvie/menus/game_menu_dialog.cpp
@@ -151,27 +151,27 @@ GUI_status GameMenuDialog::callback(uint16 msg, GUI_CallBack *caller, void *data
 		close_dialog();
 	} else if (caller == video_button) {
 		GUI_Widget *video_dialog;
-		video_dialog = (GUI_Widget *) new VideoDialog(this);
+		video_dialog = new VideoDialog(this);
 		GUI::get_gui()->AddWidget(video_dialog);
 		gui->lock_input(video_dialog);
 	} else if (caller == audio_button) {
 		GUI_Widget *audio_dialog;
-		audio_dialog = (GUI_Widget *) new AudioDialog(this);
+		audio_dialog = new AudioDialog(this);
 		GUI::get_gui()->AddWidget(audio_dialog);
 		gui->lock_input(audio_dialog);
 	} else if (caller == input_button) {
 		GUI_Widget *input_dialog;
-		input_dialog = (GUI_Widget *) new InputDialog(this);
+		input_dialog = new InputDialog(this);
 		GUI::get_gui()->AddWidget(input_dialog);
 		gui->lock_input(input_dialog);
 	} else if (caller == gameplay_button) {
 		GUI_Widget *gameplay_dialog;
-		gameplay_dialog = (GUI_Widget *) new GameplayDialog(this);
+		gameplay_dialog = new GameplayDialog(this);
 		GUI::get_gui()->AddWidget(gameplay_dialog);
 		gui->lock_input(gameplay_dialog);
 	} else if (caller == cheats_button) {
 		GUI_Widget *cheats_dialog;
-		cheats_dialog = (GUI_Widget *) new CheatsDialog(this);
+		cheats_dialog = new CheatsDialog(this);
 		GUI::get_gui()->AddWidget(cheats_dialog);
 		gui->lock_input(cheats_dialog);
 	} else if (caller == continue_button) {
diff --git a/engines/ultima/nuvie/menus/gameplay_dialog.cpp b/engines/ultima/nuvie/menus/gameplay_dialog.cpp
index e2f31f9144c..3eb63e1685a 100644
--- a/engines/ultima/nuvie/menus/gameplay_dialog.cpp
+++ b/engines/ultima/nuvie/menus/gameplay_dialog.cpp
@@ -98,14 +98,14 @@ bool GameplayDialog::init() {
 	config->value("config/general/show_console", show_console, false);
 	config->value("config/general/enable_cursors", use_original_cursor, false);
 // party formation
-	widget = (GUI_Widget *) new GUI_Text(colX[0], textY, 0, 0, 0, "Party formation:", font);
+	widget = new GUI_Text(colX[0], textY, 0, 0, 0, "Party formation:", font);
 	AddWidget(widget);
 	formation_button = new GUI_TextToggleButton(this, 197, buttonY, 68, height, formation_text, 4, game->get_party()->get_formation(), font, BUTTON_TEXTALIGN_CENTER, this, 0);
 	AddWidget(formation_button);
 	button_index[last_index] = formation_button;
 	if (is_u6) {
 // show stealing
-		widget = (GUI_Widget *) new GUI_Text(colX[0], textY += row_h, 0, 0, 0, "Look shows private property:", font);
+		widget = new GUI_Text(colX[0], textY += row_h, 0, 0, 0, "Look shows private property:", font);
 		AddWidget(widget);
 		config->value("config/ultima6/show_stealing", show_stealing, false);
 		stealing_button = new GUI_TextToggleButton(this, colX[2], buttonY += row_h, yesno_width, height, yesno_text, 2, show_stealing, font, BUTTON_TEXTALIGN_CENTER, this, 0);
@@ -116,13 +116,13 @@ bool GameplayDialog::init() {
 	}
 	if (!Game::get_game()->is_new_style()) {
 // Use text gump
-		widget = (GUI_Widget *) new GUI_Text(colX[0], textY += row_h, 0, 0, 0, "Use text gump:", font);
+		widget = new GUI_Text(colX[0], textY += row_h, 0, 0, 0, "Use text gump:", font);
 		AddWidget(widget);
 		text_gump_button = new GUI_TextToggleButton(this, colX[2], buttonY += row_h, yesno_width, height, yesno_text, 2, game->is_using_text_gumps(), font, BUTTON_TEXTALIGN_CENTER, this, 0);
 		AddWidget(text_gump_button);
 		button_index[last_index += 1] = text_gump_button;
 // use converse gump
-		widget = (GUI_Widget *) new GUI_Text(colX[0], textY += row_h, 0, 0, 0, "Converse gump:", font);
+		widget = new GUI_Text(colX[0], textY += row_h, 0, 0, 0, "Converse gump:", font);
 		AddWidget(widget);
 		converse_gump_button = new GUI_TextToggleButton(this, 187, buttonY += row_h, 78, height, converse_style_text, 3, get_converse_gump_type_from_config(config), font, BUTTON_TEXTALIGN_CENTER, this, 0);
 		AddWidget(converse_gump_button);
@@ -134,7 +134,7 @@ bool GameplayDialog::init() {
 	}
 	if (!game->is_forcing_solid_converse_bg()) {
 // converse solid bg
-		widget = (GUI_Widget *) new GUI_Text(colX[0], textY += row_h, 0, 0, 0, "Converse gump has solid bg:", font);
+		widget = new GUI_Text(colX[0], textY += row_h, 0, 0, 0, "Converse gump has solid bg:", font);
 		AddWidget(widget);
 		config->value(key + "/converse_solid_bg", solid_bg, false); // need to check cfg since converse_gump may be nullptr
 		converse_solid_bg_button = new GUI_TextToggleButton(this, colX[2], buttonY += row_h, yesno_width, height, yesno_text, 2, solid_bg, font, BUTTON_TEXTALIGN_CENTER, this, 0);
@@ -145,28 +145,28 @@ bool GameplayDialog::init() {
 
 
 // following require restart
-	widget = (GUI_Widget *) new GUI_Text(colX[0], textY += row_h * 2, 0, 0, 0, "The following require a restart:", font);
+	widget = new GUI_Text(colX[0], textY += row_h * 2, 0, 0, 0, "The following require a restart:", font);
 	AddWidget(widget);
 // game select
-	widget = (GUI_Widget *) new GUI_Text(colX[1], textY += row_h, 0, 0, 0, "Startup game:", font);
+	widget = new GUI_Text(colX[1], textY += row_h, 0, 0, 0, "Startup game:", font);
 	AddWidget(widget);
 	startup_game_button = new GUI_TextToggleButton(this, 145, buttonY += row_h * 3, selected_game_width, height, selected_game_text, 4, get_selected_game_index(selected_game),  font, BUTTON_TEXTALIGN_CENTER, this, 0);
 	AddWidget(startup_game_button);
 	button_index[last_index += 1] = startup_game_button;
 // skip intro
-	widget = (GUI_Widget *) new GUI_Text(colX[1], textY += row_h, 0, 0, 0, "Skip intro:", font);
+	widget = new GUI_Text(colX[1], textY += row_h, 0, 0, 0, "Skip intro:", font);
 	AddWidget(widget);
 	skip_intro_button = new GUI_TextToggleButton(this, colX[2], buttonY += row_h, yesno_width, height, yesno_text, 2, skip_intro,  font, BUTTON_TEXTALIGN_CENTER, this, 0);
 	AddWidget(skip_intro_button);
 	button_index[last_index += 1] = skip_intro_button;
 // show console
-	widget = (GUI_Widget *) new GUI_Text(colX[1], textY += row_h, 0, 0, 0, "Show console:", font);
+	widget = new GUI_Text(colX[1], textY += row_h, 0, 0, 0, "Show console:", font);
 	AddWidget(widget);
 	show_console_button = new GUI_TextToggleButton(this, colX[2], buttonY += row_h, yesno_width, height, yesno_text, 2, show_console, font, BUTTON_TEXTALIGN_CENTER, this, 0);
 	AddWidget(show_console_button);
 	button_index[last_index += 1] = show_console_button;
 // original cursor
-	widget = (GUI_Widget *) new GUI_Text(colX[1], textY += row_h, 0, 0, 0, "Use original cursors:", font);
+	widget = new GUI_Text(colX[1], textY += row_h, 0, 0, 0, "Use original cursors:", font);
 	AddWidget(widget);
 	cursor_button = new GUI_TextToggleButton(this, colX[2], buttonY += row_h, yesno_width, height, yesno_text, 2, use_original_cursor, font, BUTTON_TEXTALIGN_CENTER, this, 0);
 	AddWidget(cursor_button);
diff --git a/engines/ultima/nuvie/menus/input_dialog.cpp b/engines/ultima/nuvie/menus/input_dialog.cpp
index cff91825830..02de9a88753 100644
--- a/engines/ultima/nuvie/menus/input_dialog.cpp
+++ b/engines/ultima/nuvie/menus/input_dialog.cpp
@@ -68,30 +68,30 @@ bool InputDialog::init() {
 	Game *game = Game::get_game();
 	MapWindow *map_window = game->get_map_window();
 
-	widget = (GUI_Widget *) new GUI_Text(colX[0], textY, 0, 0, 0, "Interface:", font);
+	widget = new GUI_Text(colX[0], textY, 0, 0, 0, "Interface:", font);
 	AddWidget(widget);
-	widget = (GUI_Widget *) new GUI_Text(colX[0], textY += row_h, 0, 0, 0, "Dragging enabled:", font);
+	widget = new GUI_Text(colX[0], textY += row_h, 0, 0, 0, "Dragging enabled:", font);
 	AddWidget(widget);
-	widget = (GUI_Widget *) new GUI_Text(colX[0], textY += row_h, 0, 0, 0, "Direction selects target:", font);
+	widget = new GUI_Text(colX[0], textY += row_h, 0, 0, 0, "Direction selects target:", font);
 	AddWidget(widget);
-	widget = (GUI_Widget *) new GUI_Text(colX[0], textY += row_h, 0, 0, 0, "Look on left_click:", font);
+	widget = new GUI_Text(colX[0], textY += row_h, 0, 0, 0, "Look on left_click:", font);
 	AddWidget(widget);
-	widget = (GUI_Widget *) new GUI_Text(colX[0], textY += row_h, 0, 0, 0, "Walk with left button:", font);
+	widget = new GUI_Text(colX[0], textY += row_h, 0, 0, 0, "Walk with left button:", font);
 	AddWidget(widget);
-	widget = (GUI_Widget *) new GUI_Text(colX[0], textY += row_h, 0, 0, 0, "Enable doubleclick:", font);
+	widget = new GUI_Text(colX[0], textY += row_h, 0, 0, 0, "Enable doubleclick:", font);
 	AddWidget(widget);
 	if (game->get_game_type() == NUVIE_GAME_U6) {
-		widget = (GUI_Widget *) new GUI_Text(colX[0], textY += row_h, 0, 0, 0, "Allow free balloon movement:", font);
+		widget = new GUI_Text(colX[0], textY += row_h, 0, 0, 0, "Allow free balloon movement:", font);
 		AddWidget(widget);
 	}
 	if (!game->is_new_style()) {
-		widget = (GUI_Widget *) new GUI_Text(colX[0], textY += row_h, 0, 0, 0, "Doubleclick opens containers:", font);
+		widget = new GUI_Text(colX[0], textY += row_h, 0, 0, 0, "Doubleclick opens containers:", font);
 		AddWidget(widget);
 	}
-	widget = (GUI_Widget *) new GUI_Text(colX[0], textY += row_h, 0, 0, 0, "Use new command bar:", font);
+	widget = new GUI_Text(colX[0], textY += row_h, 0, 0, 0, "Use new command bar:", font);
 	AddWidget(widget);
 	if (!game->is_new_style()) {
-		widget = (GUI_Widget *) new GUI_Text(colX[0], textY += row_h, 0, 0, 0, "Party view targeting:", font);
+		widget = new GUI_Text(colX[0], textY += row_h, 0, 0, 0, "Party view targeting:", font);
 		AddWidget(widget);
 	}
 
diff --git a/engines/ultima/nuvie/menus/video_dialog.cpp b/engines/ultima/nuvie/menus/video_dialog.cpp
index bbad067b8e7..b50703f4649 100644
--- a/engines/ultima/nuvie/menus/video_dialog.cpp
+++ b/engines/ultima/nuvie/menus/video_dialog.cpp
@@ -91,7 +91,7 @@ bool VideoDialog::init() {
 	for (int i = 0; i <= num_scalers; i++)
 		scaler_text[i] = scr->get_scaler_reg()->GetNameForIndex(i);
 
-	widget = (GUI_Widget *) new GUI_Text(colX[0], textY[0], 0, 0, 0, "Scaler:", font);
+	widget = new GUI_Text(colX[0], textY[0], 0, 0, 0, "Scaler:", font);
 	AddWidget(widget);
 // scaler(fullscreen)
 	int num_scalers_fullscreen, fullscreen_scaler_selection;
@@ -109,7 +109,7 @@ bool VideoDialog::init() {
 	scaler_win_button = new GUI_TextToggleButton(this, colX[2], buttonY[0], 208, height, scaler_text, num_scalers, scr->get_scaler_index(), font, BUTTON_TEXTALIGN_CENTER, this, 0);
 	AddWidget(scaler_win_button);
 // scale
-	widget = (GUI_Widget *) new GUI_Text(colX[0], textY[1], 0, 0, 0, "Scale:", gui->get_font());
+	widget = new GUI_Text(colX[0], textY[1], 0, 0, 0, "Scale:", gui->get_font());
 	AddWidget(widget);
 	const char *scale_win_text[10];
 	scale_win_text[0] = "1";
@@ -177,7 +177,7 @@ bool VideoDialog::init() {
 	if (no_fullscreen && !scr->is_fullscreen()) {
 		fullscreen_button->Hide();
 	} else {
-		widget = (GUI_Widget *) new GUI_Text(colX[0], textY[2], 0, 0, 0, "Fullscreen:", gui->get_font());
+		widget = new GUI_Text(colX[0], textY[2], 0, 0, 0, "Fullscreen:", gui->get_font());
 		AddWidget(widget);
 	}
 #endif /* !SCALER_AND_SCALE_CANNOT_BE_CHANGED */
@@ -186,14 +186,14 @@ bool VideoDialog::init() {
 #if SCALER_AND_SCALE_CANNOT_BE_CHANGED
 // fullscreen_toggle
 	if (!no_fullscreen || scr->is_fullscreen()) {
-		widget = (GUI_Widget *) new GUI_Text(colX[0], textY, 0, 0, 0, "Fullscreen:", gui->get_font());
+		widget = new GUI_Text(colX[0], textY, 0, 0, 0, "Fullscreen:", gui->get_font());
 		AddWidget(widget);
 
 		fullscreen_button = new GUI_TextToggleButton(this, colX[4], buttonY, yesno_width, height, yesno_text, 2, scr->is_fullscreen(), font, BUTTON_TEXTALIGN_CENTER, this, 0);
 		AddWidget(fullscreen_button);
 		button_index[last_index] = fullscreen_button;
 
-		widget = (GUI_Widget *) new GUI_Text(colX[0], textY += row_h, 0, 0, 0, "Non-square pixels:", gui->get_font());
+		widget = new GUI_Text(colX[0], textY += row_h, 0, 0, 0, "Non-square pixels:", gui->get_font());
 		AddWidget(widget);
 		non_square_pixels_button = new GUI_TextToggleButton(this, colX[4], buttonY += row_h, yesno_width, height, yesno_text, 2, scr->is_non_square_pixels(), font, BUTTON_TEXTALIGN_CENTER, this, 0);
 		AddWidget(non_square_pixels_button);
@@ -207,7 +207,7 @@ bool VideoDialog::init() {
 	Configuration *config = Game::get_game()->get_config();
 
 // show roofs
-	widget = (GUI_Widget *) new GUI_Text(colX[0], textY += first_index ? 0 : row_h, 0, 0, 0, "Show roofs:", gui->get_font());
+	widget = new GUI_Text(colX[0], textY += first_index ? 0 : row_h, 0, 0, 0, "Show roofs:", gui->get_font());
 	AddWidget(widget);
 	roof_button = new GUI_TextToggleButton(this, colX[4], buttonY += first_index ? 0 : row_h, yesno_width, height, yesno_text, 2, game->is_roof_mode(), font, BUTTON_TEXTALIGN_CENTER, this, 0);
 	AddWidget(roof_button);
@@ -217,7 +217,7 @@ bool VideoDialog::init() {
 		doll_button = nullptr;
 		old_use_new_dolls = true;
 	} else {
-		widget = (GUI_Widget *) new GUI_Text(colX[0], textY += row_h, 0, 0, 0, "Use new actor dolls:", gui->get_font());
+		widget = new GUI_Text(colX[0], textY += row_h, 0, 0, 0, "Use new actor dolls:", gui->get_font());
 		AddWidget(widget);
 		bool use_new_dolls;
 		config->value(config_get_game_key(config) + "/use_new_dolls", use_new_dolls, false);
@@ -227,24 +227,24 @@ bool VideoDialog::init() {
 		button_index[last_index += 1] = doll_button;
 	}
 // tile_lighting_b
-	widget = (GUI_Widget *) new GUI_Text(colX[0], textY += row_h, 0, 0, 0, "Use lighting data from map tiles:", gui->get_font());
+	widget = new GUI_Text(colX[0], textY += row_h, 0, 0, 0, "Use lighting data from map tiles:", gui->get_font());
 	AddWidget(widget);
 	old_use_tile_lighting = game->get_map_window()->using_map_tile_lighting;
 	tile_lighting_b = new GUI_TextToggleButton(this, colX[4], buttonY += row_h, yesno_width, height, yesno_text, 2, old_use_tile_lighting, font, BUTTON_TEXTALIGN_CENTER, this, 0);
 	AddWidget(tile_lighting_b);
 	button_index[last_index += 1] = tile_lighting_b;
 // needs restart text
-	widget = (GUI_Widget *) new GUI_Text(colX[0], textY += row_h * 2, 0, 0, 0, "The following require a restart:", gui->get_font());
+	widget = new GUI_Text(colX[0], textY += row_h * 2, 0, 0, 0, "The following require a restart:", gui->get_font());
 	AddWidget(widget);
 // lighting (needs reset)
-	widget = (GUI_Widget *) new GUI_Text(colX[1], textY += row_h, 0, 0, 0, "Lighting mode:", gui->get_font());
+	widget = new GUI_Text(colX[1], textY += row_h, 0, 0, 0, "Lighting mode:", gui->get_font());
 	AddWidget(widget);
 	const char *const lighting_text[] = { "none", "smooth", "original" };
 	lighting_button = new GUI_TextToggleButton(this, colX[3], buttonY += row_h * 3, 70, height, lighting_text, 3, scr->get_old_lighting_style(), font, BUTTON_TEXTALIGN_CENTER, this, 0);
 	AddWidget(lighting_button);
 	button_index[last_index += 1] = lighting_button;
 // sprites (needs reset)
-	widget = (GUI_Widget *) new GUI_Text(colX[1], textY += row_h, 0, 0, 0, "Use custom actor tiles:", gui->get_font());
+	widget = new GUI_Text(colX[1], textY += row_h, 0, 0, 0, "Use custom actor tiles:", gui->get_font());
 	AddWidget(widget);
 	const char *const sprite_text[] = { "no", "yes", "default" };
 	Std::string custom_tile_str;
@@ -263,13 +263,13 @@ bool VideoDialog::init() {
 	game_style_text[1] = "new style";
 	game_style_text[2] = "original+";
 	game_style_text[3] = "original+ full map";
-	widget = (GUI_Widget *) new GUI_Text(colX[1], textY += row_h, 0, 0, 0, "Game style:", gui->get_font());
+	widget = new GUI_Text(colX[1], textY += row_h, 0, 0, 0, "Game style:", gui->get_font());
 	AddWidget(widget);
 	game_style_button = new GUI_TextToggleButton(this, colX[3] - 84, buttonY += row_h, 154, height, game_style_text, 4, game->get_game_style(), font, BUTTON_TEXTALIGN_CENTER, this, 0);
 	AddWidget(game_style_button);
 	button_index[last_index += 1] = game_style_button;
 // dithering (needs reset)
-	widget = (GUI_Widget *) new GUI_Text(colX[1], textY += row_h, 0, 0, 0, "Old video graphics:", gui->get_font());
+	widget = new GUI_Text(colX[1], textY += row_h, 0, 0, 0, "Old video graphics:", gui->get_font());
 	AddWidget(widget);
 	const char *const dither_text[] = { "no", "CGA", "EGA" };
 	dither_button = new GUI_TextToggleButton(this, colX[4], buttonY += row_h, yesno_width, height, dither_text, 3, game->get_dither()->get_mode(), font, BUTTON_TEXTALIGN_CENTER, this, 0);


Commit: 1103ee130d4d7770b46537ac203508ecb1db4575
    https://github.com/scummvm/scummvm/commit/1103ee130d4d7770b46537ac203508ecb1db4575
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2023-12-09T13:56:07+11:00

Commit Message:
ULTIMA: NUVIE: Reduce use of #define for numeric consts

Generall static const int is preferred over defines for numerical constants as
it provides some type safety.

Changed paths:
    engines/ultima/nuvie/core/nuvie_defs.h
    engines/ultima/nuvie/core/player.cpp
    engines/ultima/nuvie/menus/audio_dialog.cpp
    engines/ultima/nuvie/menus/cheats_dialog.cpp
    engines/ultima/nuvie/menus/game_menu_dialog.cpp
    engines/ultima/nuvie/menus/gameplay_dialog.cpp
    engines/ultima/nuvie/menus/input_dialog.cpp
    engines/ultima/nuvie/menus/video_dialog.cpp
    engines/ultima/nuvie/portraits/portrait_se.h
    engines/ultima/nuvie/screen/dither.h
    engines/ultima/nuvie/screen/screen.cpp
    engines/ultima/nuvie/views/container_view_gump.cpp
    engines/ultima/nuvie/views/container_widget.h
    engines/ultima/nuvie/views/doll_view_gump.h
    engines/ultima/nuvie/views/inventory_font.h
    engines/ultima/nuvie/views/map_editor_view.cpp
    engines/ultima/nuvie/views/scroll_view_gump.cpp
    engines/ultima/nuvie/views/scroll_widget_gump.h
    engines/ultima/nuvie/views/sign_view_gump.cpp
    engines/ultima/nuvie/views/spell_view_gump.h
    engines/ultima/nuvie/views/sun_moon_ribbon.cpp


diff --git a/engines/ultima/nuvie/core/nuvie_defs.h b/engines/ultima/nuvie/core/nuvie_defs.h
index 4f3d7578c7a..2dc41ba2334 100644
--- a/engines/ultima/nuvie/core/nuvie_defs.h
+++ b/engines/ultima/nuvie/core/nuvie_defs.h
@@ -127,8 +127,6 @@ extern void u6debug(bool no_header, const DebugLevelType level, const char *form
 #define NUVIE_RAND_MAX 0x7fffffff // POSIX: 2^(31)-1
 #define NUVIE_RAND() getRandom(NUVIE_RAND_MAX)
 
-#define MAXPATHLEN 256
-
 #define nuprint Game::get_game()->get_scroll()->print
 
 } // End of namespace Nuvie
diff --git a/engines/ultima/nuvie/core/player.cpp b/engines/ultima/nuvie/core/player.cpp
index 2bbc8cb15e2..575c3799917 100644
--- a/engines/ultima/nuvie/core/player.cpp
+++ b/engines/ultima/nuvie/core/player.cpp
@@ -40,7 +40,7 @@
 namespace Ultima {
 namespace Nuvie {
 
-#define PLAYER_BASE_MOVEMENT_COST 5
+static const int PLAYER_BASE_MOVEMENT_COST = 5;
 
 Player::Player(Configuration *cfg) : config(cfg), _clock(nullptr),
 		party(nullptr), actor(nullptr), actor_manager(nullptr), obj_manager(nullptr),
diff --git a/engines/ultima/nuvie/menus/audio_dialog.cpp b/engines/ultima/nuvie/menus/audio_dialog.cpp
index 96573c23c6c..c5d05eba2d2 100644
--- a/engines/ultima/nuvie/menus/audio_dialog.cpp
+++ b/engines/ultima/nuvie/menus/audio_dialog.cpp
@@ -41,8 +41,8 @@
 namespace Ultima {
 namespace Nuvie {
 
-#define AD_WIDTH 292
-#define AD_HEIGHT 166
+static const int AD_WIDTH = 292;
+static const int AD_HEIGHT = 166;
 
 AudioDialog::AudioDialog(GUI_CallBack *callback)
 	: GUI_Dialog(Game::get_game()->get_game_x_offset() + (Game::get_game()->get_game_width() - AD_WIDTH) / 2,
diff --git a/engines/ultima/nuvie/menus/cheats_dialog.cpp b/engines/ultima/nuvie/menus/cheats_dialog.cpp
index b32b27058aa..8fb0a146dd1 100644
--- a/engines/ultima/nuvie/menus/cheats_dialog.cpp
+++ b/engines/ultima/nuvie/menus/cheats_dialog.cpp
@@ -41,8 +41,8 @@
 namespace Ultima {
 namespace Nuvie {
 
-#define CD_WIDTH 212
-#define CD_HEIGHT 101
+static const int CD_WIDTH = 212;
+static const int CD_HEIGHT = 101;
 
 CheatsDialog::CheatsDialog(GUI_CallBack *callback)
 	: GUI_Dialog(Game::get_game()->get_game_x_offset() + (Game::get_game()->get_game_width() - CD_WIDTH) / 2,
diff --git a/engines/ultima/nuvie/menus/game_menu_dialog.cpp b/engines/ultima/nuvie/menus/game_menu_dialog.cpp
index d113a6c3f71..04b140100df 100644
--- a/engines/ultima/nuvie/menus/game_menu_dialog.cpp
+++ b/engines/ultima/nuvie/menus/game_menu_dialog.cpp
@@ -39,8 +39,8 @@
 namespace Ultima {
 namespace Nuvie {
 
-#define GMD_WIDTH 150
-#define GMD_HEIGHT 135
+static const int GMD_WIDTH = 150;
+static const int GMD_HEIGHT = 135;
 
 GameMenuDialog::GameMenuDialog(CallBack *callback)
 	: GUI_Dialog(Game::get_game()->get_game_x_offset() + (Game::get_game()->get_game_width() - GMD_WIDTH) / 2,
diff --git a/engines/ultima/nuvie/menus/gameplay_dialog.cpp b/engines/ultima/nuvie/menus/gameplay_dialog.cpp
index 3eb63e1685a..2c76c835d67 100644
--- a/engines/ultima/nuvie/menus/gameplay_dialog.cpp
+++ b/engines/ultima/nuvie/menus/gameplay_dialog.cpp
@@ -42,8 +42,8 @@
 namespace Ultima {
 namespace Nuvie {
 
-#define GD_WIDTH 274
-#define GD_HEIGHT 179
+static const int GD_WIDTH = 274;
+static const int GD_HEIGHT = 179;
 
 GameplayDialog::GameplayDialog(GUI_CallBack *callback)
 	: GUI_Dialog(Game::get_game()->get_game_x_offset() + (Game::get_game()->get_game_width() - GD_WIDTH) / 2,
diff --git a/engines/ultima/nuvie/menus/input_dialog.cpp b/engines/ultima/nuvie/menus/input_dialog.cpp
index 02de9a88753..095e5d42f18 100644
--- a/engines/ultima/nuvie/menus/input_dialog.cpp
+++ b/engines/ultima/nuvie/menus/input_dialog.cpp
@@ -42,8 +42,8 @@
 namespace Ultima {
 namespace Nuvie {
 
-#define ID_WIDTH 280
-#define ID_HEIGHT 166
+static const int ID_WIDTH = 280;
+static const int ID_HEIGHT = 166;
 
 InputDialog::InputDialog(GUI_CallBack *callback)
 	: GUI_Dialog(Game::get_game()->get_game_x_offset() + (Game::get_game()->get_game_width() - ID_WIDTH) / 2,
diff --git a/engines/ultima/nuvie/menus/video_dialog.cpp b/engines/ultima/nuvie/menus/video_dialog.cpp
index b50703f4649..16968662857 100644
--- a/engines/ultima/nuvie/menus/video_dialog.cpp
+++ b/engines/ultima/nuvie/menus/video_dialog.cpp
@@ -43,8 +43,8 @@
 namespace Ultima {
 namespace Nuvie {
 
-#define VD_WIDTH 311
-#define VD_HEIGHT 171 // add or subtract 13 if you add/remove a row
+static const int VD_WIDTH = 311;
+static const int VD_HEIGHT = 171; // add or subtract 13 if you add/remove a row
 
 VideoDialog::VideoDialog(GUI_CallBack *callback)
 	: GUI_Dialog(Game::get_game()->get_game_x_offset() + (Game::get_game()->get_game_width() - VD_WIDTH) / 2,
diff --git a/engines/ultima/nuvie/portraits/portrait_se.h b/engines/ultima/nuvie/portraits/portrait_se.h
index ec55b4c1fee..cfdf0ca4de4 100644
--- a/engines/ultima/nuvie/portraits/portrait_se.h
+++ b/engines/ultima/nuvie/portraits/portrait_se.h
@@ -31,8 +31,6 @@ namespace Nuvie {
 class Configuration;
 class Actor;
 
-#define NO_PORTRAIT_FOUND 255
-
 class PortraitSE : public Portrait {
 	U6Lib_n faces;
 
diff --git a/engines/ultima/nuvie/screen/dither.h b/engines/ultima/nuvie/screen/dither.h
index 8326ec204c2..415c082156d 100644
--- a/engines/ultima/nuvie/screen/dither.h
+++ b/engines/ultima/nuvie/screen/dither.h
@@ -31,15 +31,17 @@ class Configuration;
 
 // Dither modes..
 
-#define DITHER_NONE 0
-#define DITHER_CGA  1
-#define DITHER_EGA  2
-#define DITHER_HRC  3 //FIXME add this mode.
+enum DitherMode {
+	DITHER_NONE = 0,
+	DITHER_CGA = 1,
+	DITHER_EGA = 2,
+	DITHER_HRC = 3 //FIXME add this mode.
+};
 
 class Dither {
 	Configuration *config;
 	uint8 *dither;
-	uint8 mode;
+	DitherMode mode;
 
 public:
 
diff --git a/engines/ultima/nuvie/screen/screen.cpp b/engines/ultima/nuvie/screen/screen.cpp
index 5fd087cea5f..d931f425914 100644
--- a/engines/ultima/nuvie/screen/screen.cpp
+++ b/engines/ultima/nuvie/screen/screen.cpp
@@ -36,8 +36,8 @@ namespace Nuvie {
 #define sqr(a) ((a)*(a))
 
 //Ultima 6 light globe sizes.
-#define NUM_GLOBES 5
-#define SHADING_BORDER 2 // should be the same as MapWindow's TMP_MAP_BORDER
+static const int NUM_GLOBES = 5;
+static const int SHADING_BORDER = 2; // should be the same as MapWindow's TMP_MAP_BORDER
 static const sint32 globeradius[]   = { 36, 112, 148, 192, 448 };
 static const sint32 globeradius_2[] = { 18, 56, 74, 96, 224 };
 
diff --git a/engines/ultima/nuvie/views/container_view_gump.cpp b/engines/ultima/nuvie/views/container_view_gump.cpp
index bee8428f4df..aeec2bfa198 100644
--- a/engines/ultima/nuvie/views/container_view_gump.cpp
+++ b/engines/ultima/nuvie/views/container_view_gump.cpp
@@ -37,7 +37,7 @@
 namespace Ultima {
 namespace Nuvie {
 
-#define CONTAINER_WIDGET_OFFSET 29
+static const int CONTAINER_WIDGET_OFFSET = 29;
 #define CHECK_X 0
 
 ContainerViewGump::ContainerViewGump(Configuration *cfg) : DraggableView(cfg),
diff --git a/engines/ultima/nuvie/views/container_widget.h b/engines/ultima/nuvie/views/container_widget.h
index 9c5a11da4bc..52ce99dd7ae 100644
--- a/engines/ultima/nuvie/views/container_widget.h
+++ b/engines/ultima/nuvie/views/container_widget.h
@@ -29,8 +29,8 @@
 namespace Ultima {
 namespace Nuvie {
 
-#define CONTAINER_WIDGET_ROWS 3
-#define CONTAINER_WIDGET_COLS 4
+static const int CONTAINER_WIDGET_ROWS = 3;
+static const int CONTAINER_WIDGET_COLS = 4;
 
 class Configuration;
 class TileManager;
diff --git a/engines/ultima/nuvie/views/doll_view_gump.h b/engines/ultima/nuvie/views/doll_view_gump.h
index a3f6ec90375..184891bcb56 100644
--- a/engines/ultima/nuvie/views/doll_view_gump.h
+++ b/engines/ultima/nuvie/views/doll_view_gump.h
@@ -36,7 +36,7 @@ class Actor;
 class Font;
 class DollWidget;
 
-#define DOLLVIEWGUMP_HEIGHT 136
+static const int DOLLVIEWGUMP_HEIGHT = 136;
 
 class DollViewGump : public DraggableView {
 
diff --git a/engines/ultima/nuvie/views/inventory_font.h b/engines/ultima/nuvie/views/inventory_font.h
index 006f54e38e3..5332cfe3f2e 100644
--- a/engines/ultima/nuvie/views/inventory_font.h
+++ b/engines/ultima/nuvie/views/inventory_font.h
@@ -25,7 +25,7 @@
 namespace Ultima {
 namespace Nuvie {
 
-#define NUVIE_MICRO_FONT_COUNT 26
+static const int NUVIE_MICRO_FONT_COUNT = 26;
 
 const unsigned char inventory_font[NUVIE_MICRO_FONT_COUNT][15] = {
 	{
diff --git a/engines/ultima/nuvie/views/map_editor_view.cpp b/engines/ultima/nuvie/views/map_editor_view.cpp
index 85716c0fbf9..292433f7c08 100644
--- a/engines/ultima/nuvie/views/map_editor_view.cpp
+++ b/engines/ultima/nuvie/views/map_editor_view.cpp
@@ -33,8 +33,8 @@
 namespace Ultima {
 namespace Nuvie {
 
-#define TILES_W 5
-#define TILES_H 10
+static const int TILES_W = 5;
+static const int TILES_H = 10;
 
 MapEditorView::MapEditorView(Configuration *cfg) : View(cfg), roof_tiles(nullptr),
 		map_window(nullptr), up_button(nullptr), down_button(nullptr),
diff --git a/engines/ultima/nuvie/views/scroll_view_gump.cpp b/engines/ultima/nuvie/views/scroll_view_gump.cpp
index 1dee1a856f0..b41eb332eff 100644
--- a/engines/ultima/nuvie/views/scroll_view_gump.cpp
+++ b/engines/ultima/nuvie/views/scroll_view_gump.cpp
@@ -31,8 +31,8 @@
 namespace Ultima {
 namespace Nuvie {
 
-#define SIGN_BG_W (SCROLLWIDGETGUMP_W + 16)
-#define SIGN_BG_H (SCROLLWIDGETGUMP_H + 16)
+static const int SIGN_BG_W = (SCROLLWIDGETGUMP_W + 16);
+static const int SIGN_BG_H = (SCROLLWIDGETGUMP_H + 16);
 
 ScrollViewGump::ScrollViewGump(Configuration *cfg) : DraggableView(cfg), scroll_widget(nullptr) {
 }
diff --git a/engines/ultima/nuvie/views/scroll_widget_gump.h b/engines/ultima/nuvie/views/scroll_widget_gump.h
index 224acf01781..c6b584997b3 100644
--- a/engines/ultima/nuvie/views/scroll_widget_gump.h
+++ b/engines/ultima/nuvie/views/scroll_widget_gump.h
@@ -49,8 +49,8 @@ typedef enum {
 	SCROLL_TO_END
 } ScrollEventType;
 
-#define SCROLLWIDGETGUMP_W 200
-#define SCROLLWIDGETGUMP_H 100
+static const int SCROLLWIDGETGUMP_W = 200;
+static const int SCROLLWIDGETGUMP_H = 100;
 
 class ScrollWidgetGump: public MsgScroll {
 
diff --git a/engines/ultima/nuvie/views/sign_view_gump.cpp b/engines/ultima/nuvie/views/sign_view_gump.cpp
index d7e1db9ccaf..365ebbf5b70 100644
--- a/engines/ultima/nuvie/views/sign_view_gump.cpp
+++ b/engines/ultima/nuvie/views/sign_view_gump.cpp
@@ -30,8 +30,8 @@
 namespace Ultima {
 namespace Nuvie {
 
-#define SIGN_BG_W 246
-#define SIGN_BG_H 101
+static const int SIGN_BG_W = 246;
+static const int SIGN_BG_H = 101;
 
 SignViewGump::SignViewGump(Configuration *cfg) : DraggableView(cfg), sign_text(nullptr) {
 	font = new BMPFont();
diff --git a/engines/ultima/nuvie/views/spell_view_gump.h b/engines/ultima/nuvie/views/spell_view_gump.h
index cd4ed13bf56..f435e848121 100644
--- a/engines/ultima/nuvie/views/spell_view_gump.h
+++ b/engines/ultima/nuvie/views/spell_view_gump.h
@@ -37,7 +37,7 @@ class Font;
 class U6Bmp;
 class Spell;
 
-#define SPELLVIEWGUMP_WIDTH 162
+static const int SPELLVIEWGUMP_WIDTH = 162;
 
 class SpellViewGump : public SpellView {
 
diff --git a/engines/ultima/nuvie/views/sun_moon_ribbon.cpp b/engines/ultima/nuvie/views/sun_moon_ribbon.cpp
index 50346261700..9e5eee98f62 100644
--- a/engines/ultima/nuvie/views/sun_moon_ribbon.cpp
+++ b/engines/ultima/nuvie/views/sun_moon_ribbon.cpp
@@ -31,11 +31,11 @@
 namespace Ultima {
 namespace Nuvie {
 
-#define SUNMOON_RIBBON_END_WIDTH 5
-#define SUNMOON_RIBBON_WIDTH 48
-#define SUNMOON_RIBBON_HEIGHT 14
-#define SUNMOON_RIBBON_DIR_WIDTH 14
-#define SUNMOON_RIBBON_TOTAL_WIDTH (SUNMOON_RIBBON_WIDTH + SUNMOON_RIBBON_DIR_WIDTH)
+static const int SUNMOON_RIBBON_END_WIDTH = 5;
+static const int SUNMOON_RIBBON_WIDTH = 48;
+static const int SUNMOON_RIBBON_HEIGHT = 14;
+static const int SUNMOON_RIBBON_DIR_WIDTH = 14;
+static const int SUNMOON_RIBBON_TOTAL_WIDTH = (SUNMOON_RIBBON_WIDTH + SUNMOON_RIBBON_DIR_WIDTH);
 
 SunMoonRibbon::SunMoonRibbon(Player *p, Weather *w, TileManager *tm)
 	: SunMoonStripWidget(p, tm), bg_data(nullptr), weather(w), retracted(true),


Commit: 4182695bc71e9b6b5116944693b21208ed294369
    https://github.com/scummvm/scummvm/commit/4182695bc71e9b6b5116944693b21208ed294369
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2023-12-09T13:56:07+11:00

Commit Message:
ULTIMA: NUVIE: Remove some unused functions

Changed paths:
    engines/ultima/nuvie/conf/configuration.cpp
    engines/ultima/nuvie/conf/configuration.h


diff --git a/engines/ultima/nuvie/conf/configuration.cpp b/engines/ultima/nuvie/conf/configuration.cpp
index 11da12923ad..9f65e31af0e 100644
--- a/engines/ultima/nuvie/conf/configuration.cpp
+++ b/engines/ultima/nuvie/conf/configuration.cpp
@@ -307,10 +307,6 @@ void Configuration::getSubkeys(KeyTypeList &ktl, const Std::string &basekey) {
 	}
 }
 
-bool Configuration::isDefaultsSet() const {
-	return ConfMan.hasKey("config/video/screen_width");
-}
-
 void Configuration::load(GameId gameId, bool isEnhanced) {
 	// Load basic defaults for enhanced vs unehanced
 	if (isEnhanced)
diff --git a/engines/ultima/nuvie/conf/configuration.h b/engines/ultima/nuvie/conf/configuration.h
index 338fef1dbf8..41e3e4133ef 100644
--- a/engines/ultima/nuvie/conf/configuration.h
+++ b/engines/ultima/nuvie/conf/configuration.h
@@ -83,9 +83,6 @@ public:
 	// read config file. Multiple files may be read. Order is important.
 	bool readConfigFile(const Std::string &fname, const Std::string &root, bool readonly = true);
 
-	// Returns true if default settings for game have previously been set
-	bool isDefaultsSet() const;
-
 	// Loads up the configuration settings
 	void load(GameId gameId, bool isEnhanced);
 
@@ -95,10 +92,6 @@ public:
 	// clear everything
 	void clear();
 
-	Std::string filename() const {
-		return _configFilename;
-	}
-
 	// get value
 	void value(const Std::string &key, Std::string &ret, const char *defaultvalue = "");
 	void value(const Std::string &key, int &ret, int defaultvalue = 0);


Commit: 424a674dcc6fb37d33224548232d7e1fb7df9a4e
    https://github.com/scummvm/scummvm/commit/424a674dcc6fb37d33224548232d7e1fb7df9a4e
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2023-12-09T13:56:07+11:00

Commit Message:
ULTIMA: NUVIE: Remove some redundant casts

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 454b9188afe..bcd5605ce09 100644
--- a/engines/ultima/nuvie/script/script_cutscene.cpp
+++ b/engines/ultima/nuvie/script/script_cutscene.cpp
@@ -1261,7 +1261,7 @@ Std::vector<Std::vector<CSImage *> > ScriptCutscene::load_all_images(const char
 			Std::vector<CSImage *> v1;
 			for (uint32 idx1 = 0; idx1 < lib1.get_num_items(); idx1++) {
 				U6Shape *shp = new U6Shape();
-				if (shp->load(&lib1, (uint32)idx1)) {
+				if (shp->load(&lib1, idx1)) {
 					image = new CSImage(shp);
 					v1.push_back(image);
 				}
@@ -1283,7 +1283,7 @@ Std::vector<Std::vector<CSImage *> > ScriptCutscene::load_all_images(const char
 		for (uint32 idx = 0; idx < lib_n.get_num_items(); idx++) {
 			Std::vector<CSImage *> v1;
 			U6Shape *shp = new U6Shape();
-			if (shp->load(&lib_n, (uint32)idx)) {
+			if (shp->load(&lib_n, idx)) {
 				image = new CSImage(shp);
 				v1.push_back(image);
 				v.push_back(v1);


Commit: a2494e65252db0b3b2fa175f831e575cab5dd25b
    https://github.com/scummvm/scummvm/commit/a2494e65252db0b3b2fa175f831e575cab5dd25b
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2023-12-09T13:56:07+11:00

Commit Message:
ULTIMA: NUVIE: Remove some old sdl compat functions

Changed paths:
    engines/ultima/nuvie/core/game.cpp
    engines/ultima/nuvie/gui/gui_button.cpp
    engines/ultima/nuvie/misc/sdl_compat.cpp
    engines/ultima/nuvie/misc/sdl_compat.h


diff --git a/engines/ultima/nuvie/core/game.cpp b/engines/ultima/nuvie/core/game.cpp
index 044c6540d4b..d7b446ce35d 100644
--- a/engines/ultima/nuvie/core/game.cpp
+++ b/engines/ultima/nuvie/core/game.cpp
@@ -435,7 +435,7 @@ void Game::init_cursor() {
 		cursor = new Cursor();
 
 	if (cursor->init(config, screen, game_type))
-		SDL_ShowCursor(false); // won't need the system default
+		g_system->showMouse(false); // won't need the system default
 	else {
 		delete cursor;
 		cursor = nullptr; // no game cursor
diff --git a/engines/ultima/nuvie/gui/gui_button.cpp b/engines/ultima/nuvie/gui/gui_button.cpp
index 60b874fce91..867faa78df3 100644
--- a/engines/ultima/nuvie/gui/gui_button.cpp
+++ b/engines/ultima/nuvie/gui/gui_button.cpp
@@ -151,38 +151,35 @@ void GUI_Button:: Display(bool full_redraw) {
 		int pixel = SDL_MapRGB(surface->format, 0, 0, 0);
 		uint8 bytepp = surface->format.bytesPerPixel;
 
-		if (!SDL_LockSurface(surface)) {
-			for (int y = 0; y < area.height(); y += 2) {
-				pointer = (uint8 *)surface->getPixels() + surface->pitch * (area.top + y) + (area.left * bytepp);
-				for (int x = 0; x<area.width() >> 1; x++) {
-					switch (bytepp) {
-					case 1:
-						*((uint8 *)(pointer)) = (uint8)pixel;
-						pointer += 2;
-						break;
-					case 2:
-						*((uint16 *)(pointer)) = (uint16)pixel;
-						pointer += 4;
-						break;
-					case 3:  /* Format/endian independent */
-						uint8 r, g, b;
-
-						r = (pixel >> surface->format.rShift) & 0xFF;
-						g = (pixel >> surface->format.gShift) & 0xFF;
-						b = (pixel >> surface->format.bShift) & 0xFF;
-						*((pointer) + surface->format.rShift / 8) = r;
-						*((pointer) + surface->format.gShift / 8) = g;
-						*((pointer) + surface->format.bShift / 8) = b;
-						pointer += 6;
-						break;
-					case 4:
-						*((uint32 *)(pointer)) = (uint32)pixel;
-						pointer += 8;
-						break;
-					}
+		for (int y = 0; y < area.height(); y += 2) {
+			pointer = (uint8 *)surface->getPixels() + surface->pitch * (area.top + y) + (area.left * bytepp);
+			for (int x = 0; x<area.width() >> 1; x++) {
+				switch (bytepp) {
+				case 1:
+					*((uint8 *)(pointer)) = (uint8)pixel;
+					pointer += 2;
+					break;
+				case 2:
+					*((uint16 *)(pointer)) = (uint16)pixel;
+					pointer += 4;
+					break;
+				case 3:  /* Format/endian independent */
+					uint8 r, g, b;
+
+					r = (pixel >> surface->format.rShift) & 0xFF;
+					g = (pixel >> surface->format.gShift) & 0xFF;
+					b = (pixel >> surface->format.bShift) & 0xFF;
+					*((pointer) + surface->format.rShift / 8) = r;
+					*((pointer) + surface->format.gShift / 8) = g;
+					*((pointer) + surface->format.bShift / 8) = b;
+					pointer += 6;
+					break;
+				case 4:
+					*((uint32 *)(pointer)) = (uint32)pixel;
+					pointer += 8;
+					break;
 				}
 			}
-			SDL_UnlockSurface(surface);
 		}
 	}
 
diff --git a/engines/ultima/nuvie/misc/sdl_compat.cpp b/engines/ultima/nuvie/misc/sdl_compat.cpp
index a26fb164369..dbe6c9df4df 100644
--- a/engines/ultima/nuvie/misc/sdl_compat.cpp
+++ b/engines/ultima/nuvie/misc/sdl_compat.cpp
@@ -41,10 +41,6 @@ void SDL_FreeSurface(Graphics::ManagedSurface *&s) {
 	s = nullptr;
 }
 
-void SDL_ShowCursor(bool show) {
-	g_system->showMouse(show);
-}
-
 uint32 SDL_MapRGB(Graphics::PixelFormat &format, byte r, byte g, byte b) {
 	return format.RGBToColor(r, g, b);
 }
@@ -69,20 +65,6 @@ int SDL_FillRect(Graphics::ManagedSurface *surf, Common::Rect *rect, uint color)
 	return 0;
 }
 
-void SDL_UpdateRect(Graphics::ManagedSurface *surf, int x, int y, int w, int h) {
-	Common::Rect r(x, y, x + w, y + h);
-	if (r.isEmpty())
-		r = Common::Rect(0, 0, surf->w, surf->h);
-
-	g_system->copyRectToScreen(surf->getPixels(), surf->pitch, r.left, r.top, r.width(), r.height());
-}
-
-void SDL_UpdateRects(Graphics::ManagedSurface *surf, int count, Common::Rect *rects) {
-	while (count-- > 0)
-		g_system->copyRectToScreen(surf->getPixels(), surf->pitch, rects->left, rects->top,
-			rects->width(), rects->height());
-}
-
 Graphics::ManagedSurface *SDL_LoadBMP(const char *filename) {
 	Common::File f;
 	Image::BitmapDecoder decoder;
@@ -122,14 +104,6 @@ int SDL_PollEvent(Common::Event *event) {
 	return Events::get()->pollEvent(*event);
 }
 
-int SDL_LockSurface(Graphics::ManagedSurface *surface) {
-	return 0;
-}
-
-int SDL_UnlockSurface(Graphics::ManagedSurface *surface) {
-	return 0;
-}
-
 Graphics::ManagedSurface *SDL_ConvertSurface(Graphics::ManagedSurface *src,
 		const Graphics::PixelFormat &fmt, uint32 flags) {
 	Graphics::ManagedSurface *dest = new Graphics::ManagedSurface(src->w, src->h, fmt);
diff --git a/engines/ultima/nuvie/misc/sdl_compat.h b/engines/ultima/nuvie/misc/sdl_compat.h
index eca7864ff0f..883fcdf71bb 100644
--- a/engines/ultima/nuvie/misc/sdl_compat.h
+++ b/engines/ultima/nuvie/misc/sdl_compat.h
@@ -29,25 +29,19 @@ namespace Ultima {
 namespace Nuvie {
 
 #define SDL_TRUE 1
-#define SDL_FALSE 0
 
 #define SDL_SWSURFACE 0
 
 extern uint32 SDL_GetTicks();
 extern void SDL_FreeSurface(Graphics::ManagedSurface *&s);
-extern void SDL_ShowCursor(bool show);
 extern uint32 SDL_MapRGB(Graphics::PixelFormat &format, byte r, byte g, byte b);
 extern int SDL_BlitSurface(const Graphics::ManagedSurface *src, const Common::Rect *srcrect,
 	Graphics::ManagedSurface *dst, Common::Rect *dstrect);
 extern int SDL_FillRect(Graphics::ManagedSurface *surf, Common::Rect *rect, uint color);
-extern void SDL_UpdateRect(Graphics::ManagedSurface *surf, int x, int y, int w, int h);
-extern void SDL_UpdateRects(Graphics::ManagedSurface *surf, int count, Common::Rect *rects);
 extern Graphics::ManagedSurface *SDL_LoadBMP(const char *filename);
 extern int SDL_SetColorKey(Graphics::ManagedSurface *surface, int flag, uint32 key);
 extern int SDL_WaitEvent(Common::Event *event);
 extern int SDL_PollEvent(Common::Event *event);
-extern int SDL_LockSurface(Graphics::ManagedSurface *surface);
-extern int SDL_UnlockSurface(Graphics::ManagedSurface *surface);
 extern Graphics::ManagedSurface *SDL_ConvertSurface(Graphics::ManagedSurface *src,
 	const Graphics::PixelFormat &fmt, uint32 flags);
 


Commit: 69f3f9eff80595c291dfc953aaddae2b493326fe
    https://github.com/scummvm/scummvm/commit/69f3f9eff80595c291dfc953aaddae2b493326fe
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2023-12-09T13:56:07+11:00

Commit Message:
ULTIMA: NUVIE: Clear game ptr if load fails

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


diff --git a/engines/ultima/nuvie/nuvie.cpp b/engines/ultima/nuvie/nuvie.cpp
index 4b07fb4b3cb..adb33fc3fc8 100644
--- a/engines/ultima/nuvie/nuvie.cpp
+++ b/engines/ultima/nuvie/nuvie.cpp
@@ -163,6 +163,7 @@ bool NuvieEngine::initialize() {
 
 	if (_game->loadGame(_script) == false) {
 		delete _game;
+		_game = nullptr;
 		return false;
 	}
 


Commit: e40737dbad092fc70e5d252ed3eade9048689a80
    https://github.com/scummvm/scummvm/commit/e40737dbad092fc70e5d252ed3eade9048689a80
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2023-12-09T13:56:07+11:00

Commit Message:
ULTIMA: NUVIE: Avoid crashes on some corrupt data

These differences also occur in the PC98 version, but we should always avoid
running off the end of the buffers.

Changed paths:
    engines/ultima/nuvie/fonts/font_manager.cpp
    engines/ultima/nuvie/save/save_game.cpp
    engines/ultima/nuvie/screen/game_palette.cpp
    engines/ultima/nuvie/script/script_cutscene.cpp


diff --git a/engines/ultima/nuvie/fonts/font_manager.cpp b/engines/ultima/nuvie/fonts/font_manager.cpp
index cd832cb9308..46fe7d2f21d 100644
--- a/engines/ultima/nuvie/fonts/font_manager.cpp
+++ b/engines/ultima/nuvie/fonts/font_manager.cpp
@@ -82,7 +82,7 @@ bool FontManager::initU6() {
 		return false;
 
 	font_data = u6_ch.readAll();
-	if (font_data == nullptr)
+	if (font_data == nullptr || u6_ch.get_size() < 256 * 8)
 		return false;
 
 // english font
diff --git a/engines/ultima/nuvie/save/save_game.cpp b/engines/ultima/nuvie/save/save_game.cpp
index 20e644d37e9..b9270416433 100644
--- a/engines/ultima/nuvie/save/save_game.cpp
+++ b/engines/ultima/nuvie/save/save_game.cpp
@@ -83,19 +83,19 @@ bool SaveGame::load_new() {
 	Std::string filename;
 	U6Lzw lzw;
 	NuvieIOBuffer buf;
-	unsigned char *data;
 	uint32 decomp_size;
-	ObjManager *obj_manager;
 	uint8 i;
 	uint32 pos;
 
-	obj_manager = Game::get_game()->get_obj_manager();
+	ObjManager *obj_manager = Game::get_game()->get_obj_manager();
 
 	init(obj_manager);
 
 	// Load surface chunks
 	config_get_path(config, "lzobjblk", filename);
-	data = lzw.decompress_file(filename, decomp_size);
+	unsigned char *data = lzw.decompress_file(filename, decomp_size);
+	if (!data)
+		return false;
 
 	buf.open(data, decomp_size, NUVIE_BUF_NOCOPY);
 
@@ -108,6 +108,8 @@ bool SaveGame::load_new() {
 	// Load dungeon chunks
 	config_get_path(config, "lzdngblk", filename);
 	data = lzw.decompress_file(filename, decomp_size);
+	if (!data)
+		return false;
 
 	buf.open(data, decomp_size, NUVIE_BUF_NOCOPY);
 
@@ -138,13 +140,10 @@ bool SaveGame::load_original() {
 	char x, y;
 	uint16 len;
 	uint8 i;
-	NuvieIOFileRead *objblk_file;
 	NuvieIOFileRead objlist_file;
-	ObjManager *obj_manager;
 
-	objblk_file = new NuvieIOFileRead();
-
-	obj_manager = Game::get_game()->get_obj_manager();
+	NuvieIOFileRead *objblk_file = new NuvieIOFileRead();
+	ObjManager *obj_manager = Game::get_game()->get_obj_manager();
 
 	init(obj_manager);
 
diff --git a/engines/ultima/nuvie/screen/game_palette.cpp b/engines/ultima/nuvie/screen/game_palette.cpp
index 937c55dd313..200db6dfcb8 100644
--- a/engines/ultima/nuvie/screen/game_palette.cpp
+++ b/engines/ultima/nuvie/screen/game_palette.cpp
@@ -73,7 +73,7 @@ bool GamePalette::loadPalette() {
 
 	pal_ptr = palette;
 
-	for (i = 0, j = 0; i < 256; i++, j += 3) {
+	for (i = 0, j = 0; i < MIN(256, file.get_size() / 3); i++, j += 3) {
 		pal_ptr[0] = buf[j] << 2;
 		pal_ptr[1] = buf[j + 1] << 2;
 		pal_ptr[2] = buf[j + 2] << 2;
diff --git a/engines/ultima/nuvie/script/script_cutscene.cpp b/engines/ultima/nuvie/script/script_cutscene.cpp
index bcd5605ce09..3d145cea68d 100644
--- a/engines/ultima/nuvie/script/script_cutscene.cpp
+++ b/engines/ultima/nuvie/script/script_cutscene.cpp
@@ -40,12 +40,12 @@
 namespace Ultima {
 namespace Nuvie {
 
-#define DELUXE_PAINT_MAGIC 0x4d524f46 // "FORM"
+static const uint32 DELUXE_PAINT_MAGIC = 0x4d524f46; // "FORM"
 
-#define INPUT_KEY_RIGHT 79 | (1<<30)
-#define INPUT_KEY_LEFT 80 | (1<<30)
-#define INPUT_KEY_DOWN  81 | (1<<30)
-#define INPUT_KEY_UP  82 | (1<<30)
+static const int INPUT_KEY_RIGHT = 79 | (1<<30);
+static const int INPUT_KEY_LEFT  = 80 | (1<<30);
+static const int INPUT_KEY_DOWN  = 81 | (1<<30);
+static const int INPUT_KEY_UP    = 82 | (1<<30);
 
 static ScriptCutscene *cutScene = nullptr;
 ScriptCutscene *get_cutscene() {
@@ -1273,9 +1273,11 @@ Std::vector<Std::vector<CSImage *> > ScriptCutscene::load_all_images(const char
 	} else {
 		uint32 decomp_size;
 		buf = lzw.decompress_file(path.c_str(), decomp_size);
+		if (!buf) // failed to open or decompress
+			return v;
 		NuvieIOBuffer io;
-		io.open(buf, decomp_size, false);
-		if (!lib_n.open(&io, 4, NUVIE_GAME_MD)) {
+		if (!buf || !io.open(buf, decomp_size, false) ||
+		    !lib_n.open(&io, 4, NUVIE_GAME_MD)) {
 			free(buf);
 			return v;
 		}


Commit: 1b0d2847602969663bba8665be6b65e957b8b625
    https://github.com/scummvm/scummvm/commit/1b0d2847602969663bba8665be6b65e957b8b625
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2023-12-09T13:56:07+11:00

Commit Message:
ULTIMA: NUVIE: Use an enum for compass directions

Adds a little type safety to direction operations and lets the compiler decide
size.

Changed paths:
    engines/ultima/nuvie/actors/actor.cpp
    engines/ultima/nuvie/actors/actor.h
    engines/ultima/nuvie/actors/actor_manager.cpp
    engines/ultima/nuvie/actors/md_actor.cpp
    engines/ultima/nuvie/actors/md_actor.h
    engines/ultima/nuvie/actors/u6_actor.cpp
    engines/ultima/nuvie/actors/u6_actor.h
    engines/ultima/nuvie/core/anim_manager.cpp
    engines/ultima/nuvie/core/effect.cpp
    engines/ultima/nuvie/core/magic.cpp
    engines/ultima/nuvie/core/magic.h
    engines/ultima/nuvie/core/map.cpp
    engines/ultima/nuvie/core/map.h
    engines/ultima/nuvie/core/nuvie_defs.h
    engines/ultima/nuvie/core/player.cpp
    engines/ultima/nuvie/core/weather.cpp
    engines/ultima/nuvie/core/weather.h
    engines/ultima/nuvie/gui/widgets/map_window.cpp
    engines/ultima/nuvie/gui/widgets/map_window.h
    engines/ultima/nuvie/keybinding/keys.cpp
    engines/ultima/nuvie/misc/u6_misc.cpp
    engines/ultima/nuvie/misc/u6_misc.h
    engines/ultima/nuvie/pathfinder/dir_finder.cpp
    engines/ultima/nuvie/pathfinder/dir_finder.h
    engines/ultima/nuvie/pathfinder/party_path_finder.cpp
    engines/ultima/nuvie/script/script.cpp
    engines/ultima/nuvie/script/script.h
    engines/ultima/nuvie/script/script_actor.cpp
    engines/ultima/nuvie/usecode/u6_usecode.cpp
    engines/ultima/nuvie/views/doll_view_gump.cpp
    engines/ultima/nuvie/views/doll_view_gump.h


diff --git a/engines/ultima/nuvie/actors/actor.cpp b/engines/ultima/nuvie/actors/actor.cpp
index 8c83d429aa8..df5790458ad 100644
--- a/engines/ultima/nuvie/actors/actor.cpp
+++ b/engines/ultima/nuvie/actors/actor.cpp
@@ -49,7 +49,7 @@ class ActorManager;
 
 Actor::Actor(Map *m, ObjManager *om, GameClock *c)
 	: sched(nullptr), obj_inventory(nullptr), map(m), obj_manager(om),
-	  usecode(nullptr), pathfinder(nullptr), direction(0), walk_frame(0),
+	  usecode(nullptr), pathfinder(nullptr), direction(NUVIE_DIR_N), walk_frame(0),
 	  ethereal(false), can_move(true), temp_actor(false), visible_flag(true),
 	  met_player(false), worktype(0), sched_pos(0), move_time(0), num_schedules(0),
 	  alignment(ACTOR_ALIGNMENT_NEUTRAL), moves(0), light(0), status_flags(0),
@@ -213,7 +213,7 @@ uint16 Actor::get_downward_facing_tile_num() const {
 }
 
 /* Set direction faced by actor and change walk frame. */
-void Actor::set_direction(uint8 d) {
+void Actor::set_direction(NuvieDir d) {
 	if (is_alive() == false || is_immobile())
 		return;
 
@@ -228,30 +228,30 @@ void Actor::set_direction(uint8 d) {
 
 /* Set direction as if moving in relative direction rel_x,rel_y. */
 void Actor::set_direction(sint16 rel_x, sint16 rel_y) {
-	uint8 new_direction = direction;
+	NuvieDir new_direction = direction;
 	if (rel_x == 0 && rel_y == 0) // nowhere (just update frame)
 		new_direction = direction;
 	else if (rel_x == 0) // up or down
 		new_direction = (rel_y < 0) ? NUVIE_DIR_N : NUVIE_DIR_S;
 	else if (rel_y == 0) // left or right
 		new_direction = (rel_x < 0) ? NUVIE_DIR_W : NUVIE_DIR_E;
-// Add 2 to current direction if it is opposite the new direction
+	// Add 2 to current direction if it is opposite the new direction
 	else if (rel_x < 0 && rel_y < 0) { // up-left
 		if (direction != NUVIE_DIR_N && direction != NUVIE_DIR_W)
-			new_direction = direction + 2;
+			new_direction = static_cast<NuvieDir>(direction + 2);
 	} else if (rel_x > 0 && rel_y < 0) { // up-right
 		if (direction != NUVIE_DIR_N && direction != NUVIE_DIR_E)
-			new_direction = direction + 2;
+			new_direction = static_cast<NuvieDir>(direction + 2);
 	} else if (rel_x < 0 && rel_y > 0) { // down-left
 		if (direction != NUVIE_DIR_S && direction != NUVIE_DIR_W)
-			new_direction = direction + 2;
+			new_direction = static_cast<NuvieDir>(direction + 2);
 	} else if (rel_x > 0 && rel_y > 0) { // down-right
 		if (direction != NUVIE_DIR_S && direction != NUVIE_DIR_E)
-			new_direction = direction + 2;
+			new_direction = static_cast<NuvieDir>(direction + 2);
 	}
 	// wrap
 	if (new_direction >= 4)
-		new_direction -= 4;
+		new_direction = static_cast<NuvieDir>(new_direction - 4);
 	set_direction(new_direction);
 }
 
@@ -269,16 +269,16 @@ void Actor::face_location(uint16 lx, uint16 ly) {
 void Actor::face_location(uint16 lx, uint16 ly) {
 	uint16 xdiff = abs(x - lx), ydiff = abs(y - ly);
 	if (ydiff) {
-		if (y < ly && direction != 2)
-			set_direction(2); // down
-		else if (y > ly && direction != 0)
-			set_direction(0); // up
+		if (y < ly && direction != NUVIE_DIR_S)
+			set_direction(NUVIE_DIR_S); // down
+		else if (y > ly && direction != NUVIE_DIR_N)
+			set_direction(NUVIE_DIR_N); // up
 	}
 	if (xdiff) {
-		if (x < lx && direction != 1)
-			set_direction(1); // right
-		else if (x > lx && direction != 3)
-			set_direction(3); // left
+		if (x < lx && direction != NUVIE_DIR_E)
+			set_direction(NUVIE_DIR_E); // right
+		else if (x > lx && direction != NUVIE_DIR_W)
+			set_direction(NUVIE_DIR_W); // left
 	}
 }
 #endif
@@ -1705,7 +1705,7 @@ void Actor::print() {
 	DEBUG(1, LEVEL_INFORMATIONAL, "obj_n: %03d    frame_n: %d\n", actor->obj_n, actor->frame_n);
 	DEBUG(1, LEVEL_INFORMATIONAL, "base_obj_n: %03d    old_frame_n: %d\n", actor->base_obj_n, actor->old_frame_n);
 
-	uint8 dir = actor->direction;
+	NuvieDir dir = actor->direction;
 	DEBUG(1, LEVEL_INFORMATIONAL, "direction: %d (%s)\n", dir, (dir == NUVIE_DIR_N) ? "north" :
 	      (dir == NUVIE_DIR_E) ? "east" :
 	      (dir == NUVIE_DIR_S) ? "south" :
@@ -1882,7 +1882,7 @@ Obj *Actor::find_body() {
 
 /* Change actor type. */
 bool Actor::morph(uint16 objN) {
-	uint8 old_dir = get_direction(); // FIXME: this should get saved through init_from_obj()
+	NuvieDir old_dir = get_direction(); // FIXME: this should get saved through init_from_obj()
 
 	Obj *actor_obj = make_obj();
 	actor_obj->obj_n = objN;
diff --git a/engines/ultima/nuvie/actors/actor.h b/engines/ultima/nuvie/actors/actor.h
index bf99fa278d0..52dcc6dc7a8 100644
--- a/engines/ultima/nuvie/actors/actor.h
+++ b/engines/ultima/nuvie/actors/actor.h
@@ -248,7 +248,7 @@ protected:
 	uint16 base_obj_n;
 	uint16 old_frame_n;
 
-	uint8 direction;
+	NuvieDir direction;
 	uint8 walk_frame;
 
 	uint8 obj_flags;
@@ -541,11 +541,11 @@ public:
 	void set_combat_mode(uint8 new_mode);
 	virtual void revert_worktype() { }
 
-	uint8 get_direction() const {
+	NuvieDir get_direction() const {
 		return direction;
 	}
 	void set_direction(sint16 rel_x, sint16 rel_y);
-	virtual void set_direction(uint8 d);
+	virtual void set_direction(NuvieDir d);
 	void face_location(const MapCoord &loc);
 	virtual void face_location(uint16 lx, uint16 ly);
 	void face_actor(Actor *a);
diff --git a/engines/ultima/nuvie/actors/actor_manager.cpp b/engines/ultima/nuvie/actors/actor_manager.cpp
index 1837a1fa942..bc55e49d975 100644
--- a/engines/ultima/nuvie/actors/actor_manager.cpp
+++ b/engines/ultima/nuvie/actors/actor_manager.cpp
@@ -145,7 +145,7 @@ bool ActorManager::load(NuvieIO *objlist) {
 		actors[i]->obj_n += (b2 & 0x3) << 8;
 
 		actors[i]->frame_n = (b2 & 0xfc) >> 2;
-		actors[i]->direction = actors[i]->frame_n / 4;
+		actors[i]->direction = static_cast<NuvieDir>(actors[i]->frame_n / 4);
 		if (actors[i]->obj_n == 0) { //Hack to get rid of Exodus.
 			actors[i]->x = 0;
 			actors[i]->y = 0;
diff --git a/engines/ultima/nuvie/actors/md_actor.cpp b/engines/ultima/nuvie/actors/md_actor.cpp
index 079ffe1a4da..4525a93369e 100644
--- a/engines/ultima/nuvie/actors/md_actor.cpp
+++ b/engines/ultima/nuvie/actors/md_actor.cpp
@@ -60,7 +60,7 @@ bool MDActor::check_move(uint16 new_x, uint16 new_y, uint8 new_z, ActorMoveFlags
 		return false;
 
 	if (z == new_z) { //FIXME check if new pos is adjacent to current position
-		uint8 movement_dir = DirFinder::get_nuvie_dir(x, y, new_x, new_y, z);
+		NuvieDir movement_dir = DirFinder::get_nuvie_dir(x, y, new_x, new_y, z);
 //   printf("%d (%d,%d) -> (%d,%d) move = %d %s\n", id_n, x, y, new_x, new_y, movement_dir, get_direction_name(movement_dir));
 		return map->is_passable(new_x, new_y, new_z, movement_dir);
 	}
@@ -116,7 +116,7 @@ uint8 MDActor::get_dex_text_color() const {
 	return color;
 }
 
-void MDActor::set_direction(uint8 d) {
+void MDActor::set_direction(NuvieDir d) {
 	if (!is_alive() || is_immobile())
 		return;
 
diff --git a/engines/ultima/nuvie/actors/md_actor.h b/engines/ultima/nuvie/actors/md_actor.h
index 447a5b85187..971adea181d 100644
--- a/engines/ultima/nuvie/actors/md_actor.h
+++ b/engines/ultima/nuvie/actors/md_actor.h
@@ -47,7 +47,7 @@ public:
 
 	bool check_move(uint16 new_x, uint16 new_y, uint8 new_z, ActorMoveFlags flags = 0) override;
 	uint16 get_downward_facing_tile_num() const override;
-	void set_direction(uint8 d) override;
+	void set_direction(NuvieDir d) override;
 	bool is_passable() const override;
 
 };
diff --git a/engines/ultima/nuvie/actors/u6_actor.cpp b/engines/ultima/nuvie/actors/u6_actor.cpp
index 1c6c2b9aa97..7a689ac4991 100644
--- a/engines/ultima/nuvie/actors/u6_actor.cpp
+++ b/engines/ultima/nuvie/actors/u6_actor.cpp
@@ -145,6 +145,8 @@ bool U6Actor::init_ship() {
 		obj1_x = x - 1;
 		obj2_x = x + 1;
 		break;
+	default:
+		error("Invalid direction in U6Actor::init_ship");
 	}
 
 	obj = obj_manager->get_obj(obj1_x, obj1_y, z);
@@ -179,6 +181,8 @@ bool U6Actor::init_splitactor(uint8 obj_status) {
 	case NUVIE_DIR_W :
 		obj_x = WRAPPED_COORD(x + 1, z);
 		break;
+	default:
+		error("Invalid direction in U6Actor::init_splitactor");
 	}
 
 // init back object
@@ -225,6 +229,8 @@ bool U6Actor::init_dragon() {
 		wing1_y = y + 1;
 		wing2_y = y - 1;
 		break;
+	default:
+		error("Invalid direction in U6Actor::init_dragon");
 	}
 
 	init_surrounding_obj(head_x, head_y, z, obj_n, frame_n + 8);
@@ -276,6 +282,8 @@ bool U6Actor::init_silver_serpent() {
 		sx++;
 		tmp_frame_n = 7;
 		break;
+	default:
+		error("Invalid direction in U6Actor::init_silver_serpent");
 	}
 
 	obj = obj_manager->get_obj_of_type_from_location(OBJ_U6_SILVER_SERPENT, 1, id_n, sx, sy, sz);
@@ -431,7 +439,7 @@ bool U6Actor::updateSchedule(uint8 hour, bool teleport) {
 // workout our direction based on actor_type and frame_n
 inline void U6Actor::discover_direction() {
 	if (actor_type->frames_per_direction != 0)
-		direction = (frame_n - actor_type->tile_start_offset) / actor_type->tiles_per_direction;
+		direction = static_cast<NuvieDir>((frame_n - actor_type->tile_start_offset) / actor_type->tiles_per_direction);
 	else
 		direction = NUVIE_DIR_S;
 }
@@ -442,13 +450,14 @@ void U6Actor::change_base_obj_n(uint16 val) {
 	init();
 }
 
-void U6Actor::set_direction(uint8 d) {
+void U6Actor::set_direction(NuvieDir d) {
 	if (is_alive() == false || is_immobile())
 		return;
 
 	uint8 frames_per_dir = (actor_type->frames_per_direction != 0)
 	                       ? actor_type->frames_per_direction : 4;
-	if (d >= 4)
+
+	if (d >= 4) // ignore diagonals
 		return;
 
 	if (walk_frame == 0)
@@ -643,7 +652,7 @@ bool U6Actor::sit_on_chair(Obj *obj) {
 				frame_n = (obj->frame_n * 2);
 			else
 				frame_n = (obj->frame_n * 4) + 3;
-			direction = obj->frame_n;
+			direction = static_cast<NuvieDir>(obj->frame_n);
 			can_move = false;
 			return true;
 		}
@@ -1107,7 +1116,7 @@ inline void U6Actor::move_silver_serpent_objs_relative(sint16 rel_x, sint16 rel_
 }
 
 
-inline void U6Actor::set_direction_of_surrounding_objs(uint8 new_direction) {
+inline void U6Actor::set_direction_of_surrounding_objs(NuvieDir new_direction) {
 	remove_surrounding_objs_from_map();
 
 	switch (obj_n) {
@@ -1134,7 +1143,7 @@ inline void U6Actor::set_direction_of_surrounding_objs(uint8 new_direction) {
 	return;
 }
 
-inline void U6Actor::set_direction_of_surrounding_ship_objs(uint8 new_direction) {
+inline void U6Actor::set_direction_of_surrounding_ship_objs(NuvieDir new_direction) {
 	Std::list<Obj *>::iterator obj = surrounding_objects.begin();
 	if (obj == surrounding_objects.end())
 		return;
@@ -1173,6 +1182,9 @@ inline void U6Actor::set_direction_of_surrounding_ship_objs(uint8 new_direction)
 		else
 			(*obj)->x = x - 1;
 		break;
+
+	default:
+		error("Invalid dir for U6Actor::set_direction_of_surrounding_ship_objs");
 	}
 
 	obj++;
@@ -1211,11 +1223,14 @@ inline void U6Actor::set_direction_of_surrounding_ship_objs(uint8 new_direction)
 		else
 			(*obj)->x = x + 1;
 		break;
+
+	default:
+		error("Invalid dir for U6Actor::set_direction_of_surrounding_ship_objs");
 	}
 
 }
 
-inline void U6Actor::set_direction_of_surrounding_splitactor_objs(uint8 new_direction) {
+inline void U6Actor::set_direction_of_surrounding_splitactor_objs(NuvieDir new_direction) {
 	if (surrounding_objects.empty())
 		return;
 
@@ -1258,11 +1273,14 @@ inline void U6Actor::set_direction_of_surrounding_splitactor_objs(uint8 new_dire
 		else
 			obj->x = x + 1;
 		break;
+
+	default:
+		error("Invalid direction in U6Actor::set_direction_of_surrounding_splitactor_objs");
 	}
 
 }
 
-inline void U6Actor::set_direction_of_surrounding_dragon_objs(uint8 new_direction) {
+inline void U6Actor::set_direction_of_surrounding_dragon_objs(NuvieDir new_direction) {
 	Std::list<Obj *>::iterator obj;
 	uint8 frame_offset = (new_direction * actor_type->tiles_per_direction + actor_type->tiles_per_frame - 1);
 	Obj *head, *tail, *wing1, *wing2;
@@ -1329,6 +1347,10 @@ inline void U6Actor::set_direction_of_surrounding_dragon_objs(uint8 new_directio
 		wing1->y = y + 1;
 		wing2->y = y - 1;
 		break;
+
+	default:
+		error("Invalid direction in U6Actor::set_direction_of_surrounding_dragon_objs");
+
 	}
 
 }
diff --git a/engines/ultima/nuvie/actors/u6_actor.h b/engines/ultima/nuvie/actors/u6_actor.h
index d5ed3299005..d4237eac28c 100644
--- a/engines/ultima/nuvie/actors/u6_actor.h
+++ b/engines/ultima/nuvie/actors/u6_actor.h
@@ -28,13 +28,15 @@
 namespace Ultima {
 namespace Nuvie {
 
-#define MOVETYPE_U6_NONE       0
-#define MOVETYPE_U6_LAND       1
-#define MOVETYPE_U6_WATER_LOW  2 // skiffs, rafts
-#define MOVETYPE_U6_WATER_HIGH 3 // ships
-#define MOVETYPE_U6_AIR_LOW    4 // balloon, birds... this movetype cannot cross mountain tops.
-#define MOVETYPE_U6_AIR_HIGH   5 // dragons
-#define MOVETYPE_U6_ETHEREAL   6
+enum ActorMovetype {
+	MOVETYPE_U6_NONE = 0,
+	MOVETYPE_U6_LAND = 1,
+	MOVETYPE_U6_WATER_LOW = 2, 	// skiffs, rafts
+	MOVETYPE_U6_WATER_HIGH = 3, // ships
+	MOVETYPE_U6_AIR_LOW = 4, 	// balloon, birds... this movetype cannot cross mountain tops.
+	MOVETYPE_U6_AIR_HIGH = 5, 	// dragons
+	MOVETYPE_U6_ETHEREAL = 6,
+};
 
 #define REMOVE_SURROUNDING_OBJS true
 
@@ -51,7 +53,7 @@ typedef struct {
 	bool can_laydown;
 	bool can_sit;
 	ActorTileType tile_type;
-	uint8 movetype;
+	ActorMovetype movetype;
 	uint16 twitch_rand; //used to control how frequently an actor twitches, lower numbers twitch more
 	uint8 body_armor_class;
 } U6ActorType;
@@ -61,7 +63,7 @@ protected:
 
 	const U6ActorType *actor_type;
 	const U6ActorType *base_actor_type;
-	uint8 current_movetype;
+	ActorMovetype current_movetype;
 
 	sint8 walk_frame_inc; // added to walk_frame each step
 
@@ -76,7 +78,7 @@ public:
 	void set_worktype(uint8 new_worktype, bool init = false) override;
 	void revert_worktype() override;
 	void change_base_obj_n(uint16 val) override;
-	void set_direction(uint8 d) override;
+	void set_direction(NuvieDir d) override;
 	void face_location(uint16 lx, uint16 ly) override;
 	void clear() override;
 	bool move(uint16 new_x, uint16 new_y, uint8 new_z, ActorMoveFlags flags = 0) override;
@@ -152,10 +154,10 @@ protected:
 	inline void add_surrounding_objs_to_map();
 	inline void move_surrounding_objs_relative(sint16 rel_x, sint16 rel_y);
 	inline void move_silver_serpent_objs_relative(sint16 rel_x, sint16 rel_y);
-	inline void set_direction_of_surrounding_objs(uint8 new_direction);
-	inline void set_direction_of_surrounding_ship_objs(uint8 new_direction);
-	inline void set_direction_of_surrounding_splitactor_objs(uint8 new_direction);
-	inline void set_direction_of_surrounding_dragon_objs(uint8 new_direction);
+	inline void set_direction_of_surrounding_objs(NuvieDir new_direction);
+	inline void set_direction_of_surrounding_ship_objs(NuvieDir new_direction);
+	inline void set_direction_of_surrounding_splitactor_objs(NuvieDir new_direction);
+	inline void set_direction_of_surrounding_dragon_objs(NuvieDir new_direction);
 
 	inline void twitch_surrounding_objs();
 	inline void twitch_surrounding_dragon_objs();
diff --git a/engines/ultima/nuvie/core/anim_manager.cpp b/engines/ultima/nuvie/core/anim_manager.cpp
index 1546790d4bb..cba32b579d2 100644
--- a/engines/ultima/nuvie/core/anim_manager.cpp
+++ b/engines/ultima/nuvie/core/anim_manager.cpp
@@ -776,8 +776,9 @@ void ExplosiveAnim::start() {
 		flame[t].travelled = 0;
 		flame[t].tile = add_tile(tile_manager->get_tile(exploding_tile_num), 0, 0);
 
-		uint8 dir = (t < 8) ? t : NUVIE_RAND() % 8;
+		NuvieDir dir = static_cast<NuvieDir>((t < 8) ? t : NUVIE_RAND() % 8);
 		switch (dir) {
+		default: // can't happen, but make the analyzer happy.
 		case NUVIE_DIR_N:
 			flame[t].direction = MapCoord(0, -s);
 			break;
diff --git a/engines/ultima/nuvie/core/effect.cpp b/engines/ultima/nuvie/core/effect.cpp
index f20c4dea84c..c6d313ca654 100644
--- a/engines/ultima/nuvie/core/effect.cpp
+++ b/engines/ultima/nuvie/core/effect.cpp
@@ -397,11 +397,12 @@ void QuakeEffect::stop_quake() {
 /* Set sx,sy to a random direction. (always move left-right more than up-down)
  */
 void QuakeEffect::init_directions() {
-	uint8 dir = NUVIE_RAND() % 8;
+	NuvieDir dir = static_cast<NuvieDir>(NUVIE_RAND() % 8);
 	sx = 0;
 	sy = 0;
 
 	switch (dir) {
+	default: // can't happen, but make the analyzer happy.
 	case NUVIE_DIR_N :
 		sy = -(strength * 2);
 		break;
diff --git a/engines/ultima/nuvie/core/magic.cpp b/engines/ultima/nuvie/core/magic.cpp
index 5549532208b..57ed42a35e3 100644
--- a/engines/ultima/nuvie/core/magic.cpp
+++ b/engines/ultima/nuvie/core/magic.cpp
@@ -340,7 +340,7 @@ bool Magic::resume(const MapCoord &location) {
 	return true;
 }
 
-bool Magic::resume(uint8 dir) {
+bool Magic::resume(NuvieDir dir) {
 	if (magic_script) {
 		process_script_return(magic_script->resume_with_direction(dir));
 	}
diff --git a/engines/ultima/nuvie/core/magic.h b/engines/ultima/nuvie/core/magic.h
index 753bbb188ab..9c8f9683a19 100644
--- a/engines/ultima/nuvie/core/magic.h
+++ b/engines/ultima/nuvie/core/magic.h
@@ -109,7 +109,7 @@ public:
 	uint16 callback(uint16 msg, CallBack *caller, void *data = nullptr) override;
 	bool process_script_return(uint8 ret);
 	bool resume(const MapCoord &location);
-	bool resume(uint8 dir);
+	bool resume(NuvieDir dir);
 	bool resume_with_spell_num(uint8 spell_num);
 	bool resume(Obj *obj);
 	bool resume();
diff --git a/engines/ultima/nuvie/core/map.cpp b/engines/ultima/nuvie/core/map.cpp
index 75a84631468..d335017375f 100644
--- a/engines/ultima/nuvie/core/map.cpp
+++ b/engines/ultima/nuvie/core/map.cpp
@@ -124,7 +124,7 @@ bool Map::is_passable(uint16 x, uint16 y, uint8 level) {
  * Can we enter this map location by traveling in a given direction?
  * Used by MD
  */
-bool Map::is_passable(uint16 x, uint16 y, uint8 level, uint8 dir) {
+bool Map::is_passable(uint16 x, uint16 y, uint8 level, NuvieDir dir) {
 	if (is_passable_from_dir(x, y, level, get_reverse_direction(dir))) {
 		sint16 rel_x, rel_y;
 		uint16 tx, ty;
@@ -136,7 +136,7 @@ bool Map::is_passable(uint16 x, uint16 y, uint8 level, uint8 dir) {
 	return false;
 }
 
-bool Map::is_passable_from_dir(uint16 x, uint16 y, uint8 level, uint8 dir) {
+bool Map::is_passable_from_dir(uint16 x, uint16 y, uint8 level, NuvieDir dir) {
 	WRAP_COORD(x, level);
 	WRAP_COORD(y, level);
 
@@ -170,6 +170,8 @@ bool Map::is_passable_from_dir(uint16 x, uint16 y, uint8 level, uint8 dir) {
 			return !(!(map_tile->flags1 & TILEFLAG_WALL_SOUTH) || !(map_tile->flags1 & TILEFLAG_WALL_EAST));
 		case NUVIE_DIR_SW :
 			return !(!(map_tile->flags1 & TILEFLAG_WALL_SOUTH) || !(map_tile->flags1 & TILEFLAG_WALL_WEST));
+		default:
+			error("Invalid direction in Map::is_passable_from_dir");
 		}
 	}
 
diff --git a/engines/ultima/nuvie/core/map.h b/engines/ultima/nuvie/core/map.h
index 43f70ea4873..1e8f1ac835e 100644
--- a/engines/ultima/nuvie/core/map.h
+++ b/engines/ultima/nuvie/core/map.h
@@ -178,9 +178,9 @@ public:
 	bool actor_at_location(uint16 x, uint16 y, uint8 level, bool inc_surrounding_objs = true);
 	uint8 get_impedance(uint16 x, uint16 y, uint8 level, bool ignore_objects = false);
 	const Tile *get_dmg_tile(uint16 x, uint16 y, uint8 level);
-	bool is_passable(uint16 x, uint16 y, uint8 level, uint8 dir);
+	bool is_passable(uint16 x, uint16 y, uint8 level, NuvieDir dir);
 	bool is_passable(uint16 x1, uint16 y1, uint16 x2, uint16 y2, uint8 level);
-	bool is_passable_from_dir(uint16 x, uint16 y, uint8 level, uint8 dir);
+	bool is_passable_from_dir(uint16 x, uint16 y, uint8 level, NuvieDir dir);
 	bool has_roof(uint16 x, uint16 y, uint8 level) const;
 	void set_roof_mode(bool roofs);
 
diff --git a/engines/ultima/nuvie/core/nuvie_defs.h b/engines/ultima/nuvie/core/nuvie_defs.h
index 2dc41ba2334..be2c4e9fd96 100644
--- a/engines/ultima/nuvie/core/nuvie_defs.h
+++ b/engines/ultima/nuvie/core/nuvie_defs.h
@@ -85,17 +85,19 @@ const uint16 map_pitch[2] = { 1024, 256 }; // width of 0:surface plane, and 1:al
 #define WRAP_COORD(c,level) ((c)&=(map_pitch[(level==0)?0:1]-1)) // modifies C
 */
 
-#define NUVIE_DIR_N    0
-#define NUVIE_DIR_E    1
-#define NUVIE_DIR_S    2
-#define NUVIE_DIR_W    3
-
-#define NUVIE_DIR_NE   4
-#define NUVIE_DIR_SE   5
-#define NUVIE_DIR_SW   6
-#define NUVIE_DIR_NW   7
-
-#define NUVIE_DIR_NONE 8
+enum NuvieDir {
+	NUVIE_DIR_N = 0,
+	NUVIE_DIR_E = 1,
+	NUVIE_DIR_S = 2,
+	NUVIE_DIR_W = 3,
+
+	NUVIE_DIR_NE = 4,
+	NUVIE_DIR_SE = 5,
+	NUVIE_DIR_SW = 6,
+	NUVIE_DIR_NW = 7,
+
+	NUVIE_DIR_NONE = 8,
+};
 
 #define TRAMMEL_PHASE 1.75
 #define FELUCCA_PHASE 1.1666666666666667
diff --git a/engines/ultima/nuvie/core/player.cpp b/engines/ultima/nuvie/core/player.cpp
index 575c3799917..e01b66e8cb5 100644
--- a/engines/ultima/nuvie/core/player.cpp
+++ b/engines/ultima/nuvie/core/player.cpp
@@ -284,7 +284,7 @@ bool Player::check_moveRelative(sint16 rel_x, sint16 rel_y) {
 
 // walk to adjacent square
 void Player::moveRelative(sint16 rel_x, sint16 rel_y, bool mouse_movement) {
-	const uint8 raft_movement_tbl[] = {
+	const NuvieDir raft_movement_tbl[] = {
 		NUVIE_DIR_N, NUVIE_DIR_NE, NUVIE_DIR_N, NUVIE_DIR_NW, NUVIE_DIR_N, NUVIE_DIR_NE, NUVIE_DIR_NW, NUVIE_DIR_N,
 		NUVIE_DIR_NE, NUVIE_DIR_NE, NUVIE_DIR_E, NUVIE_DIR_N, NUVIE_DIR_NE, NUVIE_DIR_E, NUVIE_DIR_NE, NUVIE_DIR_N,
 		NUVIE_DIR_NE, NUVIE_DIR_E, NUVIE_DIR_SE, NUVIE_DIR_E, NUVIE_DIR_E, NUVIE_DIR_E, NUVIE_DIR_SE, NUVIE_DIR_NE,
@@ -299,7 +299,7 @@ void Player::moveRelative(sint16 rel_x, sint16 rel_y, bool mouse_movement) {
 
 	MovementStatus movementStatus = CAN_MOVE;
 	bool can_change_rel_dir = true;
-	uint8 wind_dir = Game::get_game()->get_weather()->get_wind_dir();
+	NuvieDir wind_dir = Game::get_game()->get_weather()->get_wind_dir();
 	uint16 x, y;
 	uint8 z;
 	actor->get_location(&x, &y, &z);
@@ -309,7 +309,7 @@ void Player::moveRelative(sint16 rel_x, sint16 rel_y, bool mouse_movement) {
 			if (actor->obj_n == OBJ_U6_INFLATED_BALLOON &&
 			        (!Game::get_game()->has_free_balloon_movement() || !party->has_obj(OBJ_U6_FAN, 0, false))) {
 				can_change_rel_dir = false;
-				uint8 dir = get_reverse_direction(Game::get_game()->get_weather()->get_wind_dir());
+				NuvieDir dir = get_reverse_direction(Game::get_game()->get_weather()->get_wind_dir());
 				if (dir == NUVIE_DIR_NONE) {
 					Game::get_game()->get_scroll()->display_string("Thou canst not move without wind!\n\n");
 					Game::get_game()->get_scroll()->display_prompt();
@@ -320,13 +320,13 @@ void Player::moveRelative(sint16 rel_x, sint16 rel_y, bool mouse_movement) {
 					get_relative_dir(dir, &rel_x, &rel_y);
 				}
 			} else if (actor->obj_n == OBJ_U6_RAFT) {
-				uint8 dir = 0;
+				NuvieDir dir = NUVIE_DIR_N;
 				can_change_rel_dir = false;
 				const Tile *t = Game::get_game()->get_game_map()->get_tile(x, y, z, true);
 				if (t->flags1 & TILEFLAG_BLOCKING) { //deep water tiles are blocking. Shore tiles should allow player movement.
 					//deep water, so take control away from player.
 					if (t->tile_num >= 8 && t->tile_num < 16) {
-						dir = t->tile_num - 8;
+						dir = static_cast<NuvieDir>(t->tile_num - 8);
 					}
 					if (wind_dir != NUVIE_DIR_NONE) {
 						dir = raft_movement_tbl[dir * 8 + get_reverse_direction(wind_dir)];
@@ -408,7 +408,7 @@ void Player::moveRelative(sint16 rel_x, sint16 rel_y, bool mouse_movement) {
 		if (game_type == NUVIE_GAME_U6 && (actor->obj_n == OBJ_U6_INFLATED_BALLOON || actor->obj_n == OBJ_U6_RAFT)) {
 			actor->set_moves_left(actor->get_moves_left() - PLAYER_BASE_MOVEMENT_COST);
 		} else if (game_type == NUVIE_GAME_U6 && actor->obj_n == OBJ_U6_SHIP && wind_dir != WEATHER_WIND_CALM) {
-			uint8 nuvie_dir = get_direction_code(rel_x, rel_y);
+			NuvieDir nuvie_dir = get_direction_code(rel_x, rel_y);
 			if (nuvie_dir != NUVIE_DIR_NONE) {
 				sint8 dir = get_original_dir_code(nuvie_dir);
 
@@ -416,7 +416,7 @@ void Player::moveRelative(sint16 rel_x, sint16 rel_y, bool mouse_movement) {
 				//DEBUG(0, LEVEL_DEBUGGING, "Ship movement cost = %d\n", ship_cost[abs(dir-wind_dir)]);
 			}
 		} else if (game_type == NUVIE_GAME_U6 && actor->obj_n == OBJ_U6_SKIFF) {
-			uint8 nuvie_dir = get_direction_code(rel_x, rel_y);
+			NuvieDir nuvie_dir = get_direction_code(rel_x, rel_y);
 			if (nuvie_dir != NUVIE_DIR_NONE) {
 				sint8 dir = get_original_dir_code(nuvie_dir);
 				sint8 water_dir = dir;
diff --git a/engines/ultima/nuvie/core/weather.cpp b/engines/ultima/nuvie/core/weather.cpp
index 1901c06f669..23a96fea5f3 100644
--- a/engines/ultima/nuvie/core/weather.cpp
+++ b/engines/ultima/nuvie/core/weather.cpp
@@ -87,8 +87,8 @@ void Weather::update_moongates() {
 	Game::get_game()->get_script()->call_update_moongates(is_moon_visible());
 }
 
-uint8 Weather::load_wind(NuvieIO *objlist) {
-	const uint8 wind_tbl[8] = {
+NuvieDir Weather::load_wind(NuvieIO *objlist) {
+	const NuvieDir wind_tbl[8] = {
 		NUVIE_DIR_N,
 		NUVIE_DIR_NE,
 		NUVIE_DIR_E,
@@ -191,16 +191,14 @@ string Weather::get_wind_dir_str() const {
 }
 
 void Weather::change_wind_dir() {
-	uint8 new_wind_dir;
-
-	new_wind_dir = NUVIE_RAND() % 9;
+	NuvieDir new_wind_dir = static_cast<NuvieDir>(NUVIE_RAND() % 9);
 
 	set_wind_dir(new_wind_dir);
 	return;
 }
 
-bool Weather::set_wind_dir(uint8 new_wind_dir) {
-	uint8 old_wind_dir = wind_dir;
+bool Weather::set_wind_dir(NuvieDir new_wind_dir) {
+	NuvieDir old_wind_dir = wind_dir;
 
 	if (new_wind_dir >= 9)
 		return false;
diff --git a/engines/ultima/nuvie/core/weather.h b/engines/ultima/nuvie/core/weather.h
index d6e05b3f46e..2e021454ed5 100644
--- a/engines/ultima/nuvie/core/weather.h
+++ b/engines/ultima/nuvie/core/weather.h
@@ -49,7 +49,7 @@ class Weather: public CallBack {
 	GameClock *_clock;
 	nuvie_game_t gametype; // what game is being played?
 
-	uint8 wind_dir;
+	NuvieDir wind_dir;
 	Std::list<CallBack *>wind_change_notification_list;
 
 	GameTimedCallback *wind_timer;
@@ -63,13 +63,13 @@ public:
 	bool save(NuvieIO *objlist);
 
 	Std::string get_wind_dir_str() const;
-	uint8 get_wind_dir() const {
+	NuvieDir get_wind_dir() const {
 		return wind_dir;
 	}
 	bool is_displaying_from_wind_dir() const {
 		return display_from_wind_dir;
 	}
-	bool set_wind_dir(uint8 new_wind_dir);
+	bool set_wind_dir(NuvieDir new_wind_dir);
 	bool add_wind_change_notification_callback(CallBack *caller);
 	bool set_moonstone(uint8 moonstone, MapCoord where);
 	MapCoord get_moonstone(uint8 moonstone);
@@ -82,7 +82,7 @@ public:
 
 protected:
 
-	uint8 load_wind(NuvieIO *objlist);
+	NuvieDir load_wind(NuvieIO *objlist);
 	bool save_wind(NuvieIO *objlist);
 	void change_wind_dir();
 	inline void set_wind_change_callback();
diff --git a/engines/ultima/nuvie/gui/widgets/map_window.cpp b/engines/ultima/nuvie/gui/widgets/map_window.cpp
index 6eaa4c2c80d..839abb0541c 100644
--- a/engines/ultima/nuvie/gui/widgets/map_window.cpp
+++ b/engines/ultima/nuvie/gui/widgets/map_window.cpp
@@ -1641,7 +1641,7 @@ bool MapWindow::tmpBufTileIsBoundary(uint16 x, uint16 y) {
 	return false;
 }
 
-bool MapWindow::tmpBufTileIsWall(uint16 x, uint16 y, uint8 direction) {
+bool MapWindow::tmpBufTileIsWall(uint16 x, uint16 y, NuvieDir direction) {
 
 	uint16 tile_num = tmp_map_buf[y * tmp_map_width + x];
 
@@ -1662,6 +1662,8 @@ bool MapWindow::tmpBufTileIsWall(uint16 x, uint16 y, uint8 direction) {
 	case NUVIE_DIR_W :
 		mask = TILEFLAG_WALL_EAST;
 		break;
+	default:
+		error("invalid direction in MapWindow::tmpBufferIsWall");
 	}
 
 	const Tile *tile = tile_manager->get_tile(tile_num);
diff --git a/engines/ultima/nuvie/gui/widgets/map_window.h b/engines/ultima/nuvie/gui/widgets/map_window.h
index 8715f677a85..98a1314bf71 100644
--- a/engines/ultima/nuvie/gui/widgets/map_window.h
+++ b/engines/ultima/nuvie/gui/widgets/map_window.h
@@ -360,7 +360,7 @@ protected:
 	void reshapeBoundary();
 	inline bool tmpBufTileIsBlack(uint16 x, uint16 y);
 	bool tmpBufTileIsBoundary(uint16 x, uint16 y);
-	bool tmpBufTileIsWall(uint16 x, uint16 y, uint8 direction);
+	bool tmpBufTileIsWall(uint16 x, uint16 y, NuvieDir direction);
 
 	void wizard_eye_stop();
 	void wizard_eye_update();
diff --git a/engines/ultima/nuvie/keybinding/keys.cpp b/engines/ultima/nuvie/keybinding/keys.cpp
index 00bb4b20c7a..593a3718688 100644
--- a/engines/ultima/nuvie/keybinding/keys.cpp
+++ b/engines/ultima/nuvie/keybinding/keys.cpp
@@ -769,7 +769,7 @@ Common::KeyCode KeyBinder::get_key_from_joy_axis_motion(int axis, bool repeating
 	if (yaxis != 255 && _joyAxisPositions[yaxis] != 0)
 		yoff = _joyAxisPositions[yaxis] < 0 ? -1 : 1;
 
-	uint8 dir = get_direction_code(xoff, yoff);
+	NuvieDir dir = get_direction_code(xoff, yoff);
 	if (axes_pair == AXES_PAIR1) {
 		if (dir == NUVIE_DIR_NONE) {
 			next_axes_pair_update = 0; // centered so okay to reset
diff --git a/engines/ultima/nuvie/misc/u6_misc.cpp b/engines/ultima/nuvie/misc/u6_misc.cpp
index 6c4b26c8897..f316a216fc0 100644
--- a/engines/ultima/nuvie/misc/u6_misc.cpp
+++ b/engines/ultima/nuvie/misc/u6_misc.cpp
@@ -326,7 +326,7 @@ bool subtract_rect(const Common::Rect *rect1, const Common::Rect *rect2, Common:
 	return true;
 }
 
-const char *get_direction_name(uint8 dir) {
+const char *get_direction_name(NuvieDir dir) {
 	switch (dir) {
 	case NUVIE_DIR_N:
 		return "north";
@@ -358,8 +358,8 @@ const char *get_direction_name(sint16 rel_x, sint16 rel_y) {
 }
 
 /* Gets the nuvie direction code from the original u6 direction code. */
-uint8 get_nuvie_dir_code(uint8 original_dir_code) {
-	uint8 dir = NUVIE_DIR_NONE;
+NuvieDir get_nuvie_dir_code(uint8 original_dir_code) {
+	NuvieDir dir = NUVIE_DIR_NONE;
 	//convert original direction into nuvie direction.
 	//original
 	// 701
@@ -402,7 +402,7 @@ uint8 get_nuvie_dir_code(uint8 original_dir_code) {
 	return dir;
 }
 
-sint8 get_original_dir_code(uint8 nuvie_dir_code) {
+sint8 get_original_dir_code(NuvieDir nuvie_dir_code) {
 	sint8 dir = -1;
 	//convert nuvie direction into original direction.
 	switch (nuvie_dir_code) {
@@ -438,7 +438,7 @@ sint8 get_original_dir_code(uint8 nuvie_dir_code) {
 }
 /* Returns direction code of relative direction.
  */
-uint8 get_direction_code(sint16 rel_x, sint16 rel_y) {
+NuvieDir get_direction_code(sint16 rel_x, sint16 rel_y) {
 	if (rel_x == 0 && rel_y < 0)
 		return NUVIE_DIR_N;
 	else if (rel_x > 0 && rel_y < 0)
@@ -459,7 +459,7 @@ uint8 get_direction_code(sint16 rel_x, sint16 rel_y) {
 	return NUVIE_DIR_NONE;
 }
 
-uint8 get_reverse_direction(uint8 dir) {
+NuvieDir get_reverse_direction(NuvieDir dir) {
 	switch (dir) {
 	case  NUVIE_DIR_N :
 		return NUVIE_DIR_S;
@@ -487,7 +487,7 @@ uint8 get_reverse_direction(uint8 dir) {
 	return NUVIE_DIR_NONE;
 }
 
-void get_relative_dir(uint8 dir, sint16 *rel_x, sint16 *rel_y) {
+void get_relative_dir(NuvieDir dir, sint16 *rel_x, sint16 *rel_y) {
 	switch (dir) {
 	case  NUVIE_DIR_N :
 		*rel_x = 0;
diff --git a/engines/ultima/nuvie/misc/u6_misc.h b/engines/ultima/nuvie/misc/u6_misc.h
index bdea061a95c..16c07a20f61 100644
--- a/engines/ultima/nuvie/misc/u6_misc.h
+++ b/engines/ultima/nuvie/misc/u6_misc.h
@@ -60,12 +60,12 @@ void print_indent(DebugLevelType level, uint8 indent);
 void print_bool(DebugLevelType level, bool state, const char *yes = "true", const char *no = "false");
 void print_flags(DebugLevelType level, uint8 num, const char *f[8]);
 bool subtract_rect(const Common::Rect *rect1, const Common::Rect *rect2, Common::Rect *sub_rect);
-uint8 get_nuvie_dir_code(uint8 original_dir_code);
-sint8 get_original_dir_code(uint8 nuvie_dir_code);
-uint8 get_direction_code(sint16 rel_x, sint16 rel_y);
-uint8 get_reverse_direction(uint8 dir);
-void get_relative_dir(uint8 dir, sint16 *rel_x, sint16 *rel_y);
-const char *get_direction_name(uint8 dir);
+NuvieDir get_nuvie_dir_code(uint8 original_dir_code);
+sint8 get_original_dir_code(NuvieDir nuvie_dir_code);
+NuvieDir get_direction_code(sint16 rel_x, sint16 rel_y);
+NuvieDir get_reverse_direction(NuvieDir dir);
+void get_relative_dir(NuvieDir dir, sint16 *rel_x, sint16 *rel_y);
+const char *get_direction_name(NuvieDir dir);
 const char *get_direction_name(sint16 rel_x, sint16 rel_y);
 int str_bsearch(const char *str[], int max, const char *value);
 void stringToLower(Std::string &str);
diff --git a/engines/ultima/nuvie/pathfinder/dir_finder.cpp b/engines/ultima/nuvie/pathfinder/dir_finder.cpp
index 8d530b0bed8..e236ded0668 100644
--- a/engines/ultima/nuvie/pathfinder/dir_finder.cpp
+++ b/engines/ultima/nuvie/pathfinder/dir_finder.cpp
@@ -52,8 +52,8 @@ void DirFinder::get_adjacent_dir(sint8 &xdir, sint8 &ydir, sint8 rotate) {
 		}
 }
 
-uint8 DirFinder::get_nuvie_dir(sint16 xrel, sint16 yrel) {
-	uint8 direction = NUVIE_DIR_N; // default
+NuvieDir DirFinder::get_nuvie_dir(sint16 xrel, sint16 yrel) {
+	NuvieDir direction = NUVIE_DIR_N; // default
 
 	if (xrel == 0 && yrel == 0) // nowhere
 		return direction;
@@ -72,7 +72,7 @@ uint8 DirFinder::get_nuvie_dir(sint16 xrel, sint16 yrel) {
 	return direction;
 }
 
-uint8 DirFinder::get_nuvie_dir(uint16 sx, uint16 sy, uint16 tx, uint16 ty, uint8 z) {
+NuvieDir DirFinder::get_nuvie_dir(uint16 sx, uint16 sy, uint16 tx, uint16 ty, uint8 z) {
 	return DirFinder::get_nuvie_dir(get_wrapped_rel_dir(tx, sx, z), get_wrapped_rel_dir(ty, sy, z));
 }
 
diff --git a/engines/ultima/nuvie/pathfinder/dir_finder.h b/engines/ultima/nuvie/pathfinder/dir_finder.h
index 243fb173819..0f60cc1f941 100644
--- a/engines/ultima/nuvie/pathfinder/dir_finder.h
+++ b/engines/ultima/nuvie/pathfinder/dir_finder.h
@@ -32,8 +32,8 @@ public:
 	DirFinder() { }
 
 	static void get_adjacent_dir(sint8 &xdir, sint8 &ydir, sint8 rotate);
-	static uint8 get_nuvie_dir(sint16 xrel, sint16 yrel);
-	static uint8 get_nuvie_dir(uint16 sx, uint16 sy, uint16 tx, uint16 ty, uint8 z);
+	static NuvieDir get_nuvie_dir(sint16 xrel, sint16 yrel);
+	static NuvieDir get_nuvie_dir(uint16 sx, uint16 sy, uint16 tx, uint16 ty, uint8 z);
 	static sint8 get_turn_towards_dir(sint16 oxdir, sint16 oydir, sint8 txdir, sint8 tydir);
 	static void get_normalized_dir(const MapCoord &from, const MapCoord &to, sint8 &xdir, sint8 &ydir);
 };
diff --git a/engines/ultima/nuvie/pathfinder/party_path_finder.cpp b/engines/ultima/nuvie/pathfinder/party_path_finder.cpp
index dfdeaac0fa7..d90c4f01e9a 100644
--- a/engines/ultima/nuvie/pathfinder/party_path_finder.cpp
+++ b/engines/ultima/nuvie/pathfinder/party_path_finder.cpp
@@ -98,7 +98,7 @@ void PartyPathFinder::get_forward_dir(sint8 &vec_x, sint8 &vec_y) {
 //    get_last_move(vec_x, vec_y);
 	vec_x = 0;
 	vec_y = 0;
-	uint8 dir = (get_leader() >= 0) ? get_member(get_leader()).actor->get_direction() : NUVIE_DIR_N;
+	NuvieDir dir = (get_leader() >= 0) ? get_member(get_leader()).actor->get_direction() : NUVIE_DIR_N;
 	if (dir == NUVIE_DIR_N)      {
 		vec_x = 0;
 		vec_y = -1;
diff --git a/engines/ultima/nuvie/script/script.cpp b/engines/ultima/nuvie/script/script.cpp
index 74f2ae60d5b..4391434920a 100644
--- a/engines/ultima/nuvie/script/script.cpp
+++ b/engines/ultima/nuvie/script/script.cpp
@@ -434,7 +434,7 @@ uint8 ScriptThread::resume_with_location(const MapCoord &loc) {
 	return resume(1);
 }
 
-uint8 ScriptThread::resume_with_direction(uint8 dir) {
+uint8 ScriptThread::resume_with_direction(NuvieDir dir) {
 	lua_pushinteger(L, dir);
 
 	return resume(1);
@@ -4198,7 +4198,7 @@ Set the current wind direction (U6).
  */
 static int nscript_wind_set(lua_State *L) {
 	Weather *weather = Game::get_game()->get_weather();
-	uint8 wind_dir = (uint8)luaL_checkinteger(L, 1);
+	NuvieDir wind_dir = (NuvieDir)luaL_checkinteger(L, 1);
 
 	weather->set_wind_dir(wind_dir);
 
diff --git a/engines/ultima/nuvie/script/script.h b/engines/ultima/nuvie/script/script.h
index c49192081b1..450beb2193a 100644
--- a/engines/ultima/nuvie/script/script.h
+++ b/engines/ultima/nuvie/script/script.h
@@ -78,7 +78,7 @@ public:
 		return resume(start_nargs);
 	}
 	uint8 resume_with_location(const MapCoord &loc);
-	uint8 resume_with_direction(uint8 dir);
+	uint8 resume_with_direction(NuvieDir dir);
 	uint8 resume_with_spell_num(uint8 spell_num);
 	uint8 resume_with_obj(Obj *obj);
 	uint8 resume_with_nil();
diff --git a/engines/ultima/nuvie/script/script_actor.cpp b/engines/ultima/nuvie/script/script_actor.cpp
index 166a93e455f..50531d6112d 100644
--- a/engines/ultima/nuvie/script/script_actor.cpp
+++ b/engines/ultima/nuvie/script/script_actor.cpp
@@ -701,7 +701,7 @@ static int nscript_actor_set_dexterity(Actor *actor, lua_State *L) {
 }
 
 static int nscript_actor_set_direction(Actor *actor, lua_State *L) {
-	actor->set_direction((uint8)lua_tointeger(L, 3));
+	actor->set_direction((NuvieDir)lua_tointeger(L, 3));
 	return 0;
 }
 
diff --git a/engines/ultima/nuvie/usecode/u6_usecode.cpp b/engines/ultima/nuvie/usecode/u6_usecode.cpp
index b41ab4e1485..ad59bfe1472 100644
--- a/engines/ultima/nuvie/usecode/u6_usecode.cpp
+++ b/engines/ultima/nuvie/usecode/u6_usecode.cpp
@@ -2299,18 +2299,20 @@ bool U6UseCode::use_horse(Obj *obj, UseCodeEvent ev) {
 }
 
 bool U6UseCode::use_fan(Obj *obj, UseCodeEvent ev) {
-	uint8 wind_tbl[] = {4, 5, 6, 7, 1, 2, 3, 0};
-	uint8 wind_dir;
+	// Directions rotated clockwise by 45 deg.
+	NuvieDir next_wind_dir_tbl[] = {
+		NUVIE_DIR_NE, NUVIE_DIR_SE, NUVIE_DIR_SW, NUVIE_DIR_NW,
+		NUVIE_DIR_E, NUVIE_DIR_S, NUVIE_DIR_W, NUVIE_DIR_N};
 	Weather *weather = game->get_weather();
 	scroll->display_string("\nYou feel a breeze.\n");
 
-	wind_dir = weather->get_wind_dir();
+	NuvieDir wind_dir = weather->get_wind_dir();
 
 	if (wind_dir == NUVIE_DIR_NONE)
 		wind_dir = NUVIE_DIR_NW;
 
 	//cycle through the wind directions.
-	weather->set_wind_dir(wind_tbl[wind_dir]);
+	weather->set_wind_dir(next_wind_dir_tbl[wind_dir]);
 
 	return true;
 }
diff --git a/engines/ultima/nuvie/views/doll_view_gump.cpp b/engines/ultima/nuvie/views/doll_view_gump.cpp
index fe3ff5a7f88..978c56449dd 100644
--- a/engines/ultima/nuvie/views/doll_view_gump.cpp
+++ b/engines/ultima/nuvie/views/doll_view_gump.cpp
@@ -329,7 +329,7 @@ GUI_status DollViewGump::callback(uint16 msg, GUI_CallBack *caller, void *data)
 	return GUI_PASS;
 }
 
-GUI_status DollViewGump::moveCursorRelative(uint8 direction) {
+GUI_status DollViewGump::moveCursorRelative(NuvieDir direction) {
 	gumpCursorPos cursor_left = actor->is_in_party() ? CURSOR_LEFT : CURSOR_HEAD; // don't allow pickpocket or control cheat into arrow area
 	gumpCursorPos cursor_right = actor->is_in_party() ? CURSOR_RIGHT : CURSOR_HEAD;
 	gumpCursorPos cursor_party; // no party button yet so skip it
diff --git a/engines/ultima/nuvie/views/doll_view_gump.h b/engines/ultima/nuvie/views/doll_view_gump.h
index 184891bcb56..c83f23e5ba5 100644
--- a/engines/ultima/nuvie/views/doll_view_gump.h
+++ b/engines/ultima/nuvie/views/doll_view_gump.h
@@ -96,7 +96,7 @@ private:
 	void activate_combat_button();
 	void setColorKey(Graphics::ManagedSurface *image);
 	GUI_status set_cursor_pos(gumpCursorPos pos);
-	GUI_status moveCursorRelative(uint8 direction);
+	GUI_status moveCursorRelative(NuvieDir direction);
 	GUI_status KeyDown(const Common::KeyState &key) override;
 
 };


Commit: a7eabd18c7fb5137c9c7242e05b8b4fb6a5b7652
    https://github.com/scummvm/scummvm/commit/a7eabd18c7fb5137c9c7242e05b8b4fb6a5b7652
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2023-12-09T13:56:08+11:00

Commit Message:
ULTIMA: NUVIE: Replace more defines with const or enum

Changed paths:
    engines/ultima/nuvie/actors/actor.cpp
    engines/ultima/nuvie/actors/actor.h
    engines/ultima/nuvie/actors/actor_manager.cpp
    engines/ultima/nuvie/actors/actor_manager.h
    engines/ultima/nuvie/core/converse.cpp
    engines/ultima/nuvie/core/converse.h
    engines/ultima/nuvie/core/effect.cpp
    engines/ultima/nuvie/core/effect.h
    engines/ultima/nuvie/core/egg_manager.cpp
    engines/ultima/nuvie/core/game.cpp
    engines/ultima/nuvie/core/game.h
    engines/ultima/nuvie/core/nuvie_defs.h
    engines/ultima/nuvie/gui/gui_button.cpp
    engines/ultima/nuvie/gui/gui_button.h
    engines/ultima/nuvie/gui/gui_text_toggle_button.cpp
    engines/ultima/nuvie/gui/gui_text_toggle_button.h
    engines/ultima/nuvie/gui/widgets/converse_gump.cpp
    engines/ultima/nuvie/menus/gameplay_dialog.cpp
    engines/ultima/nuvie/menus/gameplay_dialog.h
    engines/ultima/nuvie/script/script.cpp
    engines/ultima/nuvie/script/script.h
    engines/ultima/nuvie/script/script_actor.cpp
    engines/ultima/nuvie/usecode/u6_usecode.cpp
    engines/ultima/nuvie/views/inventory_message.h


diff --git a/engines/ultima/nuvie/actors/actor.cpp b/engines/ultima/nuvie/actors/actor.cpp
index df5790458ad..99a66e02496 100644
--- a/engines/ultima/nuvie/actors/actor.cpp
+++ b/engines/ultima/nuvie/actors/actor.cpp
@@ -1786,7 +1786,7 @@ void Actor::print() {
 }
 
 
-const char *get_actor_alignment_str(uint8 alignment) {
+const char *get_actor_alignment_str(ActorAlignment alignment) {
 	switch (alignment) {
 	case ACTOR_ALIGNMENT_DEFAULT :
 		return "default";
diff --git a/engines/ultima/nuvie/actors/actor.h b/engines/ultima/nuvie/actors/actor.h
index 52dcc6dc7a8..73db05a6e42 100644
--- a/engines/ultima/nuvie/actors/actor.h
+++ b/engines/ultima/nuvie/actors/actor.h
@@ -47,11 +47,13 @@ using Std::vector;
 #define ACTOR_NOT_READIABLE 8
 
 // actor alignment
-#define ACTOR_ALIGNMENT_DEFAULT 0
-#define ACTOR_ALIGNMENT_NEUTRAL 1
-#define ACTOR_ALIGNMENT_EVIL    2
-#define ACTOR_ALIGNMENT_GOOD    3
-#define ACTOR_ALIGNMENT_CHAOTIC 4
+enum ActorAlignment {
+	ACTOR_ALIGNMENT_DEFAULT = 0,
+	ACTOR_ALIGNMENT_NEUTRAL = 1,
+	ACTOR_ALIGNMENT_EVIL    = 2,
+	ACTOR_ALIGNMENT_GOOD    = 3,
+	ACTOR_ALIGNMENT_CHAOTIC = 4,
+};
 
 // move-flags
 #define ACTOR_FORCE_MOVE    1
@@ -278,7 +280,7 @@ protected:
 	uint16 exp;
 	uint8 magic;
 	uint8 combat_mode;
-	uint8 alignment;
+	ActorAlignment alignment;
 
 	uint8 body_armor_class;
 	uint8 readied_armor_class;
@@ -432,7 +434,7 @@ public:
 	uint8 get_magic() const {
 		return magic;
 	}
-	uint8 get_alignment() const {
+	ActorAlignment get_alignment() const {
 		return alignment;
 	}
 	uint8 get_old_alignment() const {
@@ -486,10 +488,10 @@ public:
 	void set_magic(uint8 val) {
 		magic = val;
 	}
-	void set_alignment(uint8 a) {
+	void set_alignment(ActorAlignment a) {
 		alignment = a;
 	}
-	void set_old_alignment(uint8 a) {
+	void set_old_alignment(ActorAlignment a) {
 		if (a > 0 && a < 5) {
 			movement_flags |= (a - 1) << 5;
 		}
@@ -717,7 +719,7 @@ private:
 
 };
 
-const char *get_actor_alignment_str(uint8 alignment);
+const char *get_actor_alignment_str(ActorAlignment alignment);
 
 } // End of namespace Nuvie
 } // End of namespace Ultima
diff --git a/engines/ultima/nuvie/actors/actor_manager.cpp b/engines/ultima/nuvie/actors/actor_manager.cpp
index bc55e49d975..abb14212688 100644
--- a/engines/ultima/nuvie/actors/actor_manager.cpp
+++ b/engines/ultima/nuvie/actors/actor_manager.cpp
@@ -46,8 +46,8 @@
 namespace Ultima {
 namespace Nuvie {
 
-#define ACTOR_TEMP_INIT 255
-#define SCHEDULE_SIZE 5
+static const int ACTOR_TEMP_INIT = 255;
+static const int SCHEDULE_SIZE = 5;
 
 ActorManager::ActorManager(Configuration *cfg, Map *m, TileManager *tm, ObjManager *om, GameClock *c)
 		: config(cfg), map(m), tile_manager(tm), obj_manager(om), _clock(c),
@@ -167,7 +167,7 @@ bool ActorManager::load(NuvieIO *objlist) {
 
 	for (i = 0; i < ACTORMANAGER_MAX_ACTORS; i++) {
 		actors[i]->status_flags = objlist->read1();
-		actors[i]->alignment = ((actors[i]->status_flags & ACTOR_STATUS_ALIGNMENT_MASK) >> 5) + 1;
+		actors[i]->alignment = static_cast<ActorAlignment>(((actors[i]->status_flags & ACTOR_STATUS_ALIGNMENT_MASK) >> 5) + 1);
 	}
 
 //old obj_n & frame_n values
@@ -771,7 +771,7 @@ bool ActorManager::is_temp_actor(uint8 id_n) {
 	return false;
 }
 
-bool ActorManager::create_temp_actor(uint16 obj_n, uint8 obj_status, uint16 x, uint16 y, uint8 z, uint8 alignment, uint8 worktype, Actor **new_actor) {
+bool ActorManager::create_temp_actor(uint16 obj_n, uint8 obj_status, uint16 x, uint16 y, uint8 z, ActorAlignment alignment, uint8 worktype, Actor **new_actor) {
 	Actor *actor;
 	actor = find_free_temp_actor();
 
@@ -1059,7 +1059,7 @@ bool ActorManager::can_put_actor(const MapCoord &location) {
 }
 
 // Remove actors with a certain alignment from the list. Returns the same list.
-ActorList *ActorManager::filter_alignment(ActorList *list, uint8 align) {
+ActorList *ActorManager::filter_alignment(ActorList *list, ActorAlignment align) {
 	ActorIterator i = list->begin();
 	while (i != list->end()) {
 		Actor *actor = *i;
diff --git a/engines/ultima/nuvie/actors/actor_manager.h b/engines/ultima/nuvie/actors/actor_manager.h
index d7a1efce3ea..65c9a46aa6b 100644
--- a/engines/ultima/nuvie/actors/actor_manager.h
+++ b/engines/ultima/nuvie/actors/actor_manager.h
@@ -25,19 +25,18 @@
 #include "ultima/shared/std/string.h"
 #include "ultima/nuvie/core/obj_manager.h"
 #include "ultima/nuvie/misc/actor_list.h"
+#include "ultima/nuvie/actors/actor.h"
 
 namespace Ultima {
 namespace Nuvie {
 
 class Configuration;
-class Actor;
 class Map;
 class TileManager;
 class GameClock;
 class MapCoord;
 
 
-
 #define ACTORMANAGER_MAX_ACTORS 256
 
 class ActorManager {
@@ -76,7 +75,7 @@ public:
 	ActorList *get_actor_list(); // *returns a NEW list*
 	ActorList *sort_nearest(ActorList *list, uint16 x, uint16 y, uint8 z); // ascending distance
 	ActorList *filter_distance(ActorList *list, uint16 x, uint16 y, uint8 z, uint16 dist);
-	ActorList *filter_alignment(ActorList *list, uint8 align);
+	ActorList *filter_alignment(ActorList *list, ActorAlignment align);
 	ActorList *filter_party(ActorList *list);
 
 	Actor *get_actor(uint8 actor_num);
@@ -109,7 +108,7 @@ public:
 
 	bool is_temp_actor(Actor *actor);
 	bool is_temp_actor(uint8 id_n);
-	bool create_temp_actor(uint16 obj_n, uint8 obj_status, uint16 x, uint16 y, uint8 z, uint8 alignment, uint8 worktype, Actor **new_actor = nullptr);
+	bool create_temp_actor(uint16 obj_n, uint8 obj_status, uint16 x, uint16 y, uint8 z, ActorAlignment alignment, uint8 worktype, Actor **new_actor = nullptr);
 	bool clone_actor(Actor *actor, Actor **new_actor, MapCoord new_location);
 	bool toss_actor(Actor *actor, uint16 xrange, uint16 yrange);
 	bool toss_actor_get_location(uint16 start_x, uint16 start_y, uint8 start_z, uint16 xrange, uint16 yrange, MapCoord *location);
diff --git a/engines/ultima/nuvie/core/converse.cpp b/engines/ultima/nuvie/core/converse.cpp
index 0fe0b158b1f..26f71ba70af 100644
--- a/engines/ultima/nuvie/core/converse.cpp
+++ b/engines/ultima/nuvie/core/converse.cpp
@@ -731,7 +731,7 @@ void ConvScript::write2(converse_value val) {
 }
 
 
-uint8 get_converse_gump_type_from_config(Configuration *config) {
+ConverseGumpType get_converse_gump_type_from_config(Configuration *config) {
 	Std::string configvalue;
 	config->value("config/general/converse_gump", configvalue, "default");
 
diff --git a/engines/ultima/nuvie/core/converse.h b/engines/ultima/nuvie/core/converse.h
index dbb18941375..eccee221937 100644
--- a/engines/ultima/nuvie/core/converse.h
+++ b/engines/ultima/nuvie/core/converse.h
@@ -49,12 +49,7 @@ class ConvScript;
 
 using Std::string;
 
-
-#define CONVERSE_GUMP_DEFAULT   0
-#define CONVERSE_GUMP_U7_STYLE  1
-#define CONVERSE_GUMP_WOU_STYLE 2
-
-uint8 get_converse_gump_type_from_config(Configuration *config);
+ConverseGumpType get_converse_gump_type_from_config(Configuration *config);
 
 typedef uint32 converse_value; // any single value read from a script
 typedef unsigned char *convscript_buffer;
diff --git a/engines/ultima/nuvie/core/effect.cpp b/engines/ultima/nuvie/core/effect.cpp
index c6d313ca654..5283530f639 100644
--- a/engines/ultima/nuvie/core/effect.cpp
+++ b/engines/ultima/nuvie/core/effect.cpp
@@ -50,7 +50,7 @@ namespace Nuvie {
 
 #define TRANSPARENT_COLOR 0xFF /* transparent pixel color */
 
-#define EXP_EFFECT_TILE_NUM 382
+static const int EXP_EFFECT_TILE_NUM = 382;
 
 QuakeEffect *QuakeEffect::current_quake = nullptr;
 FadeEffect *FadeEffect::current_fade = nullptr;
@@ -79,6 +79,8 @@ void Effect::add_anim(NuvieAnim *anim) {
 }
 
 
+static const int CANNON_SPEED = 320;
+
 /* Fire from a cannon in direction: 0=north, 1=east, 2=south, 3=west,
  *                                 -1=use cannon frame
  */
@@ -917,6 +919,8 @@ uint16 SleepEffect::callback(uint16 msg, CallBack *caller, void *data) {
 
 
 /*** FadeEffect ***/
+static const int FADE_EFFECT_MAX_ITERATIONS = 20;
+
 FadeEffect::FadeEffect(FadeType fade, FadeDirection dir, uint32 color, uint32 speed) {
 	speed = speed ? speed : game->get_map_window()->get_win_area() * 2116; // was 256000
 	init(fade, dir, color, nullptr, 0, 0, speed);
diff --git a/engines/ultima/nuvie/core/effect.h b/engines/ultima/nuvie/core/effect.h
index 1761ea567e4..fdb01da7f9a 100644
--- a/engines/ultima/nuvie/core/effect.h
+++ b/engines/ultima/nuvie/core/effect.h
@@ -99,7 +99,6 @@ public:
 	}
 };
 
-#define CANNON_SPEED 320
 /* Toss a cannon ball from one actor to another, or from an object towards
  * a numbered direction.
  */
@@ -402,8 +401,6 @@ public:
 typedef enum { FADE_PIXELATED, FADE_CIRCLE, FADE_PIXELATED_ONTOP } FadeType;
 typedef enum { FADE_IN, FADE_OUT } FadeDirection;
 
-#define FADE_EFFECT_MAX_ITERATIONS 20
-
 /* Manipulate the MapWindow for two types of fades. One is a stippled-like fade
  * that draws pixels to random locations on the screen until completely flooded
  * with a set color. The other changes the ambient light until fully black.
diff --git a/engines/ultima/nuvie/core/egg_manager.cpp b/engines/ultima/nuvie/core/egg_manager.cpp
index 1f8cd48dfd1..d12000c7e0e 100644
--- a/engines/ultima/nuvie/core/egg_manager.cpp
+++ b/engines/ultima/nuvie/core/egg_manager.cpp
@@ -41,12 +41,15 @@ namespace Nuvie {
 typedef enum {
 	EGG_HATCH_ALWAYS, EGG_HATCH_DAY, EGG_HATCH_NIGHT
 } egg_hatch_time;
-#define EGG_DAY_HOUR   06 /* first hour of the day */
-#define EGG_NIGHT_HOUR 19 /* first hour of night */
-#define EGG_HATCH_TIME(EQ) (EQ < 10) ? EGG_HATCH_ALWAYS \
-	: (EQ < 20) ? EGG_HATCH_DAY \
-	: (EQ < 30) ? EGG_HATCH_NIGHT : EGG_HATCH_ALWAYS;
 
+static const int EGG_DAY_HOUR = 06;   /* first hour of the day */
+static const int EGG_NIGHT_HOUR = 19; /* first hour of night */
+
+static inline egg_hatch_time get_egg_hatch_time(uint8 EQ)  {
+	return (EQ < 10) ? EGG_HATCH_ALWAYS
+			: (EQ < 20) ? EGG_HATCH_DAY
+			: (EQ < 30) ? EGG_HATCH_NIGHT : EGG_HATCH_ALWAYS;
+}
 
 EggManager::EggManager(Configuration *cfg, nuvie_game_t type, Map *m)
 		: config(cfg), gametype(type), map(m), actor_manager(nullptr),
@@ -140,7 +143,7 @@ void EggManager::spawn_eggs(uint16 x, uint16 y, uint8 z, bool teleport) {
 				hatch_probability = (NUVIE_RAND() % 100) + 1;
 				DEBUG(0, LEVEL_DEBUGGING, "Checking Egg (%x,%x,%x). Rand: %d Probability: %d%%", (*egg)->obj->x, (*egg)->obj->y, (*egg)->obj->z, hatch_probability, (*egg)->obj->qty);
 
-				DEBUG(1, LEVEL_DEBUGGING, " Align: %s", get_actor_alignment_str(quality % 10));
+				DEBUG(1, LEVEL_DEBUGGING, " Align: %s", get_actor_alignment_str(static_cast<ActorAlignment>(quality % 10)));
 
 				if (quality < 10)      DEBUG(1, LEVEL_DEBUGGING, " (always)"); // 0-9
 				else if (quality < 20) DEBUG(1, LEVEL_DEBUGGING, " (day)");    // 10-19
@@ -164,10 +167,10 @@ bool EggManager::spawn_egg(Obj *egg, uint8 hatch_probability) {
 	Obj *obj, *spawned_obj;
 	uint16 qty;
 	uint8 hour = Game::get_game()->get_clock()->get_hour();
-	uint8 alignment = egg->quality % 10;
+	ActorAlignment alignment = static_cast<ActorAlignment>(egg->quality % 10);
 
 	// check time that the egg will hach
-	egg_hatch_time period = EGG_HATCH_TIME(egg->quality);
+	egg_hatch_time period = get_egg_hatch_time(egg->quality);
 	if (period == EGG_HATCH_ALWAYS
 	        || (period == EGG_HATCH_DAY && hour >= EGG_DAY_HOUR && hour < EGG_NIGHT_HOUR)
 	        || (period == EGG_HATCH_NIGHT && !(hour >= EGG_DAY_HOUR && hour < EGG_NIGHT_HOUR))) {
diff --git a/engines/ultima/nuvie/core/game.cpp b/engines/ultima/nuvie/core/game.cpp
index d7b446ce35d..8fa51abad54 100644
--- a/engines/ultima/nuvie/core/game.cpp
+++ b/engines/ultima/nuvie/core/game.cpp
@@ -404,7 +404,7 @@ void Game::init_converse() {
 
 }
 
-void Game::set_converse_gump_type(uint8 new_type) {
+void Game::set_converse_gump_type(ConverseGumpType new_type) {
 	if (converse)
 		delete converse;
 	converse_gump_type = new_type;
diff --git a/engines/ultima/nuvie/core/game.h b/engines/ultima/nuvie/core/game.h
index 7039519ac48..d1fb3f91724 100644
--- a/engines/ultima/nuvie/core/game.h
+++ b/engines/ultima/nuvie/core/game.h
@@ -134,7 +134,7 @@ private:
 	bool ethereal;
 	bool using_text_gumps;
 	bool open_containers; //doubleclick
-	uint8 converse_gump_type;
+	ConverseGumpType converse_gump_type;
 	bool roof_mode;
 	bool free_balloon_movement;
 	bool force_solid_converse_bg;
@@ -274,10 +274,10 @@ public:
 	void set_ethereal(bool val) {
 		ethereal = val;
 	}
-	uint8 get_converse_gump_type() const {
+	ConverseGumpType get_converse_gump_type() const {
 		return converse_gump_type;
 	}
-	void set_converse_gump_type(uint8 new_type);
+	void set_converse_gump_type(ConverseGumpType new_type);
 	bool using_new_converse_gump();
 	void set_free_balloon_movement(bool val) {
 		free_balloon_movement = val;
diff --git a/engines/ultima/nuvie/core/nuvie_defs.h b/engines/ultima/nuvie/core/nuvie_defs.h
index be2c4e9fd96..331d246dca8 100644
--- a/engines/ultima/nuvie/core/nuvie_defs.h
+++ b/engines/ultima/nuvie/core/nuvie_defs.h
@@ -113,6 +113,12 @@ enum DebugLevelType {
 	LEVEL_DEBUGGING
 };
 
+enum ConverseGumpType {
+	CONVERSE_GUMP_DEFAULT = 0,
+	CONVERSE_GUMP_U7_STYLE = 1,
+	CONVERSE_GUMP_WOU_STYLE = 2,
+};
+
 #ifdef WITHOUT_DEBUG
 inline void u6debug(bool no_header, const DebugLevelType level, const char *format, ...) {}
 #else
diff --git a/engines/ultima/nuvie/gui/gui_button.cpp b/engines/ultima/nuvie/gui/gui_button.cpp
index 867faa78df3..0505de0b125 100644
--- a/engines/ultima/nuvie/gui/gui_button.cpp
+++ b/engines/ultima/nuvie/gui/gui_button.cpp
@@ -51,7 +51,7 @@ GUI_Button::GUI_Button(void *data, int x, int y, int w, int h,
 }
 
 GUI_Button::GUI_Button(void *data, int x, int y, int w, int h, const char *text,
-					   GUI_Font *font, int alignment, bool is_checkbutton,
+					   GUI_Font *font, ButtonTextAlign alignment, bool is_checkbutton,
 					   GUI_CallBack *callback, bool flat)
 	: GUI_Widget(data, x, y, w, h) {
 	callback_object = callback;
@@ -98,7 +98,7 @@ GUI_Button::~GUI_Button() {
 }
 
 /* Resize/reposition/change text */
-void GUI_Button::ChangeTextButton(int x, int y, int w, int h, const char *text, int alignment) {
+void GUI_Button::ChangeTextButton(int x, int y, int w, int h, const char *text, ButtonTextAlign alignment) {
 	if (x != -1 || y != -1) {
 		assert(x >= 0 && y >= 0);
 		area.moveTo(x, y);
@@ -238,7 +238,7 @@ void GUI_Button::Enable(bool flag) {
 	Redraw();
 }
 
-Graphics::ManagedSurface *GUI_Button::CreateTextButtonImage(int style, const char *text, int alignment) {
+Graphics::ManagedSurface *GUI_Button::CreateTextButtonImage(int style, const char *text, ButtonTextAlign alignment) {
 	Common::Rect fillrect;
 	int th, tw;
 	int tx = 0, ty = 0;
diff --git a/engines/ultima/nuvie/gui/gui_button.h b/engines/ultima/nuvie/gui/gui_button.h
index 06039e06cc1..6f0a5a1e491 100644
--- a/engines/ultima/nuvie/gui/gui_button.h
+++ b/engines/ultima/nuvie/gui/gui_button.h
@@ -39,26 +39,28 @@ class GUI_CallBack;
 #define BUTTON2D_DOWN 4
 
 /* alignment constants */
-#define BUTTON_TEXTALIGN_LEFT 1
-#define BUTTON_TEXTALIGN_CENTER 2
-#define BUTTON_TEXTALIGN_RIGHT 3
+enum ButtonTextAlign {
+	BUTTON_TEXTALIGN_LEFT = 1,
+	BUTTON_TEXTALIGN_CENTER = 2,
+	BUTTON_TEXTALIGN_RIGHT = 3,
+};
 
 // Callback message types
 
-#define BUTTON_CB 0x1
+static const uint16 BUTTON_CB = 0x1;
 
 /* color constants */
 
 // Button face color
-const uint8 BF_R = 183, BF_G = 185, BF_B = 150;
+static const uint8 BF_R = 183, BF_G = 185, BF_B = 150;
 // Button light color
-const uint8 BL_R = 245, BL_G = 247, BL_B = 201;
+static const uint8 BL_R = 245, BL_G = 247, BL_B = 201;
 // Button shadow color
-const uint8 BS_R = 115, BS_G = 116, BS_B = 94;
+static const uint8 BS_R = 115, BS_G = 116, BS_B = 94;
 // 2D Button inverse text color
-const uint8 BI1_R = 255, BI1_G = 255, BI1_B = 255;
+static const uint8 BI1_R = 255, BI1_G = 255, BI1_B = 255;
 // 2D Button inverse background color
-const uint8 BI2_R = 0, BI2_G = 0, BI2_B = 0;
+static const uint8 BI2_R = 0, BI2_G = 0, BI2_B = 0;
 
 #define GUI_BUTTON_DONT_FREE_SURFACES false
 
@@ -77,16 +79,16 @@ public:
 	           GUI_CallBack *callback);
 
 	/* Passed the button data, position, width, height, a caption, a font,
-	   an alignment (one of the constants above), if it should be a checkbutton (1/0),
+	   an alignment (enum above), if it should be a checkbutton (1/0),
 	   the callback and a flag if it should be 2D (1) or 3D (0) */
 	GUI_Button(void *data, int x, int y, int w, int h, const char *text,
-	           GUI_Font *font, int alignment, bool is_checkbutton,
+	           GUI_Font *font, ButtonTextAlign alignment, bool is_checkbutton,
 	           GUI_CallBack *callback, bool flat = false);
 
 	~GUI_Button() override;
 
 	/* change features of a text button (if one of the dimensions is negativ, it's ignored) */
-	virtual void ChangeTextButton(int x, int y, int w, int h, const char *text, int alignment);
+	virtual void ChangeTextButton(int x, int y, int w, int h, const char *text, ButtonTextAlign alignment);
 
 	/* Show the widget  */
 	void Display(bool full_redraw) override;
@@ -116,7 +118,7 @@ public:
 
 protected:
 	/* yields an appropriate image */
-	virtual Graphics::ManagedSurface *CreateTextButtonImage(int style, const char *text, int alignment);
+	virtual Graphics::ManagedSurface *CreateTextButtonImage(int style, const char *text, ButtonTextAlign alignment);
 
 	/* The button font */
 	GUI_Font *buttonFont;
diff --git a/engines/ultima/nuvie/gui/gui_text_toggle_button.cpp b/engines/ultima/nuvie/gui/gui_text_toggle_button.cpp
index 91669ccbc2e..04674f9308a 100644
--- a/engines/ultima/nuvie/gui/gui_text_toggle_button.cpp
+++ b/engines/ultima/nuvie/gui/gui_text_toggle_button.cpp
@@ -27,7 +27,7 @@ namespace Nuvie {
 
 GUI_TextToggleButton::GUI_TextToggleButton(void *data, int x, int y, int w, int h,
 		const char *const *texts_, int count_, int selection_,
-		GUI_Font *font, int alignment_,
+		GUI_Font *font, ButtonTextAlign alignment_,
 		GUI_CallBack *callback, int flat)
 	: GUI_Button(data, x, y, w, h, "", font, alignment_, 0, callback, flat), count(count_),
 	  selection(selection_), alignment(alignment_) {
diff --git a/engines/ultima/nuvie/gui/gui_text_toggle_button.h b/engines/ultima/nuvie/gui/gui_text_toggle_button.h
index b9ca38943ac..3285e4628cc 100644
--- a/engines/ultima/nuvie/gui/gui_text_toggle_button.h
+++ b/engines/ultima/nuvie/gui/gui_text_toggle_button.h
@@ -39,7 +39,7 @@ public:
 	   The captions are copied into the class. */
 	GUI_TextToggleButton(void *data, int x, int y, int w, int h,
 	                     const char *const *texts, int count, int selection,
-	                     GUI_Font *font, int alignment,
+	                     GUI_Font *font, ButtonTextAlign alignment,
 	                     GUI_CallBack *callback, int flat = 0);
 
 	~GUI_TextToggleButton() override;
@@ -53,7 +53,7 @@ protected:
 	int selection;
 	char **texts;
 	int count;
-	int alignment;
+	ButtonTextAlign alignment;
 };
 
 } // End of namespace Nuvie
diff --git a/engines/ultima/nuvie/gui/widgets/converse_gump.cpp b/engines/ultima/nuvie/gui/widgets/converse_gump.cpp
index 956a2dcef40..bc858c19f97 100644
--- a/engines/ultima/nuvie/gui/widgets/converse_gump.cpp
+++ b/engines/ultima/nuvie/gui/widgets/converse_gump.cpp
@@ -38,7 +38,7 @@
 namespace Ultima {
 namespace Nuvie {
 
-#define CURSOR_COLOR 248
+static const int CURSOR_COLOR = 248;
 
 // ConverseGump Class
 
diff --git a/engines/ultima/nuvie/menus/gameplay_dialog.cpp b/engines/ultima/nuvie/menus/gameplay_dialog.cpp
index 2c76c835d67..718b77c0f7c 100644
--- a/engines/ultima/nuvie/menus/gameplay_dialog.cpp
+++ b/engines/ultima/nuvie/menus/gameplay_dialog.cpp
@@ -268,7 +268,7 @@ GUI_status GameplayDialog::callback(uint16 msg, GUI_CallBack *caller, void *data
 		if (!Game::get_game()->is_new_style()) {
 			game->set_using_text_gumps(text_gump_button->GetSelection());
 			config->set("config/general/use_text_gumps", text_gump_button->GetSelection() ? "yes" : "no");
-			uint8 converse_gump_type = converse_gump_button->GetSelection();
+			ConverseGumpType converse_gump_type = static_cast<ConverseGumpType>(converse_gump_button->GetSelection());
 			if (converse_gump_type != old_converse_gump_type) {
 				config->set("config/general/converse_gump", get_converse_gump_config_string(converse_gump_type));
 				game->set_converse_gump_type(converse_gump_type);
diff --git a/engines/ultima/nuvie/menus/gameplay_dialog.h b/engines/ultima/nuvie/menus/gameplay_dialog.h
index 34419457ecb..f7ea253758a 100644
--- a/engines/ultima/nuvie/menus/gameplay_dialog.h
+++ b/engines/ultima/nuvie/menus/gameplay_dialog.h
@@ -36,7 +36,7 @@ class GameplayDialog : public GUI_Dialog {
 protected:
 	uint8 last_index;
 	sint8 b_index_num;
-	uint8 old_converse_gump_type;
+	ConverseGumpType old_converse_gump_type;
 	GUI_CallBack *callback_object;
 	GUI_Button *save_button, *cancel_button;
 	GUI_TextToggleButton *formation_button, *stealing_button, *text_gump_button,
diff --git a/engines/ultima/nuvie/script/script.cpp b/engines/ultima/nuvie/script/script.cpp
index 4391434920a..390e5bb437c 100644
--- a/engines/ultima/nuvie/script/script.cpp
+++ b/engines/ultima/nuvie/script/script.cpp
@@ -990,7 +990,7 @@ bool Script::call_actor_update_all() {
 	return call_function("actor_update_all", 0, 0);
 }
 
-bool Script::call_actor_init(Actor *actor, uint8 alignment) {
+bool Script::call_actor_init(Actor *actor, ActorAlignment alignment) {
 	lua_getglobal(L, "actor_init");
 	nscript_new_actor_var(L, actor->get_actor_num());
 	lua_pushinteger(L, alignment);
diff --git a/engines/ultima/nuvie/script/script.h b/engines/ultima/nuvie/script/script.h
index 450beb2193a..54f9342bb26 100644
--- a/engines/ultima/nuvie/script/script.h
+++ b/engines/ultima/nuvie/script/script.h
@@ -133,7 +133,7 @@ public:
 	bool call_player_post_move_action(bool didMove);
 	bool call_player_pass();
 	bool call_actor_update_all();
-	bool call_actor_init(Actor *actor, uint8 alignment);
+	bool call_actor_init(Actor *actor, ActorAlignment alignment);
 	bool call_actor_attack(Actor *actor, MapCoord location, Obj *weapon, Actor *foe);
 	bool call_actor_map_dmg(Actor *actor, MapCoord location);
 	bool call_actor_tile_dmg(Actor *actor, uint16 tile_num);
diff --git a/engines/ultima/nuvie/script/script_actor.cpp b/engines/ultima/nuvie/script/script_actor.cpp
index 50531d6112d..ca92e311689 100644
--- a/engines/ultima/nuvie/script/script_actor.cpp
+++ b/engines/ultima/nuvie/script/script_actor.cpp
@@ -509,7 +509,7 @@ static int nscript_actor_new(lua_State *L) {
 	uint16 x = 0;
 	uint16 y = 0;
 	uint8 z = 0;
-	uint8 alignment = ACTOR_ALIGNMENT_NEUTRAL;
+	ActorAlignment alignment = ACTOR_ALIGNMENT_NEUTRAL;
 	uint8 worktype = ACTOR_WT_ASSAULT; //FIXME this may be U6 specific.
 
 	int nargs = lua_gettop(L);
@@ -543,7 +543,7 @@ static int nscript_actor_new(lua_State *L) {
 
 		if (i) {
 			if (!lua_isnil(L, 5))
-				alignment = (uint8)lua_tointeger(L, 5);
+				alignment = (ActorAlignment)lua_tointeger(L, 5);
 			i--;
 		}
 
@@ -661,7 +661,7 @@ static int nscript_actor_set(lua_State *L) {
 }
 
 static int nscript_actor_set_align(Actor *actor, lua_State *L) {
-	actor->set_alignment((uint8)lua_tointeger(L, 3));
+	actor->set_alignment((ActorAlignment)lua_tointeger(L, 3));
 	return 0;
 }
 
@@ -766,7 +766,7 @@ static int nscript_actor_set_obj_n(Actor *actor, lua_State *L) {
 }
 
 static int nscript_actor_set_old_align(Actor *actor, lua_State *L) {
-	actor->set_old_alignment((sint8)lua_tointeger(L, 3));
+	actor->set_old_alignment((ActorAlignment)lua_tointeger(L, 3));
 	return 0;
 }
 
diff --git a/engines/ultima/nuvie/usecode/u6_usecode.cpp b/engines/ultima/nuvie/usecode/u6_usecode.cpp
index ad59bfe1472..e309fe66cde 100644
--- a/engines/ultima/nuvie/usecode/u6_usecode.cpp
+++ b/engines/ultima/nuvie/usecode/u6_usecode.cpp
@@ -121,14 +121,14 @@ static const struct {
 	{0x29b, 0x43,  0x0}
 };
 
-#define USE_U6_POTION_BLUE   0x0
-#define USE_U6_POTION_RED    0x1
-#define USE_U6_POTION_YELLOW 0x2
-#define USE_U6_POTION_GREEN  0x3
-#define USE_U6_POTION_ORANGE 0x4
-#define USE_U6_POTION_PURPLE 0x5
-#define USE_U6_POTION_BLACK  0x6
-#define USE_U6_POTION_WHITE  0x7
+static const uint8 USE_U6_POTION_BLUE   = 0;
+static const uint8 USE_U6_POTION_RED    = 1;
+static const uint8 USE_U6_POTION_YELLOW = 2;
+static const uint8 USE_U6_POTION_GREEN  = 3;
+static const uint8 USE_U6_POTION_ORANGE = 4;
+static const uint8 USE_U6_POTION_PURPLE = 5;
+static const uint8 USE_U6_POTION_BLACK  = 6;
+static const uint8 USE_U6_POTION_WHITE  = 7;
 
 // numbered by potion object frame number
 static const char *u6_potions[8] = {
diff --git a/engines/ultima/nuvie/views/inventory_message.h b/engines/ultima/nuvie/views/inventory_message.h
index 3e859f35d1e..567e218535a 100644
--- a/engines/ultima/nuvie/views/inventory_message.h
+++ b/engines/ultima/nuvie/views/inventory_message.h
@@ -22,7 +22,7 @@
 #ifndef NUVIE_VIEWS_INVENTORY_MESSAGE_H
 #define NUVIE_VIEWS_INVENTORY_MESSAGE_H
 
-#define BUTTON_CB 0x1
-#define INVSELECT_CB 0x2
+static const uint16 BUTTON_CB = 0x1;
+static const uint16 INVSELECT_CB = 0x2;
 
 #endif


Commit: 1af6406c92a580d3977061cb14f44c478d9f4fda
    https://github.com/scummvm/scummvm/commit/1af6406c92a580d3977061cb14f44c478d9f4fda
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2023-12-09T13:56:08+11:00

Commit Message:
ULTIMA: NUVIE: Fix crash if conversation active on quit

Changed paths:
    engines/ultima/nuvie/core/game.cpp


diff --git a/engines/ultima/nuvie/core/game.cpp b/engines/ultima/nuvie/core/game.cpp
index 8fa51abad54..51cd1f914d6 100644
--- a/engines/ultima/nuvie/core/game.cpp
+++ b/engines/ultima/nuvie/core/game.cpp
@@ -148,9 +148,11 @@ Game::~Game() {
 	if (game_map) delete game_map;
 	if (actor_manager) delete actor_manager;
 	//delete map_window;
+	// If conversation active, must be deleted before player as it resets
+	// player flags.
+	if (converse) delete converse;
 	if (player) delete player;
 	//delete background;
-	if (converse) delete converse;
 	if (_clock) delete _clock;
 	if (party) delete party;
 	if (portrait) delete portrait;


Commit: 7755e3430b40cd90caf5ccbca73f26b35a1064c1
    https://github.com/scummvm/scummvm/commit/7755e3430b40cd90caf5ccbca73f26b35a1064c1
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2023-12-09T13:56:08+11:00

Commit Message:
ULTIMA: NUVIE: Fix unused field warnings

Changed paths:
    engines/ultima/nuvie/core/effect.cpp
    engines/ultima/nuvie/core/effect.h
    engines/ultima/nuvie/core/egg_manager.cpp
    engines/ultima/nuvie/core/egg_manager.h
    engines/ultima/nuvie/core/game.cpp
    engines/ultima/nuvie/core/game_clock.cpp
    engines/ultima/nuvie/core/game_clock.h
    engines/ultima/nuvie/core/magic.cpp
    engines/ultima/nuvie/core/magic.h
    engines/ultima/nuvie/core/tile_manager.cpp
    engines/ultima/nuvie/files/tmx_map.cpp
    engines/ultima/nuvie/files/tmx_map.h
    engines/ultima/nuvie/misc/u6_misc.cpp


diff --git a/engines/ultima/nuvie/core/effect.cpp b/engines/ultima/nuvie/core/effect.cpp
index 5283530f639..4824cc7a952 100644
--- a/engines/ultima/nuvie/core/effect.cpp
+++ b/engines/ultima/nuvie/core/effect.cpp
@@ -189,7 +189,7 @@ uint16 CannonballEffect::callback(uint16 msg, CallBack *caller, void *msg_data)
 
 
 ExpEffect::ExpEffect(uint16 tileNum, const MapCoord &location) : ProjectileEffect(),
-		exp_tile_num(tileNum), usecode(nullptr), obj(nullptr) {
+		exp_tile_num(tileNum) {
 	start_loc = location;
 	start_anim();
 }
@@ -1293,17 +1293,14 @@ uint16 VanishEffect::callback(uint16 msg, CallBack *caller, void *data) {
 
 /* TileFadeEffect */
 TileFadeEffect::TileFadeEffect(const MapCoord &loc, Tile *from, Tile *to, FadeType type, uint16 speed)
-		: anim(nullptr), to_tile(nullptr), anim_tile(nullptr), actor(nullptr),
-		  color_from(0), color_to(0), inc_reverse(false), spd(0) {
+		: actor(nullptr), inc_reverse(false), spd(0) {
 	add_anim(new TileFadeAnim(loc, from, to, speed));
 	num_anim_running = 1;
 }
 
 //Fade out actor.
 TileFadeEffect::TileFadeEffect(Actor *a, uint16 speed)
-		: anim(nullptr), to_tile(nullptr), anim_tile(nullptr), actor(a),
-		  color_from(0), color_to(0), inc_reverse(false), spd(speed),
-		  num_anim_running(0) {
+		: actor(a), inc_reverse(false), spd(speed), num_anim_running(0) {
 	add_actor_anim();
 	actor->hide();
 }
diff --git a/engines/ultima/nuvie/core/effect.h b/engines/ultima/nuvie/core/effect.h
index fdb01da7f9a..0ac7aa8f281 100644
--- a/engines/ultima/nuvie/core/effect.h
+++ b/engines/ultima/nuvie/core/effect.h
@@ -153,10 +153,10 @@ public:
 };
 
 class ExpEffect : public ProjectileEffect {
-	UseCode *usecode;
+	//UseCode *usecode;
 	NuvieAnim *anim;
 
-	Obj *obj;
+	//Obj *obj;
 	uint16 exp_tile_num;
 
 protected:
@@ -489,11 +489,11 @@ public:
 };
 
 class TileFadeEffect : public TimedEffect {
-	TileAnim *anim;
-	Tile *to_tile;
-	Tile *anim_tile;
+	//TileAnim *anim;
+	//Tile *to_tile;
+	//Tile *anim_tile;
 	Actor *actor;
-	uint8 color_from, color_to;
+	//uint8 color_from, color_to;
 	bool inc_reverse;
 	uint16 spd;
 
diff --git a/engines/ultima/nuvie/core/egg_manager.cpp b/engines/ultima/nuvie/core/egg_manager.cpp
index d12000c7e0e..761021960ac 100644
--- a/engines/ultima/nuvie/core/egg_manager.cpp
+++ b/engines/ultima/nuvie/core/egg_manager.cpp
@@ -51,9 +51,9 @@ static inline egg_hatch_time get_egg_hatch_time(uint8 EQ)  {
 			: (EQ < 30) ? EGG_HATCH_NIGHT : EGG_HATCH_ALWAYS;
 }
 
-EggManager::EggManager(Configuration *cfg, nuvie_game_t type, Map *m)
-		: config(cfg), gametype(type), map(m), actor_manager(nullptr),
-		  obj_manager(nullptr), not_spawning_actors(false) {
+EggManager::EggManager(nuvie_game_t type)
+		: gametype(type), actor_manager(nullptr), obj_manager(nullptr),
+		  not_spawning_actors(false) {
 }
 
 EggManager::~EggManager() {
diff --git a/engines/ultima/nuvie/core/egg_manager.h b/engines/ultima/nuvie/core/egg_manager.h
index 650bee8303b..bca500c0633 100644
--- a/engines/ultima/nuvie/core/egg_manager.h
+++ b/engines/ultima/nuvie/core/egg_manager.h
@@ -43,8 +43,6 @@ class Actor;
 class Map;
 
 class EggManager {
-	Configuration *config;
-	Map *map;
 	ActorManager *actor_manager;
 	ObjManager *obj_manager;
 	nuvie_game_t gametype; // what game is being played?
@@ -53,7 +51,7 @@ class EggManager {
 
 public:
 
-	EggManager(Configuration *cfg, nuvie_game_t type, Map *m);
+	EggManager(nuvie_game_t type);
 	~EggManager();
 
 	void set_actor_manager(ActorManager *am) {
diff --git a/engines/ultima/nuvie/core/game.cpp b/engines/ultima/nuvie/core/game.cpp
index 51cd1f914d6..522ff1d32f5 100644
--- a/engines/ultima/nuvie/core/game.cpp
+++ b/engines/ultima/nuvie/core/game.cpp
@@ -182,7 +182,7 @@ bool Game::loadGame(Script *s) {
 
 	palette = new GamePalette(screen, config);
 
-	_clock = new GameClock(config, game_type);
+	_clock = new GameClock(game_type);
 
 	background = new Background(config);
 	background->init();
@@ -200,7 +200,7 @@ bool Game::loadGame(Script *s) {
 	}
 	game_map = new Map(config);
 
-	egg_manager = new EggManager(config, game_type, game_map);
+	egg_manager = new EggManager(game_type);
 
 	tile_manager = new TileManager(config);
 	if (tile_manager->loadTiles() == false)
diff --git a/engines/ultima/nuvie/core/game_clock.cpp b/engines/ultima/nuvie/core/game_clock.cpp
index ba614111954..f8dc4879fda 100644
--- a/engines/ultima/nuvie/core/game_clock.cpp
+++ b/engines/ultima/nuvie/core/game_clock.cpp
@@ -30,8 +30,7 @@
 namespace Ultima {
 namespace Nuvie {
 
-GameClock::GameClock(Configuration *cfg, nuvie_game_t type) : config(cfg),
-		game_type(type), day_of_week(0) {
+GameClock::GameClock(nuvie_game_t type) : game_type(type), day_of_week(0) {
 	date_string[10] = '\0';
 	time_string[10] = '\0';
 
diff --git a/engines/ultima/nuvie/core/game_clock.h b/engines/ultima/nuvie/core/game_clock.h
index 6b89d9406d8..087d04c110e 100644
--- a/engines/ultima/nuvie/core/game_clock.h
+++ b/engines/ultima/nuvie/core/game_clock.h
@@ -47,7 +47,6 @@ class Configuration;
 class NuvieIO;
 
 class GameClock {
-	Configuration *config;
 	nuvie_game_t game_type;
 
 	uint16 minute;
@@ -73,7 +72,7 @@ class GameClock {
 
 public:
 
-	GameClock(Configuration *cfg, nuvie_game_t type);
+	GameClock(nuvie_game_t type);
 	~GameClock();
 
 	bool load(NuvieIO *objlist);
diff --git a/engines/ultima/nuvie/core/magic.cpp b/engines/ultima/nuvie/core/magic.cpp
index 57ed42a35e3..16d68248f0d 100644
--- a/engines/ultima/nuvie/core/magic.cpp
+++ b/engines/ultima/nuvie/core/magic.cpp
@@ -68,8 +68,7 @@ const char *reagent[8] = {"mandrake root", "nightshade", "black pearl", "blood m
 const int obj_n_reagent[8] = {OBJ_U6_MANDRAKE_ROOT, OBJ_U6_NIGHTSHADE, OBJ_U6_BLACK_PEARL, OBJ_U6_BLOOD_MOSS, OBJ_U6_SPIDER_SILK, OBJ_U6_GARLIC, OBJ_U6_GINSENG, OBJ_U6_SULFUROUS_ASH};
 
 
-Magic::Magic() : event(nullptr), target_object(nullptr), magic_script(nullptr),
-		spellbook_obj(nullptr), state(0) {
+Magic::Magic() : event(nullptr), magic_script(nullptr), spellbook_obj(nullptr), state(0) {
 	ARRAYCLEAR(spell);
 	clear_cast_buffer();
 }
diff --git a/engines/ultima/nuvie/core/magic.h b/engines/ultima/nuvie/core/magic.h
index 9c8f9683a19..4969e6b668c 100644
--- a/engines/ultima/nuvie/core/magic.h
+++ b/engines/ultima/nuvie/core/magic.h
@@ -82,8 +82,6 @@ private:
 	char cast_buffer_str[26]; // buffer for spell syllables typed.
 	uint8 cast_buffer_len; // how many characters typed in the spell buffer.
 	Events *event;
-	//Actor *target_actor;
-	Obj *target_object;
 	uint8 state;
 
 	ScriptThread *magic_script;
diff --git a/engines/ultima/nuvie/core/tile_manager.cpp b/engines/ultima/nuvie/core/tile_manager.cpp
index f94402def9b..2cf1a3dc749 100644
--- a/engines/ultima/nuvie/core/tile_manager.cpp
+++ b/engines/ultima/nuvie/core/tile_manager.cpp
@@ -679,7 +679,7 @@ void TileManager::get_rotated_tile(const Tile *tileP, Tile *dest_tile, float rot
 
 	int32 const src_pitch = 16;
 	int32 const dst_pitch = 16;
-	uint8 const *src_row = (uint8 *)&tileP->data;
+	uint8 const *src_row = (uint8 const *)&tileP->data;
 	uint8 *dst_pixels = (uint8 *)&dest_tile->data;
 	uint8 *dst_row;
 
diff --git a/engines/ultima/nuvie/files/tmx_map.cpp b/engines/ultima/nuvie/files/tmx_map.cpp
index 203e2a770ab..b40b4092da5 100644
--- a/engines/ultima/nuvie/files/tmx_map.cpp
+++ b/engines/ultima/nuvie/files/tmx_map.cpp
@@ -29,7 +29,7 @@ namespace Ultima {
 namespace Nuvie {
 
 TMXMap::TMXMap(TileManager *tm, Map *m, ObjManager *om) : tile_manager(tm),
-		map(m), obj_manager(om), mapdata(nullptr), game_type(NUVIE_GAME_NONE) {
+		map(m), obj_manager(om), mapdata(nullptr) {
 }
 
 TMXMap::~TMXMap() {
diff --git a/engines/ultima/nuvie/files/tmx_map.h b/engines/ultima/nuvie/files/tmx_map.h
index 7a17d5c026d..86714976cf4 100644
--- a/engines/ultima/nuvie/files/tmx_map.h
+++ b/engines/ultima/nuvie/files/tmx_map.h
@@ -42,7 +42,7 @@ private:
 	ObjManager *obj_manager;
 	Std::string savedir;
 	Std::string savename;
-	nuvie_game_t game_type;
+	//nuvie_game_t game_type;
 
 public:
 	TMXMap(TileManager *tm, Map *m, ObjManager *om);
diff --git a/engines/ultima/nuvie/misc/u6_misc.cpp b/engines/ultima/nuvie/misc/u6_misc.cpp
index f316a216fc0..e5bd289883f 100644
--- a/engines/ultima/nuvie/misc/u6_misc.cpp
+++ b/engines/ultima/nuvie/misc/u6_misc.cpp
@@ -33,9 +33,6 @@ namespace Nuvie {
 
 using namespace Std;
 
-bool find_casesensitive_path(Std::string path, Std::string filename, Std::string &new_path);
-bool find_path(Std::string path, Std::string &dir_str);
-
 void Tokenise(const Std::string &str, Std::vector<Std::string> &tokens, char delimiter = ' ') {
 	Std::string delimiters(delimiter);
 
@@ -92,59 +89,6 @@ void config_get_path(Configuration *config, const Std::string &filename, Std::st
 	path = tmp_path;
 }
 
-bool find_casesensitive_path(const Std::string &path, const Std::string &filename, Std::string &new_path) {
-	vector<string> directories;
-	string tmp_path = path;
-
-	Tokenise(filename, directories, U6PATH_DELIMITER);
-
-	Std::vector<string>::iterator dir_iter;
-
-	for (dir_iter = directories.begin(); dir_iter != directories.end();) {
-		string dir = *dir_iter;
-
-		::debug(1, "%s, ", dir.c_str());
-
-		if (find_path(tmp_path, dir) == false)
-			return false;
-
-		dir_iter++;
-
-		if (dir_iter != directories.end())
-			dir += U6PATH_DELIMITER;
-
-		tmp_path += dir;
-	}
-
-	new_path = tmp_path;
-
-	::debug(1, "\nproper path = %s", new_path.c_str());
-	return true;
-}
-
-static bool find_path(const Std::string &path, Std::string &dir_str) {
-	dir_str = path;
-	return true;
-#if 0
-	DIR *dir;
-	struct dirent *item;
-
-	dir = opendir(path.c_str());
-	if (dir == nullptr)
-		return false;
-
-	for (item = readdir(dir); item != nullptr; item = readdir(dir)) {
-		debug("trying %s, want %s", item->d_name, dir_str.c_str());
-		if (strlen(item->d_name) == dir_str.length() && Common::scumm_stricmp(item->d_name, dir_str.c_str()) == 0) {
-			dir_str = item->d_name;
-			return true;
-		}
-	}
-
-	return false;
-#endif
-}
-
 void stringToUpper(Std::string &str) {
 	for (size_t i = 0; i < str.length(); ++i) {
 		str[i] = toupper(str[i]);


Commit: e5b83a794294b9951a37ab74f99c29f7eb321ea7
    https://github.com/scummvm/scummvm/commit/e5b83a794294b9951a37ab74f99c29f7eb321ea7
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2023-12-09T13:56:08+11:00

Commit Message:
ULTIMA: NUVIE: Improve constness of Configuration

Minimize the number of places where the Configuration can potentially be
modified to make it more clear where that happens.

Changed paths:
    engines/ultima/nuvie/actors/actor_manager.cpp
    engines/ultima/nuvie/actors/actor_manager.h
    engines/ultima/nuvie/conf/configuration.cpp
    engines/ultima/nuvie/conf/configuration.h
    engines/ultima/nuvie/core/book.cpp
    engines/ultima/nuvie/core/book.h
    engines/ultima/nuvie/core/converse.cpp
    engines/ultima/nuvie/core/converse.h
    engines/ultima/nuvie/core/converse_speech.cpp
    engines/ultima/nuvie/core/converse_speech.h
    engines/ultima/nuvie/core/cursor.cpp
    engines/ultima/nuvie/core/cursor.h
    engines/ultima/nuvie/core/events.cpp
    engines/ultima/nuvie/core/events.h
    engines/ultima/nuvie/core/look.cpp
    engines/ultima/nuvie/core/look.h
    engines/ultima/nuvie/core/map.cpp
    engines/ultima/nuvie/core/map.h
    engines/ultima/nuvie/core/obj_manager.cpp
    engines/ultima/nuvie/core/obj_manager.h
    engines/ultima/nuvie/core/party.cpp
    engines/ultima/nuvie/core/party.h
    engines/ultima/nuvie/core/player.cpp
    engines/ultima/nuvie/core/player.h
    engines/ultima/nuvie/core/tile_manager.cpp
    engines/ultima/nuvie/core/tile_manager.h
    engines/ultima/nuvie/core/weather.cpp
    engines/ultima/nuvie/core/weather.h
    engines/ultima/nuvie/files/u6_shape.cpp
    engines/ultima/nuvie/files/u6_shape.h
    engines/ultima/nuvie/fonts/font_manager.cpp
    engines/ultima/nuvie/fonts/font_manager.h
    engines/ultima/nuvie/gui/gui.cpp
    engines/ultima/nuvie/gui/gui.h
    engines/ultima/nuvie/gui/widgets/background.cpp
    engines/ultima/nuvie/gui/widgets/background.h
    engines/ultima/nuvie/gui/widgets/command_bar.cpp
    engines/ultima/nuvie/gui/widgets/console.cpp
    engines/ultima/nuvie/gui/widgets/console.h
    engines/ultima/nuvie/gui/widgets/converse_gump.cpp
    engines/ultima/nuvie/gui/widgets/converse_gump.h
    engines/ultima/nuvie/gui/widgets/converse_gump_wou.cpp
    engines/ultima/nuvie/gui/widgets/converse_gump_wou.h
    engines/ultima/nuvie/gui/widgets/map_window.cpp
    engines/ultima/nuvie/gui/widgets/map_window.h
    engines/ultima/nuvie/gui/widgets/msg_scroll.cpp
    engines/ultima/nuvie/gui/widgets/msg_scroll.h
    engines/ultima/nuvie/gui/widgets/msg_scroll_new_ui.cpp
    engines/ultima/nuvie/gui/widgets/msg_scroll_new_ui.h
    engines/ultima/nuvie/keybinding/keys.cpp
    engines/ultima/nuvie/keybinding/keys.h
    engines/ultima/nuvie/misc/u6_misc.cpp
    engines/ultima/nuvie/misc/u6_misc.h
    engines/ultima/nuvie/portraits/portrait.cpp
    engines/ultima/nuvie/portraits/portrait.h
    engines/ultima/nuvie/portraits/portrait_md.h
    engines/ultima/nuvie/portraits/portrait_se.h
    engines/ultima/nuvie/portraits/portrait_u6.h
    engines/ultima/nuvie/screen/dither.cpp
    engines/ultima/nuvie/screen/dither.h
    engines/ultima/nuvie/screen/game_palette.cpp
    engines/ultima/nuvie/screen/game_palette.h
    engines/ultima/nuvie/screen/screen.cpp
    engines/ultima/nuvie/screen/screen.h
    engines/ultima/nuvie/sound/adlib_sfx_manager.cpp
    engines/ultima/nuvie/sound/adlib_sfx_manager.h
    engines/ultima/nuvie/sound/custom_sfx_manager.cpp
    engines/ultima/nuvie/sound/custom_sfx_manager.h
    engines/ultima/nuvie/sound/decoder/adlib_sfx_stream.cpp
    engines/ultima/nuvie/sound/decoder/adlib_sfx_stream.h
    engines/ultima/nuvie/sound/origin_fx_adib_driver.cpp
    engines/ultima/nuvie/sound/origin_fx_adib_driver.h
    engines/ultima/nuvie/sound/pc_speaker_sfx_manager.cpp
    engines/ultima/nuvie/sound/pc_speaker_sfx_manager.h
    engines/ultima/nuvie/sound/sfx_manager.h
    engines/ultima/nuvie/sound/sound_manager.cpp
    engines/ultima/nuvie/sound/sound_manager.h
    engines/ultima/nuvie/sound/towns_sfx_manager.cpp
    engines/ultima/nuvie/sound/towns_sfx_manager.h
    engines/ultima/nuvie/usecode/u6_usecode.cpp
    engines/ultima/nuvie/usecode/u6_usecode.h
    engines/ultima/nuvie/usecode/usecode.cpp
    engines/ultima/nuvie/usecode/usecode.h
    engines/ultima/nuvie/views/actor_view.cpp
    engines/ultima/nuvie/views/actor_view.h
    engines/ultima/nuvie/views/container_view_gump.cpp
    engines/ultima/nuvie/views/container_view_gump.h
    engines/ultima/nuvie/views/container_widget.cpp
    engines/ultima/nuvie/views/container_widget.h
    engines/ultima/nuvie/views/container_widget_gump.cpp
    engines/ultima/nuvie/views/container_widget_gump.h
    engines/ultima/nuvie/views/doll_view_gump.cpp
    engines/ultima/nuvie/views/doll_view_gump.h
    engines/ultima/nuvie/views/doll_widget.cpp
    engines/ultima/nuvie/views/doll_widget.h
    engines/ultima/nuvie/views/draggable_view.cpp
    engines/ultima/nuvie/views/draggable_view.h
    engines/ultima/nuvie/views/inventory_view.cpp
    engines/ultima/nuvie/views/inventory_view.h
    engines/ultima/nuvie/views/inventory_widget.cpp
    engines/ultima/nuvie/views/inventory_widget.h
    engines/ultima/nuvie/views/map_editor_view.cpp
    engines/ultima/nuvie/views/map_editor_view.h
    engines/ultima/nuvie/views/md_sky_strip_widget.cpp
    engines/ultima/nuvie/views/md_sky_strip_widget.h
    engines/ultima/nuvie/views/party_view.cpp
    engines/ultima/nuvie/views/party_view.h
    engines/ultima/nuvie/views/portrait_view.cpp
    engines/ultima/nuvie/views/portrait_view.h
    engines/ultima/nuvie/views/portrait_view_gump.cpp
    engines/ultima/nuvie/views/portrait_view_gump.h
    engines/ultima/nuvie/views/scroll_view_gump.cpp
    engines/ultima/nuvie/views/scroll_view_gump.h
    engines/ultima/nuvie/views/scroll_widget_gump.cpp
    engines/ultima/nuvie/views/scroll_widget_gump.h
    engines/ultima/nuvie/views/sign_view_gump.cpp
    engines/ultima/nuvie/views/sign_view_gump.h
    engines/ultima/nuvie/views/spell_view.cpp
    engines/ultima/nuvie/views/spell_view.h
    engines/ultima/nuvie/views/spell_view_gump.cpp
    engines/ultima/nuvie/views/spell_view_gump.h
    engines/ultima/nuvie/views/view.cpp
    engines/ultima/nuvie/views/view.h
    engines/ultima/nuvie/views/view_manager.cpp
    engines/ultima/nuvie/views/view_manager.h


diff --git a/engines/ultima/nuvie/actors/actor_manager.cpp b/engines/ultima/nuvie/actors/actor_manager.cpp
index abb14212688..b639ce265cf 100644
--- a/engines/ultima/nuvie/actors/actor_manager.cpp
+++ b/engines/ultima/nuvie/actors/actor_manager.cpp
@@ -49,7 +49,7 @@ namespace Nuvie {
 static const int ACTOR_TEMP_INIT = 255;
 static const int SCHEDULE_SIZE = 5;
 
-ActorManager::ActorManager(Configuration *cfg, Map *m, TileManager *tm, ObjManager *om, GameClock *c)
+ActorManager::ActorManager(const Configuration *cfg, Map *m, TileManager *tm, ObjManager *om, GameClock *c)
 		: config(cfg), map(m), tile_manager(tm), obj_manager(om), _clock(c),
 		  temp_actor_offset(224) {
 	ARRAYCLEAR(actors);
diff --git a/engines/ultima/nuvie/actors/actor_manager.h b/engines/ultima/nuvie/actors/actor_manager.h
index 65c9a46aa6b..193cae1c532 100644
--- a/engines/ultima/nuvie/actors/actor_manager.h
+++ b/engines/ultima/nuvie/actors/actor_manager.h
@@ -40,7 +40,7 @@ class MapCoord;
 #define ACTORMANAGER_MAX_ACTORS 256
 
 class ActorManager {
-	Configuration *config;
+	const Configuration *config;
 	TileManager *tile_manager;
 	ObjManager *obj_manager;
 
@@ -63,7 +63,7 @@ class ActorManager {
 
 public:
 
-	ActorManager(Configuration *cfg, Map *m, TileManager *tm, ObjManager *om, GameClock *c);
+	ActorManager(const Configuration *cfg, Map *m, TileManager *tm, ObjManager *om, GameClock *c);
 	~ActorManager();
 
 	void init();
diff --git a/engines/ultima/nuvie/conf/configuration.cpp b/engines/ultima/nuvie/conf/configuration.cpp
index 9f65e31af0e..24f57f0d1f3 100644
--- a/engines/ultima/nuvie/conf/configuration.cpp
+++ b/engines/ultima/nuvie/conf/configuration.cpp
@@ -81,9 +81,9 @@ void Configuration::clear() {
 }
 
 void Configuration::value(const Std::string &key, Std::string &ret,
-						  const char *defaultvalue) {
+						  const char *defaultvalue) const {
 	// Check for a .cfg file value in the trees
-	for (Std::vector<Shared::XMLTree *>::reverse_iterator i = _trees.rbegin();
+	for (Std::vector<Shared::XMLTree *>::const_reverse_iterator i = _trees.rbegin();
 	        i != _trees.rend(); ++i) {
 		if ((*i)->hasNode(key)) {
 			(*i)->value(key, ret, defaultvalue);
@@ -109,9 +109,9 @@ void Configuration::value(const Std::string &key, Std::string &ret,
 	ret = defaultvalue;
 }
 
-void Configuration::value(const Std::string &key, int &ret, int defaultvalue) {
+void Configuration::value(const Std::string &key, int &ret, int defaultvalue) const {
 	// Check for a .cfg file value in the trees
-	for (Std::vector<Shared::XMLTree *>::reverse_iterator i = _trees.rbegin();
+	for (Std::vector<Shared::XMLTree *>::const_reverse_iterator i = _trees.rbegin();
 	        i != _trees.rend(); ++i) {
 		if ((*i)->hasNode(key)) {
 			(*i)->value(key, ret, defaultvalue);
@@ -137,9 +137,9 @@ void Configuration::value(const Std::string &key, int &ret, int defaultvalue) {
 	ret = defaultvalue;
 }
 
-void Configuration::value(const Std::string &key, bool &ret, bool defaultvalue) {
+void Configuration::value(const Std::string &key, bool &ret, bool defaultvalue) const {
 	// Check for a .cfg file value in the trees
-	for (Std::vector<Shared::XMLTree *>::reverse_iterator i = _trees.rbegin();
+	for (Std::vector<Shared::XMLTree *>::const_reverse_iterator i = _trees.rbegin();
 	        i != _trees.rend(); ++i) {
 		if ((*i)->hasNode(key)) {
 			(*i)->value(key, ret, defaultvalue);
@@ -167,7 +167,7 @@ void Configuration::value(const Std::string &key, bool &ret, bool defaultvalue)
 	ret = defaultvalue;
 }
 
-void Configuration::pathFromValue(const Std::string &key, const Std::string &file, Std::string &full_path) {
+void Configuration::pathFromValue(const Std::string &key, const Std::string &file, Std::string &full_path) const {
 	value(key, full_path);
 
 	if (full_path.length() > 0 && full_path[full_path.length() - 1] != U6PATH_DELIMITER)
@@ -269,12 +269,12 @@ ConfigNode *Configuration::getNode(const Std::string &key) {
 	return new ConfigNode(*this, key);
 }
 
-Std::set<Std::string> Configuration::listKeys(const Std::string &key, bool longformat) {
+Std::set<Std::string> Configuration::listKeys(const Std::string &key, bool longformat) const {
 	Std::set<Std::string> keys;
-	for (Common::Array<Shared::XMLTree *>::iterator i = _trees.begin();
+	for (Common::Array<Shared::XMLTree *>::const_iterator i = _trees.begin();
 	        i != _trees.end(); ++i) {
 		Common::Array<Common::String> k = (*i)->listKeys(key, longformat);
-		for (Common::Array<Common::String>::iterator iter = k.begin();
+		for (Common::Array<Common::String>::const_iterator iter = k.begin();
 		        iter != k.end(); ++iter) {
 			keys.insert(*iter);
 		}
diff --git a/engines/ultima/nuvie/conf/configuration.h b/engines/ultima/nuvie/conf/configuration.h
index 41e3e4133ef..602a4db5e48 100644
--- a/engines/ultima/nuvie/conf/configuration.h
+++ b/engines/ultima/nuvie/conf/configuration.h
@@ -93,11 +93,11 @@ public:
 	void clear();
 
 	// get value
-	void value(const Std::string &key, Std::string &ret, const char *defaultvalue = "");
-	void value(const Std::string &key, int &ret, int defaultvalue = 0);
-	void value(const Std::string &key, bool &ret, bool defaultvalue = false);
+	void value(const Std::string &key, Std::string &ret, const char *defaultvalue = "") const;
+	void value(const Std::string &key, int &ret, int defaultvalue = 0) const;
+	void value(const Std::string &key, bool &ret, bool defaultvalue = false) const;
 
-	void pathFromValue(const Std::string &key, const Std::string &file, Std::string &full_path);
+	void pathFromValue(const Std::string &key, const Std::string &file, Std::string &full_path) const;
 
 	// set value
 	bool set(const Std::string &key, const Std::string &value);
@@ -109,7 +109,7 @@ public:
 	ConfigNode *getNode(const Std::string &key);
 
 	// list all subkeys of a key. (no guaranteed order in result)
-	Std::set<Std::string> listKeys(const Std::string &key, bool longformat = false);
+	Std::set<Std::string> listKeys(const Std::string &key, bool longformat = false) const;
 
 	typedef Common::Pair<Common::String, Common::String> KeyType;
 	typedef Common::Array<KeyType> KeyTypeList;
diff --git a/engines/ultima/nuvie/core/book.cpp b/engines/ultima/nuvie/core/book.cpp
index bb77500f0d5..1caa721caf3 100644
--- a/engines/ultima/nuvie/core/book.cpp
+++ b/engines/ultima/nuvie/core/book.cpp
@@ -29,7 +29,7 @@
 namespace Ultima {
 namespace Nuvie {
 
-Book::Book(Configuration *cfg) : config(cfg), books(new U6Lib_n) {
+Book::Book(const Configuration *cfg) : config(cfg), books(new U6Lib_n) {
 }
 
 Book::~Book() {
diff --git a/engines/ultima/nuvie/core/book.h b/engines/ultima/nuvie/core/book.h
index 5e4b2d72f77..1d6a2bcebb2 100644
--- a/engines/ultima/nuvie/core/book.h
+++ b/engines/ultima/nuvie/core/book.h
@@ -29,13 +29,13 @@ class Configuration;
 class U6Lib_n;
 
 class Book {
-	Configuration *config;
+	const Configuration *config;
 
 	U6Lib_n *books;
 
 public:
 
-	Book(Configuration *cfg);
+	Book(const Configuration *cfg);
 	~Book();
 
 	bool init();
diff --git a/engines/ultima/nuvie/core/converse.cpp b/engines/ultima/nuvie/core/converse.cpp
index 26f71ba70af..749c6cc3ace 100644
--- a/engines/ultima/nuvie/core/converse.cpp
+++ b/engines/ultima/nuvie/core/converse.cpp
@@ -58,7 +58,7 @@ Converse::Converse() : config(nullptr), actors(nullptr), objects(nullptr),
 /* Initialize global classes from the game.
  */
 void
-Converse::init(Configuration *cfg, nuvie_game_t t, MsgScroll *s, ActorManager *a,
+Converse::init(const Configuration *cfg, nuvie_game_t t, MsgScroll *s, ActorManager *a,
 			   GameClock *c, Player *p, ViewManager *v, ObjManager *o) {
 	Std::string townsdir;
 
@@ -731,7 +731,7 @@ void ConvScript::write2(converse_value val) {
 }
 
 
-ConverseGumpType get_converse_gump_type_from_config(Configuration *config) {
+ConverseGumpType get_converse_gump_type_from_config(const Configuration *config) {
 	Std::string configvalue;
 	config->value("config/general/converse_gump", configvalue, "default");
 
diff --git a/engines/ultima/nuvie/core/converse.h b/engines/ultima/nuvie/core/converse.h
index eccee221937..fd0b4066fb4 100644
--- a/engines/ultima/nuvie/core/converse.h
+++ b/engines/ultima/nuvie/core/converse.h
@@ -49,7 +49,7 @@ class ConvScript;
 
 using Std::string;
 
-ConverseGumpType get_converse_gump_type_from_config(Configuration *config);
+ConverseGumpType get_converse_gump_type_from_config(const Configuration *config);
 
 typedef uint32 converse_value; // any single value read from a script
 typedef unsigned char *convscript_buffer;
@@ -86,7 +86,7 @@ class Converse {
 	friend class U6ConverseInterpret;
 
 	// game system objects from nuvie
-	Configuration *config;
+	const Configuration *config;
 	GameClock *_clock;
 	ActorManager *actors;
 	ObjManager *objects;
@@ -129,7 +129,7 @@ class Converse {
 public:
 	Converse();
 	~Converse();
-	void init(Configuration *cfg, nuvie_game_t t, MsgScroll *s, ActorManager *a,
+	void init(const Configuration *cfg, nuvie_game_t t, MsgScroll *s, ActorManager *a,
 	          GameClock *c, Player *p, ViewManager *v, ObjManager *o);
 
 	uint32 get_script_num(uint8 a);
diff --git a/engines/ultima/nuvie/core/converse_speech.cpp b/engines/ultima/nuvie/core/converse_speech.cpp
index 28b51938c70..08ffe6fdf09 100644
--- a/engines/ultima/nuvie/core/converse_speech.cpp
+++ b/engines/ultima/nuvie/core/converse_speech.cpp
@@ -37,7 +37,7 @@ ConverseSpeech::ConverseSpeech() : config(nullptr) {
 
 /* Initialize global classes from the game.
  */
-void ConverseSpeech::init(Configuration *cfg) {
+void ConverseSpeech::init(const Configuration *cfg) {
 	config = cfg;
 }
 
diff --git a/engines/ultima/nuvie/core/converse_speech.h b/engines/ultima/nuvie/core/converse_speech.h
index c1a205fac88..f7ec26f3f30 100644
--- a/engines/ultima/nuvie/core/converse_speech.h
+++ b/engines/ultima/nuvie/core/converse_speech.h
@@ -43,14 +43,14 @@ typedef struct TownsSound {
 
 class ConverseSpeech {
 	// game system objects from nuvie
-	Configuration *config;
+	const Configuration *config;
 	Audio::SoundHandle handle;
 	Std::list<TownsSound> list;
 
 public:
 	ConverseSpeech();
 	~ConverseSpeech();
-	void init(Configuration *cfg);
+	void init(const Configuration *cfg);
 	void update();
 	void play_speech(uint16 actor_num, uint16 sample_num);
 
diff --git a/engines/ultima/nuvie/core/cursor.cpp b/engines/ultima/nuvie/core/cursor.cpp
index 94d5e6cc6f9..0764bc93721 100644
--- a/engines/ultima/nuvie/core/cursor.cpp
+++ b/engines/ultima/nuvie/core/cursor.cpp
@@ -44,7 +44,7 @@ Cursor::Cursor() : cursor_id(0), cur_x(-1), cur_y(-1), cleanup(nullptr),
 
 /* Returns true if mouse pointers file was loaded.
  */
-bool Cursor::init(Configuration *c, Screen *s, nuvie_game_t game_type) {
+bool Cursor::init(const Configuration *c, Screen *s, nuvie_game_t game_type) {
 	Std::string file, filename;
 	bool enable_cursors;
 
diff --git a/engines/ultima/nuvie/core/cursor.h b/engines/ultima/nuvie/core/cursor.h
index da8d2036ecd..cb5bb734d4f 100644
--- a/engines/ultima/nuvie/core/cursor.h
+++ b/engines/ultima/nuvie/core/cursor.h
@@ -46,7 +46,7 @@ typedef struct {
 class Cursor {
 	friend class Screen;
 	Screen *screen;
-	Configuration *config;
+	const Configuration *config;
 	sint32 cur_x, cur_y; // location on screen, unused normally
 	Std::vector<MousePointer *> cursors; // pointer list
 	uint8 cursor_id; // which pointer is active
@@ -68,7 +68,7 @@ public:
 	~Cursor()                              {
 		unload_all();
 	}
-	bool init(Configuration *c, Screen *s, nuvie_game_t game_type);
+	bool init(const Configuration *c, Screen *s, nuvie_game_t game_type);
 	uint32 load_all(Std::string filename, nuvie_game_t game_type);
 	void unload_all();
 	bool set_pointer(uint8 ptr_num);
diff --git a/engines/ultima/nuvie/core/events.cpp b/engines/ultima/nuvie/core/events.cpp
index 3309f6687b8..be98153307d 100644
--- a/engines/ultima/nuvie/core/events.cpp
+++ b/engines/ultima/nuvie/core/events.cpp
@@ -73,7 +73,7 @@ void EventInput_s::set_loc(const MapCoord &c) {
 	loc = new MapCoord(c);
 }
 
-Events::Events(Shared::EventsCallback *callback, Configuration *cfg)
+Events::Events(Shared::EventsCallback *callback, const Configuration *cfg)
 		: Shared::EventsManager(callback), config(cfg), converse(nullptr),
 		  keybinder(nullptr), showingQuitDialog(false), fps_counter_widget(nullptr),
 		  cursor_mode(false){
diff --git a/engines/ultima/nuvie/core/events.h b/engines/ultima/nuvie/core/events.h
index 9751894eec3..1dbda8cb425 100644
--- a/engines/ultima/nuvie/core/events.h
+++ b/engines/ultima/nuvie/core/events.h
@@ -183,7 +183,7 @@ typedef struct EventInput_s EventInput;
 class Events : public Ultima::Shared::EventsManager, public CallBack {
 	friend class Magic; // FIXME
 private:
-	Configuration *config;
+	const Configuration *config;
 	GUI *gui;
 	Game *game;
 	ObjManager *obj_manager;
@@ -241,7 +241,7 @@ protected:
 	void try_next_attack();
 
 public:
-	Events(Shared::EventsCallback *callback, Configuration *cfg);
+	Events(Shared::EventsCallback *callback, const Configuration *cfg);
 	~Events() override;
 
 	void clear();
diff --git a/engines/ultima/nuvie/core/look.cpp b/engines/ultima/nuvie/core/look.cpp
index 785a804d511..a672fed3ddc 100644
--- a/engines/ultima/nuvie/core/look.cpp
+++ b/engines/ultima/nuvie/core/look.cpp
@@ -30,7 +30,7 @@
 namespace Ultima {
 namespace Nuvie {
 
-Look::Look(Configuration *cfg)
+Look::Look(const Configuration *cfg)
 	: look_data(nullptr), desc_buf(nullptr), config(cfg), max_len(0) {
 	look_tbl[2047] = nullptr;
 }
diff --git a/engines/ultima/nuvie/core/look.h b/engines/ultima/nuvie/core/look.h
index 03c051cbc16..bdb685e5664 100644
--- a/engines/ultima/nuvie/core/look.h
+++ b/engines/ultima/nuvie/core/look.h
@@ -28,7 +28,7 @@ namespace Nuvie {
 class Configuration;
 
 class Look {
-	Configuration *config;
+	const Configuration *config;
 	const char *look_tbl[2048];
 	uint16 max_len;
 	unsigned char *look_data;
@@ -36,7 +36,7 @@ class Look {
 
 public:
 
-	Look(Configuration *cfg);
+	Look(const Configuration *cfg);
 	~Look();
 
 	bool init();
diff --git a/engines/ultima/nuvie/core/map.cpp b/engines/ultima/nuvie/core/map.cpp
index d335017375f..8190c0585e3 100644
--- a/engines/ultima/nuvie/core/map.cpp
+++ b/engines/ultima/nuvie/core/map.cpp
@@ -36,7 +36,7 @@
 namespace Ultima {
 namespace Nuvie {
 
-Map::Map(Configuration *cfg) : config(cfg), tile_manager(nullptr),
+Map::Map(const Configuration *cfg) : config(cfg), tile_manager(nullptr),
 		obj_manager(nullptr), actor_manager(nullptr), surface(nullptr),
 		roof_surface(nullptr) {
 	ARRAYCLEAR(dungeons);
@@ -463,7 +463,7 @@ bool Map::has_roof(uint16 x, uint16 y, uint8 level) const {
 	return false;
 }
 
-Std::string Map::getRoofDataFilename() {
+Std::string Map::getRoofDataFilename() const {
 	Std::string game_type, datadir, path, mapfile;
 
 	config->value("config/datadir", datadir, "");
@@ -478,7 +478,7 @@ Std::string Map::getRoofDataFilename() {
 	return mapfile;
 }
 
-Std::string Map::getRoofTilesetFilename() {
+Std::string Map::getRoofTilesetFilename() const {
 	Std::string datadir;
 	Std::string imagefile;
 	Std::string path;
diff --git a/engines/ultima/nuvie/core/map.h b/engines/ultima/nuvie/core/map.h
index 1e8f1ac835e..de9f7a63a1b 100644
--- a/engines/ultima/nuvie/core/map.h
+++ b/engines/ultima/nuvie/core/map.h
@@ -143,7 +143,7 @@ public:
 
 
 class Map {
-	Configuration *config;
+	const Configuration *config;
 	TileManager *tile_manager;
 	ObjManager *obj_manager;
 	ActorManager *actor_manager;
@@ -156,7 +156,7 @@ class Map {
 
 public:
 
-	Map(Configuration *cfg);
+	Map(const Configuration *cfg);
 	~Map();
 
 	void set_actor_manager(ActorManager *am) {
@@ -192,10 +192,10 @@ public:
 	bool testIntersection(int x, int y, uint8 level, uint8 flags, LineTestResult &Result, Obj *excluded_obj = nullptr); // excluded_obj only works for LT_HitUnpassable
 
 	void saveRoofData();
-	Std::string getRoofTilesetFilename();
+	Std::string getRoofTilesetFilename() const;
 
 protected:
-	Std::string getRoofDataFilename();
+	Std::string getRoofDataFilename() const;
 	void insertSurfaceSuperChunk(const unsigned char *schunk_ptr, const unsigned char *chunk_data, uint8 schunk_num);
 	void insertSurfaceChunk(const unsigned char *chunk, uint16 x, uint16 y);
 
diff --git a/engines/ultima/nuvie/core/obj_manager.cpp b/engines/ultima/nuvie/core/obj_manager.cpp
index 44ed47d7ed6..f024b8ac389 100644
--- a/engines/ultima/nuvie/core/obj_manager.cpp
+++ b/engines/ultima/nuvie/core/obj_manager.cpp
@@ -49,7 +49,7 @@ static iAVLKey get_iAVLKey(const void *item) {
 	return ((const ObjTreeNode *)item)->key;
 }
 
-ObjManager::ObjManager(Configuration *cfg, TileManager *tm, EggManager *em)
+ObjManager::ObjManager(const Configuration *cfg, TileManager *tm, EggManager *em)
 	: config(cfg), tile_manager(tm), egg_manager(em), usecode(nullptr),
 	  obj_save_count(0) {
 	load_basetile();
diff --git a/engines/ultima/nuvie/core/obj_manager.h b/engines/ultima/nuvie/core/obj_manager.h
index 914e19e1aa6..39aea9866d7 100644
--- a/engines/ultima/nuvie/core/obj_manager.h
+++ b/engines/ultima/nuvie/core/obj_manager.h
@@ -73,7 +73,7 @@ void delete_obj(Obj *obj);
 void clean_obj_tree_node(void *node);
 
 class ObjManager {
-	Configuration *config;
+	const Configuration *config;
 	int game_type;
 	EggManager *egg_manager;
 	TileManager *tile_manager;
@@ -102,7 +102,7 @@ class ObjManager {
 
 public:
 
-	ObjManager(Configuration *cfg, TileManager *tm, EggManager *em);
+	ObjManager(const Configuration *cfg, TileManager *tm, EggManager *em);
 	~ObjManager();
 
 	bool use_custom_actor_tiles() {
diff --git a/engines/ultima/nuvie/core/party.cpp b/engines/ultima/nuvie/core/party.cpp
index c108bc431ff..961451f67d9 100644
--- a/engines/ultima/nuvie/core/party.cpp
+++ b/engines/ultima/nuvie/core/party.cpp
@@ -43,7 +43,7 @@
 namespace Ultima {
 namespace Nuvie {
 
-Party::Party(Configuration *cfg) : config(cfg), game(nullptr),
+Party::Party(const Configuration *cfg) : config(cfg), game(nullptr),
 		actor_manager(nullptr), map(nullptr), pathfinder(nullptr),
 		rest_campfire(nullptr), formation(PARTY_FORM_STANDARD),
 		num_in_party(0), prev_leader_x(0), prev_leader_y(0),
diff --git a/engines/ultima/nuvie/core/party.h b/engines/ultima/nuvie/core/party.h
index b81026d5d3e..a8d9e62eed3 100644
--- a/engines/ultima/nuvie/core/party.h
+++ b/engines/ultima/nuvie/core/party.h
@@ -93,7 +93,7 @@ class Party {
 protected:
 	friend class PartyPathFinder;
 	Game *game; // get pointers here to avoid construct order issues in loadGame()
-	Configuration *config;
+	const Configuration *config;
 	ActorManager *actor_manager;
 	Map *map;
 	PartyPathFinder *pathfinder;
@@ -115,7 +115,7 @@ protected:
 
 public:
 
-	Party(Configuration *cfg);
+	Party(const Configuration *cfg);
 	virtual ~Party();
 
 	virtual bool init(Game *g, ActorManager *am);
diff --git a/engines/ultima/nuvie/core/player.cpp b/engines/ultima/nuvie/core/player.cpp
index e01b66e8cb5..4024ad9b15d 100644
--- a/engines/ultima/nuvie/core/player.cpp
+++ b/engines/ultima/nuvie/core/player.cpp
@@ -42,7 +42,7 @@ namespace Nuvie {
 
 static const int PLAYER_BASE_MOVEMENT_COST = 5;
 
-Player::Player(Configuration *cfg) : config(cfg), _clock(nullptr),
+Player::Player(const Configuration *cfg) : config(cfg), _clock(nullptr),
 		party(nullptr), actor(nullptr), actor_manager(nullptr), obj_manager(nullptr),
 		map_window(nullptr), karma(0), gender(0), questf(0), gargishf(0), alcohol(0),
 		current_weapon(0), party_mode(false), mapwindow_centered(false) {
diff --git a/engines/ultima/nuvie/core/player.h b/engines/ultima/nuvie/core/player.h
index ae1fa3f36cb..afb0ae4cfec 100644
--- a/engines/ultima/nuvie/core/player.h
+++ b/engines/ultima/nuvie/core/player.h
@@ -39,7 +39,7 @@ class Party;
 class NuvieIO;
 
 class Player {
-	Configuration *config;
+	const Configuration *config;
 	int game_type;
 	GameClock *_clock;
 	Party *party;
@@ -63,7 +63,7 @@ class Player {
 
 public:
 
-	Player(Configuration *cfg);
+	Player(const Configuration *cfg);
 
 	bool init(ObjManager *om, ActorManager *am, MapWindow *mw, GameClock *c, Party *p);
 	void init();
diff --git a/engines/ultima/nuvie/core/tile_manager.cpp b/engines/ultima/nuvie/core/tile_manager.cpp
index 2cf1a3dc749..be63325c344 100644
--- a/engines/ultima/nuvie/core/tile_manager.cpp
+++ b/engines/ultima/nuvie/core/tile_manager.cpp
@@ -88,7 +88,7 @@ static const Tile gump_cursor = {
 	}
 };
 
-TileManager::TileManager(Configuration *cfg) : desc_buf(nullptr), config(cfg),
+TileManager::TileManager(const Configuration *cfg) : desc_buf(nullptr), config(cfg),
 		look(nullptr), game_counter(0), rgame_counter(0), extendedTiles(nullptr),
 		numTiles(NUM_ORIGINAL_TILES) {
 	memset(tileindex, 0, sizeof(tileindex));
diff --git a/engines/ultima/nuvie/core/tile_manager.h b/engines/ultima/nuvie/core/tile_manager.h
index dfeca0cebea..feed86a24e2 100644
--- a/engines/ultima/nuvie/core/tile_manager.h
+++ b/engines/ultima/nuvie/core/tile_manager.h
@@ -150,7 +150,7 @@ class TileManager {
 	Look *look;
 
 	char *desc_buf; // for look
-	Configuration *config;
+	const Configuration *config;
 
 	int game_type;
 
@@ -159,7 +159,7 @@ class TileManager {
 
 public:
 
-	TileManager(Configuration *cfg);
+	TileManager(const Configuration *cfg);
 	~TileManager();
 
 	bool loadTiles();
diff --git a/engines/ultima/nuvie/core/weather.cpp b/engines/ultima/nuvie/core/weather.cpp
index 23a96fea5f3..e9a82fd08e5 100644
--- a/engines/ultima/nuvie/core/weather.cpp
+++ b/engines/ultima/nuvie/core/weather.cpp
@@ -41,7 +41,7 @@ namespace Nuvie {
 //the longest we will go before having a change in wind direction
 #define WEATHER_MAX_WIND 30
 
-Weather::Weather(Configuration *cfg, GameClock *c, nuvie_game_t type)
+Weather::Weather(const Configuration *cfg, GameClock *c, nuvie_game_t type)
 		: config(cfg), _clock(c), gametype(type), wind_dir(NUVIE_DIR_NONE),
 		  wind_timer(nullptr) {
 	string s;
diff --git a/engines/ultima/nuvie/core/weather.h b/engines/ultima/nuvie/core/weather.h
index 2e021454ed5..397564c80a3 100644
--- a/engines/ultima/nuvie/core/weather.h
+++ b/engines/ultima/nuvie/core/weather.h
@@ -45,7 +45,7 @@ using Std::string;
 #define WEATHER_WIND_CALM 8
 
 class Weather: public CallBack {
-	Configuration *config;
+	const Configuration *config;
 	GameClock *_clock;
 	nuvie_game_t gametype; // what game is being played?
 
@@ -56,7 +56,7 @@ class Weather: public CallBack {
 
 public:
 
-	Weather(Configuration *cfg, GameClock *c, nuvie_game_t type);
+	Weather(const Configuration *cfg, GameClock *c, nuvie_game_t type);
 	~Weather() override;
 
 	bool load(NuvieIO *objlist);
diff --git a/engines/ultima/nuvie/files/u6_shape.cpp b/engines/ultima/nuvie/files/u6_shape.cpp
index ed89a0b0965..d09f5d42fd3 100644
--- a/engines/ultima/nuvie/files/u6_shape.cpp
+++ b/engines/ultima/nuvie/files/u6_shape.cpp
@@ -136,7 +136,7 @@ bool U6Shape::load(U6Lib_n *file, uint32 index) {
 	return false;
 }
 
-bool U6Shape::load_from_lzc(Std::string filename, uint32 idx, uint32 sub_idx) {
+bool U6Shape::load_from_lzc(const Std::string &filename, uint32 idx, uint32 sub_idx) {
 	U6Lib_n lib_n;
 	unsigned char *buf = nullptr;
 
@@ -288,7 +288,7 @@ bool U6Shape::load(unsigned char *buf) {
 }
 
 // TODO - allow for failure
-bool U6Shape::load_WoU_background(Configuration *config, nuvie_game_t game_type) {
+bool U6Shape::load_WoU_background(const Configuration *config, nuvie_game_t game_type) {
 	U6Lib_n file;
 	unsigned char *temp_buf;
 	Std::string filename;
diff --git a/engines/ultima/nuvie/files/u6_shape.h b/engines/ultima/nuvie/files/u6_shape.h
index a199739f399..b8f787638d3 100644
--- a/engines/ultima/nuvie/files/u6_shape.h
+++ b/engines/ultima/nuvie/files/u6_shape.h
@@ -60,8 +60,8 @@ public:
 	virtual bool load(Std::string filename);
 	bool load(U6Lib_n *file, uint32 index);
 	virtual bool load(unsigned char *buf);
-	bool load_from_lzc(Std::string filename, uint32 idx, uint32 sub_idx);
-	bool load_WoU_background(Configuration *config, nuvie_game_t game_type);
+	bool load_from_lzc(const Std::string &filename, uint32 idx, uint32 sub_idx);
+	bool load_WoU_background(const Configuration *config, nuvie_game_t game_type);
 
 	unsigned char *get_data();
 	Graphics::ManagedSurface *get_shape_surface();
diff --git a/engines/ultima/nuvie/fonts/font_manager.cpp b/engines/ultima/nuvie/fonts/font_manager.cpp
index 46fe7d2f21d..0e13e1fb633 100644
--- a/engines/ultima/nuvie/fonts/font_manager.cpp
+++ b/engines/ultima/nuvie/fonts/font_manager.cpp
@@ -35,7 +35,7 @@
 namespace Ultima {
 namespace Nuvie {
 
-FontManager::FontManager(Configuration *cfg) : config(cfg), num_fonts(0),
+FontManager::FontManager(const Configuration *cfg) : config(cfg), num_fonts(0),
 		conv_font(nullptr), conv_garg_font(nullptr), conv_font_data(nullptr),
 		conv_font_widths(nullptr) {
 }
diff --git a/engines/ultima/nuvie/fonts/font_manager.h b/engines/ultima/nuvie/fonts/font_manager.h
index a3bb26c2729..02686716148 100644
--- a/engines/ultima/nuvie/fonts/font_manager.h
+++ b/engines/ultima/nuvie/fonts/font_manager.h
@@ -34,7 +34,7 @@ class Font;
 #define NUVIE_FONT_GARG   1
 
 class FontManager {
-	Configuration *config;
+	const Configuration *config;
 
 	Std::vector<Font *> fonts;
 	uint16 num_fonts;
@@ -44,7 +44,7 @@ class FontManager {
 	uint8 *conv_font_widths;
 public:
 
-	FontManager(Configuration *cfg);
+	FontManager(const Configuration *cfg);
 	~FontManager();
 
 	bool init(nuvie_game_t game_type);
diff --git a/engines/ultima/nuvie/gui/gui.cpp b/engines/ultima/nuvie/gui/gui.cpp
index a5e11cf7126..388e669054d 100644
--- a/engines/ultima/nuvie/gui/gui.cpp
+++ b/engines/ultima/nuvie/gui/gui.cpp
@@ -38,7 +38,7 @@ const int GUI::mouseclick_delay = 300; /* SB-X */
 
 GUI *GUI::gui = nullptr;
 
-GUI::GUI(Configuration *c, Screen *s) : config(c), screen(s), numwidgets(0),
+GUI::GUI(const Configuration *c, Screen *s) : config(c), screen(s), numwidgets(0),
 		maxwidgets(0), widgets(nullptr), display(1), running(0), dragging(false),
 		full_redraw(true), focused_widget(nullptr), locked_widget(nullptr),
 		block_input(false) {
@@ -403,7 +403,7 @@ void GUI::lock_input(GUI_Widget *widget) {
 			locked_widget = widget;
 }
 
-Std::string GUI::get_data_dir() {
+Std::string GUI::get_data_dir() const {
 	Std::string datadir;
 
 	config->value("config/datadir", datadir, "");
diff --git a/engines/ultima/nuvie/gui/gui.h b/engines/ultima/nuvie/gui/gui.h
index 849d5ca8fc5..d2af16c2ae9 100644
--- a/engines/ultima/nuvie/gui/gui.h
+++ b/engines/ultima/nuvie/gui/gui.h
@@ -44,7 +44,7 @@ class GUI {
 protected:
 
 	static GUI *gui;
-	Configuration *config;
+	const Configuration *config;
 
 	/* The display surface */
 	Screen *screen;
@@ -83,7 +83,7 @@ protected:
 public:
 	static const int mouseclick_delay; /* SB-X */
 
-	GUI(Configuration *c, Screen *s);
+	GUI(const Configuration *c, Screen *s);
 	~GUI();
 
 	/* Add a widget to the GUI.
@@ -166,12 +166,12 @@ public:
 	void unblock() {
 		block_input = false;
 	}
-	Std::string get_data_dir();
+	Std::string get_data_dir() const ;
 
-	uint16 get_width() {
+	uint16 get_width() const {
 		return screen->get_width();
 	}
-	uint16 get_height() {
+	uint16 get_height() const {
 		return screen->get_height();
 	}
 protected:
diff --git a/engines/ultima/nuvie/gui/widgets/background.cpp b/engines/ultima/nuvie/gui/widgets/background.cpp
index 69cb21c98dc..65f626bba7d 100644
--- a/engines/ultima/nuvie/gui/widgets/background.cpp
+++ b/engines/ultima/nuvie/gui/widgets/background.cpp
@@ -33,7 +33,7 @@
 namespace Ultima {
 namespace Nuvie {
 
-Background::Background(Configuration *cfg) : GUI_Widget(nullptr), config(cfg),
+Background::Background(const Configuration *cfg) : GUI_Widget(nullptr), config(cfg),
 		bg_w(0), bg_h(0), border_width(0), background(nullptr), right_bg_x_off(0),
 		left_bg_x_off(0) {
 	config->value("config/GameType", game_type);
diff --git a/engines/ultima/nuvie/gui/widgets/background.h b/engines/ultima/nuvie/gui/widgets/background.h
index 7ff7757f7f9..3e41d7e5efc 100644
--- a/engines/ultima/nuvie/gui/widgets/background.h
+++ b/engines/ultima/nuvie/gui/widgets/background.h
@@ -31,7 +31,7 @@ class Configuration;
 class U6Shape;
 
 class Background: public GUI_Widget {
-	Configuration *config;
+	const Configuration *config;
 	int game_type;
 
 	U6Shape *background;
@@ -40,7 +40,7 @@ class Background: public GUI_Widget {
 
 public:
 
-	Background(Configuration *cfg);
+	Background(const Configuration *cfg);
 	~Background() override;
 
 	bool init();
diff --git a/engines/ultima/nuvie/gui/widgets/command_bar.cpp b/engines/ultima/nuvie/gui/widgets/command_bar.cpp
index 5701ac295d5..4e2f1b9c1bd 100644
--- a/engines/ultima/nuvie/gui/widgets/command_bar.cpp
+++ b/engines/ultima/nuvie/gui/widgets/command_bar.cpp
@@ -96,7 +96,7 @@ CommandBar::CommandBar(Game *g) : GUI_Widget(nullptr), game(g),
 	uint16 x_off = game->get_game_x_offset();
 	uint16 y_off =  game->get_game_y_offset();
 	bool right_pos_cb = false;
-	Configuration *cfg = nullptr;
+	const Configuration *cfg = nullptr;
 
 	if (!game->is_orig_style()) {
 		cfg = game->get_config();
diff --git a/engines/ultima/nuvie/gui/widgets/console.cpp b/engines/ultima/nuvie/gui/widgets/console.cpp
index 961b024f8d5..4d995ff11c3 100644
--- a/engines/ultima/nuvie/gui/widgets/console.cpp
+++ b/engines/ultima/nuvie/gui/widgets/console.cpp
@@ -30,7 +30,7 @@ namespace Nuvie {
 
 static Console *g_console = nullptr;
 
-Console::Console(Configuration *c, Screen *s, GUI *g, uint16 x, uint16 y, uint16 w, uint16 h)
+Console::Console(const Configuration *c, Screen *s, GUI *g, uint16 x, uint16 y, uint16 w, uint16 h)
 	: GUI_Console(x, y, w, h), config(c), screen(s), gui(g), displayConsole(true) {
 	config->value("config/general/show_console", displayConsole, true);
 
@@ -53,7 +53,7 @@ void Console::AddLine(const Std::string &line) {
 	}
 }
 
-void ConsoleInit(Configuration *c, Screen *s, GUI *gui, uint16 w, uint16 h) {
+void ConsoleInit(const Configuration *c, Screen *s, GUI *gui, uint16 w, uint16 h) {
 	assert(g_console == nullptr);
 
 	//uint16 x_off = config_get_video_x_offset(c);
diff --git a/engines/ultima/nuvie/gui/widgets/console.h b/engines/ultima/nuvie/gui/widgets/console.h
index 49ed919a9c1..e5f8d880755 100644
--- a/engines/ultima/nuvie/gui/widgets/console.h
+++ b/engines/ultima/nuvie/gui/widgets/console.h
@@ -34,12 +34,12 @@ class Console : public GUI_Console {
 protected:
 	GUI *gui;
 	Screen *screen;
-	Configuration *config;
+	const Configuration *config;
 
 	bool displayConsole;
 
 public:
-	Console(Configuration *c, Screen *s, GUI *g, uint16 x, uint16 y, uint16 w, uint16 h);
+	Console(const Configuration *c, Screen *s, GUI *g, uint16 x, uint16 y, uint16 w, uint16 h);
 	~Console() override;
 
 	void AddLine(const Std::string &line) override;
@@ -48,7 +48,7 @@ protected:
 
 };
 
-void ConsoleInit(Configuration *c, Screen *s, GUI *gui, uint16 w, uint16 h);
+void ConsoleInit(const Configuration *c, Screen *s, GUI *gui, uint16 w, uint16 h);
 void ConsoleDelete();
 void ConsoleAddInfo(const char *s, ...);
 void ConsoleAddError(const Std::string &s);
diff --git a/engines/ultima/nuvie/gui/widgets/converse_gump.cpp b/engines/ultima/nuvie/gui/widgets/converse_gump.cpp
index bc858c19f97..7ce4d806f68 100644
--- a/engines/ultima/nuvie/gui/widgets/converse_gump.cpp
+++ b/engines/ultima/nuvie/gui/widgets/converse_gump.cpp
@@ -42,7 +42,7 @@ static const int CURSOR_COLOR = 248;
 
 // ConverseGump Class
 
-ConverseGump::ConverseGump(Configuration *cfg, Font *f, Screen *s) {
+ConverseGump::ConverseGump(const Configuration *cfg, Font *f, Screen *s) {
 // uint16 x, y;
 
 	init(cfg, f);
diff --git a/engines/ultima/nuvie/gui/widgets/converse_gump.h b/engines/ultima/nuvie/gui/widgets/converse_gump.h
index 57a55e44d08..aa6ac39cd30 100644
--- a/engines/ultima/nuvie/gui/widgets/converse_gump.h
+++ b/engines/ultima/nuvie/gui/widgets/converse_gump.h
@@ -64,7 +64,7 @@ class ConverseGump: public MsgScroll {
 
 public:
 
-	ConverseGump(Configuration *cfg, Font *f, Screen *s);
+	ConverseGump(const Configuration *cfg, Font *f, Screen *s);
 	~ConverseGump() override;
 
 	void set_actor_portrait(Actor *a);
diff --git a/engines/ultima/nuvie/gui/widgets/converse_gump_wou.cpp b/engines/ultima/nuvie/gui/widgets/converse_gump_wou.cpp
index 862b9615e1b..fbd764bf0d2 100644
--- a/engines/ultima/nuvie/gui/widgets/converse_gump_wou.cpp
+++ b/engines/ultima/nuvie/gui/widgets/converse_gump_wou.cpp
@@ -48,7 +48,7 @@ namespace Nuvie {
 
 // ConverseGumpWOU Class
 
-ConverseGumpWOU::ConverseGumpWOU(Configuration *cfg, Font *f, Screen *s)
+ConverseGumpWOU::ConverseGumpWOU(const Configuration *cfg, Font *f, Screen *s)
 		: found_break_char(false), frame_h(0), frame_w(0), min_w(0) {
 // uint16 x, y;
 
diff --git a/engines/ultima/nuvie/gui/widgets/converse_gump_wou.h b/engines/ultima/nuvie/gui/widgets/converse_gump_wou.h
index 4a26a645909..4286b3df385 100644
--- a/engines/ultima/nuvie/gui/widgets/converse_gump_wou.h
+++ b/engines/ultima/nuvie/gui/widgets/converse_gump_wou.h
@@ -50,7 +50,7 @@ class ConverseGumpWOU: public MsgScroll {
 	bool found_break_char;
 public:
 
-	ConverseGumpWOU(Configuration *cfg, Font *f, Screen *s);
+	ConverseGumpWOU(const Configuration *cfg, Font *f, Screen *s);
 	~ConverseGumpWOU() override;
 
 	void set_talking(bool state, Actor *actor = nullptr) override;
diff --git a/engines/ultima/nuvie/gui/widgets/map_window.cpp b/engines/ultima/nuvie/gui/widgets/map_window.cpp
index 839abb0541c..058c0fca9a6 100644
--- a/engines/ultima/nuvie/gui/widgets/map_window.cpp
+++ b/engines/ultima/nuvie/gui/widgets/map_window.cpp
@@ -105,7 +105,7 @@ static const Tile grid_tile = {
 	}
 };
 
-MapWindow::MapWindow(Configuration *cfg, Map *m): GUI_Widget(nullptr, 0, 0, 0, 0), config(cfg),
+MapWindow::MapWindow(const Configuration *cfg, Map *m): GUI_Widget(nullptr, 0, 0, 0, 0), config(cfg),
 		map(m), anim_manager(nullptr), cur_x(0), cur_y(0), mousecenter_x(0),
 		mousecenter_y(0), cur_x_add(0), cur_y_add(0), vel_x(0), vel_y(0),
 		last_boundary_fill_x(0), last_boundary_fill_y(0), cursor_x(0), cursor_y(0),
diff --git a/engines/ultima/nuvie/gui/widgets/map_window.h b/engines/ultima/nuvie/gui/widgets/map_window.h
index 98a1314bf71..ae4dceb217d 100644
--- a/engines/ultima/nuvie/gui/widgets/map_window.h
+++ b/engines/ultima/nuvie/gui/widgets/map_window.h
@@ -74,7 +74,7 @@ class MapWindow: public GUI_Widget {
 	friend class AnimManager;
 	friend class ConverseGumpWOU;
 	Game *game;
-	Configuration *config;
+	const Configuration *config;
 	int game_type;
 	bool enable_doubleclick;
 	bool walk_with_left_button;
@@ -151,7 +151,7 @@ class MapWindow: public GUI_Widget {
 
 public:
 
-	MapWindow(Configuration *cfg, Map *m);
+	MapWindow(const Configuration *cfg, Map *m);
 	~MapWindow() override;
 
 	bool init(TileManager *tm, ObjManager *om, ActorManager *am);
diff --git a/engines/ultima/nuvie/gui/widgets/msg_scroll.cpp b/engines/ultima/nuvie/gui/widgets/msg_scroll.cpp
index ed91dae8515..3ffb6804bea 100644
--- a/engines/ultima/nuvie/gui/widgets/msg_scroll.cpp
+++ b/engines/ultima/nuvie/gui/widgets/msg_scroll.cpp
@@ -150,7 +150,7 @@ uint16 MsgLine::get_display_width() {
 
 // MsgScroll Class
 
-void MsgScroll::init(Configuration *cfg, Font *f) {
+void MsgScroll::init(const Configuration *cfg, Font *f) {
 	font = f;
 
 	config = cfg;
@@ -183,7 +183,7 @@ void MsgScroll::init(Configuration *cfg, Font *f) {
 	}
 }
 
-MsgScroll::MsgScroll(Configuration *cfg, Font *f) : GUI_Widget(nullptr, 0, 0, 0, 0),
+MsgScroll::MsgScroll(const Configuration *cfg, Font *f) : GUI_Widget(nullptr, 0, 0, 0, 0),
 		input_mode(false), permit_input(nullptr), just_displayed_prompt(false),
 		permit_inputescape(false), screen_x(0), screen_y(0), keyword_highlight(false) {
 	uint16 x, y;
diff --git a/engines/ultima/nuvie/gui/widgets/msg_scroll.h b/engines/ultima/nuvie/gui/widgets/msg_scroll.h
index 9de59a117b0..1d56fd5b6bb 100644
--- a/engines/ultima/nuvie/gui/widgets/msg_scroll.h
+++ b/engines/ultima/nuvie/gui/widgets/msg_scroll.h
@@ -92,7 +92,7 @@ public:
 
 class MsgScroll: public GUI_Widget, public CallBack {
 protected:
-	Configuration *config;
+	const Configuration *config;
 	int game_type;
 	Font *font;
 	uint8 font_color;
@@ -151,7 +151,7 @@ private:
 
 public:
 
-	MsgScroll(Configuration *cfg, Font *f);
+	MsgScroll(const Configuration *cfg, Font *f);
 	MsgScroll() : GUI_Widget(nullptr, 0, 0, 0, 0),
 		config(nullptr), game_type(0), font(nullptr), scroll_height(0),
 		scroll_width(0), callback_target(nullptr), callback_user_data(nullptr),
@@ -169,7 +169,7 @@ public:
 	}
 	~MsgScroll() override;
 
-	void init(Configuration *cfg, Font *f);
+	void init(const Configuration *cfg, Font *f);
 
 	bool init(const char *player_name);
 	void page_up();
diff --git a/engines/ultima/nuvie/gui/widgets/msg_scroll_new_ui.cpp b/engines/ultima/nuvie/gui/widgets/msg_scroll_new_ui.cpp
index bee7724f0ab..903afcbd412 100644
--- a/engines/ultima/nuvie/gui/widgets/msg_scroll_new_ui.cpp
+++ b/engines/ultima/nuvie/gui/widgets/msg_scroll_new_ui.cpp
@@ -40,7 +40,7 @@ namespace Nuvie {
 
 // MsgScrollNewUI Class
 
-MsgScrollNewUI::MsgScrollNewUI(Configuration *cfg, Screen *s) {
+MsgScrollNewUI::MsgScrollNewUI(const Configuration *cfg, Screen *s) {
 	drop_target = false; //we don't participate in drag and drop.
 
 	font_normal = Game::get_game()->get_font_manager()->get_conv_font();
diff --git a/engines/ultima/nuvie/gui/widgets/msg_scroll_new_ui.h b/engines/ultima/nuvie/gui/widgets/msg_scroll_new_ui.h
index 1722495242f..0930ab7a754 100644
--- a/engines/ultima/nuvie/gui/widgets/msg_scroll_new_ui.h
+++ b/engines/ultima/nuvie/gui/widgets/msg_scroll_new_ui.h
@@ -60,7 +60,7 @@ class MsgScrollNewUI: public MsgScroll {
 
 public:
 
-	MsgScrollNewUI(Configuration *cfg, Screen *s);
+	MsgScrollNewUI(const Configuration *cfg, Screen *s);
 	~MsgScrollNewUI() override;
 
 	GUI_status callback(uint16 msg, GUI_CallBack *caller, void *data) override {
diff --git a/engines/ultima/nuvie/keybinding/keys.cpp b/engines/ultima/nuvie/keybinding/keys.cpp
index 593a3718688..31767a4765d 100644
--- a/engines/ultima/nuvie/keybinding/keys.cpp
+++ b/engines/ultima/nuvie/keybinding/keys.cpp
@@ -254,7 +254,7 @@ const KeycodeString StringTable[] = {
 
 const Action doNothingAction = { "DO_NOTHING", ActionDoNothing, "", Action::dont_show, true, OTHER_KEY };
 
-KeyBinder::KeyBinder(Configuration *config) : enable_joystick(false) {
+KeyBinder::KeyBinder(const Configuration *config) : enable_joystick(false) {
 	FillParseMaps();
 
 	Std::string keyfilename, dir;
diff --git a/engines/ultima/nuvie/keybinding/keys.h b/engines/ultima/nuvie/keybinding/keys.h
index 37744af8438..73d57719bdc 100644
--- a/engines/ultima/nuvie/keybinding/keys.h
+++ b/engines/ultima/nuvie/keybinding/keys.h
@@ -77,7 +77,7 @@ private:
 
 	void LoadFromFileInternal(const char *filename);
 public:
-	KeyBinder(Configuration *config);
+	KeyBinder(const Configuration *config);
 	~KeyBinder();
 	/* Add keybinding */
 	void AddKeyBinding(Common::KeyCode sym, byte mod, const Action *action,
diff --git a/engines/ultima/nuvie/misc/u6_misc.cpp b/engines/ultima/nuvie/misc/u6_misc.cpp
index e5bd289883f..ed3ecf672a3 100644
--- a/engines/ultima/nuvie/misc/u6_misc.cpp
+++ b/engines/ultima/nuvie/misc/u6_misc.cpp
@@ -49,7 +49,7 @@ void Tokenise(const Std::string &str, Std::vector<Std::string> &tokens, char del
 	}
 }
 
-Std::string config_get_game_key(Configuration *config) {
+Std::string config_get_game_key(const Configuration *config) {
 	Std::string game_key, game_name;
 
 	config->value("config/GameName", game_name);
@@ -73,7 +73,7 @@ const char *get_game_tag(int game_type) {
 	return "";
 }
 
-void config_get_path(Configuration *config, const Std::string &filename, Std::string &path) {
+void config_get_path(const Configuration *config, const Std::string &filename, Std::string &path) {
 	Std::string key, game_name, game_dir, tmp_path;
 
 	config->value("config/GameName", game_name);
@@ -152,7 +152,7 @@ uint8 get_game_type(const char *string) {
 	return NUVIE_GAME_NONE;
 }
 
-nuvie_game_t get_game_type(Configuration *config) {
+nuvie_game_t get_game_type(const Configuration *config) {
 	int game_type;
 	config->value("config/GameType", game_type);
 
@@ -170,7 +170,7 @@ void build_path(const Std::string &path, const Std::string &filename, Std::strin
 	return;
 }
 
-bool has_fmtowns_support(Configuration *config) {
+bool has_fmtowns_support(const Configuration *config) {
 	Std::string townsdir;
 	config->value("config/townsdir", townsdir, "");
 	if (townsdir != "" && directory_exists(townsdir.c_str()))
diff --git a/engines/ultima/nuvie/misc/u6_misc.h b/engines/ultima/nuvie/misc/u6_misc.h
index 16c07a20f61..1c59c5d7a46 100644
--- a/engines/ultima/nuvie/misc/u6_misc.h
+++ b/engines/ultima/nuvie/misc/u6_misc.h
@@ -46,11 +46,11 @@ typedef enum {
 	FORCE_MOVE
 } MovementStatus;
 
-Std::string config_get_game_key(Configuration *config);
+Std::string config_get_game_key(const Configuration *config);
 const char *get_game_tag(int game_type);
-void config_get_path(Configuration *config, const Std::string &filename, Std::string &path);
+void config_get_path(const Configuration *config, const Std::string &filename, Std::string &path);
 uint8 get_game_type(const char *string);
-nuvie_game_t get_game_type(Configuration *config);
+nuvie_game_t get_game_type(const Configuration *config);
 void build_path(const Std::string &path, const Std::string &filename, Std::string &full_path);
 bool directory_exists(const char *directory);
 bool file_exists(const char *path);
@@ -69,12 +69,6 @@ const char *get_direction_name(NuvieDir dir);
 const char *get_direction_name(sint16 rel_x, sint16 rel_y);
 int str_bsearch(const char *str[], int max, const char *value);
 void stringToLower(Std::string &str);
-/* Is point x,y within rect?
- */
-inline bool point_in_rect(uint16 x, uint16 y, Common::Rect *rect) {
-	return rect->contains(x, y);
-}
-
 
 /* Does line xy->x2y2 cross rect, to any extent?
  */
@@ -111,7 +105,7 @@ void scale_rect_8bit(const unsigned char *Source, unsigned char *Target, int Src
 
 bool has_file_extension(const char *filename, const char *extension);
 
-bool has_fmtowns_support(Configuration *config);
+bool has_fmtowns_support(const Configuration *config);
 
 uint16 wrap_signed_coord(sint16 coord, uint8 level);
 sint8 get_wrapped_rel_dir(sint16 p1, sint16 p2, uint8 level);
diff --git a/engines/ultima/nuvie/portraits/portrait.cpp b/engines/ultima/nuvie/portraits/portrait.cpp
index f2a82f0986d..a2be74e6bb8 100644
--- a/engines/ultima/nuvie/portraits/portrait.cpp
+++ b/engines/ultima/nuvie/portraits/portrait.cpp
@@ -45,7 +45,7 @@
 namespace Ultima {
 namespace Nuvie {
 
-Portrait *newPortrait(nuvie_game_t gametype, Configuration *cfg) {
+Portrait *newPortrait(nuvie_game_t gametype, const Configuration *cfg) {
 	// Correct portrait class for each game
 	switch (gametype) {
 	case NUVIE_GAME_U6 :
@@ -62,7 +62,7 @@ Portrait *newPortrait(nuvie_game_t gametype, Configuration *cfg) {
 }
 
 
-Portrait::Portrait(Configuration *cfg) : config(cfg), avatar_portrait_num(0), width(0), height(0) {
+Portrait::Portrait(const Configuration *cfg) : config(cfg), avatar_portrait_num(0), width(0), height(0) {
 }
 
 uint8 Portrait::get_avatar_portrait_num() const {
diff --git a/engines/ultima/nuvie/portraits/portrait.h b/engines/ultima/nuvie/portraits/portrait.h
index 091f18443cd..2284a4f6ccf 100644
--- a/engines/ultima/nuvie/portraits/portrait.h
+++ b/engines/ultima/nuvie/portraits/portrait.h
@@ -35,18 +35,18 @@ class NuvieIO;
 
 #define NO_PORTRAIT_FOUND 255
 
-Portrait *newPortrait(nuvie_game_t gametype, Configuration *cfg);
+Portrait *newPortrait(nuvie_game_t gametype, const Configuration *cfg);
 
 class Portrait {
 protected:
-	Configuration *config;
+	const Configuration *config;
 
 	uint8 avatar_portrait_num;
 	uint8 width;
 	uint8 height;
 public:
 
-	Portrait(Configuration *cfg);
+	Portrait(const Configuration *cfg);
 	virtual ~Portrait() {};
 
 	virtual bool init() = 0;
diff --git a/engines/ultima/nuvie/portraits/portrait_md.h b/engines/ultima/nuvie/portraits/portrait_md.h
index 30ae901f396..bba8f013c50 100644
--- a/engines/ultima/nuvie/portraits/portrait_md.h
+++ b/engines/ultima/nuvie/portraits/portrait_md.h
@@ -36,7 +36,7 @@ class PortraitMD : public Portrait {
 	U6Lib_n faces;
 
 public:
-	PortraitMD(Configuration *cfg): Portrait(cfg) {};
+	PortraitMD(const Configuration *cfg): Portrait(cfg) {};
 
 	bool init() override;
 	bool load(NuvieIO *objlist) override;
diff --git a/engines/ultima/nuvie/portraits/portrait_se.h b/engines/ultima/nuvie/portraits/portrait_se.h
index cfdf0ca4de4..fc260512491 100644
--- a/engines/ultima/nuvie/portraits/portrait_se.h
+++ b/engines/ultima/nuvie/portraits/portrait_se.h
@@ -35,7 +35,7 @@ class PortraitSE : public Portrait {
 	U6Lib_n faces;
 
 public:
-	PortraitSE(Configuration *cfg): Portrait(cfg) {};
+	PortraitSE(const Configuration *cfg): Portrait(cfg) {};
 
 	bool init() override;
 	bool load(NuvieIO *objlist) override;
diff --git a/engines/ultima/nuvie/portraits/portrait_u6.h b/engines/ultima/nuvie/portraits/portrait_u6.h
index ac71601272e..5804875b764 100644
--- a/engines/ultima/nuvie/portraits/portrait_u6.h
+++ b/engines/ultima/nuvie/portraits/portrait_u6.h
@@ -39,7 +39,7 @@ class PortraitU6 : public Portrait {
 
 public:
 
-	PortraitU6(Configuration *cfg) : Portrait(cfg) {};
+	PortraitU6(const Configuration *cfg) : Portrait(cfg) {};
 	~PortraitU6() override {};
 
 	bool init() override;
diff --git a/engines/ultima/nuvie/screen/dither.cpp b/engines/ultima/nuvie/screen/dither.cpp
index f9b34c54be5..136356d31f9 100644
--- a/engines/ultima/nuvie/screen/dither.cpp
+++ b/engines/ultima/nuvie/screen/dither.cpp
@@ -32,7 +32,7 @@ namespace Nuvie {
 static const uint8 dither_cga_tbl[0x10] =   {0, 3, 3, 3, 13, 13, 13, 3, 3, 13, 15, 3, 13, 13, 15, 15};
 //static const uint8 dither_cga_tbl[0x10] = {0,1,1,1,2 ,2 ,2 ,1,1,2 ,3 ,1,2 ,2 ,3, 3};
 
-Dither::Dither(Configuration *cfg) : config(cfg), dither(nullptr), mode(DITHER_NONE) {
+Dither::Dither(const Configuration *cfg) : config(cfg), dither(nullptr), mode(DITHER_NONE) {
 	set_mode();
 
 	if (mode != DITHER_NONE)
diff --git a/engines/ultima/nuvie/screen/dither.h b/engines/ultima/nuvie/screen/dither.h
index 415c082156d..4b77f2925a5 100644
--- a/engines/ultima/nuvie/screen/dither.h
+++ b/engines/ultima/nuvie/screen/dither.h
@@ -39,13 +39,13 @@ enum DitherMode {
 };
 
 class Dither {
-	Configuration *config;
+	const Configuration *config;
 	uint8 *dither;
 	DitherMode mode;
 
 public:
 
-	Dither(Configuration *cfg);
+	Dither(const Configuration *cfg);
 	~Dither();
 	uint8 get_mode() const {
 		return mode;
diff --git a/engines/ultima/nuvie/screen/game_palette.cpp b/engines/ultima/nuvie/screen/game_palette.cpp
index 200db6dfcb8..5c8c6231c5c 100644
--- a/engines/ultima/nuvie/screen/game_palette.cpp
+++ b/engines/ultima/nuvie/screen/game_palette.cpp
@@ -30,7 +30,7 @@
 namespace Ultima {
 namespace Nuvie {
 
-GamePalette::GamePalette(Screen *s, Configuration *cfg) : screen(s), config(cfg), counter(0) {
+GamePalette::GamePalette(Screen *s, const Configuration *cfg) : screen(s), config(cfg), counter(0) {
 	palette = (uint8 *)malloc(768);
 	memset(palette, 0, 768);
 
diff --git a/engines/ultima/nuvie/screen/game_palette.h b/engines/ultima/nuvie/screen/game_palette.h
index ab168934d45..4f1b647eacf 100644
--- a/engines/ultima/nuvie/screen/game_palette.h
+++ b/engines/ultima/nuvie/screen/game_palette.h
@@ -32,13 +32,13 @@ class Configuration;
 class GamePalette {
 	uint8 *palette;
 	Screen *screen;
-	Configuration *config;
+	const Configuration *config;
 	uint8 counter;
 	uint8 bg_color;
 
 public:
 
-	GamePalette(Screen *s, Configuration *cfg);
+	GamePalette(Screen *s, const Configuration *cfg);
 	~GamePalette();
 	void rotatePalette();
 	uint8 get_bg_color() const {
diff --git a/engines/ultima/nuvie/screen/screen.cpp b/engines/ultima/nuvie/screen/screen.cpp
index d931f425914..698a221b4ac 100644
--- a/engines/ultima/nuvie/screen/screen.cpp
+++ b/engines/ultima/nuvie/screen/screen.cpp
@@ -41,7 +41,7 @@ static const int SHADING_BORDER = 2; // should be the same as MapWindow's TMP_MA
 static const sint32 globeradius[]   = { 36, 112, 148, 192, 448 };
 static const sint32 globeradius_2[] = { 18, 56, 74, 96, 224 };
 
-Screen::Screen(Configuration *cfg) : config(cfg), _rawSurface(nullptr),
+Screen::Screen(const Configuration *cfg) : config(cfg), _rawSurface(nullptr),
 		_renderSurface(nullptr), scaler(nullptr), shading_data(nullptr),
 		scaler_index(0), scale_factor(2), doubleBuffer(false),
 		is_no_darkness(false), non_square_pixels(false), shading_ambient(255),
diff --git a/engines/ultima/nuvie/screen/screen.h b/engines/ultima/nuvie/screen/screen.h
index f0983133243..fd5577f8591 100644
--- a/engines/ultima/nuvie/screen/screen.h
+++ b/engines/ultima/nuvie/screen/screen.h
@@ -39,7 +39,7 @@ class Configuration;
 
 class Screen {
 private:
-	Configuration *config;
+	const Configuration *config;
 	Graphics::Screen *_rawSurface;
 	RenderSurface *_renderSurface;
 	ScalerRegistry     scaler_reg;     // Scaler Registry
@@ -61,7 +61,7 @@ private:
 	uint8 *shading_tile[4];
 
 public:
-	Screen(Configuration *cfg);
+	Screen(const Configuration *cfg);
 	~Screen();
 
 	bool init();
diff --git a/engines/ultima/nuvie/sound/adlib_sfx_manager.cpp b/engines/ultima/nuvie/sound/adlib_sfx_manager.cpp
index bd33334a661..0a8dd8207dc 100644
--- a/engines/ultima/nuvie/sound/adlib_sfx_manager.cpp
+++ b/engines/ultima/nuvie/sound/adlib_sfx_manager.cpp
@@ -28,7 +28,7 @@
 namespace Ultima {
 namespace Nuvie {
 
-AdLibSfxManager::AdLibSfxManager(Configuration *cfg, Audio::Mixer *m) : SfxManager(cfg, m) {
+AdLibSfxManager::AdLibSfxManager(const Configuration *cfg, Audio::Mixer *m) : SfxManager(cfg, m) {
 
 }
 
diff --git a/engines/ultima/nuvie/sound/adlib_sfx_manager.h b/engines/ultima/nuvie/sound/adlib_sfx_manager.h
index 3673110c9f9..bf189d4da89 100644
--- a/engines/ultima/nuvie/sound/adlib_sfx_manager.h
+++ b/engines/ultima/nuvie/sound/adlib_sfx_manager.h
@@ -33,7 +33,7 @@ namespace Nuvie {
 
 class AdLibSfxManager : public SfxManager {
 public:
-	AdLibSfxManager(Configuration *cfg, Audio::Mixer *m);
+	AdLibSfxManager(const Configuration *cfg, Audio::Mixer *m);
 	~AdLibSfxManager() override;
 
 	bool playSfx(SfxIdType sfx_id, uint8 volume) override;
diff --git a/engines/ultima/nuvie/sound/custom_sfx_manager.cpp b/engines/ultima/nuvie/sound/custom_sfx_manager.cpp
index bcda26599d8..e13a51ddafb 100644
--- a/engines/ultima/nuvie/sound/custom_sfx_manager.cpp
+++ b/engines/ultima/nuvie/sound/custom_sfx_manager.cpp
@@ -31,7 +31,7 @@
 namespace Ultima {
 namespace Nuvie {
 
-CustomSfxManager::CustomSfxManager(Configuration *cfg, Audio::Mixer *m) : SfxManager(cfg, m) {
+CustomSfxManager::CustomSfxManager(const Configuration *cfg, Audio::Mixer *m) : SfxManager(cfg, m) {
 	Std::string cfg_filename;
 
 	sfx_map = new Common::HashMap<uint16, uint16>();
diff --git a/engines/ultima/nuvie/sound/custom_sfx_manager.h b/engines/ultima/nuvie/sound/custom_sfx_manager.h
index 6abd0c3c6be..9be0d0c3a00 100644
--- a/engines/ultima/nuvie/sound/custom_sfx_manager.h
+++ b/engines/ultima/nuvie/sound/custom_sfx_manager.h
@@ -34,7 +34,7 @@ namespace Nuvie {
 
 class CustomSfxManager : public SfxManager {
 public:
-	CustomSfxManager(Configuration *cfg, Audio::Mixer *m);
+	CustomSfxManager(const Configuration *cfg, Audio::Mixer *m);
 	~CustomSfxManager() override;
 
 	bool playSfx(SfxIdType sfx_id, uint8 volume) override;
diff --git a/engines/ultima/nuvie/sound/decoder/adlib_sfx_stream.cpp b/engines/ultima/nuvie/sound/decoder/adlib_sfx_stream.cpp
index a47441614e1..9f063af7194 100644
--- a/engines/ultima/nuvie/sound/decoder/adlib_sfx_stream.cpp
+++ b/engines/ultima/nuvie/sound/decoder/adlib_sfx_stream.cpp
@@ -26,7 +26,7 @@
 namespace Ultima {
 namespace Nuvie {
 
-AdLibSfxStream::AdLibSfxStream(Configuration *cfg, int rate, uint8 channel, sint8 note, uint8 velocity, uint8 program_number, uint32 d) {
+AdLibSfxStream::AdLibSfxStream(const Configuration *cfg, int rate, uint8 channel, sint8 note, uint8 velocity, uint8 program_number, uint32 d) {
 	interrupt_samples_left = 0;
 	opl = new OplClass(rate, true, true); // 16bit stereo
 	driver = new OriginFXAdLibDriver(cfg, opl);
diff --git a/engines/ultima/nuvie/sound/decoder/adlib_sfx_stream.h b/engines/ultima/nuvie/sound/decoder/adlib_sfx_stream.h
index 14f6a4ef151..75086eb42e3 100644
--- a/engines/ultima/nuvie/sound/decoder/adlib_sfx_stream.h
+++ b/engines/ultima/nuvie/sound/decoder/adlib_sfx_stream.h
@@ -42,7 +42,7 @@ public:
 		duration = 0;
 	}
 
-	AdLibSfxStream(Configuration *cfg, int rate, uint8 channel, sint8 note, uint8 velocity, uint8 program_number, uint32 d);
+	AdLibSfxStream(const Configuration *cfg, int rate, uint8 channel, sint8 note, uint8 velocity, uint8 program_number, uint32 d);
 	~AdLibSfxStream() override;
 
 	int readBuffer(sint16 *buffer, const int numSamples) override;
diff --git a/engines/ultima/nuvie/sound/origin_fx_adib_driver.cpp b/engines/ultima/nuvie/sound/origin_fx_adib_driver.cpp
index f87760296eb..f633f9f6e24 100644
--- a/engines/ultima/nuvie/sound/origin_fx_adib_driver.cpp
+++ b/engines/ultima/nuvie/sound/origin_fx_adib_driver.cpp
@@ -32,7 +32,7 @@ namespace Nuvie {
 const uint8 adlib_BD_cmd_tbl[] = { 0, 1, 0, 1, 0, 1, 16, 8, 4, 2, 1 };
 
 
-OriginFXAdLibDriver::OriginFXAdLibDriver(Configuration *cfg, Copl *newopl) {
+OriginFXAdLibDriver::OriginFXAdLibDriver(const Configuration *cfg, Copl *newopl) {
 
 	const uint8 byte_73_init[] = {1, 2, 3, 4, 5, 6, 7, 8, 0xB, 0xFF, 0xFF, 0, 0xC};
 
diff --git a/engines/ultima/nuvie/sound/origin_fx_adib_driver.h b/engines/ultima/nuvie/sound/origin_fx_adib_driver.h
index e3305e91df7..431564d7039 100644
--- a/engines/ultima/nuvie/sound/origin_fx_adib_driver.h
+++ b/engines/ultima/nuvie/sound/origin_fx_adib_driver.h
@@ -33,12 +33,12 @@ class Configuration;
 
 class OriginFXAdLibDriver {
 public:
-	OriginFXAdLibDriver(Configuration *cfg, Copl *newopl);
+	OriginFXAdLibDriver(const Configuration *cfg, Copl *newopl);
 	~OriginFXAdLibDriver();
 
 private:
 
-	Configuration *config;
+	const Configuration *config;
 	Copl *opl;
 
 	unsigned char num_tim_records;
diff --git a/engines/ultima/nuvie/sound/pc_speaker_sfx_manager.cpp b/engines/ultima/nuvie/sound/pc_speaker_sfx_manager.cpp
index 7ce6c1dfdbe..3a7d7fd8a83 100644
--- a/engines/ultima/nuvie/sound/pc_speaker_sfx_manager.cpp
+++ b/engines/ultima/nuvie/sound/pc_speaker_sfx_manager.cpp
@@ -30,7 +30,7 @@
 namespace Ultima {
 namespace Nuvie {
 
-PCSpeakerSfxManager::PCSpeakerSfxManager(Configuration *cfg, Audio::Mixer *m) : SfxManager(cfg, m) {
+PCSpeakerSfxManager::PCSpeakerSfxManager(const Configuration *cfg, Audio::Mixer *m) : SfxManager(cfg, m) {
 
 }
 
diff --git a/engines/ultima/nuvie/sound/pc_speaker_sfx_manager.h b/engines/ultima/nuvie/sound/pc_speaker_sfx_manager.h
index 314b27c49ac..1b8ed866509 100644
--- a/engines/ultima/nuvie/sound/pc_speaker_sfx_manager.h
+++ b/engines/ultima/nuvie/sound/pc_speaker_sfx_manager.h
@@ -33,7 +33,7 @@ namespace Nuvie {
 
 class PCSpeakerSfxManager : public SfxManager {
 public:
-	PCSpeakerSfxManager(Configuration *cfg, Audio::Mixer *m);
+	PCSpeakerSfxManager(const Configuration *cfg, Audio::Mixer *m);
 	~PCSpeakerSfxManager() override;
 
 	bool playSfx(SfxIdType sfx_id, uint8 volume) override;
diff --git a/engines/ultima/nuvie/sound/sfx_manager.h b/engines/ultima/nuvie/sound/sfx_manager.h
index 48b6f809a7b..548350a4e10 100644
--- a/engines/ultima/nuvie/sound/sfx_manager.h
+++ b/engines/ultima/nuvie/sound/sfx_manager.h
@@ -32,7 +32,7 @@ namespace Nuvie {
 
 class SfxManager {
 public:
-	SfxManager(Configuration *cfg, Audio::Mixer *m) : config(cfg), mixer(m) {
+	SfxManager(const Configuration *cfg, Audio::Mixer *m) : config(cfg), mixer(m) {
 		sfx_duration = 0;
 	};
 	virtual ~SfxManager() {};
@@ -46,7 +46,7 @@ public:
 	}
 
 protected:
-	Configuration *config;
+	const Configuration *config;
 	Audio::Mixer *mixer;
 	uint32 sfx_duration; //duration of the last sfx played in milliseconds.
 };
diff --git a/engines/ultima/nuvie/sound/sound_manager.cpp b/engines/ultima/nuvie/sound/sound_manager.cpp
index 83ae7ea6362..5d86c0fc01c 100644
--- a/engines/ultima/nuvie/sound/sound_manager.cpp
+++ b/engines/ultima/nuvie/sound/sound_manager.cpp
@@ -134,7 +134,7 @@ SoundManager::~SoundManager() {
 	delete m_SfxManager;
 }
 
-bool SoundManager::nuvieStartup(Configuration *config) {
+bool SoundManager::nuvieStartup(const Configuration *config) {
 	Std::string config_key;
 	Std::string music_style;
 	Std::string music_cfg_file; //full path and filename to music.cfg
diff --git a/engines/ultima/nuvie/sound/sound_manager.h b/engines/ultima/nuvie/sound/sound_manager.h
index 8a6bf04a1d4..8cc4fa41d67 100644
--- a/engines/ultima/nuvie/sound/sound_manager.h
+++ b/engines/ultima/nuvie/sound/sound_manager.h
@@ -73,7 +73,7 @@ public:
 	SoundManager(Audio::Mixer *mixer);
 	~SoundManager();
 
-	bool nuvieStartup(Configuration *config);
+	bool nuvieStartup(const Configuration *config);
 	bool initAudio();
 	void update_map_sfx(); //updates the active sounds
 	void update(); // at the moment this just changes songs if required
@@ -156,7 +156,7 @@ private:
 	StringCollectionMap m_MusicMap;
 	list<Sound *> m_Songs;
 	list<Sound *> m_Samples;
-	Configuration *m_Config;
+	const Configuration *m_Config;
 
 	//state info:
 	string m_CurrentGroup;
diff --git a/engines/ultima/nuvie/sound/towns_sfx_manager.cpp b/engines/ultima/nuvie/sound/towns_sfx_manager.cpp
index ac3d05051a2..36b15cd7c6b 100644
--- a/engines/ultima/nuvie/sound/towns_sfx_manager.cpp
+++ b/engines/ultima/nuvie/sound/towns_sfx_manager.cpp
@@ -59,7 +59,7 @@ static const TownsSfxLookup sfx_lookup_tbl[] = {
 	{NUVIE_SFX_ATTACK_SWING, 2}
 };
 
-TownsSfxManager::TownsSfxManager(Configuration *cfg, Audio::Mixer *m) : SfxManager(cfg, m),
+TownsSfxManager::TownsSfxManager(const Configuration *cfg, Audio::Mixer *m) : SfxManager(cfg, m),
 		fireStream(nullptr) {
 	config->pathFromValue("config/townsdir", "sounds2.dat", sounds2dat_filepath);
 	loadSound1Dat();
diff --git a/engines/ultima/nuvie/sound/towns_sfx_manager.h b/engines/ultima/nuvie/sound/towns_sfx_manager.h
index 7d30d348677..dd3b09b43fc 100644
--- a/engines/ultima/nuvie/sound/towns_sfx_manager.h
+++ b/engines/ultima/nuvie/sound/towns_sfx_manager.h
@@ -41,7 +41,7 @@ typedef struct {
 
 class TownsSfxManager : public SfxManager {
 public:
-	TownsSfxManager(Configuration *cfg, Audio::Mixer *m);
+	TownsSfxManager(const Configuration *cfg, Audio::Mixer *m);
 	~TownsSfxManager() override;
 
 	bool playSfx(SfxIdType sfx_id, uint8 volume) override;
diff --git a/engines/ultima/nuvie/usecode/u6_usecode.cpp b/engines/ultima/nuvie/usecode/u6_usecode.cpp
index e309fe66cde..b393b211180 100644
--- a/engines/ultima/nuvie/usecode/u6_usecode.cpp
+++ b/engines/ultima/nuvie/usecode/u6_usecode.cpp
@@ -194,7 +194,7 @@ static const char *u6_potions[8] = {
 	}
 
 
-U6UseCode::U6UseCode(Game *g, Configuration *cfg) : UseCode(g, cfg) {
+U6UseCode::U6UseCode(Game *g, const Configuration *cfg) : UseCode(g, cfg) {
 }
 
 U6UseCode::~U6UseCode() {
diff --git a/engines/ultima/nuvie/usecode/u6_usecode.h b/engines/ultima/nuvie/usecode/u6_usecode.h
index 18fdac5ba75..d2b91cca392 100644
--- a/engines/ultima/nuvie/usecode/u6_usecode.h
+++ b/engines/ultima/nuvie/usecode/u6_usecode.h
@@ -67,7 +67,7 @@ typedef enum {
 class U6UseCode: public UseCode, public CallBack {
 public:
 
-	U6UseCode(Game *g, Configuration *cfg);
+	U6UseCode(Game *g, const Configuration *cfg);
 	~U6UseCode() override;
 
 	bool use_obj(Obj *obj, Actor *actor) override;
diff --git a/engines/ultima/nuvie/usecode/usecode.cpp b/engines/ultima/nuvie/usecode/usecode.cpp
index e4c781e2e78..55be00151ce 100644
--- a/engines/ultima/nuvie/usecode/usecode.cpp
+++ b/engines/ultima/nuvie/usecode/usecode.cpp
@@ -32,7 +32,7 @@
 namespace Ultima {
 namespace Nuvie {
 
-UseCode::UseCode(Game *g, Configuration *cfg) : game(g), config(cfg),
+UseCode::UseCode(Game *g, const Configuration *cfg) : game(g), config(cfg),
 		obj_manager(nullptr), map(nullptr), player(nullptr), scroll(nullptr),
 		actor_manager(nullptr), party(nullptr), script(nullptr), script_thread(nullptr) {
 	clear_items();
diff --git a/engines/ultima/nuvie/usecode/usecode.h b/engines/ultima/nuvie/usecode/usecode.h
index 133b1110b7d..0acea26d6da 100644
--- a/engines/ultima/nuvie/usecode/usecode.h
+++ b/engines/ultima/nuvie/usecode/usecode.h
@@ -154,7 +154,7 @@ private:
 
 protected:
 	Game *game;
-	Configuration *config;
+	const Configuration *config;
 	ObjManager *obj_manager;
 	Map *map;
 	Player *player;
@@ -179,7 +179,7 @@ protected:
 
 public:
 
-	UseCode(Game *g, Configuration *cfg);
+	UseCode(Game *g, const Configuration *cfg);
 	virtual ~UseCode();
 
 	virtual bool init(ObjManager *om, Map *m, Player *p, MsgScroll *ms);
diff --git a/engines/ultima/nuvie/views/actor_view.cpp b/engines/ultima/nuvie/views/actor_view.cpp
index a2c7e5bb291..de37680c2e5 100644
--- a/engines/ultima/nuvie/views/actor_view.cpp
+++ b/engines/ultima/nuvie/views/actor_view.cpp
@@ -41,7 +41,7 @@ extern GUI_status partyViewButtonCallback(void *data);
 #define MD Game::get_game()->get_game_type()==NUVIE_GAME_MD
 
 
-ActorView::ActorView(Configuration *cfg) : View(cfg), portrait(nullptr),
+ActorView::ActorView(const Configuration *cfg) : View(cfg), portrait(nullptr),
 		portrait_data(nullptr), in_party(false), cursor_tile(nullptr),
 		show_cursor(false) {
 	cursor_pos.x = 2;
diff --git a/engines/ultima/nuvie/views/actor_view.h b/engines/ultima/nuvie/views/actor_view.h
index b3c67c3bf5d..135705bccc5 100644
--- a/engines/ultima/nuvie/views/actor_view.h
+++ b/engines/ultima/nuvie/views/actor_view.h
@@ -48,7 +48,7 @@ class ActorView : public View {
 	bool show_cursor;
 
 public:
-	ActorView(Configuration *cfg);
+	ActorView(const Configuration *cfg);
 	~ActorView() override;
 
 	bool init(Screen *tmp_screen, void *view_manager, uint16 x, uint16 y, Font *f, Party *p, TileManager *tm, ObjManager *om, Portrait *port);
diff --git a/engines/ultima/nuvie/views/container_view_gump.cpp b/engines/ultima/nuvie/views/container_view_gump.cpp
index aeec2bfa198..70c08160b66 100644
--- a/engines/ultima/nuvie/views/container_view_gump.cpp
+++ b/engines/ultima/nuvie/views/container_view_gump.cpp
@@ -40,7 +40,7 @@ namespace Nuvie {
 static const int CONTAINER_WIDGET_OFFSET = 29;
 #define CHECK_X 0
 
-ContainerViewGump::ContainerViewGump(Configuration *cfg) : DraggableView(cfg),
+ContainerViewGump::ContainerViewGump(const Configuration *cfg) : DraggableView(cfg),
 		gump_button(nullptr), up_arrow_button(nullptr), down_arrow_button(nullptr),
 		doll_button(nullptr), left_arrow_button(nullptr),
 		right_arrow_button(nullptr), container_widget(nullptr), font(nullptr),
diff --git a/engines/ultima/nuvie/views/container_view_gump.h b/engines/ultima/nuvie/views/container_view_gump.h
index 250929e8b64..41c51b62c31 100644
--- a/engines/ultima/nuvie/views/container_view_gump.h
+++ b/engines/ultima/nuvie/views/container_view_gump.h
@@ -55,7 +55,7 @@ class ContainerViewGump : public DraggableView {
 	Obj *container_obj;
 
 public:
-	ContainerViewGump(Configuration *cfg);
+	ContainerViewGump(const Configuration *cfg);
 	~ContainerViewGump() override;
 
 	bool init(Screen *tmp_screen, void *view_manager, uint16 x, uint16 y, Font *f, Party *p, TileManager *tm, ObjManager *om, Obj *container_obj_type);
diff --git a/engines/ultima/nuvie/views/container_widget.cpp b/engines/ultima/nuvie/views/container_widget.cpp
index ae93c907923..8c84a5de5b8 100644
--- a/engines/ultima/nuvie/views/container_widget.cpp
+++ b/engines/ultima/nuvie/views/container_widget.cpp
@@ -41,7 +41,7 @@
 namespace Ultima {
 namespace Nuvie {
 
-ContainerWidget::ContainerWidget(Configuration *cfg, GUI_CallBack *callback)
+ContainerWidget::ContainerWidget(const Configuration *cfg, GUI_CallBack *callback)
 		: GUI_Widget(nullptr, 0, 0, 0, 0), config(cfg), callback_object(callback),
 		container_obj(nullptr), tile_manager(nullptr), obj_manager(nullptr),
 		selected_obj(nullptr), target_cont(nullptr), actor(nullptr),
diff --git a/engines/ultima/nuvie/views/container_widget.h b/engines/ultima/nuvie/views/container_widget.h
index 52ce99dd7ae..3cc51823d85 100644
--- a/engines/ultima/nuvie/views/container_widget.h
+++ b/engines/ultima/nuvie/views/container_widget.h
@@ -40,7 +40,7 @@ class Font;
 class ContainerWidget : public GUI_Widget {
 
 protected:
-	Configuration *config;
+	const Configuration *config;
 
 	int game_type;
 
@@ -63,7 +63,7 @@ protected:
 	const Tile *empty_tile;
 
 public:
-	ContainerWidget(Configuration *cfg, GUI_CallBack *callback = nullptr);
+	ContainerWidget(const Configuration *cfg, GUI_CallBack *callback = nullptr);
 	~ContainerWidget() override;
 
 	bool init(Actor *a, uint16 x, uint16 y, TileManager *tm, ObjManager *om, Font *f);
diff --git a/engines/ultima/nuvie/views/container_widget_gump.cpp b/engines/ultima/nuvie/views/container_widget_gump.cpp
index 13392e1d48b..bc1d216cb01 100644
--- a/engines/ultima/nuvie/views/container_widget_gump.cpp
+++ b/engines/ultima/nuvie/views/container_widget_gump.cpp
@@ -68,7 +68,7 @@ static const Tile gump_empty_tile = {
 };
 
 
-ContainerWidgetGump::ContainerWidgetGump(Configuration *cfg, GUI_CallBack *callback)
+ContainerWidgetGump::ContainerWidgetGump(const Configuration *cfg, GUI_CallBack *callback)
 		: ContainerWidget(cfg, callback), cursor_tile(nullptr), check_x(0), check_y(0),
 		  cursor_x(0), cursor_y(0), show_cursor(true) {
 	empty_tile = &gump_empty_tile;
diff --git a/engines/ultima/nuvie/views/container_widget_gump.h b/engines/ultima/nuvie/views/container_widget_gump.h
index fa0f0ee2bff..623e1a4bf03 100644
--- a/engines/ultima/nuvie/views/container_widget_gump.h
+++ b/engines/ultima/nuvie/views/container_widget_gump.h
@@ -44,7 +44,7 @@ private:
 	bool show_cursor;
 
 public:
-	ContainerWidgetGump(Configuration *cfg, GUI_CallBack *callback = nullptr);
+	ContainerWidgetGump(const Configuration *cfg, GUI_CallBack *callback = nullptr);
 	~ContainerWidgetGump() override;
 
 	bool init(Actor *a, uint16 x, uint16 y, uint8 Cols, uint8 Rows, TileManager *tm, ObjManager *om, Font *f, uint8 check_xoff, uint8 check_yoff);
diff --git a/engines/ultima/nuvie/views/doll_view_gump.cpp b/engines/ultima/nuvie/views/doll_view_gump.cpp
index 978c56449dd..73334118ab0 100644
--- a/engines/ultima/nuvie/views/doll_view_gump.cpp
+++ b/engines/ultima/nuvie/views/doll_view_gump.cpp
@@ -35,7 +35,7 @@
 namespace Ultima {
 namespace Nuvie {
 
-DollViewGump::DollViewGump(Configuration *cfg)
+DollViewGump::DollViewGump(const Configuration *cfg)
     : DraggableView(cfg), gump_button(nullptr), combat_button(nullptr),
       heart_button(nullptr), party_button(nullptr), inventory_button(nullptr),
 	  doll_widget(nullptr), actor_doll(nullptr), font(nullptr), actor(nullptr),
diff --git a/engines/ultima/nuvie/views/doll_view_gump.h b/engines/ultima/nuvie/views/doll_view_gump.h
index c83f23e5ba5..9ebeb466a8c 100644
--- a/engines/ultima/nuvie/views/doll_view_gump.h
+++ b/engines/ultima/nuvie/views/doll_view_gump.h
@@ -59,7 +59,7 @@ class DollViewGump : public DraggableView {
 	Graphics::ManagedSurface *actor_doll;
 
 public:
-	DollViewGump(Configuration *cfg);
+	DollViewGump(const Configuration *cfg);
 	~DollViewGump() override;
 
 	bool init(Screen *tmp_screen, void *view_manager, uint16 x, uint16 y, Actor *a, Font *f, Party *p, TileManager *tm, ObjManager *om);
diff --git a/engines/ultima/nuvie/views/doll_widget.cpp b/engines/ultima/nuvie/views/doll_widget.cpp
index e503757a780..34322439222 100644
--- a/engines/ultima/nuvie/views/doll_widget.cpp
+++ b/engines/ultima/nuvie/views/doll_widget.cpp
@@ -79,7 +79,7 @@ static const byte gump_empty_tile_data[] = {
 	170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170
 };
 
-DollWidget::DollWidget(Configuration *cfg, GUI_CallBack *callback)
+DollWidget::DollWidget(const Configuration *cfg, GUI_CallBack *callback)
 		: GUI_Widget(nullptr, 0, 0, 0, 0), config(cfg), callback_object(callback),
 		actor(nullptr), tile_manager(nullptr), selected_obj(nullptr),
 		obj_manager(nullptr), unready_obj(nullptr), empty_tile(nullptr),
diff --git a/engines/ultima/nuvie/views/doll_widget.h b/engines/ultima/nuvie/views/doll_widget.h
index 2d364d57f1e..7e7681a40d5 100644
--- a/engines/ultima/nuvie/views/doll_widget.h
+++ b/engines/ultima/nuvie/views/doll_widget.h
@@ -36,7 +36,7 @@ class U6Shape;
 
 class DollWidget : public GUI_Widget {
 
-	Configuration *config;
+	const Configuration *config;
 	TileManager *tile_manager;
 	ObjManager *obj_manager;
 
@@ -54,7 +54,7 @@ class DollWidget : public GUI_Widget {
 	Graphics::ManagedSurface *actor_doll, *doll_bg;
 
 public:
-	DollWidget(Configuration *cfg, GUI_CallBack *callback = nullptr);
+	DollWidget(const Configuration *cfg, GUI_CallBack *callback = nullptr);
 	~DollWidget() override;
 
 	bool init(Actor *a, uint16 x, uint16 y, TileManager *tm, ObjManager *om, bool in_portrat_view = false);
diff --git a/engines/ultima/nuvie/views/draggable_view.cpp b/engines/ultima/nuvie/views/draggable_view.cpp
index 0a13cd46510..5d0b4dcc9e6 100644
--- a/engines/ultima/nuvie/views/draggable_view.cpp
+++ b/engines/ultima/nuvie/views/draggable_view.cpp
@@ -31,7 +31,7 @@
 namespace Ultima {
 namespace Nuvie {
 
-DraggableView::DraggableView(Configuration *cfg) : View(cfg),
+DraggableView::DraggableView(const Configuration *cfg) : View(cfg),
 		drag(false), button_x(0), button_y(0), bg_image(nullptr),
 		bg_color_key(0), always_need_full_redraw_when_moved(false) {
 	Game *game = Game::get_game();
diff --git a/engines/ultima/nuvie/views/draggable_view.h b/engines/ultima/nuvie/views/draggable_view.h
index 85e5e5bc452..d11bf3dd793 100644
--- a/engines/ultima/nuvie/views/draggable_view.h
+++ b/engines/ultima/nuvie/views/draggable_view.h
@@ -41,7 +41,7 @@ private:
 	int button_x, button_y;
 
 public:
-	DraggableView(Configuration *config);
+	DraggableView(const Configuration *config);
 	~DraggableView() override;
 
 	/* events, used for dragging the area. */
diff --git a/engines/ultima/nuvie/views/inventory_view.cpp b/engines/ultima/nuvie/views/inventory_view.cpp
index 6179e9f187d..90bc4e8f00d 100644
--- a/engines/ultima/nuvie/views/inventory_view.cpp
+++ b/engines/ultima/nuvie/views/inventory_view.cpp
@@ -43,7 +43,7 @@ static const char combat_mode_tbl_se[][6] = {"CMND", "RANGE", "FLEE", "CLOSE"};
 static const char combat_mode_tbl_md[][6] = {"CMND", "RANGE", "FLEE", "ATTK"};
 #define MD Game::get_game()->get_game_type()==NUVIE_GAME_MD
 
-InventoryView::InventoryView(Configuration *cfg)
+InventoryView::InventoryView(const Configuration *cfg)
 	: View(cfg), doll_widget(nullptr), inventory_widget(nullptr),
 	  combat_button(nullptr), cursor_tile(nullptr), show_cursor(false),
 	  is_party_member(false), picking_pocket(false), outside_actor(nullptr),
diff --git a/engines/ultima/nuvie/views/inventory_view.h b/engines/ultima/nuvie/views/inventory_view.h
index eec2910b49a..7fa3630ebff 100644
--- a/engines/ultima/nuvie/views/inventory_view.h
+++ b/engines/ultima/nuvie/views/inventory_view.h
@@ -62,7 +62,7 @@ class InventoryView : public View {
 	bool show_cursor;
 
 public:
-	InventoryView(Configuration *cfg);
+	InventoryView(const Configuration *cfg);
 	~InventoryView() override;
 
 	bool init(Screen *tmp_screen, void *view_manager, uint16 x, uint16 y, Font *f, Party *p, TileManager *tm, ObjManager *om);
diff --git a/engines/ultima/nuvie/views/inventory_widget.cpp b/engines/ultima/nuvie/views/inventory_widget.cpp
index fffa781efe3..e43c6773be5 100644
--- a/engines/ultima/nuvie/views/inventory_widget.cpp
+++ b/engines/ultima/nuvie/views/inventory_widget.cpp
@@ -41,7 +41,7 @@
 namespace Ultima {
 namespace Nuvie {
 
-InventoryWidget::InventoryWidget(Configuration *cfg, GUI_CallBack *callback)
+InventoryWidget::InventoryWidget(const Configuration *cfg, GUI_CallBack *callback)
 	: GUI_Widget(nullptr, 0, 0, 0, 0), config(cfg), callback_object(callback),
       container_obj(nullptr), tile_manager(nullptr), obj_manager(nullptr),
 	  selected_obj(nullptr), font(nullptr), actor(nullptr), target_obj(nullptr),
diff --git a/engines/ultima/nuvie/views/inventory_widget.h b/engines/ultima/nuvie/views/inventory_widget.h
index 2a51fc8e1f0..b364d9bc070 100644
--- a/engines/ultima/nuvie/views/inventory_widget.h
+++ b/engines/ultima/nuvie/views/inventory_widget.h
@@ -38,7 +38,7 @@ class InventoryWidget : public GUI_Widget {
 private:
 	Common::Rect arrow_rects[2];
 protected:
-	Configuration *config;
+	const Configuration *config;
 
 	int game_type;
 
@@ -60,7 +60,7 @@ protected:
 	const Tile *empty_tile;
 
 public:
-	InventoryWidget(Configuration *cfg, GUI_CallBack *callback = nullptr);
+	InventoryWidget(const Configuration *cfg, GUI_CallBack *callback = nullptr);
 	~InventoryWidget() override;
 
 	bool init(Actor *a, uint16 x, uint16 y, TileManager *tm, ObjManager *om, Font *f);
diff --git a/engines/ultima/nuvie/views/map_editor_view.cpp b/engines/ultima/nuvie/views/map_editor_view.cpp
index 292433f7c08..74cec29fb85 100644
--- a/engines/ultima/nuvie/views/map_editor_view.cpp
+++ b/engines/ultima/nuvie/views/map_editor_view.cpp
@@ -36,7 +36,7 @@ namespace Nuvie {
 static const int TILES_W = 5;
 static const int TILES_H = 10;
 
-MapEditorView::MapEditorView(Configuration *cfg) : View(cfg), roof_tiles(nullptr),
+MapEditorView::MapEditorView(const Configuration *cfg) : View(cfg), roof_tiles(nullptr),
 		map_window(nullptr), up_button(nullptr), down_button(nullptr),
 		selectedTile(0), tile_offset(0) {
 }
diff --git a/engines/ultima/nuvie/views/map_editor_view.h b/engines/ultima/nuvie/views/map_editor_view.h
index 2e2c174b6e8..f9a9965d3ff 100644
--- a/engines/ultima/nuvie/views/map_editor_view.h
+++ b/engines/ultima/nuvie/views/map_editor_view.h
@@ -40,7 +40,7 @@ private:
 	GUI_Button *up_button;
 	GUI_Button *down_button;
 public:
-	MapEditorView(Configuration *config);
+	MapEditorView(const Configuration *config);
 	~MapEditorView() override;
 
 	bool init(Screen *tmp_screen, void *view_manager, uint16 x, uint16 y, Font *f, Party *p, TileManager *tm, ObjManager *om);
diff --git a/engines/ultima/nuvie/views/md_sky_strip_widget.cpp b/engines/ultima/nuvie/views/md_sky_strip_widget.cpp
index 0998baaea88..6e7a3b6e4a5 100644
--- a/engines/ultima/nuvie/views/md_sky_strip_widget.cpp
+++ b/engines/ultima/nuvie/views/md_sky_strip_widget.cpp
@@ -30,7 +30,7 @@
 namespace Ultima {
 namespace Nuvie {
 
-MDSkyStripWidget::MDSkyStripWidget(Configuration *cfg, GameClock *c, Player *p)
+MDSkyStripWidget::MDSkyStripWidget(const Configuration *cfg, GameClock *c, Player *p)
 	: GUI_Widget(nullptr, 0, 0, 0, 0), config(cfg), player(p), _clock(c) {
 }
 
diff --git a/engines/ultima/nuvie/views/md_sky_strip_widget.h b/engines/ultima/nuvie/views/md_sky_strip_widget.h
index 204007d1a66..c6f0a8b71d3 100644
--- a/engines/ultima/nuvie/views/md_sky_strip_widget.h
+++ b/engines/ultima/nuvie/views/md_sky_strip_widget.h
@@ -35,13 +35,13 @@ class Player;
 class MDSkyStripWidget : public GUI_Widget {
 
 protected:
-	Configuration *config;
+	const Configuration *config;
 	GameClock *_clock;
 	U6Shape strip1, strip2;
 	Player *player;
 
 public:
-	MDSkyStripWidget(Configuration *cfg, GameClock *c, Player *p);
+	MDSkyStripWidget(const Configuration *cfg, GameClock *c, Player *p);
 	~MDSkyStripWidget() override;
 
 	void init(sint16 x, sint16 y);
diff --git a/engines/ultima/nuvie/views/party_view.cpp b/engines/ultima/nuvie/views/party_view.cpp
index 82994f37d70..70ad8b388b8 100644
--- a/engines/ultima/nuvie/views/party_view.cpp
+++ b/engines/ultima/nuvie/views/party_view.cpp
@@ -46,7 +46,7 @@ extern GUI_status actorViewButtonCallback(void *data);
 #define SE Game::get_game()->get_game_type()==NUVIE_GAME_SE
 #define MD Game::get_game()->get_game_type()==NUVIE_GAME_MD
 
-PartyView::PartyView(Configuration *cfg) : View(cfg), player(nullptr),
+PartyView::PartyView(const Configuration *cfg) : View(cfg), player(nullptr),
 		view_manager(nullptr), party_view_targeting(false), row_offset(0),
 		sun_moon_widget(nullptr) {
 }
diff --git a/engines/ultima/nuvie/views/party_view.h b/engines/ultima/nuvie/views/party_view.h
index 4aa32985c07..cbede0a846c 100644
--- a/engines/ultima/nuvie/views/party_view.h
+++ b/engines/ultima/nuvie/views/party_view.h
@@ -45,7 +45,7 @@ class PartyView : public View {
 	SunMoonStripWidget *sun_moon_widget;
 
 public:
-	PartyView(Configuration *cfg);
+	PartyView(const Configuration *cfg);
 	~PartyView() override;
 
 	bool init(void *vm, uint16 x, uint16 y, Font *f, Party *p, Player *pl, TileManager *tm, ObjManager *om);
diff --git a/engines/ultima/nuvie/views/portrait_view.cpp b/engines/ultima/nuvie/views/portrait_view.cpp
index 1a305ca747f..1e8ec0dc38f 100644
--- a/engines/ultima/nuvie/views/portrait_view.cpp
+++ b/engines/ultima/nuvie/views/portrait_view.cpp
@@ -42,7 +42,7 @@
 namespace Ultima {
 namespace Nuvie {
 
-PortraitView::PortraitView(Configuration *cfg) : View(cfg),
+PortraitView::PortraitView(const Configuration *cfg) : View(cfg),
 		portrait_data(nullptr), portrait(nullptr),	bg_data(nullptr),
 		name_string(new string), show_cursor(false), doll_widget(nullptr),
 		waiting(false), display_doll(false), cur_actor_num(0) {
diff --git a/engines/ultima/nuvie/views/portrait_view.h b/engines/ultima/nuvie/views/portrait_view.h
index c9d1a1542f9..fca76c8379e 100644
--- a/engines/ultima/nuvie/views/portrait_view.h
+++ b/engines/ultima/nuvie/views/portrait_view.h
@@ -60,7 +60,7 @@ class PortraitView : public View {
 	bool display_doll;
 
 public:
-	PortraitView(Configuration *cfg);
+	PortraitView(const Configuration *cfg);
 	~PortraitView() override;
 
 	bool init(uint16 x, uint16 y, Font *f, Party *p, Player *player, TileManager *tm, ObjManager *om, Portrait *port);
diff --git a/engines/ultima/nuvie/views/portrait_view_gump.cpp b/engines/ultima/nuvie/views/portrait_view_gump.cpp
index 7d07a2a7d8c..7ffb8b4042b 100644
--- a/engines/ultima/nuvie/views/portrait_view_gump.cpp
+++ b/engines/ultima/nuvie/views/portrait_view_gump.cpp
@@ -35,7 +35,7 @@
 namespace Ultima {
 namespace Nuvie {
 
-PortraitViewGump::PortraitViewGump(Configuration *cfg) : DraggableView(cfg),
+PortraitViewGump::PortraitViewGump(const Configuration *cfg) : DraggableView(cfg),
 		portrait(nullptr), font(nullptr), gump_button(nullptr), portrait_data(nullptr),
 		actor(nullptr), cursor_tile(nullptr), show_cursor(true),
 		cursor_pos(CURSOR_CHECK), cursor_xoff(1), cursor_yoff(67) {
diff --git a/engines/ultima/nuvie/views/portrait_view_gump.h b/engines/ultima/nuvie/views/portrait_view_gump.h
index 399baf07500..b8048914500 100644
--- a/engines/ultima/nuvie/views/portrait_view_gump.h
+++ b/engines/ultima/nuvie/views/portrait_view_gump.h
@@ -51,7 +51,7 @@ class PortraitViewGump : public DraggableView {
 	uint8 cursor_xoff, cursor_yoff;
 
 public:
-	PortraitViewGump(Configuration *cfg);
+	PortraitViewGump(const Configuration *cfg);
 	~PortraitViewGump() override;
 
 	bool init(Screen *tmp_screen, void *view_manager, uint16 x, uint16 y, Font *f, Party *p, TileManager *tm, ObjManager *om, Portrait *por, Actor *a);
diff --git a/engines/ultima/nuvie/views/scroll_view_gump.cpp b/engines/ultima/nuvie/views/scroll_view_gump.cpp
index b41eb332eff..b63658e0195 100644
--- a/engines/ultima/nuvie/views/scroll_view_gump.cpp
+++ b/engines/ultima/nuvie/views/scroll_view_gump.cpp
@@ -34,7 +34,7 @@ namespace Nuvie {
 static const int SIGN_BG_W = (SCROLLWIDGETGUMP_W + 16);
 static const int SIGN_BG_H = (SCROLLWIDGETGUMP_H + 16);
 
-ScrollViewGump::ScrollViewGump(Configuration *cfg) : DraggableView(cfg), scroll_widget(nullptr) {
+ScrollViewGump::ScrollViewGump(const Configuration *cfg) : DraggableView(cfg), scroll_widget(nullptr) {
 }
 
 ScrollViewGump::~ScrollViewGump() {
diff --git a/engines/ultima/nuvie/views/scroll_view_gump.h b/engines/ultima/nuvie/views/scroll_view_gump.h
index 968645982f9..07b5d513b6f 100644
--- a/engines/ultima/nuvie/views/scroll_view_gump.h
+++ b/engines/ultima/nuvie/views/scroll_view_gump.h
@@ -38,7 +38,7 @@ class ScrollViewGump : public DraggableView {
 	ScrollWidgetGump *scroll_widget;
 
 public:
-	ScrollViewGump(Configuration *cfg);
+	ScrollViewGump(const Configuration *cfg);
 	~ScrollViewGump() override;
 
 	bool init(Screen *tmp_screen, void *view_manager, Font *f, Party *p, TileManager *tm, ObjManager *om, Std::string text_string);
diff --git a/engines/ultima/nuvie/views/scroll_widget_gump.cpp b/engines/ultima/nuvie/views/scroll_widget_gump.cpp
index 4a05e089239..9dd9d6c6c7a 100644
--- a/engines/ultima/nuvie/views/scroll_widget_gump.cpp
+++ b/engines/ultima/nuvie/views/scroll_widget_gump.cpp
@@ -41,7 +41,7 @@ namespace Nuvie {
 
 // ScrollWidgetGump Class
 
-ScrollWidgetGump::ScrollWidgetGump(Configuration *cfg, Screen *s) :
+ScrollWidgetGump::ScrollWidgetGump(const Configuration *cfg, Screen *s) :
 		arrow_up_rect(SCROLLWIDGETGUMP_W - 8 - 1, 4 + 1,
 			SCROLLWIDGETGUMP_W - 8 - 1 + 7, 4 + 1 + 5),
 		arrow_down_rect(SCROLLWIDGETGUMP_W - 8 - 1, SCROLLWIDGETGUMP_H - 8 + 3,
diff --git a/engines/ultima/nuvie/views/scroll_widget_gump.h b/engines/ultima/nuvie/views/scroll_widget_gump.h
index c6b584997b3..8ff1ba393fd 100644
--- a/engines/ultima/nuvie/views/scroll_widget_gump.h
+++ b/engines/ultima/nuvie/views/scroll_widget_gump.h
@@ -68,7 +68,7 @@ class ScrollWidgetGump: public MsgScroll {
 
 public:
 
-	ScrollWidgetGump(Configuration *cfg, Screen *s);
+	ScrollWidgetGump(const Configuration *cfg, Screen *s);
 	~ScrollWidgetGump() override;
 
 	bool parse_token(MsgText *token) override;
diff --git a/engines/ultima/nuvie/views/sign_view_gump.cpp b/engines/ultima/nuvie/views/sign_view_gump.cpp
index 365ebbf5b70..4e7a93de84c 100644
--- a/engines/ultima/nuvie/views/sign_view_gump.cpp
+++ b/engines/ultima/nuvie/views/sign_view_gump.cpp
@@ -33,7 +33,7 @@ namespace Nuvie {
 static const int SIGN_BG_W = 246;
 static const int SIGN_BG_H = 101;
 
-SignViewGump::SignViewGump(Configuration *cfg) : DraggableView(cfg), sign_text(nullptr) {
+SignViewGump::SignViewGump(const Configuration *cfg) : DraggableView(cfg), sign_text(nullptr) {
 	font = new BMPFont();
 
 	Std::string datadir = GUI::get_gui()->get_data_dir();
diff --git a/engines/ultima/nuvie/views/sign_view_gump.h b/engines/ultima/nuvie/views/sign_view_gump.h
index ea5b519cb0d..890c38e9c47 100644
--- a/engines/ultima/nuvie/views/sign_view_gump.h
+++ b/engines/ultima/nuvie/views/sign_view_gump.h
@@ -40,7 +40,7 @@ class SignViewGump : public DraggableView {
 	char *sign_text;
 
 public:
-	SignViewGump(Configuration *cfg);
+	SignViewGump(const Configuration *cfg);
 	~SignViewGump() override;
 
 	bool init(Screen *tmp_screen, void *view_manager, Font *f, Party *p, TileManager *tm, ObjManager *om, const char *text_string, uint16 length);
diff --git a/engines/ultima/nuvie/views/spell_view.cpp b/engines/ultima/nuvie/views/spell_view.cpp
index ddae192e4b2..06a89498ed7 100644
--- a/engines/ultima/nuvie/views/spell_view.cpp
+++ b/engines/ultima/nuvie/views/spell_view.cpp
@@ -51,7 +51,7 @@ static const int obj_n_reagent[8] = {OBJ_U6_MANDRAKE_ROOT, OBJ_U6_NIGHTSHADE, OB
 static const int NEWMAGIC_BMP_W = 144;
 static const int NEWMAGIC_BMP_H = 82;
 
-SpellView::SpellView(Configuration *cfg) : DraggableView(cfg), spell_container(nullptr),
+SpellView::SpellView(const Configuration *cfg) : DraggableView(cfg), spell_container(nullptr),
 		background(nullptr), level(1), all_spells_mode(false), spell_num(0),
 		event_mode(false), num_spells_per_page(8), caster(nullptr) {
 }
diff --git a/engines/ultima/nuvie/views/spell_view.h b/engines/ultima/nuvie/views/spell_view.h
index 1050f16bc27..96379b0e957 100644
--- a/engines/ultima/nuvie/views/spell_view.h
+++ b/engines/ultima/nuvie/views/spell_view.h
@@ -57,7 +57,7 @@ protected:
 	uint8 num_spells_per_page;
 
 public:
-	SpellView(Configuration *cfg);
+	SpellView(const Configuration *cfg);
 	~SpellView() override;
 
 	virtual bool init(Screen *tmp_screen, void *view_manager, uint16 x, uint16 y, Font *f, Party *p, TileManager *tm, ObjManager *om);
diff --git a/engines/ultima/nuvie/views/spell_view_gump.cpp b/engines/ultima/nuvie/views/spell_view_gump.cpp
index 1789884aad6..835e7f158d2 100644
--- a/engines/ultima/nuvie/views/spell_view_gump.cpp
+++ b/engines/ultima/nuvie/views/spell_view_gump.cpp
@@ -32,7 +32,7 @@
 namespace Ultima {
 namespace Nuvie {
 
-SpellViewGump::SpellViewGump(Configuration *cfg) : SpellView(cfg),
+SpellViewGump::SpellViewGump(const Configuration *cfg) : SpellView(cfg),
 		gump_button(nullptr), font(nullptr), selected_spell(-1) {
 	num_spells_per_page = 10;
 	bg_image = nullptr;
diff --git a/engines/ultima/nuvie/views/spell_view_gump.h b/engines/ultima/nuvie/views/spell_view_gump.h
index f435e848121..592387d5102 100644
--- a/engines/ultima/nuvie/views/spell_view_gump.h
+++ b/engines/ultima/nuvie/views/spell_view_gump.h
@@ -46,7 +46,7 @@ class SpellViewGump : public SpellView {
 	GUI_Font *font;
 	NuvieBmpFile bmp;
 public:
-	SpellViewGump(Configuration *cfg);
+	SpellViewGump(const Configuration *cfg);
 	~SpellViewGump() override;
 
 	bool init(Screen *tmp_screen, void *view_manager, uint16 x, uint16 y, Font *f, Party *p, TileManager *tm, ObjManager *om) override;
diff --git a/engines/ultima/nuvie/views/view.cpp b/engines/ultima/nuvie/views/view.cpp
index d2ba37ee3e7..091ec3822d3 100644
--- a/engines/ultima/nuvie/views/view.cpp
+++ b/engines/ultima/nuvie/views/view.cpp
@@ -33,7 +33,7 @@
 namespace Ultima {
 namespace Nuvie {
 
-View::View(Configuration *cfg) : GUI_Widget(nullptr, 0, 0, 0, 0),
+View::View(const Configuration *cfg) : GUI_Widget(nullptr, 0, 0, 0, 0),
 		config(cfg), new_ui_mode(false), left_button(nullptr), font(nullptr),
 		tile_manager(nullptr), right_button(nullptr), obj_manager(nullptr),
 		party(nullptr), party_button(nullptr), inventory_button(nullptr),
diff --git a/engines/ultima/nuvie/views/view.h b/engines/ultima/nuvie/views/view.h
index bc457cba88f..f92636b13e7 100644
--- a/engines/ultima/nuvie/views/view.h
+++ b/engines/ultima/nuvie/views/view.h
@@ -41,7 +41,7 @@ class Actor;
 
 class View: public GUI_Widget {
 protected:
-	Configuration *config;
+	const Configuration *config;
 
 	GUI_Button *left_button, *right_button, *actor_button, *party_button, *inventory_button;
 
@@ -56,7 +56,7 @@ protected:
 
 public:
 
-	View(Configuration *cfg);
+	View(const Configuration *cfg);
 	~View() override;
 
 	bool init(uint16 x, uint16 y, Font *f, Party *p, TileManager *tm, ObjManager *om);
diff --git a/engines/ultima/nuvie/views/view_manager.cpp b/engines/ultima/nuvie/views/view_manager.cpp
index 7b0e00a4611..45888614ab3 100644
--- a/engines/ultima/nuvie/views/view_manager.cpp
+++ b/engines/ultima/nuvie/views/view_manager.cpp
@@ -50,7 +50,7 @@
 namespace Ultima {
 namespace Nuvie {
 
-ViewManager::ViewManager(Configuration *cfg) : config(cfg),
+ViewManager::ViewManager(const Configuration *cfg) : config(cfg),
 		current_view(nullptr), gui(nullptr), font(nullptr), tile_manager(nullptr),
 		obj_manager(nullptr), party(nullptr), portrait(nullptr), actor_view(nullptr),
 		inventory_view(nullptr), portrait_view(nullptr), party_view(nullptr),
diff --git a/engines/ultima/nuvie/views/view_manager.h b/engines/ultima/nuvie/views/view_manager.h
index 4e5c13599a1..a2c8ecc6066 100644
--- a/engines/ultima/nuvie/views/view_manager.h
+++ b/engines/ultima/nuvie/views/view_manager.h
@@ -57,7 +57,7 @@ typedef enum { CURSOR_HEAD, CURSOR_NECK, CURSOR_CHEST, CURSOR_RIGHT_HAND, CURSOR
 class ViewManager {
 protected:
 
-	Configuration *config;
+	const Configuration *config;
 	int game_type;
 	GUI *gui;
 	Font *font;
@@ -87,7 +87,7 @@ protected:
 
 public:
 
-	ViewManager(Configuration *cfg);
+	ViewManager(const Configuration *cfg);
 	virtual ~ViewManager();
 
 	bool init(GUI *g, Font *f, Party *p, Player *player, TileManager *tm, ObjManager *om, Portrait *por);


Commit: 724b0483128f7e4f0d307e65268a4b6fe53c85c9
    https://github.com/scummvm/scummvm/commit/724b0483128f7e4f0d307e65268a4b6fe53c85c9
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2023-12-09T13:56:08+11:00

Commit Message:
ULTIMA: NUVIE: Yet more const correctness

Changed paths:
    engines/ultima/nuvie/actors/actor.cpp
    engines/ultima/nuvie/actors/actor.h
    engines/ultima/nuvie/actors/actor_manager.cpp
    engines/ultima/nuvie/actors/actor_manager.h
    engines/ultima/nuvie/core/events.cpp
    engines/ultima/nuvie/core/events.h
    engines/ultima/nuvie/files/nuvie_io.h
    engines/ultima/nuvie/gui/widgets/background.cpp
    engines/ultima/nuvie/gui/widgets/map_window.cpp
    engines/ultima/nuvie/keybinding/keys.cpp
    engines/ultima/nuvie/keybinding/keys.h


diff --git a/engines/ultima/nuvie/actors/actor.cpp b/engines/ultima/nuvie/actors/actor.cpp
index 99a66e02496..da1eaf43b60 100644
--- a/engines/ultima/nuvie/actors/actor.cpp
+++ b/engines/ultima/nuvie/actors/actor.cpp
@@ -1629,8 +1629,8 @@ void Actor::repel_from(Actor *target) {
 	((CombatPathFinder *)pathfinder)->set_distance(2);
 }
 
-uint8 Actor::get_light_level() {
-	Tile *tile = get_tile();
+uint8 Actor::get_light_level() const {
+	const Tile *tile = get_tile();
 	return MAX(light, GET_TILE_LIGHT_LEVEL(tile));
 }
 
diff --git a/engines/ultima/nuvie/actors/actor.h b/engines/ultima/nuvie/actors/actor.h
index 73db05a6e42..947a480a78a 100644
--- a/engines/ultima/nuvie/actors/actor.h
+++ b/engines/ultima/nuvie/actors/actor.h
@@ -496,7 +496,7 @@ public:
 			movement_flags |= (a - 1) << 5;
 		}
 	}
-	uint8 get_light_level();
+	uint8 get_light_level() const;
 	void add_light(uint8 val);
 	void subtract_light(uint8 val);
 	void heal() {
diff --git a/engines/ultima/nuvie/actors/actor_manager.cpp b/engines/ultima/nuvie/actors/actor_manager.cpp
index b639ce265cf..8ca96a812cb 100644
--- a/engines/ultima/nuvie/actors/actor_manager.cpp
+++ b/engines/ultima/nuvie/actors/actor_manager.cpp
@@ -587,7 +587,7 @@ void ActorManager::set_player(Actor *a) {
 /* Returns an actor's "look-string," a general description of their occupation
  * or appearance. (the tile description)
  */
-const char *ActorManager::look_actor(Actor *a, bool show_prefix) {
+const char *ActorManager::look_actor(const Actor *a, bool show_prefix) {
 	uint16 tile_num = obj_manager->get_obj_tile_num(a->base_obj_n);
 	if (tile_num == 0) {
 		uint8 actor_num = a->id_n;
diff --git a/engines/ultima/nuvie/actors/actor_manager.h b/engines/ultima/nuvie/actors/actor_manager.h
index 193cae1c532..88c817b18d6 100644
--- a/engines/ultima/nuvie/actors/actor_manager.h
+++ b/engines/ultima/nuvie/actors/actor_manager.h
@@ -87,7 +87,7 @@ public:
 	Actor *get_player();
 	void set_player(Actor *a);
 
-	const char *look_actor(Actor *a, bool show_prefix = true);
+	const char *look_actor(const Actor *a, bool show_prefix = true);
 
 	void set_update(bool u) {
 		update = u;
diff --git a/engines/ultima/nuvie/core/events.cpp b/engines/ultima/nuvie/core/events.cpp
index be98153307d..8467c3daf7e 100644
--- a/engines/ultima/nuvie/core/events.cpp
+++ b/engines/ultima/nuvie/core/events.cpp
@@ -1494,7 +1494,7 @@ bool Events::pushFrom(const MapCoord &target) {
 	return true;
 }
 
-bool Events::actor_exists(Actor *a) {
+bool Events::actor_exists(const Actor *a) const {
 	if (a->get_z() > 5 || a->get_actor_num() == 0
 	        || ((a->is_temp() || a->get_strength() == 0) && a->get_x() == 0 && a->get_y() == 0
 	            && a->get_z() == 0) // temp actor that has been cleaned up or invalid normal npc
@@ -2887,7 +2887,7 @@ void Events::walk_to_mouse_cursor(uint32 mx, uint32 my) {
 
 	// Mouse->World->RelativeDirection
 //    map_window->mouseToWorldCoords((int)mx, (int)my, wx, wy);
-	map_window->get_movement_direction((uint16) mx, (uint16) my, rx, ry);
+	map_window->get_movement_direction((uint16)mx, (uint16)my, rx, ry);
 	player->moveRelative(rx, ry, true);
 	game->time_changed();
 }
@@ -3743,7 +3743,7 @@ void Events::display_move_text(Actor *target_actor, Obj *obj) {
 	scroll->display_string(".");
 }
 
-bool Events::can_get_to_actor(Actor *actor, uint16 x, uint16 y) { // need the exact tile
+bool Events::can_get_to_actor(const Actor *actor, uint16 x, uint16 y) { // need the exact tile
 	if (map_window->get_interface() == INTERFACE_IGNORE_BLOCK
 	        || player->get_actor() == actor)
 		return true;
@@ -3781,20 +3781,17 @@ bool Events::select_view_obj(Obj *obj, Actor *actor) {
 }
 
 void Events::close_gumps() {
-//	if(game->is_new_style())
-	{
-		view_manager->close_all_gumps();
-	}
+	view_manager->close_all_gumps();
 }
 
-bool Events::dont_show_target_cursor() {
+bool Events::dont_show_target_cursor() const {
 	if (do_not_show_target_cursor || push_actor)
 		return true;
 	else
 		return false;
 }
 
-bool Events::input_really_needs_directon() {
+bool Events::input_really_needs_directon() const {
 	if ((input.get_direction && (map_window->get_interface() == INTERFACE_NORMAL || last_mode == CAST_MODE)) ||
 	        dont_show_target_cursor())
 		return true;
diff --git a/engines/ultima/nuvie/core/events.h b/engines/ultima/nuvie/core/events.h
index 1dbda8cb425..f2291b655f6 100644
--- a/engines/ultima/nuvie/core/events.h
+++ b/engines/ultima/nuvie/core/events.h
@@ -376,14 +376,14 @@ public:
 	bool can_move_obj_between_actors(Obj *obj, Actor *src_actor, Actor *target_actor, bool display_name = false);
 	void display_not_aboard_vehicle(bool show_prompt = true);
 	void display_move_text(Actor *target_actor, Obj *obj);
-	bool can_get_to_actor(Actor *actor, uint16 x, uint16 y);
-	bool using_control_cheat() {
+	bool can_get_to_actor(const Actor *actor, uint16 x, uint16 y);
+	bool using_control_cheat() const {
 		return in_control_cheat;
 	}
 	void set_control_cheat(bool control_cheat) {
 		in_control_cheat = control_cheat;
 	}
-	bool is_looking_at_spellbook() {
+	bool is_looking_at_spellbook() const {
 		return looking_at_spellbook;
 	}
 	void set_looking_at_spellbook(bool looking) {
@@ -427,11 +427,11 @@ public:
 	void toggleFpsDisplay();
 	void close_gumps();
 	bool do_not_show_target_cursor;
-	bool dont_show_target_cursor();
-	bool input_really_needs_directon();
+	bool dont_show_target_cursor() const;
+	bool input_really_needs_directon() const;
 	void quitDialog();
 	void gameMenuDialog();
-	bool actor_exists(Actor *a);
+	bool actor_exists(const Actor *a) const;
 
 	/* FIXME: Some of the above (action) functions can be removed from public, so
 	   that we don't need to check for WAIT mode in all of them. */
diff --git a/engines/ultima/nuvie/files/nuvie_io.h b/engines/ultima/nuvie/files/nuvie_io.h
index d1756f41dcf..301220331c8 100644
--- a/engines/ultima/nuvie/files/nuvie_io.h
+++ b/engines/ultima/nuvie/files/nuvie_io.h
@@ -75,7 +75,7 @@ public:
 		return 0;
 	};
 
-	uint32 get_size() {
+	uint32 get_size() const {
 		return size;
 	};
 
@@ -88,13 +88,13 @@ public:
 	};
 	virtual void seek(uint32 new_pos) = 0;
 
-	inline bool is_end() {
+	inline bool is_end() const {
 		return (pos == size - 1);
 	};
-	inline bool is_eof() {
+	inline bool is_eof() const {
 		return (size == 0 || pos >= size);
 	};
-	uint32 position() {
+	uint32 position() const {
 		return pos;
 	};
 };
diff --git a/engines/ultima/nuvie/gui/widgets/background.cpp b/engines/ultima/nuvie/gui/widgets/background.cpp
index 65f626bba7d..0d168fa37e7 100644
--- a/engines/ultima/nuvie/gui/widgets/background.cpp
+++ b/engines/ultima/nuvie/gui/widgets/background.cpp
@@ -112,7 +112,7 @@ void Background::Display(bool full_redraw) {
 					screen->clear(area.left, game_height, area.width(), area.height() - game_height, nullptr); // bottom
 				}
 			}
-			unsigned char *ptr = background->get_data();
+			const unsigned char *ptr = background->get_data();
 			if (game_type == NUVIE_GAME_U6) {
 				ptr += (bg_w - 152);
 				screen->blit(right_bg_x_off, y_off, ptr, 8, 152, bg_h, bg_w, true);
diff --git a/engines/ultima/nuvie/gui/widgets/map_window.cpp b/engines/ultima/nuvie/gui/widgets/map_window.cpp
index 058c0fca9a6..5b13c38a603 100644
--- a/engines/ultima/nuvie/gui/widgets/map_window.cpp
+++ b/engines/ultima/nuvie/gui/widgets/map_window.cpp
@@ -758,20 +758,17 @@ void MapWindow::updateLighting() {
 			}
 		}
 
-		for (Std::vector<TileInfo>::iterator ti = m_ViewableMapTiles.begin();
-		        ti != m_ViewableMapTiles.end(); ti++) {
-			if (GET_TILE_LIGHT_LEVEL((*ti).t) > 0)
-				screen->drawalphamap8globe((*ti).x, (*ti).y, GET_TILE_LIGHT_LEVEL((*ti).t));
+		for (const TileInfo &ti : m_ViewableMapTiles) {
+			if (GET_TILE_LIGHT_LEVEL(ti.t) > 0)
+				screen->drawalphamap8globe(ti.x, ti.y, GET_TILE_LIGHT_LEVEL(ti.t));
 		}
 	}
 
 	/* draw light coming from the actor
 	   Wisps can change the light level depending on their current tile so we can't use actor->light for an actor's innate lighting.
 	*/
-	Actor *actor;
-
 	for (uint16 i = 0; i < 256; i++) {
-		actor = actor_manager->get_actor(i);
+		const Actor *actor = actor_manager->get_actor(i);
 
 		if (actor->z == cur_level) {
 			if (actor->x >= cur_x - TMP_MAP_BORDER && actor->x < cur_x + win_width + TMP_MAP_BORDER) {
@@ -1180,8 +1177,8 @@ inline void MapWindow::drawTopTile(Tile *tile, uint16 x, uint16 y, bool toptile)
 }
 
 void MapWindow::drawBorder() {
-	Tile *tile;
-	Tile *tile1;
+	const Tile *tile;
+	const Tile *tile1;
 	uint16 i;
 
 	if (game_type != NUVIE_GAME_U6)
@@ -2560,10 +2557,9 @@ void MapWindow::set_overlay(Graphics::ManagedSurface *surfpt) {
 bool MapWindow::in_town() const {
 	const MapCoord player_loc = actor_manager->get_player()->get_location();
 
-	for (Std::vector<TileInfo>::const_iterator ti = m_ViewableMapTiles.begin();
-	        ti != m_ViewableMapTiles.end(); ti++)
-		if (MapCoord((*ti).x + cur_x, (*ti).y + cur_y, cur_level).distance(player_loc) <= 5 && // make sure tile is close enough
-		        ((*ti).t->flags1 & TILEFLAG_WALL) && ((*ti).t->flags1 & TILEFLAG_WALL_MASK)) { //only wall tiles with wall direction bits set.
+	for (const TileInfo &ti : m_ViewableMapTiles)
+		if (MapCoord(ti.x + cur_x, ti.y + cur_y, cur_level).distance(player_loc) <= 5 && // make sure tile is close enough
+		        (ti.t->flags1 & TILEFLAG_WALL) && (ti.t->flags1 & TILEFLAG_WALL_MASK)) { //only wall tiles with wall direction bits set.
 			return true;
 		}
 	return false;
diff --git a/engines/ultima/nuvie/keybinding/keys.cpp b/engines/ultima/nuvie/keybinding/keys.cpp
index 31767a4765d..7656b410ea4 100644
--- a/engines/ultima/nuvie/keybinding/keys.cpp
+++ b/engines/ultima/nuvie/keybinding/keys.cpp
@@ -458,7 +458,7 @@ void KeyBinder::ParseLine(char *line) {
 	k.keycode = Common::KEYCODE_INVALID;
 	k.flags = 0;
 	string s = line, u;
-	string d, desc, keycode;
+	string d, keycode;
 	bool show;
 
 	skipspace(s);
@@ -567,7 +567,7 @@ void KeyBinder::ParseLine(char *line) {
 	}
 
 	if (show) {
-		desc = "";
+		string desc;
 		if (k.flags & Common::KBD_CTRL)
 			desc += "Ctrl-";
 #if defined(MACOS) || defined(MACOSX)
@@ -625,7 +625,7 @@ void KeyBinder::LoadFromFile(const char *filename) {
 void KeyBinder::LoadGameSpecificKeys() {
 	string key_path_str;
 	string default_key_path;
-	Configuration *config = Game::get_game()->get_config();
+	const Configuration *config = Game::get_game()->get_config();
 	config->value("config/datadir", default_key_path, "./data");
 	nuvie_game_t game_type = get_game_type(config);
 
@@ -651,7 +651,7 @@ void KeyBinder::LoadGameSpecificKeys() {
 
 void KeyBinder::LoadFromPatch() { // FIXME default should probably be system specific
 	string PATCH_KEYS;
-	Configuration *config = Game::get_game()->get_config();
+	const Configuration *config = Game::get_game()->get_config();
 
 	config->value(config_get_game_key(config) + "/patch_keys", PATCH_KEYS, "./patchkeys.txt");
 	if (fileExists(PATCH_KEYS.c_str())) {
@@ -669,7 +669,7 @@ void KeyBinder::FillParseMaps() {
 		_actions[NuvieActions[i].s] = &(NuvieActions[i]);
 }
 
-uint8 KeyBinder::get_axis(uint8 index) {
+uint8 KeyBinder::get_axis(uint8 index) const {
 	switch (index) {
 	case 0:
 		return x_axis;
@@ -721,7 +721,7 @@ void KeyBinder::set_axis(uint8 index, uint8 value) {
 	}
 }
 
-joy_axes_pairs KeyBinder::get_axes_pair(int axis) {
+joy_axes_pairs KeyBinder::get_axes_pair(int axis) const {
 	if (axis == x_axis || axis == y_axis)
 		return AXES_PAIR1;
 	else if (axis == x_axis2 || axis == y_axis2)
diff --git a/engines/ultima/nuvie/keybinding/keys.h b/engines/ultima/nuvie/keybinding/keys.h
index 73d57719bdc..fc124560829 100644
--- a/engines/ultima/nuvie/keybinding/keys.h
+++ b/engines/ultima/nuvie/keybinding/keys.h
@@ -106,33 +106,33 @@ public:
 
 	void ShowKeys() const;
 
-	uint8 get_axis(uint8 index);
+	uint8 get_axis(uint8 index) const;
 	void set_axis(uint8 index, uint8 value);
 	Common::KeyCode get_key_from_joy_walk_axes() {
 		return get_key_from_joy_axis_motion(x_axis, true);
 	}
 	Common::KeyCode get_key_from_joy_axis_motion(int axis, bool repeating);
-	Common::KeyCode get_key_from_joy_hat_button(uint8 hat_button);
+	Common::KeyCode get_key_from_joy_hat_button(uint8 hat_button) const;
 	Common::KeyCode get_key_from_joy_events(Common::Event *event);
 	void init_joystick(sint8 joy_num);
 //	SDL_Joystick *get_joystick() { return joystick; }
-	uint32 get_next_joy_repeat_time() {
+	uint32 get_next_joy_repeat_time() const {
 		return next_joy_repeat_time;
 	}
 	void set_enable_joy_repeat(bool val) {
 		if (joy_repeat_delay == 10000) return;
 		joy_repeat_enabled = val;
 	}
-	bool is_joy_repeat_enabled() {
+	bool is_joy_repeat_enabled() const {
 		return joy_repeat_enabled;
 	}
-	bool is_hat_repeating() {
+	bool is_hat_repeating() const {
 		return repeat_hat;
 	}
 	void set_hat_repeating(bool val) {
 		repeat_hat = val;
 	}
-	sint8 get_enable_joystick() {
+	sint8 get_enable_joystick() const {
 		return enable_joystick;
 	}
 	void set_enable_joystick(bool val) {
@@ -144,7 +144,7 @@ private:
 	void ParseLine(char *line);
 	void FillParseMaps();
 
-	joy_axes_pairs get_axes_pair(int axis);
+	joy_axes_pairs get_axes_pair(int axis) const;
 	Common::KeyCode get_key_from_joy_button(uint8 button);
 };
 


Commit: 4493bdcf5c08e040cb7f5afda029fb748d915cd4
    https://github.com/scummvm/scummvm/commit/4493bdcf5c08e040cb7f5afda029fb748d915cd4
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2023-12-09T13:56:08+11:00

Commit Message:
ULTIMA: NUVIE: Use foreach style loops for cleaner code

Includes some small other cleanups in MapWindow.

Changed paths:
    engines/ultima/nuvie/actors/actor.cpp
    engines/ultima/nuvie/actors/actor.h
    engines/ultima/nuvie/actors/actor_manager.cpp
    engines/ultima/nuvie/actors/u6_actor.cpp
    engines/ultima/nuvie/conf/configuration.cpp
    engines/ultima/nuvie/core/effect.cpp
    engines/ultima/nuvie/core/egg_manager.cpp
    engines/ultima/nuvie/core/obj_manager.cpp
    engines/ultima/nuvie/core/weather.cpp
    engines/ultima/nuvie/files/nuvie_file_list.cpp
    engines/ultima/nuvie/gui/gui_console.cpp
    engines/ultima/nuvie/gui/gui_scroller.cpp
    engines/ultima/nuvie/gui/widgets/converse_gump.cpp
    engines/ultima/nuvie/gui/widgets/gui_widget.cpp
    engines/ultima/nuvie/gui/widgets/map_window.cpp
    engines/ultima/nuvie/gui/widgets/map_window.h
    engines/ultima/nuvie/gui/widgets/msg_scroll.cpp
    engines/ultima/nuvie/gui/widgets/msg_scroll_new_ui.cpp
    engines/ultima/nuvie/gui/widgets/msg_scroll_new_ui.h
    engines/ultima/nuvie/metaengine.cpp
    engines/ultima/nuvie/pathfinder/astar_path.cpp
    engines/ultima/nuvie/script/script_cutscene.cpp
    engines/ultima/nuvie/sound/sound_manager.cpp
    engines/ultima/nuvie/sound/sound_manager.h
    engines/ultima/nuvie/usecode/u6_usecode.cpp
    engines/ultima/nuvie/views/view_manager.cpp


diff --git a/engines/ultima/nuvie/actors/actor.cpp b/engines/ultima/nuvie/actors/actor.cpp
index da1eaf43b60..8d914b3ea1d 100644
--- a/engines/ultima/nuvie/actors/actor.cpp
+++ b/engines/ultima/nuvie/actors/actor.cpp
@@ -310,8 +310,7 @@ void Actor::set_poisoned(bool poisoned) {
 const char *Actor::get_name(bool force_real_name) {
 	ActorManager *actor_manager = Game::get_game()->get_actor_manager();
 	Converse *converse = Game::get_game()->get_converse();
-	Party *party = Game::get_game()->get_party();
-	//Actor *player = Game::get_game()->get_player()->get_actor();
+	const Party *party = Game::get_game()->get_party();
 	const char *talk_name = nullptr; // name from conversation script
 	bool statue = (Game::get_game()->get_game_type() == NUVIE_GAME_U6 && id_n >= 189 && id_n <= 200);
 
@@ -336,12 +335,10 @@ void Actor::add_surrounding_obj(Obj *obj) {
 void Actor::unlink_surrounding_objects(bool make_objects_temporary) {
 //	if(make_objects_temporary)
 	{
-		Std::list<Obj *>::iterator obj;
-
-		for (obj = surrounding_objects.begin(); obj != surrounding_objects.end(); obj++) {
+		for (Obj *obj : surrounding_objects) {
 			if (make_objects_temporary)
-				(*obj)->set_temporary();
-			(*obj)->set_actor_obj(false);
+				obj->set_temporary();
+			obj->set_actor_obj(false);
 		}
 	}
 	surrounding_objects.clear();
@@ -1408,9 +1405,8 @@ void Actor::clear() {
 void Actor::show() {
 	visible_flag = true;
 
-	Std::list<Obj *>::iterator obj_iter;
-	for (obj_iter = surrounding_objects.begin(); obj_iter != surrounding_objects.end(); obj_iter++) {
-		(*obj_iter)->set_invisible(false);
+	for (Obj *obj : surrounding_objects) {
+		obj->set_invisible(false);
 	}
 
 }
@@ -1418,9 +1414,8 @@ void Actor::show() {
 void Actor::hide() {
 	visible_flag = false;
 
-	Std::list<Obj *>::iterator obj_iter;
-	for (obj_iter = surrounding_objects.begin(); obj_iter != surrounding_objects.end(); obj_iter++) {
-		(*obj_iter)->set_invisible(true);
+	for (Obj *obj : surrounding_objects) {
+		obj->set_invisible(true);
 	}
 }
 
@@ -1650,12 +1645,12 @@ void Actor::subtract_light(uint8 val) {
 //        light -= val;
 //    else
 //        light = 0;
-	vector<uint8>::iterator l = light_source.begin();
-	for (; l != light_source.end(); l++)
+	for (vector<uint8>::iterator l = light_source.begin(); l != light_source.end(); l++) {
 		if (*l == val) {
 			light_source.erase(l);
 			break;
 		}
+	}
 	light = 0; // change to next highest light source
 	for (unsigned int lCtr = 0; lCtr < light_source.size(); lCtr++)
 		if (light_source[lCtr] > light)
diff --git a/engines/ultima/nuvie/actors/actor.h b/engines/ultima/nuvie/actors/actor.h
index 947a480a78a..87e1eca5612 100644
--- a/engines/ultima/nuvie/actors/actor.h
+++ b/engines/ultima/nuvie/actors/actor.h
@@ -564,8 +564,8 @@ public:
 	void clear_error();
 	ActorError *get_error();
 
-	list<Obj *> *get_surrounding_obj_list() {
-		return surrounding_objects.empty() ? nullptr : &surrounding_objects;
+	const list<Obj *> &get_surrounding_obj_list() const {
+		return surrounding_objects;
 	}
 	void add_surrounding_obj(Obj *obj);
 	void unlink_surrounding_objects(bool make_objects_temporary = false);
diff --git a/engines/ultima/nuvie/actors/actor_manager.cpp b/engines/ultima/nuvie/actors/actor_manager.cpp
index 8ca96a812cb..39bb9617970 100644
--- a/engines/ultima/nuvie/actors/actor_manager.cpp
+++ b/engines/ultima/nuvie/actors/actor_manager.cpp
@@ -1123,8 +1123,7 @@ void ActorManager::loadAvatarTiles(const Std::string &datadir) {
 
 	Std::set<Std::string> files = getCustomTileFilenames(datadir, "avatar_");
 
-	for (Std::set<Std::string>::iterator iter = files.begin(); iter != files.end(); iter++) {
-		Std::string filename = *iter;
+	for (const Std::string &filename : files) {
 		if (filename.length() != 19) { // avatar_nnn_nnnn.bmp
 			continue;
 		}
@@ -1152,8 +1151,7 @@ void ActorManager::loadNPCTiles(const Std::string &datadir) {
 
 	Std::set<Std::string> files = getCustomTileFilenames(datadir, "actor_");
 
-	for (Std::set<Std::string>::iterator iter = files.begin(); iter != files.end(); iter++) {
-		Std::string filename = *iter;
+	for (const Std::string &filename : files) {
 		if (filename.length() != 18) { // actor_nnn_nnnn.bmp
 			continue;
 		}
diff --git a/engines/ultima/nuvie/actors/u6_actor.cpp b/engines/ultima/nuvie/actors/u6_actor.cpp
index 7a689ac4991..c39c0bf721a 100644
--- a/engines/ultima/nuvie/actors/u6_actor.cpp
+++ b/engines/ultima/nuvie/actors/u6_actor.cpp
@@ -705,17 +705,12 @@ bool U6Actor::weapon_can_hit(const CombatType *weapon, Actor *target, uint16 *hi
 		return true;
 	}
 
-	Std::list<Obj *> *surrounding_objs = target->get_surrounding_obj_list();
-
-	if (surrounding_objs) {
-		Std::list<Obj *>::iterator obj_iter;
-		for (obj_iter = surrounding_objs->begin(); obj_iter != surrounding_objs->end(); obj_iter++) {
-			Obj *obj = *obj_iter;
-			if (Actor::weapon_can_hit(weapon, obj->x, obj->y)) {
-				*hit_x = obj->x;
-				*hit_y = obj->y;
-				return true;
-			}
+	const Std::list<Obj *> &surrounding_objs = target->get_surrounding_obj_list();
+	for (Obj *obj : surrounding_objs) {
+		if (Actor::weapon_can_hit(weapon, obj->x, obj->y)) {
+			*hit_x = obj->x;
+			*hit_y = obj->y;
+			return true;
 		}
 	}
 
@@ -1022,32 +1017,24 @@ inline bool U6Actor::has_surrounding_objs() {
 }
 
 inline void U6Actor::remove_surrounding_objs_from_map() {
-	Std::list<Obj *>::iterator obj;
-
-	for (obj = surrounding_objects.begin(); obj != surrounding_objects.end(); obj++)
-		obj_manager->remove_obj_from_map((*obj));
+	for (Obj *obj : surrounding_objects)
+		obj_manager->remove_obj_from_map(obj);
 
 	return;
 }
 
 inline void U6Actor::add_surrounding_objs_to_map() {
-	Std::list<Obj *>::reverse_iterator obj;
-
-	for (obj = surrounding_objects.rbegin(); obj != surrounding_objects.rend(); ++obj)
-		obj_manager->add_obj((*obj), OBJ_ADD_TOP);
+	for (Obj *obj : surrounding_objects)
+		obj_manager->add_obj(obj, OBJ_ADD_TOP);
 
 	return;
 }
 
 inline void U6Actor::move_surrounding_objs_relative(sint16 rel_x, sint16 rel_y) {
-	Std::list<Obj *>::iterator obj_iter;
-	Obj *obj;
-
 	if (obj_n == OBJ_U6_SILVER_SERPENT) {
 		move_silver_serpent_objs_relative(rel_x, rel_y);
 	} else {
-		for (obj_iter = surrounding_objects.begin(); obj_iter != surrounding_objects.end(); obj_iter++) {
-			obj = *obj_iter;
+		for (Obj *obj : surrounding_objects) {
 			obj->x = WRAPPED_COORD(obj->x + rel_x, z);
 			obj->y = WRAPPED_COORD(obj->y + rel_y, z);
 		}
@@ -1356,12 +1343,8 @@ inline void U6Actor::set_direction_of_surrounding_dragon_objs(NuvieDir new_direc
 }
 
 inline void U6Actor::twitch_surrounding_objs() {
-	Std::list<Obj *>::iterator obj;
-
-	for (obj = surrounding_objects.begin(); obj != surrounding_objects.end(); obj++) {
-		twitch_obj(*obj);
-	}
-
+	for (Obj *obj : surrounding_objects)
+		twitch_obj(obj);
 }
 
 inline void U6Actor::twitch_surrounding_dragon_objs() {
@@ -1409,8 +1392,6 @@ inline void U6Actor::twitch_obj(Obj *obj) {
 }
 
 inline void U6Actor::clear_surrounding_objs_list(bool delete_objs) {
-	Std::list<Obj *>::iterator obj;
-
 	if (surrounding_objects.empty())
 		return;
 
@@ -1419,7 +1400,7 @@ inline void U6Actor::clear_surrounding_objs_list(bool delete_objs) {
 		return;
 	}
 
-	obj = surrounding_objects.begin();
+	Std::list<Obj *>::iterator obj = surrounding_objects.begin();
 
 	for (; !surrounding_objects.empty();) {
 		obj_manager->remove_obj_from_map(*obj);
diff --git a/engines/ultima/nuvie/conf/configuration.cpp b/engines/ultima/nuvie/conf/configuration.cpp
index 24f57f0d1f3..b2aeb83e2de 100644
--- a/engines/ultima/nuvie/conf/configuration.cpp
+++ b/engines/ultima/nuvie/conf/configuration.cpp
@@ -41,9 +41,8 @@ Configuration::Configuration() : _configChanged(false) {
 }
 
 Configuration::~Configuration() {
-	for (Std::vector<Shared::XMLTree *>::iterator i = _trees.begin();
-	        i != _trees.end(); ++i) {
-		delete(*i);
+	for (Shared::XMLTree *t : _trees) {
+		delete(t);
 	}
 
 	if (_configChanged)
@@ -65,17 +64,15 @@ bool Configuration::readConfigFile(const Std::string &fname, const Std::string &
 }
 
 void Configuration::write() {
-	for (Std::vector<Shared::XMLTree *>::iterator i = _trees.begin();
-	        i != _trees.end(); ++i) {
-		if (!(*i)->isReadonly())
-			(*i)->write();
+	for (Shared::XMLTree *t : _trees) {
+		if (!t->isReadonly())
+			t->write();
 	}
 }
 
 void Configuration::clear() {
-	for (Std::vector<Shared::XMLTree *>::iterator i = _trees.begin();
-	        i != _trees.end(); ++i) {
-		delete(*i);
+	for (Shared::XMLTree *t : _trees) {
+		delete(t);
 	}
 	_trees.clear();
 }
@@ -283,10 +280,9 @@ Std::set<Std::string> Configuration::listKeys(const Std::string &key, bool longf
 }
 
 void Configuration::getSubkeys(KeyTypeList &ktl, const Std::string &basekey) {
-	for (Std::vector<Shared::XMLTree *>::iterator tree = _trees.begin();
-	        tree != _trees.end(); ++tree) {
+	for (Shared::XMLTree *tree : _trees) {
 		Shared::XMLTree::KeyTypeList l;
-		(*tree)->getSubkeys(l, basekey);
+		tree->getSubkeys(l, basekey);
 
 		for (Shared::XMLTree::KeyTypeList::iterator i = l.begin();
 		        i != l.end(); ++i) {
diff --git a/engines/ultima/nuvie/core/effect.cpp b/engines/ultima/nuvie/core/effect.cpp
index 4824cc7a952..684c4cdb91e 100644
--- a/engines/ultima/nuvie/core/effect.cpp
+++ b/engines/ultima/nuvie/core/effect.cpp
@@ -1314,14 +1314,9 @@ void TileFadeEffect::add_actor_anim() {
 	Tile *from = actor->get_tile();
 	add_tile_anim(loc, from);
 
-	Std::list<Obj *> *surrounding_objs = actor->get_surrounding_obj_list();
-
-	if (surrounding_objs) {
-		Std::list<Obj *>::iterator obj_iter;
-		for (obj_iter = surrounding_objs->begin(); obj_iter != surrounding_objs->end(); obj_iter++) {
-			add_obj_anim(*obj_iter);
-		}
-	}
+	const Std::list<Obj *> &surrounding_objs = actor->get_surrounding_obj_list();
+	for (Obj *obj : surrounding_objs)
+		add_obj_anim(obj);
 }
 
 void TileFadeEffect::add_obj_anim(Obj *obj) {
@@ -1420,14 +1415,9 @@ void TileBlackFadeEffect::add_actor_anim() {
 	Tile *from = actor->get_tile();
 	add_tile_anim(loc, from);
 
-	Std::list<Obj *> *surrounding_objs = actor->get_surrounding_obj_list();
-
-	if (surrounding_objs) {
-		Std::list<Obj *>::iterator obj_iter;
-		for (obj_iter = surrounding_objs->begin(); obj_iter != surrounding_objs->end(); obj_iter++) {
-			add_obj_anim(*obj_iter);
-		}
-	}
+	const Std::list<Obj *> &surrounding_objs = actor->get_surrounding_obj_list();
+	for (Obj *o : surrounding_objs)
+		add_obj_anim(o);
 }
 
 void TileBlackFadeEffect::add_obj_anim(Obj *o) {
diff --git a/engines/ultima/nuvie/core/egg_manager.cpp b/engines/ultima/nuvie/core/egg_manager.cpp
index 761021960ac..a8740b6e755 100644
--- a/engines/ultima/nuvie/core/egg_manager.cpp
+++ b/engines/ultima/nuvie/core/egg_manager.cpp
@@ -112,36 +112,30 @@ void EggManager::remove_egg(Obj *egg_obj, bool keep_obj) {
 }
 
 void EggManager::set_egg_visibility(bool show_eggs) {
-	Std::list<Egg *>::iterator egg_iter;
-
-	for (egg_iter = egg_list.begin(); egg_iter != egg_list.end(); egg_iter++)
-		(*egg_iter)->obj->set_invisible(!show_eggs);
+	for (Egg *egg : egg_list)
+		egg->obj->set_invisible(!show_eggs);
 }
 
 void EggManager::spawn_eggs(uint16 x, uint16 y, uint8 z, bool teleport) {
-	Std::list<Egg *>::iterator egg;
-	sint16 dist_x, dist_y;
-	uint8 hatch_probability;
-
-	for (egg = egg_list.begin(); egg != egg_list.end();) {
-		uint8 quality = (*egg)->obj->quality;
-		dist_x = abs((sint16)(*egg)->obj->x - x);
-		dist_y = abs((sint16)(*egg)->obj->y - y);
+	for (Egg *egg : egg_list) {
+		uint8 quality = egg->obj->quality;
+		sint16 dist_x = abs((sint16)egg->obj->x - x);
+		sint16 dist_y = abs((sint16)egg->obj->y - y);
 
 		//Deactivate eggs that are more than 20 tiles from player.
-		if (((*egg)->obj->status & OBJ_STATUS_EGG_ACTIVE) && ((*egg)->obj->z != z || (dist_x >= 20 || dist_y >= 20))) {
-			(*egg)->obj->status &= (0xff ^ OBJ_STATUS_EGG_ACTIVE);
-			DEBUG(0, LEVEL_DEBUGGING, "Reactivate egg at (%x,%x,%d)\n", (*egg)->obj->x, (*egg)->obj->y, (*egg)->obj->z);
+		if ((egg->obj->status & OBJ_STATUS_EGG_ACTIVE) && (egg->obj->z != z || (dist_x >= 20 || dist_y >= 20))) {
+			egg->obj->status &= (0xff ^ OBJ_STATUS_EGG_ACTIVE);
+			DEBUG(0, LEVEL_DEBUGGING, "Reactivate egg at (%x,%x,%d)\n", egg->obj->x, egg->obj->y, egg->obj->z);
 		}
 
-		if (dist_x < 20 && dist_y < 20 && (*egg)->obj->z == z
+		if (dist_x < 20 && dist_y < 20 && egg->obj->z == z
 		        && (dist_x > 8 || dist_y > 8 || !Game::get_game()->is_orig_style() || teleport)) {
 
-			if (((*egg)->obj->status & OBJ_STATUS_EGG_ACTIVE) == 0) {
-				(*egg)->obj->status |= OBJ_STATUS_EGG_ACTIVE;
+			if ((egg->obj->status & OBJ_STATUS_EGG_ACTIVE) == 0) {
+				egg->obj->status |= OBJ_STATUS_EGG_ACTIVE;
 
-				hatch_probability = (NUVIE_RAND() % 100) + 1;
-				DEBUG(0, LEVEL_DEBUGGING, "Checking Egg (%x,%x,%x). Rand: %d Probability: %d%%", (*egg)->obj->x, (*egg)->obj->y, (*egg)->obj->z, hatch_probability, (*egg)->obj->qty);
+				uint8 hatch_probability = (NUVIE_RAND() % 100) + 1;
+				DEBUG(0, LEVEL_DEBUGGING, "Checking Egg (%x,%x,%x). Rand: %d Probability: %d%%", egg->obj->x, egg->obj->y, egg->obj->z, hatch_probability, egg->obj->qty);
 
 				DEBUG(1, LEVEL_DEBUGGING, " Align: %s", get_actor_alignment_str(static_cast<ActorAlignment>(quality % 10)));
 
@@ -150,11 +144,9 @@ void EggManager::spawn_eggs(uint16 x, uint16 y, uint8 z, bool teleport) {
 				else if (quality < 30) DEBUG(1, LEVEL_DEBUGGING, " (night)");  // 20-29
 				else if (quality < 40) DEBUG(1, LEVEL_DEBUGGING, " (day+night)"); // 30-39
 				DEBUG(1, LEVEL_DEBUGGING, "\n");
-				spawn_egg((*egg)->obj, hatch_probability);
+				spawn_egg(egg->obj, hatch_probability);
 			}
 		}
-
-		egg++;
 	}
 
 	return;
diff --git a/engines/ultima/nuvie/core/obj_manager.cpp b/engines/ultima/nuvie/core/obj_manager.cpp
index f024b8ac389..b3a85d85342 100644
--- a/engines/ultima/nuvie/core/obj_manager.cpp
+++ b/engines/ultima/nuvie/core/obj_manager.cpp
@@ -250,22 +250,19 @@ bool ObjManager::save_super_chunk(NuvieIO *save_buf, uint8 level, uint8 chunk_of
 }
 
 bool ObjManager::save_eggs(NuvieIO *save_buf) {
-	uint32 start_pos;
 	uint32 finish_pos;
-	Std::list<Egg *> *egg_list;
-	Std::list<Egg *>::iterator egg;
 
-	start_pos = save_buf->position();
+	uint32 start_pos = save_buf->position();
 
 //skip number of objects we will fill that in at the end.
 	save_buf->write2(0);
 
-	egg_list = egg_manager->get_egg_list();
+	Std::list<Egg *> *egg_list = egg_manager->get_egg_list();
 
 	obj_save_count = 0;
 
-	for (egg = egg_list->begin(); egg != egg_list->end(); egg++)
-		save_obj(save_buf, (*egg)->obj, obj_save_count);
+	for (Egg *egg : *egg_list)
+		save_obj(save_buf, egg->obj, obj_save_count);
 
 	finish_pos = save_buf->position();
 	save_buf->seek(start_pos);
@@ -398,9 +395,8 @@ void ObjManager::clean() {
 // remove the temporary object list. The objects were deleted from the surface and dungeon trees.
 	temp_obj_list.clear();
 
-	for (Std::list<Obj *>::iterator it = tile_obj_list.begin(); it != tile_obj_list.end(); ++it) {
-		delete *it;
-	}
+	for (Obj *obj : tile_obj_list)
+		delete obj;
 	tile_obj_list.clear();
 
 	return;
@@ -1229,10 +1225,9 @@ Obj *ObjManager::get_objBasedAt(uint16 x, uint16 y, uint8 level, bool top_obj, b
 // ObjManager keeps one instance of tile_obj per object.
 // SE has 3 tile objects (Trees, Yucca Plants, and Oven Fires)
 Obj *ObjManager::get_tile_obj(uint16 obj_n) {
-	for (Std::list<Obj *>::iterator it = tile_obj_list.begin(); it != tile_obj_list.end(); ++it) {
-		if ((*it)->obj_n == obj_n) {
-			return *it;
-		}
+	for (Obj *o : tile_obj_list) {
+		if (o->obj_n == obj_n)
+			return o;
 	}
 	Obj *obj = new Obj();
 	obj->obj_n = obj_n;
diff --git a/engines/ultima/nuvie/core/weather.cpp b/engines/ultima/nuvie/core/weather.cpp
index e9a82fd08e5..d62ec88cd94 100644
--- a/engines/ultima/nuvie/core/weather.cpp
+++ b/engines/ultima/nuvie/core/weather.cpp
@@ -226,9 +226,8 @@ inline void Weather::set_wind_change_callback() {
 }
 
 inline void Weather::send_wind_change_notification_callback() {
-	Std::list<CallBack *>::iterator cb_iter;
-	for (cb_iter = wind_change_notification_list.begin(); cb_iter != wind_change_notification_list.end(); cb_iter++)
-		(*cb_iter)->callback(WEATHER_CB_CHANGE_WIND_DIR, (CallBack *)this, nullptr);
+	for (CallBack *cb : wind_change_notification_list)
+		cb->callback(WEATHER_CB_CHANGE_WIND_DIR, (CallBack *)this, nullptr);
 }
 
 bool Weather::add_wind_change_notification_callback(CallBack *caller) {
diff --git a/engines/ultima/nuvie/files/nuvie_file_list.cpp b/engines/ultima/nuvie/files/nuvie_file_list.cpp
index ab0b7af7769..aff00bb6e82 100644
--- a/engines/ultima/nuvie/files/nuvie_file_list.cpp
+++ b/engines/ultima/nuvie/files/nuvie_file_list.cpp
@@ -51,8 +51,8 @@ bool NuvieFileList::open(const char *directory, const char *search, uint8 s_mode
 		ConsoleAddWarning(Std::string("Failed to get children of ") + directory);
 		return false;
 	};
-	for (Common::FSList::iterator it = list.begin(); it != list.end(); ++it)
-		add_filename(*it);
+	for (const Common::FSNode &node : list)
+		add_filename(node);
 
 	//sort list by time last modified in decending order.
 	Common::sort(file_list.begin(), file_list.end(), NuvieFileDesc());
diff --git a/engines/ultima/nuvie/gui/gui_console.cpp b/engines/ultima/nuvie/gui/gui_console.cpp
index e44ed77738a..78741c2de4f 100644
--- a/engines/ultima/nuvie/gui/gui_console.cpp
+++ b/engines/ultima/nuvie/gui/gui_console.cpp
@@ -58,8 +58,8 @@ void GUI_Console:: Display(bool full_redraw) {
 	SDL_FillRect(surface, &framerect, bg_color->sdl_color);
 
 	uint16 i = 0;
-	for (Std::list<Std::string>::iterator it = data.begin(); it != data.end(); it++) {
-		font->textOut(surface, area.left, area.top + i * font->charHeight(), (*it).c_str(), false);
+	for (const Std::string &s : data) {
+		font->textOut(surface, area.left, area.top + i * font->charHeight(), s.c_str(), false);
 		i++;
 	}
 	screen->update(area.left, area.top, area.width(), area.height());
diff --git a/engines/ultima/nuvie/gui/gui_scroller.cpp b/engines/ultima/nuvie/gui/gui_scroller.cpp
index 2fb94b10e28..ce99c3d1f9a 100644
--- a/engines/ultima/nuvie/gui/gui_scroller.cpp
+++ b/engines/ultima/nuvie/gui/gui_scroller.cpp
@@ -76,8 +76,7 @@ void GUI_Scroller::update_viewport(bool update_slider) {
 		scroll_bar->set_slider_position(s_pos);
 	}
 
-	Std::list<GUI_Widget *>::iterator child;
-	child = children.begin();
+	Std::list<GUI_Widget *>::iterator child = children.begin();
 	child++; // skip the scroll_bar widget. This is a bit evil.
 
 	for (i = 0; child != children.end(); child++, i++) {
diff --git a/engines/ultima/nuvie/gui/widgets/converse_gump.cpp b/engines/ultima/nuvie/gui/widgets/converse_gump.cpp
index 7ce4d806f68..1466f50e9d1 100644
--- a/engines/ultima/nuvie/gui/widgets/converse_gump.cpp
+++ b/engines/ultima/nuvie/gui/widgets/converse_gump.cpp
@@ -436,9 +436,8 @@ void ConverseGump::parse_fm_towns_token(MsgText *token) {
 void ConverseGump::add_keyword(const Std::string keyword_) {
 	string keyword = " *" + keyword_;
 
-	Std::list<MsgText>::iterator iter;
-	for (iter = keyword_list->begin(); iter != keyword_list->end(); iter++) {
-		if (string_i_compare((*iter).s, keyword)) {
+	for (const MsgText &txt : *keyword_list) {
+		if (string_i_compare(txt.s, keyword)) {
 			return;
 		}
 	}
@@ -511,8 +510,6 @@ bool ConverseGump::input_buf_remove_char() {
 }
 
 void ConverseGump::Display(bool full_redraw) {
-	MsgText *token;
-	//Std::list<MsgText>::iterator iter;
 	uint16 total_length = 0;
 	uint16 y = area.top + portrait_height + 8 + 3;
 
@@ -531,10 +528,8 @@ void ConverseGump::Display(bool full_redraw) {
 
 	if (!page_break && input_mode && avatar_portrait && is_talking()) {
 		screen->blit(area.left + portrait_width / 2 + 4, y, avatar_portrait, 8, frame_w, frame_h, frame_w, use_transparency);
-		Std::list<MsgText>::iterator iter;
 		sint16 i = 0;
-		for (iter = keyword_list->begin(); iter != keyword_list->end(); i++, iter++) {
-			MsgText t = *iter;
+		for (const MsgText &t : *keyword_list) {
 			uint16 token_len = font->getStringWidth(t.s.c_str());
 //			 if(token_len + total_length >= (26 * 8))
 			if (portrait_width / 2 + portrait_width + token_len + total_length + 8 >= min_w - 4) {
@@ -559,14 +554,8 @@ void ConverseGump::Display(bool full_redraw) {
 
 	y = area.top + 4;
 	total_length = 0;
-	Std::list<MsgLine *>::iterator iter;
-	for (iter = msg_buf.begin(); iter != msg_buf.end(); iter++) {
-		MsgLine *msg_line = *iter;
-		Std::list<MsgText *>::iterator iter1;
-
-		for (iter1 = msg_line->text.begin(); iter1 != msg_line->text.end() ; iter1++) {
-			token = *iter1;
-
+	for (const MsgLine *line : msg_buf) {
+		for (const MsgText *token : line->text) {
 			total_length += token->font->drawString(screen, token->s.c_str(), area.left + 4 + frame_w + 4 + total_length, y + 4, 0, 0); //FIX for hardcoded font height
 
 			//token->s.length();
diff --git a/engines/ultima/nuvie/gui/widgets/gui_widget.cpp b/engines/ultima/nuvie/gui/widgets/gui_widget.cpp
index a928eb48b36..335584660c8 100644
--- a/engines/ultima/nuvie/gui/widgets/gui_widget.cpp
+++ b/engines/ultima/nuvie/gui/widgets/gui_widget.cpp
@@ -100,38 +100,32 @@ void GUI_Widget:: Delete(void) {
 }
 
 void GUI_Widget::MoveRelative(int dx, int dy) {
-	Std::list<GUI_Widget *>::iterator child;
-
 	area.translate(dx, dy);
 
-	for (child = children.begin(); child != children.end(); child++)
-		(*child)->MoveRelative(dx, dy);
+	for (GUI_Widget *child : children)
+		child->MoveRelative(dx, dy);
 
 	return;
 }
 
 void GUI_Widget::Move(int32 new_x, int32 new_y) {
-	Std::list<GUI_Widget *>::iterator child;
-
 	area.moveTo(new_x + offset_x, new_y + offset_y);
 
-	for (child = children.begin(); child != children.end(); child++)
-		(*child)->Move(area.left, area.top);
+	for (GUI_Widget *child : children)
+		child->Move(area.left, area.top);
 
 	return;
 }
 
 void GUI_Widget::MoveRelativeToParent(int dx, int dy) {
-	Std::list<GUI_Widget *>::iterator child;
-
 	area.left = (area.left - offset_x) + dx;
 	area.top = (area.top - offset_y) + dy;
 
 	offset_x = dx;
 	offset_y = dy;
 
-	for (child = children.begin(); child != children.end(); child++)
-		(*child)->Move(area.left, area.top);
+	for (GUI_Widget *child : children)
+		child->Move(area.left, area.top);
 
 	return;
 }
@@ -155,8 +149,6 @@ void GUI_Widget::moveToFront() {
 }
 
 void GUI_Widget::PlaceOnScreen(Screen *s, GUI_DragManager *dm, int x, int y) {
-	Std::list<GUI_Widget *>::iterator child;
-
 	if (screen != nullptr)
 		return;
 
@@ -167,8 +159,8 @@ void GUI_Widget::PlaceOnScreen(Screen *s, GUI_DragManager *dm, int x, int y) {
 	SetDisplay(s);
 
 	/* place our children relative to ourself */
-	for (child = children.begin(); child != children.end(); child++)
-		(*child)->PlaceOnScreen(screen, dm, area.left, area.top);
+	for (GUI_Widget *child : children)
+		child->PlaceOnScreen(screen, dm, area.left, area.top);
 	return;
 }
 
@@ -259,12 +251,10 @@ void GUI_Widget::DisplayChildren(bool full_redraw) {
 		full_redraw = true;
 
 	if (children.empty() == false) {
-		Std::list<GUI_Widget *>::iterator child;
-
 		/* display our children */
-		for (child = children.begin(); child != children.end(); child++) {
-			if ((*child)->Status() == WIDGET_VISIBLE)
-				(*child)->Display(full_redraw);
+		for (GUI_Widget *child : children) {
+			if (child->Status() == WIDGET_VISIBLE)
+				child->Display(full_redraw);
 		}
 	}
 
@@ -287,10 +277,9 @@ void GUI_Widget::Redraw(void) {
 // Idle and HandleEvent produce delayed clicks. Don't override if using those. -- SB-X
 GUI_status GUI_Widget::Idle(void) {
 	if (children.empty() == false) {
-		Std::list<GUI_Widget *>::iterator child;
 		/* idle our children */
-		for (child = children.begin(); child != children.end(); child++) {
-			GUI_status idleStatus = (*child)->Idle();
+		for (GUI_Widget *child : children) {
+			GUI_status idleStatus = child->Idle();
 			if (idleStatus != GUI_PASS)
 				return idleStatus;
 		}
@@ -339,11 +328,9 @@ GUI_status GUI_Widget::HandleEvent(const Common::Event *event) {
 		return GUI_PASS;
 
 	if (children.empty() == false) {
-		Std::list<GUI_Widget *>::iterator child;
-
 		/* handle our children */
-		for (child = children.begin(); child != children.end(); child++) {
-			GUI_status status_ = (*child)->HandleEvent(event);
+		for (GUI_Widget *child : children) {
+			GUI_status status_ = child->HandleEvent(event);
 			if (status_ != GUI_PASS)
 				return status_;
 		}
@@ -449,11 +436,9 @@ GUI_status GUI_Widget::HandleEvent(const Common::Event *event) {
 // iterate through children if present to hit the correct drag area.
 bool GUI_Widget::drag_accept_drop(int x, int y, int message, void *data) {
 	if (children.empty() == false) {
-		Std::list<GUI_Widget *>::iterator child;
-
-		for (child = children.begin(); child != children.end(); child++) {
-			if ((*child)->HitRect(x, y)) {
-				if ((*child)->drag_accept_drop(x, y, message, data))
+		for (GUI_Widget *child : children) {
+			if (child->HitRect(x, y)) {
+				if (child->drag_accept_drop(x, y, message, data))
 					return true;
 			}
 		}
@@ -465,11 +450,9 @@ bool GUI_Widget::drag_accept_drop(int x, int y, int message, void *data) {
 
 void GUI_Widget::drag_perform_drop(int x, int y, int message, void *data) {
 	if (children.empty() == false) {
-		Std::list<GUI_Widget *>::iterator child;
-
-		for (child = children.begin(); child != children.end(); child++) {
-			if ((*child)->HitRect(x, y)) {
-				(*child)->drag_perform_drop(x, y, message, data);
+		for (GUI_Widget *child : children) {
+			if (child->HitRect(x, y)) {
+				child->drag_perform_drop(x, y, message, data);
 				break;
 			}
 		}
diff --git a/engines/ultima/nuvie/gui/widgets/map_window.cpp b/engines/ultima/nuvie/gui/widgets/map_window.cpp
index 5b13c38a603..cc08e1bee32 100644
--- a/engines/ultima/nuvie/gui/widgets/map_window.cpp
+++ b/engines/ultima/nuvie/gui/widgets/map_window.cpp
@@ -156,8 +156,6 @@ MapWindow::~MapWindow() {
 }
 
 bool MapWindow::init(TileManager *tm, ObjManager *om, ActorManager *am) {
-// int game_type; Why is this local, and retrieved again here? --SB-X
-
 	game = Game::get_game();
 
 	tile_manager = tm;
@@ -392,7 +390,7 @@ void MapWindow::moveMapRelative(sint16 rel_x, sint16 rel_y) {
 /* Move map by relative pixel amount.
  */
 void MapWindow::shiftMapRelative(sint16 rel_x, sint16 rel_y) {
-	uint8 tile_pitch = 16;
+	const uint8 tile_pitch = 16;
 	uint32 total_px = (cur_x * tile_pitch) + cur_x_add,
 	       total_py = (cur_y * tile_pitch) + cur_y_add;
 	total_px += rel_x;
@@ -490,7 +488,7 @@ bool MapWindow::tile_is_black(uint16 x, uint16 y, Obj *obj) {
 	if (tmpBufTileIsBlack(wrapped_x + TMP_MAP_BORDER, y - cur_y + TMP_MAP_BORDER))
 		return true;
 	else if (obj) {
-		Tile *tile = tile_manager->get_original_tile(obj_manager->get_obj_tile_num(obj->obj_n) + obj->frame_n);
+		const Tile *tile = tile_manager->get_original_tile(obj_manager->get_obj_tile_num(obj->obj_n) + obj->frame_n);
 		if (!tile || (tmpBufTileIsBlack(wrapped_x + TMP_MAP_BORDER + 1, y - cur_y + TMP_MAP_BORDER)  && !(tile->flags1 & TILEFLAG_WALL))
 		        || (tmpBufTileIsBlack(wrapped_x + TMP_MAP_BORDER, y - cur_y + TMP_MAP_BORDER + 1) && !(tile->flags1 & TILEFLAG_WALL)))
 			return true;
@@ -500,13 +498,11 @@ bool MapWindow::tile_is_black(uint16 x, uint16 y, Obj *obj) {
 }
 
 const char *MapWindow::look(uint16 x, uint16 y, bool show_prefix) {
-	Actor *actor;
-
 	if (tmp_map_buf[(y + TMP_MAP_BORDER) * tmp_map_width + (x + TMP_MAP_BORDER)] == 0) //black area
 		return "darkness."; // nothing to see here. ;)
 
 	uint16 wrapped_x = WRAPPED_COORD(cur_x + x, cur_level);
-	actor = actor_manager->get_actor(wrapped_x, cur_y + y, cur_level);
+	const Actor *actor = actor_manager->get_actor(wrapped_x, cur_y + y, cur_level);
 	if (actor != nullptr && actor->is_visible())
 		return actor_manager->look_actor(actor, show_prefix);
 
@@ -545,8 +541,6 @@ Obj *MapWindow::get_objAtCoord(MapCoord coord, bool top_obj, bool include_ignore
 }
 
 Actor *MapWindow::get_actorAtCursor() {
-//Actor *actor;
-
 	if (tmp_map_buf[(cursor_y + TMP_MAP_BORDER) * tmp_map_width + (cursor_x + TMP_MAP_BORDER)] == 0) //black area
 		return nullptr; // nothing to see here. ;)
 
@@ -593,7 +587,6 @@ void MapWindow::update() {
 
 	// do fade-in on the first update (game has loaded now)
 	if (game_started == false) {
-//        new FadeEffect(FADE_PIXELATED_ONTOP, FADE_IN, 0x31);
 		new GameFadeInEffect(game->get_palette()->get_bg_color());
 		game_started = true;
 	}
@@ -668,7 +661,7 @@ void MapWindow::createLightOverlay() {
 
 	if (!screen)
 		return;
-	bool dawn_or_dusk = false;
+
 	uint8 cur_min_brightness;
 	if (game->are_cheats_enabled())
 		cur_min_brightness = min_brightness;
@@ -678,6 +671,7 @@ void MapWindow::createLightOverlay() {
 	GameClock *clock = game->get_clock();
 	Weather *weather = game->get_weather();
 
+	bool dawn_or_dusk = false;
 	int h = clock->get_hour();
 	int a;
 	if (x_ray_view >= X_RAY_ON)
@@ -711,6 +705,7 @@ void MapWindow::createLightOverlay() {
 
 	if (a > 255)
 		a = 255;
+
 	bool party_light_source;
 	// smooth seems to need an enormous range in order to have smooth transitions
 	if (a < (screen->get_lighting_style() == LIGHTING_STYLE_SMOOTH ? 248 : 81) &&
@@ -734,11 +729,10 @@ void MapWindow::createLightOverlay() {
 }
 
 void MapWindow::updateLighting() {
-	uint16 x, y;
 	if (using_map_tile_lighting) {
 		uint16 *ptr = tmp_map_buf;
-		for (y = 0; y < tmp_map_height; y++) {
-			for (x = 0; x < tmp_map_width; x++) {
+		for (uint16 y = 0; y < tmp_map_height; y++) {
+			for (uint16 x = 0; x < tmp_map_width; x++) {
 				if (tmp_map_buf[x + y * tmp_map_width] != 0) {
 					Tile *tile = tile_manager->get_tile(*ptr);
 					if (GET_TILE_LIGHT_LEVEL(tile) > 0)
@@ -800,40 +794,31 @@ void MapWindow::updateBlacking() {
 }
 
 void MapWindow::Display(bool full_redraw) {
-	uint16 i, j;
-	uint16 *map_ptr;
-// uint16 map_width;
-	Tile *tile;
-//byte *ptr;
-
 	if (lighting_update_required) {
 		createLightOverlay();
 	}
 
-//map_ptr = map->get_map_data(cur_level);
-// map_width = map->get_width(cur_level);
-
-//map_ptr += cur_y * map_width + cur_x;
-	map_ptr = tmp_map_buf;
+	uint16 *map_ptr = tmp_map_buf;
 	map_ptr += (TMP_MAP_BORDER * tmp_map_width + TMP_MAP_BORDER);// * sizeof(uint16); //remember our tmp map is TMP_MAP_BORDER bigger all around.
 
-	for (i = 0; i < win_height; i++) {
-		for (j = 0; j < win_width; j++) {
+	for (uint16 i = 0; i < win_height; i++) {
+		for (uint16 j = 0; j < win_width; j++) {
 			sint16 draw_x = area.left + (j * 16), draw_y = area.top + (i * 16);
 			//draw_x -= (cur_x_add <= draw_x) ? cur_x_add : draw_x;
 			//draw_y -= (cur_y_add <= draw_y) ? cur_y_add : draw_y;
 			draw_x -= cur_x_add;
 			draw_y -= cur_y_add;
-			if (map_ptr[j] == 0)
+			if (map_ptr[j] == 0) {
 				screen->clear(draw_x, draw_y, 16, 16, &clip_rect); //blackout tile.
-			else {
+			} else {
+				const Tile *tile;
 				if (map_ptr[j] >= 16 && map_ptr[j] < 48) { //lay down the base tile for shoreline tiles
 					tile = tile_manager->get_anim_base_tile(map_ptr[j]);
-					screen->blit(draw_x, draw_y, (byte *)tile->data, 8, 16, 16, 16, tile->transparent, &clip_rect);
+					screen->blit(draw_x, draw_y, (const byte *)tile->data, 8, 16, 16, 16, tile->transparent, &clip_rect);
 				}
 
 				tile = tile_manager->get_tile(map_ptr[j]);
-				screen->blit(draw_x, draw_y, (byte *)tile->data, 8, 16, 16, 16, tile->transparent, &clip_rect);
+				screen->blit(draw_x, draw_y, (const byte *)tile->data, 8, 16, 16, 16, tile->transparent, &clip_rect);
 
 			}
 
@@ -913,11 +898,8 @@ void MapWindow::Display(bool full_redraw) {
 }
 
 void MapWindow::drawActors() {
-	uint16 i;
-	Actor *actor;
-
-	for (i = 0; i < 256; i++) {
-		actor = actor_manager->get_actor(i);
+	for (uint16 i = 0; i < 256; i++) {
+		Actor *actor = actor_manager->get_actor(i);
 
 		if (actor->z == cur_level) {
 			uint8 x = WRAP_VIEWP(cur_x, actor->x, map_width);
@@ -933,7 +915,7 @@ void MapWindow::drawActors() {
 }
 
 //FIX need a function for multi-tile actors.
-inline void MapWindow::drawActor(Actor *actor) {
+inline void MapWindow::drawActor(const Actor *actor) {
 	if (actor->is_visible() /* && actor->obj_n != 0*/
 	        && (!(actor->obj_flags & OBJ_STATUS_INVISIBLE) || actor->is_in_party() || actor == actor_manager->get_player())
 	        && actor->get_corpser_flag() == false) {
@@ -967,17 +949,12 @@ inline void MapWindow::drawActor(Actor *actor) {
 			drawTile(tile, wrapped_x, actor->y - cur_y, false);
 			drawTile(tile, wrapped_x, actor->y - cur_y, true);
 			if (game->get_clock()->get_timer(GAMECLOCK_TIMER_U6_INFRAVISION) != 0) {
-				Std::list<Obj *> *surrounding_objs = actor->get_surrounding_obj_list();
-
-				if (surrounding_objs) {
-					Std::list<Obj *>::iterator obj_iter;
-					for (obj_iter = surrounding_objs->begin(); obj_iter != surrounding_objs->end(); obj_iter++) {
-						Obj *obj = *obj_iter;
-						Tile *t = tile_manager->get_original_tile(obj_manager->get_obj_tile_num(obj->obj_n) + obj->frame_n);
-						uint16 wrapped_obj_x = WRAP_VIEWP(cur_x, obj->x, map_width);
-						drawTile(t, wrapped_obj_x, obj->y - cur_y, false);
-						drawTile(t, wrapped_obj_x, obj->y - cur_y, true); // doesn't seem needed but will do it anyway (for now)
-					}
+				const Std::list<Obj *> &surrounding_objs = actor->get_surrounding_obj_list();
+				for (Obj *obj : surrounding_objs) {
+					const Tile *t = tile_manager->get_original_tile(obj_manager->get_obj_tile_num(obj->obj_n) + obj->frame_n);
+					uint16 wrapped_obj_x = WRAP_VIEWP(cur_x, obj->x, map_width);
+					drawTile(t, wrapped_obj_x, obj->y - cur_y, false);
+					drawTile(t, wrapped_obj_x, obj->y - cur_y, true); // doesn't seem needed but will do it anyway (for now)
 				}
 			}
 		}
@@ -1017,10 +994,6 @@ inline void MapWindow::drawLensAnim() {
 }
 
 void MapWindow::drawObjSuperBlock(bool draw_lowertiles, bool toptile) {
-	U6Link *link;
-	U6LList *obj_list;
-	Obj *obj;
-	sint16 x, y;
 	uint16 stop_x, stop_y;
 
 	if (cur_x < 0)
@@ -1033,12 +1006,12 @@ void MapWindow::drawObjSuperBlock(bool draw_lowertiles, bool toptile) {
 	else
 		stop_y = cur_y;
 
-	for (y = cur_y + win_height; y >= stop_y; y--) {
-		for (x = cur_x + win_width; x >= stop_x; x--) {
-			obj_list = obj_manager->get_obj_list(x, y, cur_level);
+	for (sint16 y = cur_y + win_height; y >= stop_y; y--) {
+		for (sint16 x = cur_x + win_width; x >= stop_x; x--) {
+			U6LList *obj_list = obj_manager->get_obj_list(x, y, cur_level);
 			if (obj_list) {
-				for (link = obj_list->start(); link != nullptr; link = link->next) {
-					obj = (Obj *)link->data;
+				for (U6Link *link = obj_list->start(); link != nullptr; link = link->next) {
+					Obj *obj = (Obj *)link->data;
 					drawObj(obj, draw_lowertiles, toptile);
 				}
 			}
@@ -1047,12 +1020,9 @@ void MapWindow::drawObjSuperBlock(bool draw_lowertiles, bool toptile) {
 
 }
 
-inline void MapWindow::drawObj(Obj *obj, bool draw_lowertiles, bool toptile) {
-	sint16 x, y;
-	Tile *tile;
-
-	y = obj->y - cur_y;
-	x = WRAP_VIEWP(cur_x, obj->x, map_width);
+inline void MapWindow::drawObj(const Obj *obj, bool draw_lowertiles, bool toptile) {
+	sint16 y = obj->y - cur_y;
+	sint16 x = WRAP_VIEWP(cur_x, obj->x, map_width);
 
 	if (x < 0 || y < 0)
 		return;
@@ -1069,11 +1039,11 @@ inline void MapWindow::drawObj(Obj *obj, bool draw_lowertiles, bool toptile) {
 		}
 	}
 
-//don't show invisible objects.
+	//don't show invisible objects.
 	if (obj->status & OBJ_STATUS_INVISIBLE)
 		return;
 
-	tile = tile_manager->get_original_tile(obj_manager->get_obj_tile_num(obj) + obj->frame_n);
+	Tile *tile = tile_manager->get_original_tile(obj_manager->get_obj_tile_num(obj) + obj->frame_n);
 
 	if (draw_lowertiles == false && (tile->flags3 & 0x4) && toptile == false) //don't display force lower tiles.
 		return;
@@ -1099,12 +1069,9 @@ inline void MapWindow::drawObj(Obj *obj, bool draw_lowertiles, bool toptile) {
  * true, otherwise the current tile is derived from tile_num. This can't be
  * used with animated tiles. It only applies to the base tile in multi-tiles.
  */
-inline void MapWindow::drawTile(Tile *tile, uint16 x, uint16 y, bool toptile,
+inline void MapWindow::drawTile(const Tile *tile, uint16 x, uint16 y, bool toptile,
 								bool use_tile_data) {
-	bool dbl_width, dbl_height;
-	uint16 tile_num;
-
-	tile_num = tile->tile_num;
+	uint16 tile_num = tile->tile_num;
 
 	//don't show special marker tiles in MD unless "show eggs" is turned on.
 	if (game_type == NUVIE_GAME_MD
@@ -1122,8 +1089,8 @@ inline void MapWindow::drawTile(Tile *tile, uint16 x, uint16 y, bool toptile,
 	    m_ViewableObjTiles.push_back(ti);
 	   }
 	*/
-	dbl_width = tile->dbl_width;
-	dbl_height = tile->dbl_height;
+	bool dbl_width = tile->dbl_width;
+	bool dbl_height = tile->dbl_height;
 
 	if (x < win_width && y < win_height)
 		drawTopTile(use_tile_data ? tile : tile_manager->get_tile(tile_num), x, y, toptile);
@@ -1152,11 +1119,11 @@ inline void MapWindow::drawTile(Tile *tile, uint16 x, uint16 y, bool toptile,
 
 }
 
-inline void MapWindow::drawNewTile(Tile *tile, uint16 x, uint16 y, bool toptile) {
+inline void MapWindow::drawNewTile(const Tile *tile, uint16 x, uint16 y, bool toptile) {
 	drawTile(tile, x, y, toptile, true);
 }
 
-inline void MapWindow::drawTopTile(Tile *tile, uint16 x, uint16 y, bool toptile) {
+inline void MapWindow::drawTopTile(const Tile *tile, uint16 x, uint16 y, bool toptile) {
 
 
 
@@ -1183,8 +1150,9 @@ void MapWindow::drawBorder() {
 
 	if (game_type != NUVIE_GAME_U6)
 		return;
-	uint16 orig_win_w = 11;
-	uint16 orig_win_h = 11;
+
+	const uint16 orig_win_w = 11;
+	const uint16 orig_win_h = 11;
 	uint16 x_off = Game::get_game()->get_game_x_offset();
 	uint16 y_off = Game::get_game()->get_game_y_offset();
 
@@ -1397,14 +1365,11 @@ void MapWindow::generateTmpMap() {
 }
 
 void MapWindow::boundaryFill(const byte *map_ptr, uint16 pitch, uint16 x, uint16 y) {
-	unsigned char current;
-	uint16 *ptr;
 	uint16 pos;
 	uint16 tmp_x, tmp_y;
-	uint16 p_cur_x, p_cur_y; //wrapped cur_x - 1 and wrapped cur_y - 1
 
-	p_cur_x = WRAPPED_COORD(cur_x - TMP_MAP_BORDER, cur_level);
-	p_cur_y = WRAPPED_COORD(cur_y - TMP_MAP_BORDER, cur_level);
+	uint16 p_cur_x = WRAPPED_COORD(cur_x - TMP_MAP_BORDER, cur_level);
+	uint16 p_cur_y = WRAPPED_COORD(cur_y - TMP_MAP_BORDER, cur_level);
 
 	if (x == WRAPPED_COORD(p_cur_x - 1, cur_level) || x == WRAPPED_COORD(p_cur_x + tmp_map_width, cur_level))
 		return;
@@ -1426,12 +1391,12 @@ void MapWindow::boundaryFill(const byte *map_ptr, uint16 pitch, uint16 x, uint16
 
 	pos += tmp_x;
 
-	ptr = &tmp_map_buf[pos];
+	uint16 *ptr = &tmp_map_buf[pos];
 
 	if (*ptr != 0)
 		return;
 
-	current = map_ptr[y * pitch + x];
+	byte current = map_ptr[y * pitch + x];
 
 	*ptr = (uint16)current;
 
@@ -1444,15 +1409,11 @@ void MapWindow::boundaryFill(const byte *map_ptr, uint16 pitch, uint16 x, uint16
 			roof_display = ROOF_DISPLAY_OFF; //hide roof tiles if player is looking through window.
 	}
 
+	uint16 xp1 = WRAPPED_COORD(x + 1, cur_level);
+	uint16 xm1 = WRAPPED_COORD(x - 1, cur_level);
 
-	uint16 xp1, xm1;
-	uint16 yp1, ym1;
-
-	xp1 = WRAPPED_COORD(x + 1, cur_level);
-	xm1 = WRAPPED_COORD(x - 1, cur_level);
-
-	yp1 = WRAPPED_COORD(y + 1, cur_level);
-	ym1 = WRAPPED_COORD(y - 1, cur_level);
+	uint16 yp1 = WRAPPED_COORD(y + 1, cur_level);
+	uint16 ym1 = WRAPPED_COORD(y - 1, cur_level);
 
 	boundaryFill(map_ptr, pitch, xp1,   y);
 	boundaryFill(map_ptr, pitch,   x, yp1);
@@ -1463,18 +1424,18 @@ void MapWindow::boundaryFill(const byte *map_ptr, uint16 pitch, uint16 x, uint16
 	boundaryFill(map_ptr, pitch, xp1, ym1);
 	boundaryFill(map_ptr, pitch, xm1, yp1);
 
-
 	return;
 }
 
 bool MapWindow::floorTilesVisible() {
-	Actor *actor;
-	uint16 a_x, a_y;
-	uint8 a_z;
-	actor = actor_manager->get_player();
+	Actor *actor = actor_manager->get_player();
 	if (!actor)
 		return false;
+
+	uint16 a_x, a_y;
+	uint8 a_z;
 	actor->get_location(&a_x, &a_y, &a_z);
+
 	uint16 cX = WRAPPED_COORD(a_x - 1, cur_level), eX = WRAPPED_COORD(a_x + 2, cur_level);
 	uint16 cY = WRAPPED_COORD(a_y - 1, cur_level), eY = WRAPPED_COORD(a_y + 2, cur_level);
 
@@ -1495,15 +1456,9 @@ bool MapWindow::floorTilesVisible() {
 }
 
 bool MapWindow::boundaryLookThroughWindow(uint16 tile_num, uint16 x, uint16 y) {
-	Tile *tile;
-	Actor *actor;
-	uint16 a_x, a_y;
-	uint8 a_z;
-	Obj  *obj;
-
-	tile = tile_manager->get_tile(tile_num);
+	Tile *tile = tile_manager->get_tile(tile_num);
 	if (!(tile->flags2 & TILEFLAG_WINDOW)) {
-		obj = obj_manager->get_objBasedAt(x, y, cur_level, true);
+		Obj *obj = obj_manager->get_objBasedAt(x, y, cur_level, true);
 		if (obj) { //check for a windowed object.
 			tile = tile_manager->get_tile(obj_manager->get_obj_tile_num(obj->obj_n) + obj->frame_n);
 			if (!(tile->flags2 & TILEFLAG_WINDOW))
@@ -1512,7 +1467,10 @@ bool MapWindow::boundaryLookThroughWindow(uint16 tile_num, uint16 x, uint16 y) {
 			return false;
 	}
 
-	actor = actor_manager->get_player();
+	Actor *actor = actor_manager->get_player();
+
+	uint16 a_x, a_y;
+	uint8 a_z;
 	actor->get_location(&a_x, &a_y, &a_z);
 
 	if (a_x == x) {
@@ -1531,15 +1489,12 @@ bool MapWindow::boundaryLookThroughWindow(uint16 tile_num, uint16 x, uint16 y) {
 //reshape walls based on new blacked out areas.
 
 void MapWindow::reshapeBoundary() {
-	uint16 x, y;
-	uint8 flag, original_flag;
-	Tile *tile;
-
-	for (y = 1; y < tmp_map_height - 1; y++) {
-		for (x = 1; x < tmp_map_width - 1; x++) {
+	for (uint16 y = 1; y < tmp_map_height - 1; y++) {
+		for (uint16 x = 1; x < tmp_map_width - 1; x++) {
 			if (tmpBufTileIsBoundary(x, y)) {
-				tile = tile_manager->get_tile(tmp_map_buf[y * tmp_map_width + x]);
+				const Tile *tile = tile_manager->get_tile(tmp_map_buf[y * tmp_map_width + x]);
 
+				uint8 flag, original_flag;
 				if ((tile->tile_num >= 140 && tile->tile_num <= 187)) { //main U6 wall tiles FIX for WOU games
 					flag = 0;
 					original_flag = tile->flags1 & TILEFLAG_WALL_MASK;
@@ -1619,15 +1574,12 @@ inline bool MapWindow::tmpBufTileIsBlack(uint16 x, uint16 y) {
 }
 
 bool MapWindow::tmpBufTileIsBoundary(uint16 x, uint16 y) {
-	uint16 tile_num;
-	Tile *tile;
-
-	tile_num = tmp_map_buf[y * tmp_map_width + x];
+	uint16 tile_num = tmp_map_buf[y * tmp_map_width + x];
 
 	if (tile_num == 0)
 		return false;
 
-	tile = tile_manager->get_tile(tile_num);
+	const Tile *tile = tile_manager->get_tile(tile_num);
 
 	if (tile->boundary)
 		return true;
@@ -1639,7 +1591,6 @@ bool MapWindow::tmpBufTileIsBoundary(uint16 x, uint16 y) {
 }
 
 bool MapWindow::tmpBufTileIsWall(uint16 x, uint16 y, NuvieDir direction) {
-
 	uint16 tile_num = tmp_map_buf[y * tmp_map_width + x];
 
 	if (tile_num == 0)
@@ -1701,6 +1652,7 @@ CanDropOrMoveMsg MapWindow::can_drop_or_move_obj(uint16 x, uint16 y, Actor *acto
 		else
 			return MSG_BLOCKED;
 	}
+
 	MapCoord actor_loc = actor->get_location();
 	if (actor_manager->get_actor(x, y, actor_loc.z))
 		return MSG_NOT_POSSIBLE;
@@ -1731,8 +1683,7 @@ CanDropOrMoveMsg MapWindow::can_drop_or_move_obj(uint16 x, uint16 y, Actor *acto
 	if (actor_loc.distance(target_loc) > 5 && get_interface() == INTERFACE_NORMAL)
 		return MSG_OUT_OF_RANGE;
 
-	uint8 lt_flags;
-	lt_flags = (game_type == NUVIE_GAME_U6) ? LT_HitMissileBoundary : 0; //FIXME this probably isn't quite right for MD/SE
+	uint8 lt_flags = (game_type == NUVIE_GAME_U6) ? LT_HitMissileBoundary : 0; //FIXME this probably isn't quite right for MD/SE
 	if (map->lineTest(actor_loc.x, actor_loc.y, x, y, actor_loc.z, lt_flags, lt, 0, obj)) {
 		MapCoord hit_loc = MapCoord(lt.hit_x, lt.hit_y, lt.hit_level);
 		if (obj_loc.distance(target_loc) != 1 || hit_loc.distance(target_loc) != 1) {
@@ -1763,6 +1714,7 @@ CanDropOrMoveMsg MapWindow::can_drop_or_move_obj(uint16 x, uint16 y, Actor *acto
 			return MSG_BLOCKED;
 		}
 	}
+
 	const Tile *tile;
 	if (dest_obj)
 		tile = obj_manager->get_obj_tile(dest_obj->obj_n, dest_obj->frame_n);
@@ -1792,7 +1744,7 @@ void MapWindow::display_can_drop_or_move_msg(CanDropOrMoveMsg msg, string msg_te
 	game->get_scroll()->display_string(msg_text);
 }
 
-bool MapWindow::can_get_obj(Actor *actor, Obj *obj) {
+bool MapWindow::can_get_obj(const Actor *actor, Obj *obj) {
 	if (!obj)
 		return false;
 	if (get_interface() == INTERFACE_IGNORE_BLOCK)
@@ -1823,7 +1775,7 @@ bool MapWindow::can_get_obj(Actor *actor, Obj *obj) {
  * Check to make sure the obj isn't on the other side of a wall or trying to push through it.
  * The original engine didn't bother to check.
  */
-bool MapWindow::blocked_by_wall(Actor *actor, Obj *obj) {
+bool MapWindow::blocked_by_wall(const Actor *actor, const Obj *obj) {
 	if (game_type == NUVIE_GAME_U6 && obj->x == 282 && obj->y == 438 && cur_level == 0) // HACK for buggy location
 		return false;
 	const Tile *tile = map->get_tile(obj->x, obj->y, cur_level);
@@ -1839,7 +1791,6 @@ bool MapWindow::blocked_by_wall(Actor *actor, Obj *obj) {
 
 bool MapWindow::drag_accept_drop(int x, int y, int message, void *data) {
 	DEBUG(0, LEVEL_DEBUGGING, "MapWindow::drag_accept_drop()\n");
-	uint16 mapWidth;
 
 	x -= area.left;
 	y -= area.top;
@@ -1854,7 +1805,7 @@ bool MapWindow::drag_accept_drop(int x, int y, int message, void *data) {
 			game->get_event()->display_not_aboard_vehicle();
 			return false;
 		}
-		mapWidth = map->get_width(cur_level);
+		uint16 mapWidth = map->get_width(cur_level);
 		x = (cur_x + x) % mapWidth;
 		y = (cur_y + y) % mapWidth;
 
diff --git a/engines/ultima/nuvie/gui/widgets/map_window.h b/engines/ultima/nuvie/gui/widgets/map_window.h
index ae4dceb217d..a7978af53ae 100644
--- a/engines/ultima/nuvie/gui/widgets/map_window.h
+++ b/engines/ultima/nuvie/gui/widgets/map_window.h
@@ -283,9 +283,8 @@ public:
 // can put object at world location x,y?
 	CanDropOrMoveMsg can_drop_or_move_obj(uint16 x, uint16 y, Actor *actor, Obj *obj);
 	void display_can_drop_or_move_msg(CanDropOrMoveMsg msg, Std::string msg_text = "");
-	bool can_get_obj(Actor *actor, Obj *obj);
-	bool blocked_by_wall(Actor *actor, Obj *obj);
-	void display_move_text(Actor *target_actor, Obj *obj);
+	bool can_get_obj(const Actor *actor, Obj *obj);
+	bool blocked_by_wall(const Actor *actor, const Obj *obj);
 	MapCoord original_obj_loc;
 
 	void updateBlacking();
@@ -327,7 +326,7 @@ public:
 		return roof_tiles;
 	}
 
-	Std::vector<Obj *> m_ViewableObjects; //^^ dodgy public buffer
+	Std::vector<const Obj *> m_ViewableObjects; //^^ dodgy public buffer
 
 	void wizard_eye_start(const MapCoord &location, uint16 duration, CallBack *caller);
 
@@ -340,12 +339,12 @@ protected:
 	void drawAnims(bool top_anims);
 	void drawObjs();
 	void drawObjSuperBlock(bool draw_lowertiles, bool toptile);
-	inline void drawObj(Obj *obj, bool draw_lowertiles, bool toptile);
-	inline void drawTile(Tile *tile, uint16 x, uint16 y, bool toptile, bool use_tile_data = false);
-	inline void drawNewTile(Tile *tile, uint16 x, uint16 y, bool toptile);
+	inline void drawObj(const Obj *obj, bool draw_lowertiles, bool toptile);
+	inline void drawTile(const Tile *tile, uint16 x, uint16 y, bool toptile, bool use_tile_data = false);
+	inline void drawNewTile(const Tile *tile, uint16 x, uint16 y, bool toptile);
 	void drawBorder();
-	inline void drawTopTile(Tile *tile, uint16 x, uint16 y, bool toptile);
-	inline void drawActor(Actor *actor);
+	inline void drawTopTile(const Tile *tile, uint16 x, uint16 y, bool toptile);
+	inline void drawActor(const Actor *actor);
 	void drawRoofs();
 	void drawGrid();
 	void drawRain();
diff --git a/engines/ultima/nuvie/gui/widgets/msg_scroll.cpp b/engines/ultima/nuvie/gui/widgets/msg_scroll.cpp
index 3ffb6804bea..c48fec35bcc 100644
--- a/engines/ultima/nuvie/gui/widgets/msg_scroll.cpp
+++ b/engines/ultima/nuvie/gui/widgets/msg_scroll.cpp
@@ -69,10 +69,8 @@ uint16 MsgText::getDisplayWidth() {
 }
 
 MsgLine::~MsgLine() {
-	Std::list<MsgText *>::iterator iter;
-
-	for (iter = text.begin(); iter != text.end(); iter++) {
-		delete *iter;
+	for (MsgText *token : text) {
+		delete token;
 	}
 }
 
@@ -139,10 +137,7 @@ MsgText *MsgLine::get_text_at_pos(uint16 pos) {
 
 uint16 MsgLine::get_display_width() {
 	uint16 len = 0;
-	Std::list<MsgText *>::iterator iter;
-	for (iter = text.begin(); iter != text.end() ; iter++) {
-		MsgText *token = *iter;
-
+	for (MsgText *token : text) {
 		len += token->font->getStringWidth(token->s.c_str());
 	}
 	return len;
@@ -240,17 +235,13 @@ MsgScroll::MsgScroll(const Configuration *cfg, Font *f) : GUI_Widget(nullptr, 0,
 }
 
 MsgScroll::~MsgScroll() {
-	Std::list<MsgLine *>::iterator msg_line;
-	Std::list<MsgText *>::iterator msg_text;
-
-// delete the scroll buffer
-	for (msg_line = msg_buf.begin(); msg_line != msg_buf.end(); msg_line++)
-		delete *msg_line;
-
-// delete the holding buffer
-	for (msg_text = holding_buffer.begin(); msg_text != holding_buffer.end(); msg_text++)
-		delete *msg_text;
+	// delete the scroll buffer
+	for (MsgLine *line : msg_buf)
+		delete line;
 
+	// delete the holding buffer
+	for (MsgText *token : holding_buffer)
+		delete token;
 }
 
 bool MsgScroll::init(const char *player_name) {
@@ -548,10 +539,7 @@ bool MsgScroll::is_garg_font() {
 }
 
 void MsgScroll::clear_scroll() {
-	Std::list<MsgLine *>::iterator iter;
-
-	for (iter = msg_buf.begin(); iter != msg_buf.end(); iter++) {
-		MsgLine *line = *iter;
+	for (MsgLine *line : msg_buf) {
 		delete line;
 	}
 
@@ -989,12 +977,9 @@ void MsgScroll::Display(bool full_redraw) {
 }
 
 inline void MsgScroll::drawLine(Screen *theScreen, MsgLine *msg_line, uint16 line_y) {
-	MsgText *token;
-	Std::list<MsgText *>::iterator iter;
 	uint16 total_length = 0;
 
-	for (iter = msg_line->text.begin(); iter != msg_line->text.end() ; iter++) {
-		token = *iter;
+	for (MsgText *token : msg_line->text) {
 		token->font->drawString(theScreen, token->s.c_str(), area.left + left_margin + total_length * 8, area.top + line_y * 8, token->color, font_highlight_color); //FIX for hardcoded font height
 		total_length += token->s.length();
 	}
diff --git a/engines/ultima/nuvie/gui/widgets/msg_scroll_new_ui.cpp b/engines/ultima/nuvie/gui/widgets/msg_scroll_new_ui.cpp
index 903afcbd412..d0a1391fb51 100644
--- a/engines/ultima/nuvie/gui/widgets/msg_scroll_new_ui.cpp
+++ b/engines/ultima/nuvie/gui/widgets/msg_scroll_new_ui.cpp
@@ -133,11 +133,9 @@ void MsgScrollNewUI::display_string(const Std::string &str, Font *f, bool includ
 	}
 }
 
-uint16 MsgScrollNewUI::count_empty_lines(Std::string s) {
-	Std::string::iterator iter;
+uint16 MsgScrollNewUI::count_empty_lines(const Std::string &s) {
 	uint16 count = 0;
-	for (iter = s.begin(); iter != s.end(); iter++) {
-		char c = *iter;
+	for (char c : s) {
 		if (c != ' ' && c != '\t' && c != '\n')
 			break;
 
diff --git a/engines/ultima/nuvie/gui/widgets/msg_scroll_new_ui.h b/engines/ultima/nuvie/gui/widgets/msg_scroll_new_ui.h
index 0930ab7a754..97a37cf9f91 100644
--- a/engines/ultima/nuvie/gui/widgets/msg_scroll_new_ui.h
+++ b/engines/ultima/nuvie/gui/widgets/msg_scroll_new_ui.h
@@ -99,7 +99,7 @@ protected:
 
 private:
 	GUI_status scroll_movement_event(MsgScrollEventType event);
-	uint16 count_empty_lines(Std::string s);
+	uint16 count_empty_lines(const Std::string &s);
 
 };
 
diff --git a/engines/ultima/nuvie/metaengine.cpp b/engines/ultima/nuvie/metaengine.cpp
index 3712ef200e6..5ec071a5aa3 100644
--- a/engines/ultima/nuvie/metaengine.cpp
+++ b/engines/ultima/nuvie/metaengine.cpp
@@ -27,8 +27,8 @@ namespace Nuvie {
 
 void MetaEngine::listSaves(SaveStateList &saveList) {
 	// Check whether there's an entry for the original save slot
-	for (SaveStateList::iterator it = saveList.begin(); it != saveList.end(); ++it) {
-		if (it->getSaveSlot() == ORIGINAL_SAVE_SLOT)
+	for (const SaveStateDescriptor &state : saveList) {
+		if (state.getSaveSlot() == ORIGINAL_SAVE_SLOT)
 			return;
 	}
 
diff --git a/engines/ultima/nuvie/pathfinder/astar_path.cpp b/engines/ultima/nuvie/pathfinder/astar_path.cpp
index e732e090df7..a37a469d855 100644
--- a/engines/ultima/nuvie/pathfinder/astar_path.cpp
+++ b/engines/ultima/nuvie/pathfinder/astar_path.cpp
@@ -134,7 +134,9 @@ bool AStarPath::path_search(const MapCoord &start, const MapCoord &goal) {
 //DEBUG(0,LEVEL_DEBUGGING,"FAIL\n");
 	delete_nodes();
 	return false; // out of open nodes - failure
-}/* Return the cost of moving one step from `c1' to `c2', which is always 1. This
+}
+
+/* Return the cost of moving one step from `c1' to `c2', which is always 1. This
  * isn't very helpful, so subclasses should provide their own function.
  * Returns -1 if c2 is blocked. */
 sint32 AStarPath::step_cost(const MapCoord &c1, const MapCoord &c2) {
@@ -142,34 +144,44 @@ sint32 AStarPath::step_cost(const MapCoord &c1, const MapCoord &c2) {
 	        || c2.distance(c1) > 1)
 		return -1;
 	return 1;
-}/* Return an item in the list of closed nodes whose location matches `ncmp'.
- */astar_node *AStarPath::find_closed_node(astar_node *ncmp) {
-	Std::list<astar_node *>::iterator n;
-	for (n = closed_nodes.begin(); n != closed_nodes.end(); n++)
-		if ((*n)->loc == ncmp->loc)
-			return *n;
+}
+
+/* Return an item in the list of closed nodes whose location matches `ncmp'.
+ */
+astar_node *AStarPath::find_closed_node(astar_node *ncmp) {
+	for (astar_node *n : open_nodes)
+		if (n->loc == ncmp->loc)
+			return n;
 	return nullptr;
-}/* Return an item in the list of closed nodes whose location matches `ncmp'.
- */astar_node *AStarPath::find_open_node(astar_node *ncmp) {
-	Std::list<astar_node *>::iterator n;
-	for (n = open_nodes.begin(); n != open_nodes.end(); n++)
-		if ((*n)->loc == ncmp->loc)
-			return *n;
+}
+
+/* Return an item in the list of closed nodes whose location matches `ncmp'.
+ */
+astar_node *AStarPath::find_open_node(astar_node *ncmp) {
+	for (astar_node *n : open_nodes)
+		if (n->loc == ncmp->loc)
+			return n;
 	return nullptr;
-}/* Add new node pointer to the list of open nodes (sorting by score).
- */void AStarPath::push_open_node(astar_node *node) {
-	Std::list<astar_node *>::iterator n, next;
+}
+
+/* Add new node pointer to the list of open nodes (sorting by score).
+ */
+void AStarPath::push_open_node(astar_node *node) {
 	if (open_nodes.empty()) {
 		open_nodes.push_front(node);
 		return;
 	}
-	n = open_nodes.begin();
+
+	Std::list<astar_node *>::iterator n = open_nodes.begin();
 	// get to end of list or to a node with equal or greater score
 	while (n != open_nodes.end() && (*n++)->score < node->score);
 	open_nodes.insert(n, node); // and add before that location
-}/* Return pointer to the highest priority node from the list of open nodes, and
+}
+
+/* Return pointer to the highest priority node from the list of open nodes, and
  * remove it.
- */astar_node *AStarPath::pop_open_node() {
+ */
+astar_node *AStarPath::pop_open_node() {
 	astar_node *best = open_nodes.front();
 	open_nodes.pop_front(); // remove it
 	return best;
diff --git a/engines/ultima/nuvie/script/script_cutscene.cpp b/engines/ultima/nuvie/script/script_cutscene.cpp
index 3d145cea68d..24efbf9e6f3 100644
--- a/engines/ultima/nuvie/script/script_cutscene.cpp
+++ b/engines/ultima/nuvie/script/script_cutscene.cpp
@@ -1408,13 +1408,12 @@ void ScriptCutscene::print_text(CSImage *image, const char *s, uint16 *x, uint16
 
 		if (len + token_len + space_width > width) {
 			//FIXME render line here.
-			list<Std::string>::iterator it;
 			int new_space = 0;
 			if (tokens.size() > 1)
 				new_space = floor((width - (len - space_width * (tokens.size() - 1))) / (tokens.size() - 1));
 
-			for (it = tokens.begin() ; it != tokens.end() ; it++) {
-				*x = ((WOUFont *)font)->drawStringToShape(image->shp, (*it).c_str(), *x, *y, color);
+			for (const Std::string &s : tokens) {
+				*x = ((WOUFont *)font)->drawStringToShape(image->shp, s.c_str(), *x, *y, color);
 				*x += new_space;
 			}
 			*y += 8;
@@ -1431,10 +1430,8 @@ void ScriptCutscene::print_text(CSImage *image, const char *s, uint16 *x, uint16
 		found = str.findFirstOf(" ", start);
 	}
 
-	list<Std::string>::iterator it;
-
-	for (it = tokens.begin() ; it != tokens.end() ; it++) {
-		*x = ((WOUFont *)font)->drawStringToShape(image->shp, (*it).c_str(), *x, *y, color);
+	for (const Std::string &s : tokens) {
+		*x = ((WOUFont *)font)->drawStringToShape(image->shp, s.c_str(), *x, *y, color);
 		*x += space_width;
 	}
 
@@ -1525,8 +1522,7 @@ void ScriptCutscene::set_screen_opacity(uint8 new_opacity) {
 }
 
 void ScriptCutscene::hide_sprites() {
-	for (Std::list<CSSprite *>::iterator it = sprite_list.begin(); it != sprite_list.end(); it++) {
-		CSSprite *s = *it;
+	for (CSSprite *s : sprite_list) {
 		if (s->visible)
 			s->visible = false;
 	}
@@ -1575,8 +1571,7 @@ void ScriptCutscene::Display(bool full_redraw) {
 	}
 
 	if (screen_opacity > 0) {
-		for (Std::list<CSSprite *>::iterator it = sprite_list.begin(); it != sprite_list.end(); it++) {
-			CSSprite *s = *it;
+		for (CSSprite *s : sprite_list) {
 			if (s->visible) {
 				if (s->image) {
 					uint16 w, h;
diff --git a/engines/ultima/nuvie/sound/sound_manager.cpp b/engines/ultima/nuvie/sound/sound_manager.cpp
index 5d86c0fc01c..77d6b7d2f83 100644
--- a/engines/ultima/nuvie/sound/sound_manager.cpp
+++ b/engines/ultima/nuvie/sound/sound_manager.cpp
@@ -656,13 +656,13 @@ void SoundManager::update_map_sfx() {
 	//m_ViewableTiles
 
 	//get a list of all the sounds
-	for (i = 0; i < mw->m_ViewableObjects.size(); i++) {
-		//DEBUG(0,LEVEL_DEBUGGING,"%d %s",mw->m_ViewableObjects[i]->obj_n,Game::get_game()->get_obj_manager()->get_obj_name(mw->m_ViewableObjects[i]));
-		SfxIdType sfx_id = RequestObjectSfxId(mw->m_ViewableObjects[i]->obj_n); //does this object have an associated sound?
+	for (const Obj *obj : mw->m_ViewableObjects) {
+		//DEBUG(0,LEVEL_DEBUGGING,"%d %s",obj->obj_n,Game::get_game()->get_obj_manager()->get_obj_name(obj));
+		SfxIdType sfx_id = RequestObjectSfxId(obj->obj_n); //does this object have an associated sound?
 		if (sfx_id != NUVIE_SFX_NONE) {
 			//calculate the volume
-			uint16 ox = mw->m_ViewableObjects[i]->x;
-			uint16 oy = mw->m_ViewableObjects[i]->y;
+			uint16 ox = obj->x;
+			uint16 oy = obj->y;
 			float dist = sqrtf((float)(x - ox) * (x - ox) + (float)(y - oy) * (y - oy));
 			float vol = (8.0f - dist) / 8.0f;
 			if (vol < 0)
@@ -762,21 +762,19 @@ void SoundManager::update() {
 	}
 }
 
-Sound *SoundManager::SongExists(string name) {
-	Std::list < Sound * >::iterator it;
-	for (it = m_Songs.begin(); it != m_Songs.end(); ++it) {
-		if ((*it)->GetName() == name)
-			return *it;
+Sound *SoundManager::SongExists(const string &name) {
+	for (Sound *song : m_Songs) {
+		if (song->GetName() == name)
+			return song;
 	}
 
 	return nullptr;
 }
 
-Sound *SoundManager::SampleExists(string name) {
-	Std::list < Sound * >::iterator it;
-	for (it = m_Samples.begin(); it != m_Samples.end(); ++it) {
-		if ((*it)->GetName() == name)
-			return *it;
+Sound *SoundManager::SampleExists(const string &name) {
+	for (Sound *sample : m_Samples) {
+		if (sample->GetName() == name)
+			return sample;
 	}
 
 	return nullptr;
@@ -815,7 +813,7 @@ uint16 SoundManager::RequestObjectSfxId(uint16 obj_n) {
 	return NUVIE_SFX_NONE;
 }
 
-Sound *SoundManager::RequestSong(string group) {
+Sound *SoundManager::RequestSong(const string &group) {
 	Common::HashMap<Common::String, SoundCollection * >::iterator it;
 	it = m_MusicMap.find(group);
 	if (it != m_MusicMap.end()) {
diff --git a/engines/ultima/nuvie/sound/sound_manager.h b/engines/ultima/nuvie/sound/sound_manager.h
index 8cc4fa41d67..454ea1e8cf5 100644
--- a/engines/ultima/nuvie/sound/sound_manager.h
+++ b/engines/ultima/nuvie/sound/sound_manager.h
@@ -139,13 +139,13 @@ private:
 	//bool LoadTileSamples(string sound_dir);
 	bool LoadSfxManager(string sfx_style);
 
-	Sound *SongExists(string name); //have we loaded this sound before?
-	Sound *SampleExists(string name); //have we loaded this sound before?
+	Sound *SongExists(const string &name); //have we loaded this sound before?
+	Sound *SampleExists(const string &name); //have we loaded this sound before?
 
 
 	Sound *RequestTileSound(int id);
 	Sound *RequestObjectSound(int id);
-	Sound *RequestSong(string group); //request a song from this group
+	Sound *RequestSong(const string &group); //request a song from this group
 
 	uint16 RequestObjectSfxId(uint16 obj_n);
 
diff --git a/engines/ultima/nuvie/usecode/u6_usecode.cpp b/engines/ultima/nuvie/usecode/u6_usecode.cpp
index b393b211180..203a6d0d9b5 100644
--- a/engines/ultima/nuvie/usecode/u6_usecode.cpp
+++ b/engines/ultima/nuvie/usecode/u6_usecode.cpp
@@ -765,24 +765,19 @@ bool U6UseCode::use_rune(Obj *obj, UseCodeEvent ev) {
 }
 
 void U6UseCode::remove_gargoyle_egg(uint16 x, uint16 y, uint8 z) {
-	Std::list<Egg *> *egg_list;
+	Std::list<Egg *> *egg_list = game->get_egg_manager()->get_egg_list();
 	Std::list<Egg *>::iterator egg_itr;
 
-	egg_list = game->get_egg_manager()->get_egg_list();
-
 	for (egg_itr = egg_list->begin(); egg_itr != egg_list->end();) {
 		Egg *egg = *egg_itr;
-		egg_itr++;
-
 		Obj *egg_obj = egg->obj;
-
+		egg_itr++;  // increment here, it might get removed from the list below.
 		if (abs(x - egg_obj->x) < 20 && abs(y - egg_obj->y) < 20 && z == egg_obj->z) {
 			if (egg_obj->find_in_container(OBJ_U6_GARGOYLE, 0, false, 0, false) || egg_obj->find_in_container(OBJ_U6_WINGED_GARGOYLE, 0, false, 0, false)) {
 				DEBUG(0, LEVEL_DEBUGGING, "Removed egg at (%x,%x,%x)", egg_obj->x, egg_obj->y, egg_obj->z);
 				game->get_egg_manager()->remove_egg(egg_obj, false);
 				obj_manager->unlink_from_engine(egg_obj);
 				delete_obj(egg_obj);
-
 			}
 		}
 	}
diff --git a/engines/ultima/nuvie/views/view_manager.cpp b/engines/ultima/nuvie/views/view_manager.cpp
index 45888614ab3..c6ed0f9e96d 100644
--- a/engines/ultima/nuvie/views/view_manager.cpp
+++ b/engines/ultima/nuvie/views/view_manager.cpp
@@ -305,9 +305,8 @@ Actor *ViewManager::doll_view_get_next_party_member() {
 }
 
 DollViewGump *ViewManager::get_doll_view(Actor *actor) {
-	Std::list<DraggableView *>::iterator iter;
-	for (iter = doll_gumps.begin(); iter != doll_gumps.end(); iter++) {
-		DollViewGump *view = (DollViewGump *)*iter;
+	for (DraggableView *draggable : doll_gumps) {
+		DollViewGump *view = (DollViewGump *)draggable;
 		if (view->get_actor() == actor) {
 			return view;
 		}
@@ -317,9 +316,8 @@ DollViewGump *ViewManager::get_doll_view(Actor *actor) {
 }
 
 ContainerViewGump *ViewManager::get_container_view(Actor *actor, Obj *obj) {
-	Std::list<DraggableView *>::iterator iter;
-	for (iter = container_gumps.begin(); iter != container_gumps.end(); iter++) {
-		ContainerViewGump *view = (ContainerViewGump *)*iter;
+	for (DraggableView *draggable : container_gumps) {
+		ContainerViewGump *view = (ContainerViewGump *)draggable;
 		if (actor) {
 			if (view->is_actor_container() && view->get_actor() == actor) {
 				return view;
@@ -449,13 +447,8 @@ void ViewManager::close_gump(DraggableView *gump) {
 }
 
 void ViewManager::close_all_gumps() {
-	Std::list<DraggableView *>::iterator iter;
-	for (iter = gumps.begin(); iter != gumps.end();) {
-		DraggableView *gump = *iter;
-		iter++;
-
-		close_gump(gump);
-	}
+	while (!gumps.empty())
+		close_gump(gumps.front());
 	//TODO make sure all gump objects have been deleted by GUI.
 }
 


Commit: bfd975ed4d4e9649b468d81e3f1c9079dbfa1d77
    https://github.com/scummvm/scummvm/commit/bfd975ed4d4e9649b468d81e3f1c9079dbfa1d77
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2023-12-09T13:56:08+11:00

Commit Message:
ULTIMA: NUVIE: Remove some unused util functions

Changed paths:
    engines/ultima/nuvie/misc/u6_misc.cpp
    engines/ultima/nuvie/misc/u6_misc.h
    engines/ultima/nuvie/script/script.cpp


diff --git a/engines/ultima/nuvie/misc/u6_misc.cpp b/engines/ultima/nuvie/misc/u6_misc.cpp
index ed3ecf672a3..c367e432863 100644
--- a/engines/ultima/nuvie/misc/u6_misc.cpp
+++ b/engines/ultima/nuvie/misc/u6_misc.cpp
@@ -89,18 +89,6 @@ void config_get_path(const Configuration *config, const Std::string &filename, S
 	path = tmp_path;
 }
 
-void stringToUpper(Std::string &str) {
-	for (size_t i = 0; i < str.length(); ++i) {
-		str[i] = toupper(str[i]);
-	}
-}
-
-void stringToLower(Std::string &str) {
-	for (size_t i = 0; i < str.length(); ++i) {
-		str[i] = tolower(str[i]);
-	}
-}
-
 int mkdir_recursive(const Std::string &path, int mode) {
 #ifdef TODO
 	vector<string> directories;
diff --git a/engines/ultima/nuvie/misc/u6_misc.h b/engines/ultima/nuvie/misc/u6_misc.h
index 1c59c5d7a46..b1c91cf5b3b 100644
--- a/engines/ultima/nuvie/misc/u6_misc.h
+++ b/engines/ultima/nuvie/misc/u6_misc.h
@@ -68,7 +68,6 @@ void get_relative_dir(NuvieDir dir, sint16 *rel_x, sint16 *rel_y);
 const char *get_direction_name(NuvieDir dir);
 const char *get_direction_name(sint16 rel_x, sint16 rel_y);
 int str_bsearch(const char *str[], int max, const char *value);
-void stringToLower(Std::string &str);
 
 /* Does line xy->x2y2 cross rect, to any extent?
  */
diff --git a/engines/ultima/nuvie/script/script.cpp b/engines/ultima/nuvie/script/script.cpp
index 390e5bb437c..0bccdc186e1 100644
--- a/engines/ultima/nuvie/script/script.cpp
+++ b/engines/ultima/nuvie/script/script.cpp
@@ -887,7 +887,7 @@ bool Script::init() {
 	dir = path;
 
 	Std::string game_tag = get_game_tag(gametype);
-	stringToLower(game_tag);
+	game_tag.toLowercase();
 
 	build_path(dir, game_tag, path);
 


Commit: 02e75c657e6281f9a7a8605175490a725dda9604
    https://github.com/scummvm/scummvm/commit/02e75c657e6281f9a7a8605175490a725dda9604
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2023-12-09T13:56:09+11:00

Commit Message:
ULTIMA: NUVIE: Use nullptr instead of 0 for pointers

Changed paths:
    engines/ultima/nuvie/actors/actor.cpp
    engines/ultima/nuvie/actors/u6_actor.cpp
    engines/ultima/nuvie/core/converse.cpp
    engines/ultima/nuvie/core/party.cpp
    engines/ultima/nuvie/files/u6_lib_n.cpp
    engines/ultima/nuvie/gui/gui_button.cpp
    engines/ultima/nuvie/gui/widgets/map_window.cpp
    engines/ultima/nuvie/usecode/usecode.cpp


diff --git a/engines/ultima/nuvie/actors/actor.cpp b/engines/ultima/nuvie/actors/actor.cpp
index 8d914b3ea1d..8e25d03b6d7 100644
--- a/engines/ultima/nuvie/actors/actor.cpp
+++ b/engines/ultima/nuvie/actors/actor.cpp
@@ -700,12 +700,11 @@ uint32 Actor::inventory_count_objects(bool inc_readied_objects) const {
  */
 uint32 Actor::inventory_count_object(uint16 objN) {
 	uint32 qty = 0;
-	U6Link *link = 0;
-	Obj *obj = 0;
+	U6Link *link = nullptr;
 	U6LList *inv = get_inventory_list();
 
 	for (link = inv->start(); link != nullptr; link = link->next) {
-		obj = (Obj *)link->data;
+		Obj *obj = (Obj *)link->data;
 		if (obj)
 			qty += obj->get_total_qty(objN);
 	}
@@ -789,7 +788,6 @@ bool Actor::inventory_add_object(Obj *obj, Obj *container, bool stack) {
 /* Stacks the new object with existing objects if possible.
    Returns a pointer to the new object in inventory. */
 Obj *Actor::inventory_new_object(uint16 objN, uint32 qty, uint8 quality) {
-	Obj *obj = 0;
 	uint8 frameN = 0;
 
 	if (objN >= 1024) {
@@ -797,7 +795,7 @@ Obj *Actor::inventory_new_object(uint16 objN, uint32 qty, uint8 quality) {
 		objN -= frameN * 1024;
 	}
 
-	obj = new Obj;
+	Obj *obj = new Obj;
 	obj->obj_n = objN;
 	obj->frame_n = frameN;
 	obj->quality = quality;
diff --git a/engines/ultima/nuvie/actors/u6_actor.cpp b/engines/ultima/nuvie/actors/u6_actor.cpp
index c39c0bf721a..74edde72a74 100644
--- a/engines/ultima/nuvie/actors/u6_actor.cpp
+++ b/engines/ultima/nuvie/actors/u6_actor.cpp
@@ -1400,12 +1400,11 @@ inline void U6Actor::clear_surrounding_objs_list(bool delete_objs) {
 		return;
 	}
 
-	Std::list<Obj *>::iterator obj = surrounding_objects.begin();
-
-	for (; !surrounding_objects.empty();) {
-		obj_manager->remove_obj_from_map(*obj);
-		delete_obj(*obj);
-		obj = surrounding_objects.erase(obj);
+	while (!surrounding_objects.empty()) {
+		Obj *obj = surrounding_objects.front();
+		obj_manager->remove_obj_from_map(obj);
+		delete_obj(obj);
+		surrounding_objects.pop_front();
 	}
 
 	return;
@@ -1562,10 +1561,9 @@ const char *U6Actor::get_worktype_string(uint32 wt) const {
 Obj *U6Actor::inventory_get_food(Obj *container) {
 	U6UseCode *uc = (U6UseCode *)Game::get_game()->get_usecode();
 	U6LList *inv = container ? container->container : get_inventory_list();
-	U6Link *link = 0;
-	Obj *obj = 0;
+	U6Link *link = nullptr;
 	for (link = inv->start(); link != nullptr; link = link->next) {
-		obj = (Obj *)link->data;
+		Obj *obj = (Obj *)link->data;
 		if (uc->is_food(obj))
 			return obj;
 		if (obj->container) { // search within container
diff --git a/engines/ultima/nuvie/core/converse.cpp b/engines/ultima/nuvie/core/converse.cpp
index 749c6cc3ace..a4f7ba31472 100644
--- a/engines/ultima/nuvie/core/converse.cpp
+++ b/engines/ultima/nuvie/core/converse.cpp
@@ -449,7 +449,7 @@ void Converse::set_svar(uint8 varnum, const char *set) {
 void Converse::show_portrait(uint8 n) {
 	Game *game = Game::get_game();
 	Actor *actor = (n == npc_num) ? npc : actors->get_actor(n);
-	const char *nameret = 0;
+	const char *nameret = nullptr;
 	if (!actor)
 		return;
 	bool statue = (gametype == NUVIE_GAME_U6 && n >= 189 && n <= 191);
diff --git a/engines/ultima/nuvie/core/party.cpp b/engines/ultima/nuvie/core/party.cpp
index 961451f67d9..9cc0f5b7325 100644
--- a/engines/ultima/nuvie/core/party.cpp
+++ b/engines/ultima/nuvie/core/party.cpp
@@ -812,7 +812,7 @@ void Party::dismount_from_horses() {
 }
 
 Actor *Party::get_slowest_actor() {
-	Actor *actor = 0;
+	Actor *actor = nullptr;
 	sint8 begin = get_leader();
 	if (begin >= 0) {
 		actor = member[begin].actor;
@@ -858,8 +858,8 @@ bool Party::can_rest(Std::string &err_str) {
 	Actor *pActor = player->get_actor();
 	MapCoord loc = pActor->get_location();
 
-	ActorList *enemies = 0;
-	ActorList *all_actors = 0;
+	ActorList *enemies = nullptr;
+	ActorList *all_actors = nullptr;
 
 	if (is_in_combat_mode()) {
 		if (Game::get_game()->get_game_type() == NUVIE_GAME_SE)
diff --git a/engines/ultima/nuvie/files/u6_lib_n.cpp b/engines/ultima/nuvie/files/u6_lib_n.cpp
index fad8335b7dd..e1c65345e4b 100644
--- a/engines/ultima/nuvie/files/u6_lib_n.cpp
+++ b/engines/ultima/nuvie/files/u6_lib_n.cpp
@@ -369,7 +369,6 @@ const char *U6Lib_n::get_item_name(uint32 item_number) {
  * Size & uncompressed size is set to source length.
  */
 void U6Lib_n::set_item_data(uint32 item_number, unsigned char *src, uint32 src_len) {
-	unsigned char *dcopy = 0;
 	if (item_number >= num_offsets)
 		return;
 // FIXME: need a way to set an item as compressed or uncompressed so we know
@@ -377,7 +376,7 @@ void U6Lib_n::set_item_data(uint32 item_number, unsigned char *src, uint32 src_l
 	items[item_number].size = src_len;
 	items[item_number].uncomp_size = src_len;
 	if (src_len) {
-		dcopy = (unsigned char *)malloc(src_len);
+		unsigned char *dcopy = (unsigned char *)malloc(src_len);
 		memcpy(dcopy, src, src_len);
 		items[item_number].data = dcopy;
 	} else
diff --git a/engines/ultima/nuvie/gui/gui_button.cpp b/engines/ultima/nuvie/gui/gui_button.cpp
index 0505de0b125..98326204259 100644
--- a/engines/ultima/nuvie/gui/gui_button.cpp
+++ b/engines/ultima/nuvie/gui/gui_button.cpp
@@ -242,7 +242,7 @@ Graphics::ManagedSurface *GUI_Button::CreateTextButtonImage(int style, const cha
 	Common::Rect fillrect;
 	int th, tw;
 	int tx = 0, ty = 0;
-	char *duptext = 0;
+	char *duptext = nullptr;
 
 	Graphics::ManagedSurface *img = new Graphics::ManagedSurface(area.width(), area.height(),
 		Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0));
diff --git a/engines/ultima/nuvie/gui/widgets/map_window.cpp b/engines/ultima/nuvie/gui/widgets/map_window.cpp
index cc08e1bee32..79f2d93df81 100644
--- a/engines/ultima/nuvie/gui/widgets/map_window.cpp
+++ b/engines/ultima/nuvie/gui/widgets/map_window.cpp
@@ -920,7 +920,7 @@ inline void MapWindow::drawActor(const Actor *actor) {
 	        && (!(actor->obj_flags & OBJ_STATUS_INVISIBLE) || actor->is_in_party() || actor == actor_manager->get_player())
 	        && actor->get_corpser_flag() == false) {
 		Tile *tile = tile_manager->get_tile(actor->get_tile_num() + actor->frame_n);
-		Tile *rtile = 0;
+		Tile *rtile = nullptr;
 
 		if (actor->obj_flags & OBJ_STATUS_INVISIBLE) {
 			rtile = new Tile(*tile);
diff --git a/engines/ultima/nuvie/usecode/usecode.cpp b/engines/ultima/nuvie/usecode/usecode.cpp
index 55be00151ce..25633ed0d09 100644
--- a/engines/ultima/nuvie/usecode/usecode.cpp
+++ b/engines/ultima/nuvie/usecode/usecode.cpp
@@ -285,7 +285,7 @@ bool UseCode::out_of_use_range(Obj *obj, bool check_enemies) {
 		} else
 			return false;
 	} else if (player_loc.distance(obj_loc) > 1) { // only setup for objects that already checked range and blocking limit
-		ActorList *enemies = 0;
+		ActorList *enemies = nullptr;
 
 		if ((enemies = player->get_actor()->find_enemies())) {
 			scroll->display_string("\nOut of range.\n");


Commit: d5b5c7314931238fb76378b5868da9cccd5004f3
    https://github.com/scummvm/scummvm/commit/d5b5c7314931238fb76378b5868da9cccd5004f3
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2023-12-09T13:56:09+11:00

Commit Message:
ULTIMA: NUVIE: Clean up by reducing variable scope

Replaced c-style variable declarations at the front of the function and moved
the declaration closer to use to reduce their scope and improve readability.

Changed paths:
    engines/ultima/nuvie/actors/u6_actor.cpp
    engines/ultima/nuvie/core/game_clock.cpp
    engines/ultima/nuvie/core/look.cpp
    engines/ultima/nuvie/core/magic.cpp
    engines/ultima/nuvie/core/map.cpp
    engines/ultima/nuvie/core/nuvie_defs.h
    engines/ultima/nuvie/core/obj_manager.cpp
    engines/ultima/nuvie/core/party.cpp
    engines/ultima/nuvie/core/player.cpp
    engines/ultima/nuvie/core/tile_manager.cpp
    engines/ultima/nuvie/core/timed_event.cpp
    engines/ultima/nuvie/core/weather.cpp
    engines/ultima/nuvie/files/u6_shape.cpp
    engines/ultima/nuvie/gui/gui_dialog.cpp
    engines/ultima/nuvie/save/save_game.cpp
    engines/ultima/nuvie/screen/dither.cpp
    engines/ultima/nuvie/screen/game_palette.cpp
    engines/ultima/nuvie/screen/screen.cpp
    engines/ultima/nuvie/sound/towns_sfx_manager.cpp
    engines/ultima/nuvie/views/party_view.cpp
    engines/ultima/nuvie/views/spell_view_gump.cpp
    engines/ultima/nuvie/views/sun_moon_strip_widget.cpp


diff --git a/engines/ultima/nuvie/actors/u6_actor.cpp b/engines/ultima/nuvie/actors/u6_actor.cpp
index 74edde72a74..7c251f989f4 100644
--- a/engines/ultima/nuvie/actors/u6_actor.cpp
+++ b/engines/ultima/nuvie/actors/u6_actor.cpp
@@ -1351,11 +1351,10 @@ inline void U6Actor::twitch_surrounding_dragon_objs() {
 }
 
 inline void U6Actor::twitch_surrounding_hydra_objs() {
-	uint8 i;
 	Std::list<Obj *>::iterator obj;
+	int i;
 
-//Note! list order is important here. As it corresponds to the frame order in the tile set. This is defined in init_hydra()
-
+	//Note! list order is important here. As it corresponds to the frame order in the tile set. This is defined in init_hydra()
 	for (i = 0, obj = surrounding_objects.begin(); obj != surrounding_objects.end(); obj++, i += 4) {
 		if (NUVIE_RAND() % 4 == 0)
 			(*obj)->frame_n = i + (((*obj)->frame_n - i + 1) % 4);
diff --git a/engines/ultima/nuvie/core/game_clock.cpp b/engines/ultima/nuvie/core/game_clock.cpp
index f8dc4879fda..9d7d5c54906 100644
--- a/engines/ultima/nuvie/core/game_clock.cpp
+++ b/engines/ultima/nuvie/core/game_clock.cpp
@@ -136,7 +136,7 @@ bool GameClock::save(NuvieIO *objlist) {
 void GameClock::save_U6_timers(NuvieIO *objlist) {
 	objlist->seek(OBJLIST_OFFSET_U6_TIMERS);
 
-	for (uint8 i = 0; i < num_timers; i++) {
+	for (int i = 0; i < num_timers; i++) {
 		objlist->write1(timers[i]);
 	}
 
@@ -147,7 +147,7 @@ void GameClock::save_U6_timers(NuvieIO *objlist) {
 void GameClock::save_MD_timers(NuvieIO *objlist) {
 	objlist->seek(OBJLIST_OFFSET_MD_BERRY_TIMERS);
 
-	for (uint8 i = 0; i < num_timers - 1; i += 3) {
+	for (int i = 0; i < num_timers - 1; i += 3) {
 		objlist->write1((uint8)(timers[i + 1] << 4) + timers[i]);
 		objlist->write1(timers[i + 2]);
 	}
diff --git a/engines/ultima/nuvie/core/look.cpp b/engines/ultima/nuvie/core/look.cpp
index a672fed3ddc..3d6990602b7 100644
--- a/engines/ultima/nuvie/core/look.cpp
+++ b/engines/ultima/nuvie/core/look.cpp
@@ -168,9 +168,7 @@ uint16 Look::get_max_len() const {
 }
 
 void Look::print() {
-	uint16 i;
-
-	for (i = 0; i < 2048; i++) {
+	for (int i = 0; i < 2048; i++) {
 		DEBUG(0, LEVEL_DEBUGGING, "%04d :: %s\n", i, look_tbl[i]);
 	}
 
diff --git a/engines/ultima/nuvie/core/magic.cpp b/engines/ultima/nuvie/core/magic.cpp
index 16d68248f0d..efab0417f69 100644
--- a/engines/ultima/nuvie/core/magic.cpp
+++ b/engines/ultima/nuvie/core/magic.cpp
@@ -74,7 +74,8 @@ Magic::Magic() : event(nullptr), magic_script(nullptr), spellbook_obj(nullptr),
 }
 
 Magic::~Magic() {
-	for (uint16 index = 0; index < 256; index++) delete(spell[index]);
+	for (int index = 0; index < 256; index++)
+		delete(spell[index]);
 }
 
 bool Magic::init(Events *evt) {
@@ -88,10 +89,9 @@ bool Magic::read_spell_list() {
 
 Obj *Magic::book_equipped() {
 	// book(s) equipped? Maybe should check all locations?
-	Obj *obj = nullptr;
 	Actor *caster = event->player->get_actor();
 
-	obj = caster->inventory_get_readied_object(ACTOR_ARM);
+	Obj *obj = caster->inventory_get_readied_object(ACTOR_ARM);
 	if (obj && obj->obj_n == OBJ_U6_SPELLBOOK)
 		return obj;
 
@@ -269,7 +269,7 @@ bool Magic::cast() {
 	// consume the reagents and magic points; we checked so they must be there.
 	caster->set_magic(caster->get_magic() - spell_level); // add a MAX (0, here?
 
-	for (uint8 shift = 0; shift < 8; shift++) {
+	for (int shift = 0; shift < 8; shift++) {
 		if (1 << shift & spell[index]->reagents) {
 			// FIXME Although we just checked, maybe something is messed up, so we
 			// should probably check that we're not passing nullptr to delete_obj
@@ -286,7 +286,7 @@ bool Magic::cast() {
 
 void Magic::display_spell_incantation(uint8 index) {
 	string incantation_str;
-	for (uint8 i = 0; spell[index]->invocation[i] != '\0'; i++)
+	for (int i = 0; spell[index]->invocation[i] != '\0'; i++)
 		incantation_str += syllable[spell[index]->invocation[i] - Common::KEYCODE_a];
 
 	incantation_str.erase(incantation_str.size() - 1); // get rid of extra space at the end
@@ -307,7 +307,7 @@ void Magic::display_ingredients(uint8 index) {
 		return;
 	}
 	string list;
-	for (uint8 shift = 0; shift < 8; shift++) {
+	for (int shift = 0; shift < 8; shift++) {
 		if (1 << shift & spell[index]->reagents) {
 			list += " ";
 			list += reagent[shift];
diff --git a/engines/ultima/nuvie/core/map.cpp b/engines/ultima/nuvie/core/map.cpp
index 8190c0585e3..4c88f50c592 100644
--- a/engines/ultima/nuvie/core/map.cpp
+++ b/engines/ultima/nuvie/core/map.cpp
@@ -45,14 +45,12 @@ Map::Map(const Configuration *cfg) : config(cfg), tile_manager(nullptr),
 }
 
 Map::~Map() {
-	uint8 i;
-
 	if (surface == nullptr)
 		return;
 
 	free(surface);
 
-	for (i = 0; i < 5; i++)
+	for (int i = 0; i < 5; i++)
 		free(dungeons[i]);
 
 	if (roof_surface)
@@ -188,14 +186,11 @@ bool Map::is_passable(uint16 x1, uint16 y1, uint16 x2, uint16 y2, uint8 level) {
 }
 
 bool Map::is_boundary(uint16 x, uint16 y, uint8 level) {
-	uint8 *ptr;
-	Tile *map_tile;
-
 	WRAP_COORD(x, level);
 	WRAP_COORD(y, level);
 
-	ptr = get_map_data(level);
-	map_tile = tile_manager->get_tile(ptr[y * get_width(level) + x]);
+	uint8 *ptr = get_map_data(level);
+	Tile *map_tile = tile_manager->get_tile(ptr[y * get_width(level) + x]);
 
 	if (map_tile->boundary && obj_manager->is_forced_passable(x, y, level) == false)
 		return true;
@@ -207,14 +202,11 @@ bool Map::is_boundary(uint16 x, uint16 y, uint8 level) {
 }
 
 bool Map::is_missile_boundary(uint16 x, uint16 y, uint8 level, Obj *excluded_obj) {
-	uint8 *ptr;
-	Tile *map_tile;
-
 	WRAP_COORD(x, level);
 	WRAP_COORD(y, level);
 
-	ptr = get_map_data(level);
-	map_tile = tile_manager->get_tile(ptr[y * get_width(level) + x]);
+	uint8 *ptr = get_map_data(level);
+	Tile *map_tile = tile_manager->get_tile(ptr[y * get_width(level) + x]);
 
 	if ((map_tile->flags2 & TILEFLAG_MISSILE_BOUNDARY) != 0 && obj_manager->is_forced_passable(x, y, level) == false)
 		return true;
@@ -344,8 +336,6 @@ Actor *Map::get_actor(uint16 x, uint16 y, uint8 z, bool inc_surrounding_objs) {
 
 const char *Map::look(uint16 x, uint16 y, uint8 level) {
 	unsigned char *ptr;
-	uint16 tile_num;
-	Obj *obj;
 	uint16 qty = 0;
 
 	if (level == 0) {
@@ -355,7 +345,7 @@ const char *Map::look(uint16 x, uint16 y, uint8 level) {
 
 	WRAP_COORD(x, level);
 	WRAP_COORD(y, level);
-	obj = obj_manager->get_obj(x, y, level);
+	Obj *obj = obj_manager->get_obj(x, y, level);
 	if (obj != nullptr && !(obj->status & OBJ_STATUS_INVISIBLE) //only show visible objects.
 	        && !Game::get_game()->get_map_window()->tile_is_black(obj->x, obj->y, obj)) {
 		//      tile = tile_manager->get_original_tile(obj_manager->get_obj_tile_num(obj->obj_n)+obj->frame_n);
@@ -363,7 +353,7 @@ const char *Map::look(uint16 x, uint16 y, uint8 level) {
 		//      qty = obj->qty;
 		return obj_manager->look_obj(obj);
 	}
-	tile_num =  ptr[y * get_width(level) + x];
+	uint16 tile_num =  ptr[y * get_width(level) + x];
 	return tile_manager->lookAtTile(tile_num, qty, true);
 }
 
@@ -372,9 +362,6 @@ bool Map::loadMap(TileManager *tm, ObjManager *om) {
 	Std::string filename;
 	NuvieIOFileRead map_file;
 	NuvieIOFileRead chunks_file;
-	unsigned char *map_data;
-	unsigned char *map_ptr;
-	unsigned char *chunk_data;
 
 	uint8 i;
 
@@ -389,15 +376,15 @@ bool Map::loadMap(TileManager *tm, ObjManager *om) {
 	if (chunks_file.open(filename) == false)
 		return false;
 
-	map_data = map_file.readAll();
+	unsigned char *map_data = map_file.readAll();
 	if (map_data == nullptr)
 		return false;
 
-	chunk_data = chunks_file.readAll();
+	unsigned char *chunk_data = chunks_file.readAll();
 	if (chunk_data == nullptr)
 		return false;
 
-	map_ptr = map_data;
+	unsigned char *map_ptr = map_data;
 
 	surface = (unsigned char *)malloc(1024 * 1024);
 	if (surface == nullptr)
@@ -507,12 +494,11 @@ void Map::set_roof_mode(bool roofs) {
 
 void Map::loadRoofData() {
 	NuvieIOFileRead file;
-	uint16 *ptr;
 	roof_surface = (uint16 *)malloc(1024 * 1024 * 2);
 
 	if (file.open(getRoofDataFilename())) {
 		memset(roof_surface, 0, 1024 * 1024 * 2);
-		ptr = roof_surface;
+		uint16 *ptr = roof_surface;
 		while (!file.is_eof()) {
 			uint16 offset = file.read2();
 			ptr += offset;
@@ -596,11 +582,10 @@ void Map::insertSurfaceSuperChunk(const unsigned char *schunk, const unsigned ch
 
 void Map::insertSurfaceChunk(const unsigned char *chunk, uint16 x, uint16 y) {
 	unsigned char *map_ptr;
-	uint8 i;
 
 	map_ptr = &surface[y * 1024 + x];
 
-	for (i = 0; i < 8; i++) {
+	for (int i = 0; i < 8; i++) {
 		memcpy(map_ptr, chunk, 8);
 		map_ptr += 1024;
 		chunk += 8;
@@ -627,11 +612,10 @@ void Map::insertDungeonSuperChunk(const unsigned char *schunk, const unsigned ch
 
 void Map::insertDungeonChunk(const unsigned char *chunk, uint16 x, uint16 y, uint8 level) {
 	unsigned char *map_ptr;
-	uint8 i;
 
 	map_ptr = &dungeons[level][y * 256 + x];
 
-	for (i = 0; i < 8; i++) {
+	for (int i = 0; i < 8; i++) {
 		memcpy(map_ptr, chunk, 8);
 		map_ptr += 256;
 		chunk += 8;
diff --git a/engines/ultima/nuvie/core/nuvie_defs.h b/engines/ultima/nuvie/core/nuvie_defs.h
index 331d246dca8..17a132e694f 100644
--- a/engines/ultima/nuvie/core/nuvie_defs.h
+++ b/engines/ultima/nuvie/core/nuvie_defs.h
@@ -53,8 +53,6 @@ typedef uint8 nuvie_game_t; // Game type (1=u6,2=md,4=se)
 #define NUVIE_STYLE_ORIG_PLUS_CUTOFF_MAP 2
 #define NUVIE_STYLE_ORIG_PLUS_FULL_MAP   3
 
-#define MAX(x, y)      ((x) > (y) ? (x) : (y))
-#define MIN(x, y)      ((x) < (y) ? (x) : (y))
 #define clamp_min(v, c)  (((v) < (c)) ? (c) : (v))
 #define clamp_max(v, c)  (((v) > (c)) ? (c) : (v))
 #define clamp(v, c1, c2) ( ((v) < (c1)) ? (c1) : (((v) > (c2)) ? (c2) : (v)) )
@@ -135,8 +133,6 @@ extern void u6debug(bool no_header, const DebugLevelType level, const char *form
 #define NUVIE_RAND_MAX 0x7fffffff // POSIX: 2^(31)-1
 #define NUVIE_RAND() getRandom(NUVIE_RAND_MAX)
 
-#define nuprint Game::get_game()->get_scroll()->print
-
 } // End of namespace Nuvie
 } // End of namespace Ultima
 
diff --git a/engines/ultima/nuvie/core/obj_manager.cpp b/engines/ultima/nuvie/core/obj_manager.cpp
index b3a85d85342..a799cc992c2 100644
--- a/engines/ultima/nuvie/core/obj_manager.cpp
+++ b/engines/ultima/nuvie/core/obj_manager.cpp
@@ -57,11 +57,11 @@ ObjManager::ObjManager(const Configuration *cfg, TileManager *tm, EggManager *em
 
 	memset(actor_inventories, 0, sizeof(actor_inventories));
 
-	for (uint8 i = 0; i < 64; i++) {
+	for (int i = 0; i < 64; i++) {
 		surface[i] = iAVLAllocTree(get_iAVLKey);
 	}
 
-	for (uint8 i = 0; i < 5; i++) {
+	for (int i = 0; i < 5; i++) {
 		dungeon[i] = iAVLAllocTree(get_iAVLKey);
 	}
 
@@ -97,14 +97,13 @@ ObjManager::ObjManager(const Configuration *cfg, TileManager *tm, EggManager *em
 ObjManager::~ObjManager() {
 	clean();
 
-	unsigned int i;
-	for (i = 0; i < 64; i++)
+	for (int i = 0; i < 64; i++)
 		iAVLFreeTree(surface[i], clean_obj_tree_node);
 
-	for (i = 0; i < 5; i++)
+	for (int i = 0; i < 5; i++)
 		iAVLFreeTree(dungeon[i], clean_obj_tree_node);
 
-	for (i = 0; i < 256; i++) {
+	for (int i = 0; i < 256; i++) {
 		if (actor_inventories[i]) {
 			delete actor_inventories[i];
 		}
@@ -114,14 +113,13 @@ ObjManager::~ObjManager() {
 bool ObjManager::load_basetile() {
 	Std::string filename;
 	NuvieIOFileRead basetile;
-	uint16 i;
 
 	config_get_path(config, "basetile", filename);
 
 	if (basetile.open(filename) == false)
 		return false;
 
-	for (i = 0; i < 1024; i++) {
+	for (int i = 0; i < 1024; i++) {
 		obj_to_tile[i] = basetile.read2();
 		obj_stackable[i] = (uint8)tile_manager->tile_is_stackable(obj_to_tile[i]);
 	} // FIXME: tile_manager's tile_is_stackable is incorrect for (at least) Zu Ylem, silver snake venom.
@@ -147,26 +145,13 @@ bool ObjManager::load_weight_table() {
 
 
 bool ObjManager::load_super_chunk(NuvieIO *chunk_buf, uint8 level, uint8 chunk_offset) {
-	NuvieIOFileRead file;
-	U6LList *list;
-	uint16 num_objs;
-	Obj *obj;
-	uint16 i;
-	U6LList *inventory_list;
-	iAVLTree *obj_tree;
-
-	if (level == 0)
-		obj_tree = surface[chunk_offset];
-	else
-		obj_tree = dungeon[level - 1];
-
-	list = new U6LList();
+	U6LList *list = new U6LList();
 
-	num_objs = chunk_buf->read2();
-//DEBUG(0,LEVEL_DEBUGGING,"chunk %02d number of objects: %d\n", chunk_offset, num_objs);
+	uint num_objs = chunk_buf->read2();
+	//DEBUG(0,LEVEL_DEBUGGING,"chunk %02d number of objects: %d\n", chunk_offset, num_objs);
 
-	for (i = 0; i < num_objs; i++) {
-		obj = loadObj(chunk_buf);
+	for (uint i = 0; i < num_objs; i++) {
+		Obj *obj = loadObj(chunk_buf);
 
 		list->add(obj);
 
@@ -182,7 +167,7 @@ bool ObjManager::load_super_chunk(NuvieIO *chunk_buf, uint8 level, uint8 chunk_o
 
 		if (obj->get_engine_loc() == OBJ_LOC_INV || obj->get_engine_loc() == OBJ_LOC_READIED) { //triggered when object in actor's inventory OR equipped
 			//FIXME need to add to inventory properly!! eg set engine loc.
-			inventory_list = get_actor_inventory(obj->x);
+			U6LList *inventory_list = get_actor_inventory(obj->x);
 			inventory_list->add(obj);
 		} else {
 			if (obj->is_in_container()) { //object in container
@@ -200,39 +185,32 @@ bool ObjManager::load_super_chunk(NuvieIO *chunk_buf, uint8 level, uint8 chunk_o
 		//print_obj(obj,false);
 	}
 
-	// Unused variable
-	(void)obj_tree;
-
 	delete list;
 
 	return true;
 }
 
 bool ObjManager::save_super_chunk(NuvieIO *save_buf, uint8 level, uint8 chunk_offset) {
-	iAVLTree *obj_tree;
-	ObjTreeNode *item;
-	U6Link *link;
-	iAVLCursor node;
-	uint32 start_pos;
-	uint32 finish_pos;
 	uint16 egg_type = obj_egg_table[game_type];
 
+	iAVLTree *obj_tree;
 	if (level == 0)
 		obj_tree = surface[chunk_offset];
 	else
 		obj_tree = dungeon[level - 1];
 
-	item = (ObjTreeNode *)iAVLFirst(&node, obj_tree);
+	iAVLCursor node;
+	ObjTreeNode *item = (ObjTreeNode *)iAVLFirst(&node, obj_tree);
 
-	start_pos = save_buf->position();
+	uint32 start_pos = save_buf->position();
 
-//skip the 2 bytes for number of objects.
+	//skip the 2 bytes for number of objects.
 	save_buf->write2(0); // we'll fill this in later on.
 
 	obj_save_count = 0;
 
 	for (; item;) {
-		for (link = item->obj_list->end(); link != nullptr; link = link->prev) {
+		for (U6Link *link = item->obj_list->end(); link != nullptr; link = link->prev) {
 			if (((Obj *)link->data)->obj_n != egg_type) // we don't save eggs here. They are saved in save_eggs()
 				save_obj(save_buf, (Obj *)link->data, obj_save_count);
 		}
@@ -240,7 +218,7 @@ bool ObjManager::save_super_chunk(NuvieIO *save_buf, uint8 level, uint8 chunk_of
 		item = (ObjTreeNode *)iAVLNext(&node);
 	}
 
-	finish_pos = save_buf->position();
+	uint32 finish_pos = save_buf->position();
 	save_buf->seek(start_pos);
 
 	save_buf->write2(obj_save_count);
@@ -250,8 +228,6 @@ bool ObjManager::save_super_chunk(NuvieIO *save_buf, uint8 level, uint8 chunk_of
 }
 
 bool ObjManager::save_eggs(NuvieIO *save_buf) {
-	uint32 finish_pos;
-
 	uint32 start_pos = save_buf->position();
 
 //skip number of objects we will fill that in at the end.
@@ -264,7 +240,7 @@ bool ObjManager::save_eggs(NuvieIO *save_buf) {
 	for (Egg *egg : *egg_list)
 		save_obj(save_buf, egg->obj, obj_save_count);
 
-	finish_pos = save_buf->position();
+	uint32 finish_pos = save_buf->position();
 	save_buf->seek(start_pos);
 
 	save_buf->write2(obj_save_count);
@@ -276,20 +252,15 @@ bool ObjManager::save_eggs(NuvieIO *save_buf) {
 }
 
 bool ObjManager::save_inventories(NuvieIO *save_buf) {
-	uint32 start_pos;
-	uint32 finish_pos;
-	U6Link *link;
-	uint16 i;
-
-	start_pos = save_buf->position();
+	uint32 start_pos = save_buf->position();
 
 	save_buf->write2(0);
 
 	obj_save_count = 0;
 
-	for (i = 0; i < 256; i++) {
+	for (int i = 0; i < 256; i++) {
 		if (actor_inventories[i] != nullptr) {
-			for (link = actor_inventories[i]->start(); link != nullptr; link = link->next) {
+			for (U6Link *link = actor_inventories[i]->start(); link != nullptr; link = link->next) {
 				save_obj(save_buf, (Obj *)link->data, obj_save_count);
 			}
 		}
@@ -297,7 +268,7 @@ bool ObjManager::save_inventories(NuvieIO *save_buf) {
 
 	DEBUG(0, LEVEL_DEBUGGING, "Actor Inventories: %d\n", obj_save_count);
 
-	finish_pos = save_buf->position();
+	uint32 finish_pos = save_buf->position();
 	save_buf->seek(start_pos);
 
 	save_buf->write2(obj_save_count);
@@ -307,10 +278,6 @@ bool ObjManager::save_inventories(NuvieIO *save_buf) {
 }
 
 bool ObjManager::save_obj(NuvieIO *save_buf, Obj *obj, uint16 parent_objblk_n) {
-	uint8 b;
-	U6Link *link;
-	uint16 objblk_n;
-
 	if (obj->is_in_container()) { //obj is in a container
 		//obj->in_container(); // in container
 		obj->x = parent_objblk_n & 0x3ff; //save 10bits in x
@@ -344,7 +311,8 @@ bool ObjManager::save_obj(NuvieIO *save_buf, Obj *obj, uint16 parent_objblk_n) {
 
 	save_buf->write1(obj->status);
 	save_buf->write1(obj->x & 0xff);
-	b = obj->x >> 8;
+
+	uint8 b = obj->x >> 8;
 	b += obj->y << 2;
 	save_buf->write1(b);
 
@@ -367,12 +335,12 @@ bool ObjManager::save_obj(NuvieIO *save_buf, Obj *obj, uint16 parent_objblk_n) {
 	else
 		save_buf->write1(obj->quality);
 
-	objblk_n = obj_save_count;
+	uint16 objblk_n = obj_save_count;
 
 	obj_save_count += 1;
 
 	if (obj->container) {
-		for (link = obj->container->start(); link != nullptr; link = link->next)
+		for (U6Link *link = obj->container->start(); link != nullptr; link = link->next)
 			save_obj(save_buf, (Obj *)link->data, objblk_n);
 	}
 
@@ -380,14 +348,12 @@ bool ObjManager::save_obj(NuvieIO *save_buf, Obj *obj, uint16 parent_objblk_n) {
 }
 
 void ObjManager::clean() {
-	uint8 i;
-
 	egg_manager->clean(Game::get_game()->are_cheats_enabled() ? show_eggs : false); //show_eggs determines whether we delete the actual Objs from egg manager.
 
-	for (i = 0; i < 64; i++)
+	for (int i = 0; i < 64; i++)
 		iAVLCleanTree(surface[i], clean_obj_tree_node);
 
-	for (i = 0; i < 5; i++)
+	for (int i = 0; i < 5; i++)
 		iAVLCleanTree(dungeon[i], clean_obj_tree_node);
 
 	clean_actor_inventories();
@@ -403,12 +369,9 @@ void ObjManager::clean() {
 }
 
 void ObjManager::clean_actor_inventories() {
-	U6Link *link;
-	uint16 i;
-
-	for (i = 0; i < 256; i++) {
+	for (int i = 0; i < 256; i++) {
 		if (actor_inventories[i]) {
-			for (link = actor_inventories[i]->start(); link != nullptr;) {
+			for (U6Link *link = actor_inventories[i]->start(); link != nullptr;) {
 				Obj *obj = (Obj *)link->data;
 				link = link->next;
 				delete_obj(obj);
@@ -436,31 +399,23 @@ U6LList *ObjManager::get_obj_superchunk(uint16 x, uint16 y, uint8 level)
 */
 
 bool ObjManager::is_boundary(uint16 x, uint16 y, uint8 level, uint8 boundary_type, Obj *excluded_obj) {
-	U6Link *link;
-	U6LList *obj_list;
-	Obj *obj;
-	Tile *tile, *tile1;
-	uint16 tile_num;
-	bool check_tile;
-	uint16 i, j;
-	uint16 next_x, next_y;
-
-	next_x = WRAPPED_COORD(x + 1, level);
-	next_y = WRAPPED_COORD(y + 1, level);
+	uint16 next_x = WRAPPED_COORD(x + 1, level);
+	uint16 next_y = WRAPPED_COORD(y + 1, level);
 
-	for (j = y; j <= y + 1; j++) {
-		for (i = x; i <= x + 1; i++) {
-			obj_list = get_obj_list(WRAPPED_COORD(i, level), WRAPPED_COORD(j, level), level);
+	for (uint16 j = y; j <= y + 1; j++) {
+		for (uint16 i = x; i <= x + 1; i++) {
+			U6LList *obj_list = get_obj_list(WRAPPED_COORD(i, level), WRAPPED_COORD(j, level), level);
 
 			if (obj_list != nullptr) {
-				link = obj_list->end();
+				U6Link *link = obj_list->end();
 
-				for (check_tile = false; link != nullptr; link = link->prev) {
-					obj = (Obj *)link->data;
+				for (bool check_tile = false; link != nullptr; link = link->prev) {
+					Obj *obj = (Obj *)link->data;
 					if (obj == excluded_obj)
 						continue;
-					tile_num = get_obj_tile_num(obj->obj_n) + obj->frame_n;
-					tile = tile_manager->get_original_tile(tile_num);
+
+					uint16 tile_num = get_obj_tile_num(obj->obj_n) + obj->frame_n;
+					Tile *tile = tile_manager->get_original_tile(tile_num);
 
 					if (obj->x == x && obj->y == y) {
 						check_tile = true;
@@ -478,7 +433,7 @@ bool ObjManager::is_boundary(uint16 x, uint16 y, uint8 level, uint8 boundary_typ
 						check_tile = true;
 					}
 					if (check_tile) {
-						tile1 = tile_manager->get_tile(tile_num);
+						Tile *tile1 = tile_manager->get_tile(tile_num);
 						if (tile1->flags2 & boundary_type) //either TILEFLAG_BOUNDARY or TILEFLAG_MISSILE_BOUNDARY
 							return true;
 
@@ -505,32 +460,25 @@ bool ObjManager::is_door(Obj * obj)
 */
 
 uint8 ObjManager::is_passable(uint16 x, uint16 y, uint8 level) {
-	U6Link *link;
-	U6LList *obj_list;
-	Obj *obj;
-	Tile *tile, *tile1;
-	uint16 tile_num;
-	bool check_tile;
 	bool object_at_location = false;
-	uint16 i, j;
 
 	uint16 x2 = WRAPPED_COORD((x + 1), level); // wrap on map edge
 	uint16 y2 = WRAPPED_COORD((y + 1), level);
 
-	for (i = x;; i = x2) { // only checks x and x2
-		for (j = y;; j = y2) { // only checks y and y2
-			obj_list = get_obj_list(i, j, level);
+	for (uint16 i = x;; i = x2) { // only checks x and x2
+		for (uint16 j = y;; j = y2) { // only checks y and y2
+			U6LList *obj_list = get_obj_list(i, j, level);
 			if (i == x && j == y && obj_list) {
 				if (obj_list->end() != nullptr)
 					object_at_location = true;
 			}
 			if (obj_list != nullptr) {
-				link = obj_list->end();
+				U6Link *link = obj_list->end();
 
-				for (check_tile = false; link != nullptr; link = link->prev) {
-					obj = (Obj *)link->data;
-					tile_num = get_obj_tile_num(obj->obj_n) + obj->frame_n;
-					tile = tile_manager->get_original_tile(tile_num);
+				for (bool check_tile = false; link != nullptr; link = link->prev) {
+					Obj *obj = (Obj *)link->data;
+					uint16 tile_num = get_obj_tile_num(obj->obj_n) + obj->frame_n;
+					Tile *tile = tile_manager->get_original_tile(tile_num);
 
 					if (obj->x == x && obj->y == y) {
 						check_tile = true;
@@ -548,7 +496,7 @@ uint8 ObjManager::is_passable(uint16 x, uint16 y, uint8 level) {
 						check_tile = true;
 					}
 					if (check_tile) {
-						tile1 = tile_manager->get_original_tile(tile_num);
+						Tile *tile1 = tile_manager->get_original_tile(tile_num);
 						if (tile1->passable == false)
 							return OBJ_NOT_PASSABLE;
 						check_tile = false;
@@ -569,17 +517,12 @@ uint8 ObjManager::is_passable(uint16 x, uint16 y, uint8 level) {
 }
 
 bool ObjManager::is_forced_passable(uint16 x, uint16 y, uint8 level) {
-	U6LList *obj_list;
-	U6Link *link;
-	Obj *obj;
-	Tile *tile;
-
-	obj_list = get_obj_list(x, y, level);
+	U6LList *obj_list = get_obj_list(x, y, level);
 
 	if (obj_list) {
-		for (link = obj_list->start(); link != nullptr; link = link->next) {
-			obj = (Obj *)link->data;
-			tile = tile_manager->get_tile(get_obj_tile_num(obj->obj_n) + obj->frame_n);
+		for (U6Link *link = obj_list->start(); link != nullptr; link = link->next) {
+			Obj *obj = (Obj *)link->data;
+			Tile *tile = tile_manager->get_tile(get_obj_tile_num(obj->obj_n) + obj->frame_n);
 			if (tile->flags3 & TILEFLAG_FORCED_PASSABLE)
 				return true;
 		}
@@ -590,12 +533,10 @@ bool ObjManager::is_forced_passable(uint16 x, uint16 y, uint8 level) {
 
 bool ObjManager::is_door(uint16 x, uint16 y, uint8 level) {
 	U6LList *obj_list = get_obj_list(x, y, level);
-	U6Link *link;
-	Obj *obj;
 
 	if (obj_list) {
-		for (link = obj_list->start(); link != nullptr; link = link->next) {
-			obj = (Obj *)link->data;
+		for (U6Link *link = obj_list->start(); link != nullptr; link = link->next) {
+			Obj *obj = (Obj *)link->data;
 			if (usecode->is_door(obj))
 				return true;
 		}
@@ -604,17 +545,12 @@ bool ObjManager::is_door(uint16 x, uint16 y, uint8 level) {
 }
 
 bool ObjManager::is_damaging(uint16 x, uint16 y, uint8 level) {
-	U6LList *obj_list;
-	U6Link *link;
-	Obj *obj;
-	Tile *tile;
-
-	obj_list = get_obj_list(x, y, level);
+	U6LList *obj_list = get_obj_list(x, y, level);
 
 	if (obj_list) {
-		for (link = obj_list->start(); link != nullptr; link = link->next) {
-			obj = (Obj *)link->data;
-			tile = tile_manager->get_original_tile(get_obj_tile_num(obj->obj_n) + obj->frame_n); //get_tile(get_obj_tile_num(obj->obj_n)+obj->frame_n);
+		for (U6Link *link = obj_list->start(); link != nullptr; link = link->next) {
+			Obj *obj = (Obj *)link->data;
+			Tile *tile = tile_manager->get_original_tile(get_obj_tile_num(obj->obj_n) + obj->frame_n); //get_tile(get_obj_tile_num(obj->obj_n)+obj->frame_n);
 			if (tile->flags1 & TILEFLAG_DAMAGING)
 				return true;
 		}
@@ -624,14 +560,12 @@ bool ObjManager::is_damaging(uint16 x, uint16 y, uint8 level) {
 }
 
 bool ObjManager::is_stackable(const Obj *obj) {
-// Tile *tile;
-
 	if (obj == nullptr)
 		return false;
 	if (obj->is_readied()) // readied objects cannot be stacked --SB-X
 		return false;
 	/*
-	 tile = tile_manager->get_tile(get_obj_tile_num(obj->obj_n)+obj->frame_n);
+	 Tile *tile = tile_manager->get_tile(get_obj_tile_num(obj->obj_n)+obj->frame_n);
 
 	 if(tile_manager->tile_is_stackable(tile->tile_num))
 	   return true;
@@ -983,10 +917,9 @@ bool ObjManager::has_reduced_weight(uint16 obj_n) {
 }
 
 bool ObjManager::has_toptile(const Obj *obj) {
-	Tile *tile;
 	uint8 i = 1;
 
-	tile = tile_manager->get_tile(get_obj_tile_num(obj->obj_n) + obj->frame_n);
+	Tile *tile = tile_manager->get_tile(get_obj_tile_num(obj->obj_n) + obj->frame_n);
 
 	if (tile->dbl_width)
 		i++;
@@ -1011,17 +944,13 @@ bool ObjManager::has_toptile(const Obj *obj) {
 //gets the linked list of objects at a particular location.
 
 U6LList *ObjManager::get_obj_list(uint16 x, uint16 y, uint8 level) {
-	iAVLTree *obj_tree;
-	iAVLKey key;
-	ObjTreeNode *item;
-
 	WRAP_COORD(x, level); // wrap on map edge
 	WRAP_COORD(y, level);
 
-	obj_tree = get_obj_tree(x, y, level);
-	key = get_obj_tree_key(x, y, level);
+	iAVLTree *obj_tree = get_obj_tree(x, y, level);
+	iAVLKey key = get_obj_tree_key(x, y, level);
 
-	item = (ObjTreeNode *)iAVLSearch(obj_tree, key);
+	ObjTreeNode *item = (ObjTreeNode *)iAVLSearch(obj_tree, key);
 	if (item)
 		return item->obj_list;
 
@@ -1087,30 +1016,27 @@ bool ObjManager::obj_is_damaging(const Obj *obj, Actor *actor) {
 }
 
 Obj *ObjManager::get_obj(uint16 x, uint16 y, uint8 level, bool top_obj, bool include_ignored_objects, Obj *excluded_obj) {
-	Obj *obj;
-	Tile *tile;
-
-	obj = get_objBasedAt(x, y, level, top_obj, include_ignored_objects, excluded_obj);
+	Obj *obj = get_objBasedAt(x, y, level, top_obj, include_ignored_objects, excluded_obj);
 	if (obj != nullptr)
 		return obj;
 
 	obj = get_objBasedAt(x + 1, y + 1, level, top_obj, include_ignored_objects, excluded_obj);
 	if (obj != nullptr) {
-		tile = tile_manager->get_tile(get_obj_tile_num(obj->obj_n) + obj->frame_n);
+		Tile *tile = tile_manager->get_tile(get_obj_tile_num(obj->obj_n) + obj->frame_n);
 		if (tile->dbl_width && tile->dbl_height)
 			return obj;
 	}
 
 	obj = get_objBasedAt(x, y + 1, level, top_obj, include_ignored_objects, excluded_obj);
 	if (obj != nullptr) {
-		tile = tile_manager->get_tile(get_obj_tile_num(obj->obj_n) + obj->frame_n);
+		Tile *tile = tile_manager->get_tile(get_obj_tile_num(obj->obj_n) + obj->frame_n);
 		if (tile->dbl_height)
 			return obj;
 	}
 
 	obj = get_objBasedAt(x + 1, y, level, top_obj, include_ignored_objects, excluded_obj);
 	if (obj != nullptr) {
-		tile = tile_manager->get_tile(get_obj_tile_num(obj->obj_n) + obj->frame_n);
+		Tile *tile = tile_manager->get_tile(get_obj_tile_num(obj->obj_n) + obj->frame_n);
 		if (tile->dbl_width)
 			return obj;
 	}
@@ -1124,30 +1050,27 @@ Obj *ObjManager::get_obj_of_type_from_location_inc_multi_tile(uint16 obj_n, uint
 }
 
 Obj *ObjManager::get_obj_of_type_from_location_inc_multi_tile(uint16 obj_n, sint16 quality, sint32 qty, uint16 x, uint16 y, uint8 z) {
-	Obj *obj;
-	Tile *tile;
-
-	obj = get_obj_of_type_from_location(obj_n, quality, qty, x, y, z);
+	Obj *obj = get_obj_of_type_from_location(obj_n, quality, qty, x, y, z);
 	if (obj != nullptr)
 		return obj;
 
 	obj = get_obj_of_type_from_location(obj_n, quality, qty, x + 1, y + 1, z);
 	if (obj != nullptr) {
-		tile = tile_manager->get_tile(get_obj_tile_num(obj->obj_n) + obj->frame_n);
+		Tile *tile = tile_manager->get_tile(get_obj_tile_num(obj->obj_n) + obj->frame_n);
 		if (tile->dbl_width && tile->dbl_height)
 			return obj;
 	}
 
 	obj = get_obj_of_type_from_location(obj_n, quality, qty, x, y + 1, z);
 	if (obj != nullptr) {
-		tile = tile_manager->get_tile(get_obj_tile_num(obj->obj_n) + obj->frame_n);
+		Tile *tile = tile_manager->get_tile(get_obj_tile_num(obj->obj_n) + obj->frame_n);
 		if (tile->dbl_height)
 			return obj;
 	}
 
 	obj = get_obj_of_type_from_location(obj_n, quality, qty, x + 1, y, z);
 	if (obj != nullptr) {
-		tile = tile_manager->get_tile(get_obj_tile_num(obj->obj_n) + obj->frame_n);
+		Tile *tile = tile_manager->get_tile(get_obj_tile_num(obj->obj_n) + obj->frame_n);
 		if (tile->dbl_width)
 			return obj;
 	}
@@ -1161,17 +1084,13 @@ Obj *ObjManager::get_obj_of_type_from_location(uint16 obj_n, uint16 x, uint16 y,
 }
 
 Obj *ObjManager::get_obj_of_type_from_location(uint16 obj_n, sint16 quality, sint32 qty, uint16 x, uint16 y, uint8 z) {
-	U6LList *obj_list;
-	U6Link *link;
-	Obj *obj;
-
-	obj_list = get_obj_list(x, y, z);
+	U6LList *obj_list = get_obj_list(x, y, z);
 
 	if (obj_list == nullptr)
 		return nullptr;
 // start from the top of the stack
-	for (link = obj_list->end(); link != nullptr; link = link->prev) {
-		obj = (Obj *)link->data;
+	for (U6Link *link = obj_list->end(); link != nullptr; link = link->prev) {
+		Obj *obj = (Obj *)link->data;
 		if (obj->obj_n == obj_n) {
 			if (quality != -1 && obj->quality != (uint8)quality)
 				continue;
@@ -1188,20 +1107,17 @@ Obj *ObjManager::get_obj_of_type_from_location(uint16 obj_n, sint16 quality, sin
 
 // x, y in world coords
 Obj *ObjManager::get_objBasedAt(uint16 x, uint16 y, uint8 level, bool top_obj, bool include_ignored_objects, Obj *excluded_obj) {
-	U6Link *link;
-	U6LList *obj_list;
-	Obj *obj;
-
-	obj_list = get_obj_list(x, y, level);
+	U6LList *obj_list = get_obj_list(x, y, level);
 
 	if (obj_list != nullptr) {
+		U6Link *link;
 		if (top_obj)
 			link = obj_list->end();
 		else
 			link = obj_list->start();
 
 		while (link != nullptr) {
-			obj = (Obj *)link->data;
+			Obj *obj = (Obj *)link->data;
 
 			if (obj != excluded_obj) {
 				if (include_ignored_objects)
@@ -1244,12 +1160,10 @@ bool ObjManager::add_obj(Obj *obj, bool addOnTop)
 */
 
 bool ObjManager::remove_obj_from_map(Obj *obj) {
-	U6LList *obj_list;
-
 	if (obj->get_engine_loc() != OBJ_LOC_MAP)
 		return false;
 
-	obj_list = (U6LList *)obj->parent;
+	U6LList *obj_list = (U6LList *)obj->parent;
 
 	if (obj_list == nullptr)
 		return false;
@@ -1276,16 +1190,13 @@ void ObjManager::remove_obj(Obj *obj) {
 // remove all objects of type obj_n from location (x,y,z)
 
 bool ObjManager::remove_obj_type_from_location(uint16 obj_n, uint16 x, uint16 y, uint8 z) {
-	U6LList *obj_list;
-	U6Link *link;
-	Obj *obj;
 	bool objects_deleted = false;
 
-	obj_list = get_obj_list(x, y, z);
+	U6LList *obj_list = get_obj_list(x, y, z);
 
 	if (obj_list != nullptr) {
-		for (link = obj_list->start(); link != nullptr;) {
-			obj = (Obj *)link->data;
+		for (U6Link *link = obj_list->start(); link != nullptr;) {
+			Obj *obj = (Obj *)link->data;
 			link = link->next;
 
 			if (obj->obj_n == obj_n) {
@@ -1300,25 +1211,12 @@ bool ObjManager::remove_obj_type_from_location(uint16 obj_n, uint16 x, uint16 y,
 }
 
 Obj *ObjManager::copy_obj(const Obj *obj) {
-	Obj *new_obj;
-
 	if (obj == nullptr)
 		return nullptr;
 
-	new_obj = new Obj(*obj);
-	/* changed to direct copy in case we add new members to Obj --SB-X
-	 new_obj->obj_n = obj->obj_n;
-	 new_obj->frame_n = obj->frame_n;
-
-	 new_obj->status = obj->status;
-	 new_obj->qty = obj->qty;
-	 new_obj->quality = obj->quality;
+	Obj *new_obj = new Obj(*obj);
 
-	 new_obj->x = obj->x;
-	 new_obj->y = obj->y;
-	 new_obj->z = obj->z;*/
-
-// should we copy container???
+	// should we copy container???
 	new_obj->container = 0;
 
 	return new_obj;
@@ -1340,11 +1238,10 @@ bool ObjManager::move(Obj *obj, uint16 x, uint16 y, uint8 level) {
 /* Returns an objects look-string, its general description.
  */
 const char *ObjManager::look_obj(Obj *obj, bool show_prefix) {
-	const char *desc;
 	if (obj == nullptr)
 		return nullptr;
 
-	desc = tile_manager->lookAtTile(get_obj_tile_num(obj) + obj->frame_n, obj->qty, show_prefix);
+	const char *desc = tile_manager->lookAtTile(get_obj_tile_num(obj) + obj->frame_n, obj->qty, show_prefix);
 
 	return desc;
 }
@@ -1371,10 +1268,7 @@ float ObjManager::get_obj_weight(uint16 obj_n) {
 }
 
 float ObjManager::get_obj_weight(Obj *obj, bool include_container_items, bool scale, bool include_qty) {
-	float weight;
-	U6Link *link;
-
-	weight = obj_weight[obj->obj_n];
+	float weight = obj_weight[obj->obj_n];
 
 	if (is_stackable(obj)) {
 		if (include_qty) {
@@ -1391,7 +1285,7 @@ float ObjManager::get_obj_weight(Obj *obj, bool include_container_items, bool sc
 	}
 
 	if (obj->container != nullptr && include_container_items == OBJ_WEIGHT_INCLUDE_CONTAINER_ITEMS) {
-		for (link = obj->container->start(); link != nullptr; link = link->next)
+		for (U6Link *link = obj->container->start(); link != nullptr; link = link->next)
 			/* weight += get_obj_weight(reinterpret_cast<Obj*>(link->data), false);*/ //don't scale container objects yet.
 			weight += get_obj_weight(reinterpret_cast<Obj *>(link->data), OBJ_WEIGHT_INCLUDE_CONTAINER_ITEMS, OBJ_WEIGHT_DONT_SCALE); //don't scale container objects yet. luteijn: and use the right flag to do so!
 	}
@@ -1500,17 +1394,14 @@ Obj *ObjManager::find_next_obj(uint8 level, Obj *prev_obj, bool match_frame_n, b
 }
 
 Obj *ObjManager::find_obj(uint8 level, uint16 obj_n, uint8 quality, bool match_quality, uint16 frame_n, bool match_frame_n, Obj **prev_obj) {
-	uint8 i;
-	Obj *new_obj;
-
 	if (level == 0) {
-		for (i = 0; i < 64; i++) {
-			new_obj = find_obj_in_tree(obj_n, quality, match_quality, frame_n, match_frame_n, prev_obj, surface[i]);
+		for (int i = 0; i < 64; i++) {
+			Obj *new_obj = find_obj_in_tree(obj_n, quality, match_quality, frame_n, match_frame_n, prev_obj, surface[i]);
 			if (new_obj != nullptr)
 				return new_obj;
 		}
 	} else {
-		new_obj = find_obj_in_tree(obj_n, quality, match_quality, frame_n, match_frame_n, prev_obj, dungeon[level - 1]);
+		Obj *new_obj = find_obj_in_tree(obj_n, quality, match_quality, frame_n, match_frame_n, prev_obj, dungeon[level - 1]);
 		if (new_obj != nullptr)
 			return new_obj;
 	}
@@ -1520,16 +1411,12 @@ Obj *ObjManager::find_obj(uint8 level, uint16 obj_n, uint8 quality, bool match_q
 
 inline Obj *ObjManager::find_obj_in_tree(uint16 obj_n, uint8 quality, bool match_quality, uint8 frame_n, bool match_frame_n, Obj **prev_obj, iAVLTree *obj_tree) {
 	iAVLCursor cursor;
-	ObjTreeNode *node;
-	U6Link *link;
-	Obj *new_obj;
-
-	node = (ObjTreeNode *)iAVLFirst(&cursor, obj_tree);
+	ObjTreeNode *node = (ObjTreeNode *)iAVLFirst(&cursor, obj_tree);
 
 	for (; node != nullptr;) {
-		link = ((U6LList *)(node->obj_list))->start();
+		U6Link *link = ((U6LList *)(node->obj_list))->start();
 		for (; link != nullptr; link = link->next) {
-			new_obj = (Obj *)link->data;
+			Obj *new_obj = (Obj *)link->data;
 			if (new_obj->obj_n == obj_n && (match_quality == false || new_obj->quality == quality) && (match_frame_n == false || new_obj->frame_n == frame_n)) {
 				if (prev_obj != nullptr && new_obj == *prev_obj)
 					*prev_obj = nullptr;
@@ -1555,16 +1442,12 @@ inline Obj *ObjManager::find_obj_in_tree(uint16 obj_n, uint8 quality, bool match
 }
 
 bool ObjManager::add_obj(Obj *obj, bool addOnTop) {
-	iAVLTree *obj_tree;
-	ObjTreeNode *node;
-	U6LList *obj_list;
-	iAVLKey key;
+	iAVLTree *obj_tree = get_obj_tree(obj->x, obj->y, obj->z);
+	iAVLKey key = get_obj_tree_key(obj);
 
-	obj_tree = get_obj_tree(obj->x, obj->y, obj->z);
-	key = get_obj_tree_key(obj);
-
-	node = (ObjTreeNode *)iAVLSearch(obj_tree, key);
+	ObjTreeNode *node = (ObjTreeNode *)iAVLSearch(obj_tree, key);
 
+	U6LList *obj_list;
 	if (node == nullptr) {
 		obj_list = new U6LList();
 
@@ -1590,13 +1473,9 @@ bool ObjManager::add_obj(Obj *obj, bool addOnTop) {
 	return true;
 }
 bool ObjManager::addObjToContainer(U6LList *llist, Obj *obj) {
-	U6Link *link;
 	Obj *c_obj = nullptr; //container object
-	uint16 index;
-
-	index = ((obj->y & 0x3f) << 10) + obj->x; //10 bits from x and 6 bits from y
-
-	link = llist->gotoPos(index);
+	uint16 index = ((obj->y & 0x3f) << 10) + obj->x; //10 bits from x and 6 bits from y
+	U6Link *link = llist->gotoPos(index);
 	if (link != nullptr)
 		c_obj = (Obj *)link->data;
 
@@ -1613,15 +1492,11 @@ bool ObjManager::addObjToContainer(U6LList *llist, Obj *obj) {
 }
 
 Obj *ObjManager::loadObj(NuvieIO *buf) {
-	uint8 b1, b2;
-	Obj *obj;
-
-	obj = new Obj();
-//obj->objblk_n = objblk_n;
+	Obj *obj = new Obj();
 
 	obj->status = buf->read1();
 
-//set new nuvie location bits.
+	//set new nuvie location bits.
 	switch (obj->status & OBJ_STATUS_MASK_GET) {
 	case OBJ_STATUS_ON_MAP :
 		obj->set_on_map(nullptr);
@@ -1637,6 +1512,7 @@ Obj *ObjManager::loadObj(NuvieIO *buf) {
 		break;//obj->nuvie_status |= OBJ_LOC_READIED; break;
 	}
 
+	uint8 b1, b2;
 	obj->x = buf->read1(); // h
 	b1 = buf->read1();
 	obj->x += (b1 & 0x3) << 8;
@@ -1659,9 +1535,6 @@ Obj *ObjManager::loadObj(NuvieIO *buf) {
 	if (is_stackable(obj))
 		obj->qty = (uint16)(obj->quality << 8) + obj->qty;
 
-//if(obj->qty == 0)
-//  obj->qty = 1;
-
 	return obj;
 }
 
@@ -1695,10 +1568,8 @@ iAVLKey ObjManager::get_obj_tree_key(uint16 x, uint16 y, uint8 level) {
 }
 
 void ObjManager::update(uint16 x, uint16 y, uint8 z, bool teleport) {
-	uint16 cur_blk_x, cur_blk_y;
-
-	cur_blk_x = x >> 3; // x / 8;
-	cur_blk_y = y >> 3; // y / 8;
+	uint16 cur_blk_x = x >> 3; // x / 8;
+	uint16 cur_blk_y = y >> 3; // y / 8;
 
 // We're changing levels so clean out all temp objects on the current level.
 	if (last_obj_blk_z != z) {
@@ -1756,11 +1627,10 @@ void ObjManager::remove_temp_obj(Obj *tmp_obj) {
 // clean objects from a whole level.
 void ObjManager::temp_obj_list_clean_level(uint8 z) {
 	Std::list<Obj *>::iterator obj;
-	Obj *tmp_obj;
 
 	for (obj = temp_obj_list.begin(); obj != temp_obj_list.end();) {
 		if ((*obj)->z == z) {
-			tmp_obj = *obj++;
+			Obj *tmp_obj = *obj++;
 			remove_temp_obj(tmp_obj);
 		} else
 			obj++;
@@ -1773,15 +1643,13 @@ void ObjManager::temp_obj_list_clean_level(uint8 z) {
 // Clean objects more than 19 tiles from position
 void ObjManager::temp_obj_list_clean_area(uint16 x, uint16 y) {
 	Std::list<Obj *>::iterator obj;
-	Obj *tmp_obj;
-	sint16 dist_x, dist_y;
 
 	for (obj = temp_obj_list.begin(); obj != temp_obj_list.end();) {
-		dist_x = abs((sint16)(*obj)->x - x);
-		dist_y = abs((sint16)(*obj)->y - y);
+		sint16 dist_x = abs((sint16)(*obj)->x - x);
+		sint16 dist_y = abs((sint16)(*obj)->y - y);
 
 		if (dist_x > 19 || dist_y > 19) {
-			tmp_obj = *obj++;
+			Obj *tmp_obj = *obj++;
 			remove_temp_obj(tmp_obj);
 		} else
 			obj++;
@@ -1808,10 +1676,8 @@ inline U6LList *ObjManager::get_schunk_list(uint16 x, uint16 y, uint8 level)
 //prints a human readable list of object number / names.
 
 void ObjManager::print_object_list() {
-	uint16 i;
-
 	DEBUG(0, LEVEL_INFORMATIONAL, "print_object_list:\n");
-	for (i = 0; i < 1024; i++) {
+	for (uint16 i = 0; i < 1024; i++) {
 		DEBUG(1, LEVEL_INFORMATIONAL, "%04d: %s\n", i, tile_manager->lookAtTile(get_obj_tile_num(i), 0, false));
 	}
 
@@ -1819,30 +1685,25 @@ void ObjManager::print_object_list() {
 }
 
 void ObjManager::print_egg_list() {
-	uint8 i;
-
-	for (i = 0; i < 64; i++)
+	for (int i = 0; i < 64; i++)
 		print_egg_tree(surface[i]);
 
-	for (i = 0; i < 5; i++)
+	for (int i = 0; i < 5; i++)
 		print_egg_tree(dungeon[i]);
 
 	return;
 }
 
 inline void ObjManager::print_egg_tree(iAVLTree *obj_tree) {
-	ObjTreeNode *tree_node;
 	iAVLCursor cursor;
-	U6LList *obj_list;
-	U6Link *link;
-	Obj *obj;
 
-	tree_node = (ObjTreeNode *)iAVLFirst(&cursor, obj_tree);
+	ObjTreeNode *tree_node = (ObjTreeNode *)iAVLFirst(&cursor, obj_tree);
 
 	for (; tree_node != nullptr; tree_node = (ObjTreeNode *)iAVLNext(&cursor)) {
-		obj_list = (U6LList *)tree_node->obj_list;
+		U6Link *link;
+		U6LList *obj_list = (U6LList *)tree_node->obj_list;
 		for (link = obj_list->start(); link != nullptr; link = link->next) {
-			obj = (Obj *)link->data;
+			Obj *obj = (Obj *)link->data;
 			if (obj->obj_n == 335) {
 				print_obj(obj, false);
 			}
@@ -1854,7 +1715,6 @@ inline void ObjManager::print_egg_tree(iAVLTree *obj_tree) {
 
 void ObjManager::print_obj(const Obj *obj, bool in_container, uint8 indent) {
 	U6Link *link;
-	Obj *container_obj;
 	const CombatType *c_type = nullptr;
 	Actor *a = Game::get_game()->get_player()->get_actor();
 
@@ -1977,7 +1837,7 @@ void ObjManager::print_obj(const Obj *obj, bool in_container, uint8 indent) {
 		DEBUG(1, LEVEL_INFORMATIONAL, "---------");
 
 		for (link = obj->container->start(); link != nullptr; link = link->next) {
-			container_obj = (Obj *)link->data;
+			Obj *container_obj = (Obj *)link->data;
 			print_obj(container_obj, true, indent + 2);
 		}
 
@@ -1992,9 +1852,7 @@ void ObjManager::print_obj(const Obj *obj, bool in_container, uint8 indent) {
 }
 
 Obj *new_obj(uint16 obj_n, uint8 frame_n, uint16 x, uint16 y, uint16 z) {
-	Obj *obj;
-
-	obj = new Obj();
+	Obj *obj = new Obj();
 
 	obj->obj_n = obj_n;
 	obj->frame_n = frame_n;
@@ -2007,11 +1865,10 @@ Obj *new_obj(uint16 obj_n, uint8 frame_n, uint16 x, uint16 y, uint16 z) {
 }
 
 void delete_obj(Obj *obj) {
-	U6Link *link;
-
 	if (obj->is_script_obj() == false) {
 		if (obj->container) {
-			for (link = obj->container->start(); link != nullptr;) {
+			U6Link *link = obj->container->start();
+			while (link) {
 				Obj *cont_obj = (Obj *)link->data;
 				link = link->next;
 
@@ -2034,23 +1891,19 @@ void delete_obj(Obj *obj) {
 //FIXME!!!!! We need to set on_map() etc if going to the map.
 
 bool ObjManager::list_add_obj(U6LList *llist, Obj *obj, bool stack_objects, uint32 pos) {
-	Obj *stack_with;
-	uint16 new_qty;
-	U6Link *link;
-
 	if (!llist || !obj)
 		return false;
 
 	assert(pos == 0 || pos < llist->count());
 
 	if (stack_objects && is_stackable(obj)) {
-		for (link = llist->start(); link != nullptr;) {
-			stack_with = (Obj *)link->data;
+		for (U6Link *link = llist->start(); link != nullptr;) {
+			Obj *stack_with = (Obj *)link->data;
 			link = link->next;
 
 			if (stack_with->obj_n == obj->obj_n && stack_with->frame_n == obj->frame_n
 			        && stack_with->quality == obj->quality && is_stackable(stack_with)) {
-				new_qty = obj->qty + stack_with->qty;
+				uint16 new_qty = obj->qty + stack_with->qty;
 				obj->qty = new_qty;
 				llist->addAtPos(llist->findPos(stack_with), obj);
 
@@ -2071,30 +1924,24 @@ bool ObjManager::list_add_obj(U6LList *llist, Obj *obj, bool stack_objects, uint
  * loadObj() but that was crashing when usecode tried to use timers.
  */
 void ObjManager::startObjs() {
-	uint8 i;
-
-//iterate through surface chunks.
-	for (i = 0; i < 64; i++)
+	//iterate through surface chunks.
+	for (int i = 0; i < 64; i++)
 		start_obj_usecode(surface[i]);
 
-//iterate through dungeon chunks.
-	for (i = 0; i < 5; i++)
+	//iterate through dungeon chunks.
+	for (int i = 0; i < 5; i++)
 		start_obj_usecode(dungeon[i]);
 
 }
 
 inline void ObjManager::start_obj_usecode(iAVLTree *obj_tree) {
-	ObjTreeNode *tree_node;
 	iAVLCursor cursor;
-	U6LList *obj_list;
-	U6Link *link;
-	Obj *obj;
 
-	tree_node = (ObjTreeNode *)iAVLFirst(&cursor, obj_tree);
+	ObjTreeNode *tree_node = (ObjTreeNode *)iAVLFirst(&cursor, obj_tree);
 	for (; tree_node != nullptr; tree_node = (ObjTreeNode *)iAVLNext(&cursor)) {
-		obj_list = (U6LList *)tree_node->obj_list;
-		for (link = obj_list->start(); link != nullptr; link = link->next) {
-			obj = (Obj *)link->data;
+		U6LList *obj_list = (U6LList *)tree_node->obj_list;
+		for (U6Link *link = obj_list->start(); link != nullptr; link = link->next) {
+			Obj *obj = (Obj *)link->data;
 			if (usecode->has_loadcode(obj))
 				usecode->load_obj(obj);
 		}
@@ -2121,10 +1968,9 @@ Obj *ObjManager::get_obj_from_stack(Obj *obj, uint32 count) {
 }
 
 void clean_obj_tree_node(void *node) {
-	U6Link *link;
 	ObjTreeNode *obj_node = (ObjTreeNode *)node;
 
-	for (link = obj_node->obj_list->start(); link != nullptr;) {
+	for (U6Link *link = obj_node->obj_list->start(); link != nullptr;) {
 		Obj *obj = (Obj *)link->data;
 		link = link->next;
 
@@ -2138,32 +1984,29 @@ void clean_obj_tree_node(void *node) {
 }
 
 bool ObjManager::unlink_from_engine(Obj *obj, bool run_usecode) {
-	Actor *a;
-	Obj *cont_obj;
-
 	switch (obj->get_engine_loc()) {
-	case OBJ_LOC_NONE :
+	case OBJ_LOC_NONE:
 		break;
-	case OBJ_LOC_MAP :
+	case OBJ_LOC_MAP:
 		remove_obj_from_map(obj);
 		break;
 // inventory_remove_obj unreadies
-	case OBJ_LOC_READIED :/* a = (Actor *)obj->parent;
+	case OBJ_LOC_READIED:/* a = (Actor *)obj->parent;
 						   a->remove_readied_object(obj, run_usecode);
 						   a->inventory_remove_obj(obj, run_usecode);
 						   break;
 */
-	case OBJ_LOC_INV :
-		a = (Actor *)obj->parent;
+	case OBJ_LOC_INV: {
+		Actor *a = (Actor *)obj->parent;
 		a->inventory_remove_obj(obj, run_usecode);
 		break;
-
-	case OBJ_LOC_CONT :
-		cont_obj = obj->get_container_obj();
+	}
+	case OBJ_LOC_CONT: {
+		Obj *cont_obj = obj->get_container_obj();
 		if (cont_obj)
 			cont_obj->remove(obj); //remove from parent container.
 		break;
-		break;
+	}
 	}
 
 	return true;
diff --git a/engines/ultima/nuvie/core/party.cpp b/engines/ultima/nuvie/core/party.cpp
index 9cc0f5b7325..2af67ff762e 100644
--- a/engines/ultima/nuvie/core/party.cpp
+++ b/engines/ultima/nuvie/core/party.cpp
@@ -185,9 +185,8 @@ bool Party::remove_actor(Actor *actor, bool keep_party_flag) {
 	if (defer_removing_dead_members) //we don't want to remove member while inside the Party::follow() method.
 		return true;
 	Game::get_game()->get_event()->set_control_cheat(false);
-	uint8 i;
 
-	for (i = 0; i < num_in_party; i++) {
+	for (int i = 0; i < num_in_party; i++) {
 		if (member[i].actor->id_n == actor->id_n) {
 			if (keep_party_flag == false) {
 				for (int j = 0; j < member[i].actor->get_num_light_sources(); j++)
diff --git a/engines/ultima/nuvie/core/player.cpp b/engines/ultima/nuvie/core/player.cpp
index 4024ad9b15d..1976392bda8 100644
--- a/engines/ultima/nuvie/core/player.cpp
+++ b/engines/ultima/nuvie/core/player.cpp
@@ -148,8 +148,7 @@ bool Player::save(NuvieIO *objlist) {
 }
 
 Actor *Player::find_actor() {
-
-	for (uint32 p = 0; p < ACTORMANAGER_MAX_ACTORS; p++) {
+	for (int p = 0; p < ACTORMANAGER_MAX_ACTORS; p++) {
 		Actor *theActor = actor_manager->get_actor(p);
 		if (theActor->get_worktype() == 0x02 && theActor->is_immobile() == false) // WT_U6_PLAYER
 			return theActor;
diff --git a/engines/ultima/nuvie/core/tile_manager.cpp b/engines/ultima/nuvie/core/tile_manager.cpp
index be63325c344..68baf52ff3e 100644
--- a/engines/ultima/nuvie/core/tile_manager.cpp
+++ b/engines/ultima/nuvie/core/tile_manager.cpp
@@ -456,7 +456,6 @@ bool TileManager::loadTileFlag() {
 bool TileManager::loadAnimData() {
 	Std::string filename;
 	NuvieIOFileRead file;
-	uint8 i;
 	int gameType;
 	config->value("config/GameType", gameType);
 	config_get_path(config, "animdata", filename);
@@ -469,23 +468,23 @@ bool TileManager::loadAnimData() {
 
 	animdata.number_of_tiles_to_animate = file.read2();
 
-	for (i = 0; i < 32; i++) {
+	for (int i = 0; i < 32; i++) {
 		animdata.tile_to_animate[i] = file.read2();
 	}
 
-	for (i = 0; i < 32; i++) {
+	for (int i = 0; i < 32; i++) {
 		animdata.first_anim_frame[i] = file.read2();
 	}
 
-	for (i = 0; i < 32; i++) {
+	for (int i = 0; i < 32; i++) {
 		animdata.and_masks[i] = file.read1();
 	}
 
-	for (i = 0; i < 32; i++) {
+	for (int i = 0; i < 32; i++) {
 		animdata.shift_values[i] = file.read1();
 	}
 
-	for (i = 0; i < 32; i++) { // FIXME: any data on which tiles don't start as animated?
+	for (int i = 0; i < 32; i++) { // FIXME: any data on which tiles don't start as animated?
 		animdata.loop[i] = 0; // loop forwards
 		if ((gameType == NUVIE_GAME_U6 &&
 		        (animdata.tile_to_animate[i] == 862 // Crank
diff --git a/engines/ultima/nuvie/core/timed_event.cpp b/engines/ultima/nuvie/core/timed_event.cpp
index 76de64917c5..fde3b7a4542 100644
--- a/engines/ultima/nuvie/core/timed_event.cpp
+++ b/engines/ultima/nuvie/core/timed_event.cpp
@@ -68,7 +68,6 @@ void TimeQueue::clear() {
  * `evtime'.
  */
 void TimeQueue::add_timer(TimedEvent *tevent) {
-	Std::list<TimedEvent *>::iterator t;
 	if (tq.empty()) {
 		tq.push_front(tevent);
 		return;
@@ -76,7 +75,7 @@ void TimeQueue::add_timer(TimedEvent *tevent) {
 	// in case it's already queued, remove the earlier instance(s)
 	remove_timer(tevent);
 	// add after events with earlier/equal time
-	t = tq.begin();
+	Std::list<TimedEvent *>::iterator t = tq.begin();
 	while (t != tq.end() && (*t)->time <= tevent->time) t++;
 	tq.insert(t, tevent);
 }
@@ -85,8 +84,7 @@ void TimeQueue::add_timer(TimedEvent *tevent) {
 /* Remove timed event from queue.
  */
 void TimeQueue::remove_timer(TimedEvent *tevent) {
-	Std::list<TimedEvent *>::iterator t;
-	t = tq.begin();
+	Std::list<TimedEvent *>::iterator t = tq.begin();
 	while (t != tq.end()) {
 		if (*t == tevent) {
 			t = tq.erase(t);
@@ -629,8 +627,8 @@ bool TimedAdvance::time_passed() const {
 /* Set hour and minute from "HH:MM" string.
  */
 void TimedAdvance::get_time_from_string(uint8 &hour, uint8 &minute, Std::string timestring) {
-	char *hour_s = nullptr, *minute_s = nullptr;
-	hour_s = scumm_strdup(timestring.c_str());
+	char *minute_s = nullptr;
+	char *hour_s = scumm_strdup(timestring.c_str());
 	for (uint32 c = 0; c < strlen(hour_s); c++)
 		if (hour_s[c] == ':') { // get minutes
 			minute_s = scumm_strdup(&hour_s[c + 1]);
diff --git a/engines/ultima/nuvie/core/weather.cpp b/engines/ultima/nuvie/core/weather.cpp
index d62ec88cd94..d215a750dda 100644
--- a/engines/ultima/nuvie/core/weather.cpp
+++ b/engines/ultima/nuvie/core/weather.cpp
@@ -99,10 +99,8 @@ NuvieDir Weather::load_wind(NuvieIO *objlist) {
 		NUVIE_DIR_NW
 	};
 
-	uint8 objlist_wind;
-
 	objlist->seek(OBJLIST_OFFSET_U6_WIND_DIR);
-	objlist_wind = objlist->read1();
+	uint8 objlist_wind = objlist->read1();
 
 	if (objlist_wind > 7) //objlist 0xff = Calm 'C'
 		return NUVIE_DIR_NONE;
@@ -161,9 +159,8 @@ bool Weather::is_moon_visible() const {
 
 	uint8 day = _clock->get_day();
 	uint8 hour = _clock->get_hour();
-	uint8 phase = 0;
 	// trammel (starts 1 hour ahead of sun)
-	phase = uint8(nearbyint((day - 1) / TRAMMEL_PHASE)) % 8;
+	uint8 phase = uint8(nearbyint((day - 1) / TRAMMEL_PHASE)) % 8;
 	uint8 posA = ((hour + 1) + 3 * phase) % 24; // advance 3 positions each phase-change
 	if (posA >= 5 && posA <= 19)
 		return true;
diff --git a/engines/ultima/nuvie/files/u6_shape.cpp b/engines/ultima/nuvie/files/u6_shape.cpp
index d09f5d42fd3..de060dae49b 100644
--- a/engines/ultima/nuvie/files/u6_shape.cpp
+++ b/engines/ultima/nuvie/files/u6_shape.cpp
@@ -122,9 +122,7 @@ bool U6Shape::load(Std::string filename) {
 }
 
 bool U6Shape::load(U6Lib_n *file, uint32 index) {
-	unsigned char *buf;
-
-	buf = file->get_item(index);
+	unsigned char *buf = file->get_item(index);
 	if (buf != nullptr) {
 		if (load(buf)) {
 			free(buf);
@@ -138,7 +136,6 @@ bool U6Shape::load(U6Lib_n *file, uint32 index) {
 
 bool U6Shape::load_from_lzc(const Std::string &filename, uint32 idx, uint32 sub_idx) {
 	U6Lib_n lib_n;
-	unsigned char *buf = nullptr;
 
 	if (!lib_n.open(filename, 4, NUVIE_GAME_MD)) {
 		return false;
@@ -148,7 +145,7 @@ bool U6Shape::load_from_lzc(const Std::string &filename, uint32 idx, uint32 sub_
 		return false;
 	}
 
-	buf = lib_n.get_item(idx, nullptr);
+	unsigned char *buf = lib_n.get_item(idx, nullptr);
 	NuvieIOBuffer io;
 	io.open(buf, lib_n.get_item_size(idx), false);
 	U6Lib_n lib1;
@@ -176,17 +173,12 @@ bool U6Shape::load_from_lzc(const Std::string &filename, uint32 idx, uint32 sub_
  * Returns true if successful, else returns false.
  */
 bool U6Shape::load(unsigned char *buf) {
-	int encoded;
-	unsigned char *data;
-	uint16 num_pixels;
-	sint16 xpos, ypos;
-
 	/* A file already loaded. */
 	if (raw != nullptr)
 		return false;
 	/* NOT REACHED */
 
-	data = buf;
+	unsigned char *data = buf;
 
 	/* Size and hot point. */
 	width = READ_LE_UINT16(data);
@@ -211,14 +203,15 @@ bool U6Shape::load(unsigned char *buf) {
 	memset(raw, 255, width * height);
 
 	/* Get the pixel data. */
+	uint16 num_pixels;
 	while ((num_pixels = READ_LE_UINT16(data)) != 0) {
 
 		data += 2;
 
 		/* Coordinates relative to hot spot. */
-		xpos = READ_LE_UINT16(data);
+		sint16 xpos = READ_LE_UINT16(data);
 		data += 2;
-		ypos = READ_LE_UINT16(data);
+		sint16 ypos = READ_LE_UINT16(data);
 		data += 2;
 
 		if (((hotx + xpos) >= width) || ((hoty + ypos) >= height)) {
@@ -228,7 +221,7 @@ bool U6Shape::load(unsigned char *buf) {
 		 * Test if this block of pixels is encoded
 		 * (bit0 is set).
 		 */
-		encoded = num_pixels & 1;
+		int encoded = num_pixels & 1;
 
 		/* Divide it by 2. */
 		num_pixels >>= 1;
@@ -290,7 +283,6 @@ bool U6Shape::load(unsigned char *buf) {
 // TODO - allow for failure
 bool U6Shape::load_WoU_background(const Configuration *config, nuvie_game_t game_type) {
 	U6Lib_n file;
-	unsigned char *temp_buf;
 	Std::string filename;
 
 	if (game_type == NUVIE_GAME_MD)
@@ -299,7 +291,7 @@ bool U6Shape::load_WoU_background(const Configuration *config, nuvie_game_t game
 		config_get_path(config, "screen.lzc", filename);
 
 	file.open(filename, 4, game_type);
-	temp_buf = file.get_item(0);
+	unsigned char *temp_buf = file.get_item(0);
 	load(temp_buf + 8);
 	free(temp_buf);
 	return true;
diff --git a/engines/ultima/nuvie/gui/gui_dialog.cpp b/engines/ultima/nuvie/gui/gui_dialog.cpp
index 2648de0ed5a..715c8bcedeb 100644
--- a/engines/ultima/nuvie/gui/gui_dialog.cpp
+++ b/engines/ultima/nuvie/gui/gui_dialog.cpp
@@ -46,12 +46,11 @@ GUI_Dialog::~GUI_Dialog() {
 }
 
 void GUI_Dialog::loadBorderImages() {
-	uint8 i;
 	char filename[15]; // BorderU6_x.bmp\0
 	Std::string datadir = GUI::get_gui()->get_data_dir();
 	Std::string imagefile;
 
-	for (i = 0; i < 8; i++) {
+	for (int i = 0; i < 8; i++) {
 		Common::sprintf_s(filename, "Border%s_%d.bmp", "U6", i + 1);
 		build_path(datadir, filename, imagefile);
 		border[i] = SDL_LoadBMP(imagefile.c_str());
diff --git a/engines/ultima/nuvie/save/save_game.cpp b/engines/ultima/nuvie/save/save_game.cpp
index b9270416433..42137b2af1b 100644
--- a/engines/ultima/nuvie/save/save_game.cpp
+++ b/engines/ultima/nuvie/save/save_game.cpp
@@ -136,10 +136,8 @@ bool SaveGame::load_new() {
 
 bool SaveGame::load_original() {
 	Std::string path, objlist_filename, objblk_filename;
-	unsigned char *data;
 	char x, y;
 	uint16 len;
-	uint8 i;
 	NuvieIOFileRead objlist_file;
 
 	NuvieIOFileRead *objblk_file = new NuvieIOFileRead();
@@ -150,7 +148,7 @@ bool SaveGame::load_original() {
 	objblk_filename = OBJBLK_FILENAME;
 	len = objblk_filename.length();
 
-	i = 0;
+	uint8 i = 0;
 
 	for (y = 'a'; y < 'i'; y++) {
 		for (x = 'a'; x < 'i'; x++) {
@@ -194,7 +192,7 @@ bool SaveGame::load_original() {
 	if (objlist_file.open(objlist_filename) == false)
 		return false;
 
-	data = objlist_file.readAll();
+	unsigned char *data = objlist_file.readAll();
 
 	objlist.open(data, objlist_file.get_size(), NUVIE_BUF_COPY);
 	free(data);
@@ -356,7 +354,6 @@ bool SaveGame::load(const Common::String &filename) {
 }
 
 bool SaveGame::save(const Common::String &filename, const Common::String &save_description, bool isAutosave) {
-	uint8 i;
 	NuvieIOFileWrite saveFile;
 	GameId gameType = g_engine->getGameId();
 	ObjManager *obj_manager = Game::get_game()->get_obj_manager();
@@ -378,11 +375,11 @@ bool SaveGame::save(const Common::String &filename, const Common::String &save_d
 	obj_manager->save_eggs(&saveFile);
 
 	// Save surface objects
-	for (i = 0; i < 64; i++)
+	for (uint8 i = 0; i < 64; i++)
 		obj_manager->save_super_chunk(&saveFile, 0, i);
 
 	// Save dungeon objects
-	for (i = 0; i < 5; i++)
+	for (uint8 i = 0; i < 5; i++)
 		obj_manager->save_super_chunk(&saveFile, i + 1, 0);
 
 	save_objlist();
diff --git a/engines/ultima/nuvie/screen/dither.cpp b/engines/ultima/nuvie/screen/dither.cpp
index 136356d31f9..278b9b3c5fe 100644
--- a/engines/ultima/nuvie/screen/dither.cpp
+++ b/engines/ultima/nuvie/screen/dither.cpp
@@ -81,14 +81,12 @@ void Dither::set_mode() {
 }
 
 bool Dither::dither_bitmap(unsigned char *src_buf, uint16 src_w, uint16 src_h, bool has_transparency) {
-	uint8 pixel;
-
 	if (!dither || mode == DITHER_NONE)
 		return false;
 
 	for (int y = 0; y < src_h; y++) {
 		for (int x = 0; x < src_w; x++) {
-			pixel = src_buf[y * src_w + x];
+			uint8 pixel = src_buf[y * src_w + x];
 
 			if (has_transparency && pixel == 0xff)
 				continue;
diff --git a/engines/ultima/nuvie/screen/game_palette.cpp b/engines/ultima/nuvie/screen/game_palette.cpp
index 5c8c6231c5c..77bd95e0f44 100644
--- a/engines/ultima/nuvie/screen/game_palette.cpp
+++ b/engines/ultima/nuvie/screen/game_palette.cpp
@@ -27,6 +27,8 @@
 #include "ultima/nuvie/screen/dither.h"
 #include "ultima/nuvie/screen/game_palette.h"
 
+#include "common/util.h"
+
 namespace Ultima {
 namespace Nuvie {
 
@@ -51,10 +53,7 @@ bool GamePalette::loadPalette() {
 	uint16 i, j;
 	Std::string filename;
 	NuvieIOFileRead file;
-	unsigned char *buf;
-	uint8 *pal_ptr;
 	Std::string game_name, game_id, pal_name;
-	uint8 dither_mode;
 
 	config->value("config/GameName", game_name);
 	config->value("config/GameID", game_id);
@@ -69,11 +68,11 @@ bool GamePalette::loadPalette() {
 		return false;
 	}
 
-	buf = file.readAll();
+	unsigned char *buf = file.readAll();
 
-	pal_ptr = palette;
+	uint8 *pal_ptr = palette;
 
-	for (i = 0, j = 0; i < MIN(256, file.get_size() / 3); i++, j += 3) {
+	for (i = 0, j = 0; i < MIN(256U, file.get_size() / 3); i++, j += 3) {
 		pal_ptr[0] = buf[j] << 2;
 		pal_ptr[1] = buf[j + 1] << 2;
 		pal_ptr[2] = buf[j + 2] << 2;
@@ -93,7 +92,7 @@ bool GamePalette::loadPalette() {
 	        printf(" untitled\n");
 	    }
 	*/
-	dither_mode = Game::get_game()->get_dither()->get_mode();
+	uint8 dither_mode = Game::get_game()->get_dither()->get_mode();
 	if (Game::get_game()->get_game_type() == NUVIE_GAME_U6) {
 		if (dither_mode == DITHER_NONE)
 			bg_color = 0x31;
@@ -110,8 +109,6 @@ bool GamePalette::loadPaletteIntoBuffer(unsigned char *pal) {
 	uint16 i, j;
 	Std::string filename;
 	NuvieIOFileRead file;
-	unsigned char *buf;
-	uint8 *pal_ptr;
 	Std::string game_name, game_id, pal_name;
 
 	config->value("config/GameName", game_name);
@@ -127,9 +124,9 @@ bool GamePalette::loadPaletteIntoBuffer(unsigned char *pal) {
 		return false;
 	}
 
-	buf = file.readAll();
+	unsigned char *buf = file.readAll();
 
-	pal_ptr = pal;
+	uint8 *pal_ptr = pal;
 
 	for (i = 0, j = 0; i < 256; i++, j += 3) {
 		pal_ptr[0] = buf[j] << 2;
diff --git a/engines/ultima/nuvie/screen/screen.cpp b/engines/ultima/nuvie/screen/screen.cpp
index 698a221b4ac..60fdf417fe8 100644
--- a/engines/ultima/nuvie/screen/screen.cpp
+++ b/engines/ultima/nuvie/screen/screen.cpp
@@ -151,12 +151,9 @@ bool Screen::set_palette_entry(uint8 idx, uint8 r, uint8 g, uint8 b) {
 }
 
 bool Screen::rotate_palette(uint8 pos, uint8 length) {
-	uint32 tmp_colour;
-	uint8 i;
+	uint32 tmp_colour = _renderSurface->colour32[pos + length - 1];
 
-	tmp_colour = _renderSurface->colour32[pos + length - 1];
-
-	for (i = length - 1; i > 0; i--)
+	for (int i = length - 1; i > 0; i--)
 		_renderSurface->colour32[pos + i] = _renderSurface->colour32[pos + i - 1];
 
 	_renderSurface->colour32[pos] = tmp_colour;
@@ -526,16 +523,13 @@ inline uint32 Screen::blendpixel32(uint32 p, uint32 p1, uint8 opacity) {
 }
 
 inline bool Screen::blit16(uint16 dest_x, uint16 dest_y, const byte *src_buf, uint16 src_bpp, uint16 src_w, uint16 src_h, uint16 src_pitch, bool trans) {
-	uint16 *pixels;
-	uint16 i, j;
-
-	pixels = (uint16 *)_renderSurface->pixels;
+	uint16 *pixels = (uint16 *)_renderSurface->pixels;
 
 	pixels += dest_y * _renderSurface->w + dest_x;
 
 	if (trans) {
-		for (i = 0; i < src_h; i++) {
-			for (j = 0; j < src_w; j++) {
+		for (int i = 0; i < src_h; i++) {
+			for (int j = 0; j < src_w; j++) {
 				if (src_buf[j] != 0xff)
 					pixels[j] = (uint16)_renderSurface->colour32[src_buf[j]];
 			}
@@ -543,8 +537,8 @@ inline bool Screen::blit16(uint16 dest_x, uint16 dest_y, const byte *src_buf, ui
 			pixels += _renderSurface->w; //pitch;
 		}
 	} else {
-		for (i = 0; i < src_h; i++) {
-			for (j = 0; j < src_w; j++) {
+		for (int i = 0; i < src_h; i++) {
+			for (int j = 0; j < src_w; j++) {
 				pixels[j] = (uint16)_renderSurface->colour32[src_buf[j]];
 			}
 			src_buf += src_pitch;
@@ -564,8 +558,8 @@ inline bool Screen::blit16WithOpacity(uint16 dest_x, uint16 dest_y, const byte *
 	pixels += dest_y * _renderSurface->w + dest_x;
 
 	if (trans) {
-		for (i = 0; i < src_h; i++) {
-			for (j = 0; j < src_w; j++) {
+		for (int i = 0; i < src_h; i++) {
+			for (int j = 0; j < src_w; j++) {
 				if (src_buf[j] != 0xff)
 					pixels[j] = blendpixel16(pixels[j], (uint16)_renderSurface->colour32[src_buf[j]], opacity);
 			}
@@ -573,8 +567,8 @@ inline bool Screen::blit16WithOpacity(uint16 dest_x, uint16 dest_y, const byte *
 			pixels += _renderSurface->w; //pitch;
 		}
 	} else {
-		for (i = 0; i < src_h; i++) {
-			for (j = 0; j < src_w; j++) {
+		for (int i = 0; i < src_h; i++) {
+			for (int j = 0; j < src_w; j++) {
 				pixels[j] = blendpixel16(pixels[j], (uint16)_renderSurface->colour32[src_buf[j]], opacity);
 			}
 			src_buf += src_pitch;
@@ -595,8 +589,8 @@ bool Screen::blit32(uint16 dest_x, uint16 dest_y, const byte *src_buf, uint16 sr
 
 
 	if (trans) {
-		for (i = 0; i < src_h; i++) {
-			for (j = 0; j < src_w; j++) {
+		for (int i = 0; i < src_h; i++) {
+			for (int j = 0; j < src_w; j++) {
 				if (src_buf[j] != 0xff)
 					pixels[j] = _renderSurface->colour32[src_buf[j]];
 			}
@@ -604,8 +598,8 @@ bool Screen::blit32(uint16 dest_x, uint16 dest_y, const byte *src_buf, uint16 sr
 			pixels += _renderSurface->w; //pitch;
 		}
 	} else {
-		for (i = 0; i < src_h; i++) {
-			for (j = 0; j < src_w; j++) {
+		for (int i = 0; i < src_h; i++) {
+			for (int j = 0; j < src_w; j++) {
 				pixels[j] = _renderSurface->colour32[src_buf[j]];
 			}
 			src_buf += src_pitch;
@@ -626,8 +620,8 @@ bool Screen::blit32WithOpacity(uint16 dest_x, uint16 dest_y, const byte *src_buf
 
 
 	if (trans) {
-		for (i = 0; i < src_h; i++) {
-			for (j = 0; j < src_w; j++) {
+		for (int i = 0; i < src_h; i++) {
+			for (int j = 0; j < src_w; j++) {
 				if (src_buf[j] != 0xff)
 					pixels[j] = blendpixel32(pixels[j], _renderSurface->colour32[src_buf[j]], opacity);
 			}
@@ -635,8 +629,8 @@ bool Screen::blit32WithOpacity(uint16 dest_x, uint16 dest_y, const byte *src_buf
 			pixels += _renderSurface->w; //pitch;
 		}
 	} else {
-		for (i = 0; i < src_h; i++) {
-			for (j = 0; j < src_w; j++) {
+		for (int i = 0; i < src_h; i++) {
+			for (int j = 0; j < src_w; j++) {
 				pixels[j] = blendpixel32(pixels[j], _renderSurface->colour32[src_buf[j]], opacity);
 			}
 			src_buf += src_pitch;
@@ -664,8 +658,8 @@ void Screen::blitbitmap16(uint16 dest_x, uint16 dest_y, const byte *src_buf, uin
 
 	pixels += dest_y * _renderSurface->w + dest_x;
 
-	for (i = 0; i < src_h; i++) {
-		for (j = 0; j < src_w; j++) {
+	for (int i = 0; i < src_h; i++) {
+		for (int j = 0; j < src_w; j++) {
 			if (src_buf[j])
 				pixels[j] = (uint16)_renderSurface->colour32[fg_color];
 			else
@@ -686,8 +680,8 @@ void Screen::blitbitmap32(uint16 dest_x, uint16 dest_y, const byte *src_buf, uin
 
 	pixels += dest_y * _renderSurface->w + dest_x;
 
-	for (i = 0; i < src_h; i++) {
-		for (j = 0; j < src_w; j++) {
+	for (int i = 0; i < src_h; i++) {
+		for (int j = 0; j < src_w; j++) {
 			if (src_buf[j])
 				pixels[j] = _renderSurface->colour32[fg_color];
 			else
@@ -928,8 +922,8 @@ void Screen::drawalphamap8globe(sint16 x, sint16 y, uint16 r) {
 		x += SHADING_BORDER;
 		y += SHADING_BORDER;
 		//Draw using "original" lighting
-		for (j = 0; j <= rad * 2; j++)
-			for (i = 0; i <= rad * 2; i++) {
+		for (int j = 0; j <= rad * 2; j++)
+			for (int i = 0; i <= rad * 2; i++) {
 				if (x + i - rad < 0 || x + i - rad >= shading_rect.width())
 					continue;
 				if (y + j - rad < 0 || y + j - rad >= shading_rect.height())
@@ -944,8 +938,8 @@ void Screen::drawalphamap8globe(sint16 x, sint16 y, uint16 r) {
 	//Draw using "smooth" lighting
 	//The x and y are relative to (0,0) of the mapwindow itself, and are absolute coordinates, so are i and j
 	r--;
-	for (i = -globeradius_2[r]; i < globeradius_2[r]; i++)
-		for (j = -globeradius_2[r]; j < globeradius_2[r]; j++) {
+	for (int i = -globeradius_2[r]; i < globeradius_2[r]; i++)
+		for (int j = -globeradius_2[r]; j < globeradius_2[r]; j++) {
 			if ((y + i) - 1 < 0 ||
 			        (x + j) - 1 < 0 ||
 			        (y + i) + 1 > shading_rect.height() ||
@@ -971,8 +965,8 @@ void Screen::blitalphamap8(sint16 x, sint16 y, Common::Rect *clip_rect) {
 
 	if (lighting_style == LIGHTING_STYLE_ORIGINAL) {
 
-		for (j = SHADING_BORDER; j < shading_rect.height() - SHADING_BORDER; j++) {
-			for (i = SHADING_BORDER; i < shading_rect.width() - SHADING_BORDER; i++) {
+		for (int j = SHADING_BORDER; j < shading_rect.height() - SHADING_BORDER; j++) {
+			for (int i = SHADING_BORDER; i < shading_rect.width() - SHADING_BORDER; i++) {
 				if (shading_data[j * shading_rect.width() + i] < 4)
 					blit(x + (i - SHADING_BORDER) * 16, y + (j - SHADING_BORDER) * 16, shading_tile[shading_data[j * shading_rect.width() + i]], 8, 16, 16, 16, true, game->get_map_window()->get_clip_rect());
 			}
@@ -1062,8 +1056,8 @@ void Screen::blitalphamap8(sint16 x, sint16 y, Common::Rect *clip_rect) {
 
 		pixels16 += y * _renderSurface->w + x;
 
-		for (i = 0; i < src_h; i++) {
-			for (j = 0; j < src_w; j++) {
+		for (int i = 0; i < src_h; i++) {
+			for (int j = 0; j < src_w; j++) {
 				pixels16[j] = (((unsigned char)(((float)((pixels16[j] & _renderSurface->Rmask) >> _renderSurface->Rshift)) * (float)(src_buf[j]) / 255.0f)) << _renderSurface->Rshift) |      //R
 				              (((unsigned char)(((float)((pixels16[j] & _renderSurface->Gmask) >> _renderSurface->Gshift)) * (float)(src_buf[j]) / 255.0f)) << _renderSurface->Gshift) |      //G
 				              (((unsigned char)(((float)((pixels16[j] & _renderSurface->Bmask) >> _renderSurface->Bshift)) * (float)(src_buf[j]) / 255.0f)) << _renderSurface->Bshift);       //B
@@ -1080,8 +1074,8 @@ void Screen::blitalphamap8(sint16 x, sint16 y, Common::Rect *clip_rect) {
 
 		pixels += y * _renderSurface->w + x;
 
-		for (i = 0; i < src_h; i++) {
-			for (j = 0; j < src_w; j++) {
+		for (int i = 0; i < src_h; i++) {
+			for (int j = 0; j < src_w; j++) {
 				pixels[j] = (((unsigned char)(((float)((pixels[j] & _renderSurface->Rmask) >> _renderSurface->Rshift)) * (float)(src_buf[j]) / 255.0f)) << _renderSurface->Rshift) |      //R
 				            (((unsigned char)(((float)((pixels[j] & _renderSurface->Gmask) >> _renderSurface->Gshift)) * (float)(src_buf[j]) / 255.0f)) << _renderSurface->Gshift) |      //G
 				            (((unsigned char)(((float)((pixels[j] & _renderSurface->Bmask) >> _renderSurface->Bshift)) * (float)(src_buf[j]) / 255.0f)) << _renderSurface->Bshift);       //B
@@ -1137,8 +1131,8 @@ Graphics::ManagedSurface *Screen::create_sdl_surface_from(byte *src_buf, uint16
 	if (_renderSurface->bits_per_pixel == 16) {
 		uint16 *pixels = (uint16 *)new_surface->getPixels();
 
-		for (i = 0; i < src_h; i++) {
-			for (j = 0; j < src_w; j++) {
+		for (int i = 0; i < src_h; i++) {
+			for (int j = 0; j < src_w; j++) {
 				pixels[j] = (uint16)_renderSurface->colour32[src_buf[j]];
 			}
 			src_buf += src_pitch;
@@ -1147,8 +1141,8 @@ Graphics::ManagedSurface *Screen::create_sdl_surface_from(byte *src_buf, uint16
 	} else {
 		uint32 *pixels = (uint32 *)new_surface->getPixels();
 
-		for (i = 0; i < src_h; i++) {
-			for (j = 0; j < src_w; j++) {
+		for (int i = 0; i < src_h; i++) {
+			for (int j = 0; j < src_w; j++) {
 				pixels[j] = _renderSurface->colour32[src_buf[j]];
 			}
 			src_buf += src_pitch;
@@ -1273,8 +1267,8 @@ byte *Screen::copy_area16(Common::Rect *area, uint16 down_scale) {
 
 	fmt = &main_surface->format;
 
-	for (y = 0; y < area->height(); y += down_scale) {
-		for (x = 0; x < area->width(); x += down_scale) {
+	for (int y = 0; y < area->height(); y += down_scale) {
+		for (int x = 0; x < area->width(); x += down_scale) {
 			r = 0;
 			g = 0;
 			b = 0;
@@ -1331,8 +1325,8 @@ byte *Screen::copy_area32(Common::Rect *area, uint16 down_scale) {
 
 	fmt = &main_surface->format;
 
-	for (y = 0; y < area->height(); y += down_scale) {
-		for (x = 0; x < area->width(); x += down_scale) {
+	for (int y = 0; y < area->height(); y += down_scale) {
+		for (int x = 0; x < area->width(); x += down_scale) {
 			r = 0;
 			g = 0;
 			b = 0;
diff --git a/engines/ultima/nuvie/sound/towns_sfx_manager.cpp b/engines/ultima/nuvie/sound/towns_sfx_manager.cpp
index 36b15cd7c6b..b221cd06496 100644
--- a/engines/ultima/nuvie/sound/towns_sfx_manager.cpp
+++ b/engines/ultima/nuvie/sound/towns_sfx_manager.cpp
@@ -94,8 +94,7 @@ void TownsSfxManager::loadSound1Dat() {
 		return;
 	}
 
-	uint8 i;
-	for (i = 0; i < TOWNS_SFX_SOUNDS1_SIZE; i++) {
+	for (int i = 0; i < TOWNS_SFX_SOUNDS1_SIZE; i++) {
 		sounds1_dat[i].buf = lib.get_item(i);
 		sounds1_dat[i].len = lib.get_item_size(i);
 	}
diff --git a/engines/ultima/nuvie/views/party_view.cpp b/engines/ultima/nuvie/views/party_view.cpp
index 70ad8b388b8..5145ff2af82 100644
--- a/engines/ultima/nuvie/views/party_view.cpp
+++ b/engines/ultima/nuvie/views/party_view.cpp
@@ -262,9 +262,6 @@ void PartyView::drag_perform_drop(int x, int y, int message, void *data) {
 void PartyView::Display(bool full_redraw) {
 
 	if (full_redraw || update_display || MD || Game::get_game()->is_original_plus_full_map()) {
-		uint8 i;
-		uint8 hp_text_color;
-		char hp_string[4];
 		uint8 party_size = party->get_party_size();
 		int rowH = 16;
 		if (MD)
@@ -285,13 +282,13 @@ void PartyView::Display(bool full_redraw) {
 		if (end_offset > party_size)
 			end_offset = party_size;
 
-		for (i = row_offset; i < end_offset; i++) {
+		for (uint8 i = row_offset; i < end_offset; i++) {
 			Actor *actor = party->get_actor(i);
 			Tile *actor_tile = tile_manager->get_tile(actor->get_downward_facing_tile_num());
 
 			int x_offset = 8;
 			int y_offset = 18;
-			hp_text_color = 0; //standard text color
+			uint8 hp_text_color = 0; //standard text color
 
 			if (U6)
 				hp_text_color = 0x48; //standard text color
@@ -326,6 +323,7 @@ void PartyView::Display(bool full_redraw) {
 				y_offset = -3;
 			// FIXME: Martian Dreams text is somewhat center aligned
 			font->drawString(screen, actor_name, area.left + x_offset + 24, area.top + y_offset + (i - row_offset) * rowH + 8);
+			char hp_string[4];
 			Common::sprintf_s(hp_string, "%3d", actor->get_hp());
 			hp_text_color = actor->get_hp_text_color();
 			if (SE) {
diff --git a/engines/ultima/nuvie/views/spell_view_gump.cpp b/engines/ultima/nuvie/views/spell_view_gump.cpp
index 835e7f158d2..65c15c860fa 100644
--- a/engines/ultima/nuvie/views/spell_view_gump.cpp
+++ b/engines/ultima/nuvie/views/spell_view_gump.cpp
@@ -94,8 +94,6 @@ uint8 SpellViewGump::fill_cur_spell_list() {
 	uint8 count = SpellView::fill_cur_spell_list();
 
 	//load spell images
-	uint8 i;
-	char filename[24]; // spellbook_spell_xxx.bmp\0
 	Std::string datadir = GUI::get_gui()->get_data_dir();
 	Std::string path;
 
@@ -121,7 +119,8 @@ uint8 SpellViewGump::fill_cur_spell_list() {
 
 	set_bg_color_key(0, 0x70, 0xfc);
 
-	for (i = 0; i < count; i++) {
+	for (int i = 0; i < count; i++) {
+		char filename[24]; // spellbook_spell_xxx.bmp\0
 		Common::sprintf_s(filename, "spellbook_spell_%03d.bmp", cur_spells[i]);
 		build_path(datadir, filename, imagefile);
 		Graphics::ManagedSurface *spell_image = bmp.getSdlSurface32(imagefile);
diff --git a/engines/ultima/nuvie/views/sun_moon_strip_widget.cpp b/engines/ultima/nuvie/views/sun_moon_strip_widget.cpp
index b9825b5527e..2e724c288b0 100644
--- a/engines/ultima/nuvie/views/sun_moon_strip_widget.cpp
+++ b/engines/ultima/nuvie/views/sun_moon_strip_widget.cpp
@@ -59,8 +59,6 @@ void SunMoonStripWidget::Display(bool full_redraw) {
 
 
 void SunMoonStripWidget::display_surface_strip() {
-	uint8 i;
-	Tile *tile;
 	GameClock *clock = Game::get_game()->get_clock();
 	Weather *weather = Game::get_game()->get_weather();
 	bool eclipse = weather->is_eclipse();
@@ -70,8 +68,8 @@ void SunMoonStripWidget::display_surface_strip() {
 	if (!eclipse)
 		display_moons(clock->get_day(), clock->get_hour());
 
-	for (i = 0; i < 9; i++) {
-		tile = tile_manager->get_tile(352 + i);
+	for (int i = 0; i < 9; i++) {
+		Tile *tile = tile_manager->get_tile(352 + i);
 		screen->blit(area.left + 8 + i * 16, area.top, tile->data, 8, 16, 16, 16, true);
 	}
 
@@ -79,15 +77,12 @@ void SunMoonStripWidget::display_surface_strip() {
 }
 
 void SunMoonStripWidget::display_dungeon_strip() {
-	uint8 i;
-	Tile *tile;
-
-	tile = tile_manager->get_tile(372);
+	Tile *tile = tile_manager->get_tile(372);
 	screen->blit(area.left + 8, area.top, tile->data, 8, 16, 16, 16, true);
 
 	tile = tile_manager->get_tile(373);
 
-	for (i = 1; i < 8; i++) {
+	for (int i = 1; i < 8; i++) {
 		screen->blit(area.left + 8 + i * 16, area.top, tile->data, 8, 16, 16, 16, true);
 	}
 
@@ -138,9 +133,8 @@ void SunMoonStripWidget::display_sun(uint8 hour, uint8 minute, bool eclipse) {
 }
 
 void SunMoonStripWidget::display_moons(uint8 day, uint8 hour, uint8 minute) {
-	uint8 phase = 0;
 	// trammel (starts 1 hour ahead of sun)
-	phase = uint8(nearbyint((day - 1) / TRAMMEL_PHASE)) % 8;
+	uint8 phase = uint8(nearbyint((day - 1) / TRAMMEL_PHASE)) % 8;
 	Tile *tileA = tile_manager->get_tile((phase == 0) ? 584 : 584 + (8 - phase)); // reverse order in tilelist
 	uint8 posA = ((hour + 1) + 3 * phase) % 24; // advance 3 positions each phase-change
 


Commit: 3ec573399528bb6ad51e264197996f5bd9a1fabd
    https://github.com/scummvm/scummvm/commit/3ec573399528bb6ad51e264197996f5bd9a1fabd
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2023-12-09T13:56:09+11:00

Commit Message:
ULTIMA: NUVIE: Remove now-unused debug function

Changed paths:
    engines/ultima/nuvie/core/debug.cpp


diff --git a/engines/ultima/nuvie/core/debug.cpp b/engines/ultima/nuvie/core/debug.cpp
index 0e555ced572..eb5ddb492a4 100644
--- a/engines/ultima/nuvie/core/debug.cpp
+++ b/engines/ultima/nuvie/core/debug.cpp
@@ -26,84 +26,6 @@
 namespace Ultima {
 namespace Nuvie {
 
-#ifndef WITHOUT_DEBUG
-
-// maybe make these configurable at runtime instead?
-#define WITHOUT_DEBUG_TIMESTAMP_IN_HEADER
-//#define WITHOUT_DEBUG_LEVEL_IN_HEADER
-//#define WITHOUT_DEBUG_FUNC_IN_HEADER
-//#define WITHOUT_DEBUG_FILE_LINE_IN_HEADER
-//#define WITHOUT_DEBUG_NEWLINE_IN_HEADER
-
-DebugLevelType debug(const char *func, const char *file, const int line, const bool no_header, const DebugLevelType level, const char *format, ...) {
-// original
-//  static const char* DebugLevelNames[]= { "EMERGENCY", "ALERT", "CRITICAL", "ERROR", "WARNING", "NOTIFICATION", "INFORMATIONAL", "DEBUGGING" };
-//  shorter, because spammy enough as is.
-//  static const char* DebugLevelNames[]= { "EMERG", "ALERT", "CRIT.", "ERROR", "WARN.", "NOTE.", "INFO.", "DEBUG" };
-//  shorter, because spammy enough as is.
-	static const char *DebugLevelNames[] = { "!", "A", "C", "E", "W", "N", "I", "D" };
-	static DebugLevelType CurrentDebugLevel = LEVEL_DEBUGGING;
-
-	if (format == nullptr) {
-		CurrentDebugLevel = level;
-		return CurrentDebugLevel;
-	}
-	if (!strcmp(format, "!!increase!!\n")) {
-		unsigned char c = (unsigned char) CurrentDebugLevel;
-		if (c < 7) {
-			c++;
-		}
-		CurrentDebugLevel = (DebugLevelType) c;
-	}
-	if (!strcmp(format, "!!decrease!!\n")) {
-		unsigned char c = (unsigned char) CurrentDebugLevel;
-		if (c > 0) {
-			c--;
-		}
-		CurrentDebugLevel = (DebugLevelType) c;
-	}
-	if (level > CurrentDebugLevel) {
-		return CurrentDebugLevel;    // Don't call ourselves here to log something like 'message suppressed'
-	}
-	if (!no_header) {
-#ifndef WITHOUT_DEBUG_LEVEL_IN_HEADER
-		::debugN("[%s] ", DebugLevelNames[(unsigned char)level]);
-#endif
-#ifndef WITHOUT_DEBUG_FUNC_IN_HEADER
-		::debugN("%s ", func);
-#endif
-#ifndef WITHOUT_DEBUG_FILE_LINE_IN_HEADER
-		::debugN("%s:%d", file, line);
-#endif
-		::debugN("> ");
-#ifndef WITHOUT_DEBUG_NEWLINE_IN_HEADER
-		::debugN("\n");
-#endif
-	}
-
-	va_list ap;
-	va_start(ap, format);
-	Common::String buf = Common::String::vformat(format, ap);
-	::debugN("%s", buf.c_str());
-	va_end(ap);
-
-	return CurrentDebugLevel;
-}
-
-#endif /* WITHOUT_DEBUG */
-
-/* test code / documentation.
-int main(char ** argv,int argc)
-{
-  DEBUG(0,LEVEL_EMERGENCY,nullptr); // to set the debug cut-off rather high
-  DEBUG(0,LEVEL_EMERGENCY,"%d %c %s\n",1,'a',"aarrgghh..");
-  DEBUG(1,LEVEL_EMERGENCY,"continuation of aarrgghh..");
-  DEBUG(0,LEVEL_ALERT,"%d %c %s\n",1,'a',"RED"); // should be suppressed
-  DEBUG(0,LEVEL_DEBUGGING,nullptr); // to allow all messages through.
-  DEBUG(0,LEVEL_DEBUGGING,"%d %c %s\n",1,'a',"debugging");
-  return 1;
-  }
-*/
 
 } // End of namespace Nuvie
 } // End of namespace Ultima


Commit: a7d6bbac50ecf9736ca874f33ffe8f6a8ea20b00
    https://github.com/scummvm/scummvm/commit/a7d6bbac50ecf9736ca874f33ffe8f6a8ea20b00
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2023-12-09T13:56:09+11:00

Commit Message:
ULTIMA: NUVIE: Small whitespace fixes

Changed paths:
    engines/ultima/nuvie/gui/widgets/gui_widget.cpp


diff --git a/engines/ultima/nuvie/gui/widgets/gui_widget.cpp b/engines/ultima/nuvie/gui/widgets/gui_widget.cpp
index 335584660c8..ce56e480807 100644
--- a/engines/ultima/nuvie/gui/widgets/gui_widget.cpp
+++ b/engines/ultima/nuvie/gui/widgets/gui_widget.cpp
@@ -27,10 +27,10 @@ namespace Ultima {
 namespace Nuvie {
 
 /* Widget constructors */
-GUI_Widget:: GUI_Widget(void *data) {
+GUI_Widget::GUI_Widget(void *data) {
 	Init(data, 0, 0, 0, 0);
 }
-GUI_Widget:: GUI_Widget(void *data, int x, int y, int w, int h) {
+GUI_Widget::GUI_Widget(void *data, int x, int y, int w, int h) {
 	Init(data, x, y, w, h);
 }
 
@@ -95,7 +95,7 @@ void GUI_Widget::Hide(void) {
 }
 
 /* Mark the widget as free, so it will be deleted by the GUI */
-void GUI_Widget:: Delete(void) {
+void GUI_Widget::Delete(void) {
 	status = WIDGET_DELETED;
 }
 
@@ -165,18 +165,18 @@ void GUI_Widget::PlaceOnScreen(Screen *s, GUI_DragManager *dm, int x, int y) {
 }
 
 /* Report status to GUI */
-int GUI_Widget:: Status(void) const {
+int GUI_Widget::Status(void) const {
 	return status;
 }
 
 /* Set the bounds of the widget.
    If 'w' or 'h' is -1, that parameter will not be changed.
  */
-void GUI_Widget:: SetRect(int x, int y, int w, int h) {
+void GUI_Widget::SetRect(int x, int y, int w, int h) {
 	area = Common::Rect(x, y, x + w, y + h);
 }
 
-void GUI_Widget:: SetRect(Common::Rect **bounds) {
+void GUI_Widget::SetRect(Common::Rect **bounds) {
 	int minx, maxx;
 	int miny, maxy;
 	int i, v;


Commit: b9a9cfd8067b5d7588ed0f41c1ac37e6b6bfc494
    https://github.com/scummvm/scummvm/commit/b9a9cfd8067b5d7588ed0f41c1ac37e6b6bfc494
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2023-12-09T13:56:09+11:00

Commit Message:
ULTIMA: NUVIE: Add an asset viewer to assist debugging

Added a simple viewer like the one in Pentagram that can look at tiles and
shapes inside the game.

Changed paths:
  A engines/ultima/nuvie/menus/asset_viewer_dialog.cpp
  A engines/ultima/nuvie/menus/asset_viewer_dialog.h
    engines/ultima/module.mk
    engines/ultima/nuvie/core/events.cpp
    engines/ultima/nuvie/core/events.h
    engines/ultima/nuvie/core/tile_manager.h
    engines/ultima/nuvie/files/u6_shape.cpp
    engines/ultima/nuvie/files/u6_shape.h
    engines/ultima/nuvie/gui/gui_text.cpp
    engines/ultima/nuvie/gui/gui_text.h
    engines/ultima/nuvie/keybinding/key_actions.cpp
    engines/ultima/nuvie/keybinding/key_actions.h
    engines/ultima/nuvie/keybinding/keys.cpp


diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index 347e97621c7..89d792d9cc7 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -309,6 +309,7 @@ MODULE_OBJS += \
 	nuvie/gui/widgets/map_window.o \
 	nuvie/keybinding/keys.o \
 	nuvie/keybinding/key_actions.o \
+	nuvie/menus/asset_viewer_dialog.o \
 	nuvie/menus/audio_dialog.o \
 	nuvie/menus/cheats_dialog.o \
 	nuvie/menus/gameplay_dialog.o \
diff --git a/engines/ultima/nuvie/core/events.cpp b/engines/ultima/nuvie/core/events.cpp
index 8467c3daf7e..dc8227b7202 100644
--- a/engines/ultima/nuvie/core/events.cpp
+++ b/engines/ultima/nuvie/core/events.cpp
@@ -46,6 +46,7 @@
 #include "ultima/nuvie/files/nuvie_io_file.h"
 #include "ultima/nuvie/core/magic.h"
 #include "ultima/nuvie/gui/gui_yes_no_dialog.h"
+#include "ultima/nuvie/menus/asset_viewer_dialog.h"
 #include "ultima/nuvie/menus/game_menu_dialog.h"
 #include "ultima/nuvie/views/inventory_widget.h"
 #include "ultima/nuvie/keybinding/keys.h"
@@ -116,6 +117,7 @@ void Events::clear() {
 	time_queue = game_time_queue = nullptr;
 	showingDialog = false;
 	gamemenu_dialog = nullptr;
+	assetviewer_dialog = nullptr;
 	ignore_timeleft = false;
 	in_control_cheat = false;
 	looking_at_spellbook = false;
@@ -2462,8 +2464,21 @@ void Events::gameMenuDialog() {
 		gui->AddWidget(gamemenu_dialog);
 		gui->lock_input(gamemenu_dialog);
 		keybinder->set_enable_joy_repeat(false);
-	} else
+	} else {
 		cancelAction();
+	}
+}
+
+void Events::assetViewer() {
+	if (mode != MOVE_MODE || view_manager->gumps_are_active())
+		return;
+	showingDialog = true;
+	map_window->set_looking(false);
+	map_window->set_walking(false);
+	assetviewer_dialog = new AssetViewerDialog(this);
+	gui->AddWidget(assetviewer_dialog);
+	gui->lock_input(assetviewer_dialog);
+	keybinder->set_enable_joy_repeat(false);
 }
 
 uint16 Events::callback(uint16 msg, CallBack *caller, void *data) {
@@ -2487,6 +2502,7 @@ uint16 Events::callback(uint16 msg, CallBack *caller, void *data) {
 	case GAMEMENUDIALOG_CB_DELETE :
 		showingDialog = false;
 		gamemenu_dialog = nullptr;
+		assetviewer_dialog = nullptr;
 		keybinder->set_enable_joy_repeat(true);
 		return GUI_YUM;
 	}
diff --git a/engines/ultima/nuvie/core/events.h b/engines/ultima/nuvie/core/events.h
index f2291b655f6..94c94ac0a8d 100644
--- a/engines/ultima/nuvie/core/events.h
+++ b/engines/ultima/nuvie/core/events.h
@@ -197,6 +197,7 @@ private:
 	Magic *magic;
 	KeyBinder *keybinder;
 	GUI_Dialog *gamemenu_dialog;
+	GUI_Dialog *assetviewer_dialog;
 
 	Common::Event event;
 	EventMode mode, last_mode;
@@ -431,6 +432,7 @@ public:
 	bool input_really_needs_directon() const;
 	void quitDialog();
 	void gameMenuDialog();
+	void assetViewer();
 	bool actor_exists(const Actor *a) const;
 
 	/* FIXME: Some of the above (action) functions can be removed from public, so
diff --git a/engines/ultima/nuvie/core/tile_manager.h b/engines/ultima/nuvie/core/tile_manager.h
index feed86a24e2..d40ee5aa575 100644
--- a/engines/ultima/nuvie/core/tile_manager.h
+++ b/engines/ultima/nuvie/core/tile_manager.h
@@ -180,6 +180,9 @@ public:
 	uint8 get_number_of_animations() const {
 		return animdata.number_of_tiles_to_animate;
 	}
+	uint16 get_numtiles() const {
+		return numTiles;
+	}
 	uint16 get_anim_tile(uint8 anim_index) const {
 		return anim_index < animdata.number_of_tiles_to_animate ? animdata.tile_to_animate[anim_index] : 0;
 	}
diff --git a/engines/ultima/nuvie/files/u6_shape.cpp b/engines/ultima/nuvie/files/u6_shape.cpp
index de060dae49b..1166a791a8d 100644
--- a/engines/ultima/nuvie/files/u6_shape.cpp
+++ b/engines/ultima/nuvie/files/u6_shape.cpp
@@ -304,6 +304,10 @@ bool U6Shape::load_WoU_background(const Configuration *config, nuvie_game_t game
  *
  * Returns raw data representing the shape or nullptr on failure.
  */
+const unsigned char *U6Shape::get_data() const {
+	return raw;
+}
+
 unsigned char *U6Shape::get_data() {
 	return raw;
 }
@@ -381,7 +385,7 @@ bool U6Shape::blit(U6Shape *shp, uint16 x, uint16 y) {
 	if (shp == nullptr)
 		return false;
 
-	unsigned char *src_data = shp->get_data();
+	const unsigned char *src_data = shp->get_data();
 	uint16 src_w = 0, src_h = 0;
 
 	shp->get_size(&src_w, &src_h);
diff --git a/engines/ultima/nuvie/files/u6_shape.h b/engines/ultima/nuvie/files/u6_shape.h
index b8f787638d3..145f32b8fe0 100644
--- a/engines/ultima/nuvie/files/u6_shape.h
+++ b/engines/ultima/nuvie/files/u6_shape.h
@@ -63,6 +63,7 @@ public:
 	bool load_from_lzc(const Std::string &filename, uint32 idx, uint32 sub_idx);
 	bool load_WoU_background(const Configuration *config, nuvie_game_t game_type);
 
+	const unsigned char *get_data() const;
 	unsigned char *get_data();
 	Graphics::ManagedSurface *get_shape_surface();
 	bool get_hot_point(uint16 *x, uint16 *y);
diff --git a/engines/ultima/nuvie/gui/gui_text.cpp b/engines/ultima/nuvie/gui/gui_text.cpp
index b99cae5b302..ae73dd6e002 100644
--- a/engines/ultima/nuvie/gui/gui_text.cpp
+++ b/engines/ultima/nuvie/gui/gui_text.cpp
@@ -26,7 +26,7 @@
 namespace Ultima {
 namespace Nuvie {
 
-GUI_Text:: GUI_Text(int x, int y, uint8 r, uint8 g, uint8 b, GUI_Font *gui_font, uint16 line_length)
+GUI_Text::GUI_Text(int x, int y, uint8 r, uint8 g, uint8 b, GUI_Font *gui_font, uint16 line_length)
 	: GUI_Widget(nullptr, x, y, 0, 0) {
 	R = r;
 	G = g;
@@ -38,27 +38,19 @@ GUI_Text:: GUI_Text(int x, int y, uint8 r, uint8 g, uint8 b, GUI_Font *gui_font,
 }
 
 
-GUI_Text:: GUI_Text(int x, int y, uint8 r, uint8 g, uint8 b, const char *str, GUI_Font *gui_font, uint16 line_length)
+GUI_Text::GUI_Text(int x, int y, uint8 r, uint8 g, uint8 b, const char *str, GUI_Font *gui_font, uint16 line_length)
 	: GUI_Widget(nullptr, x, y, 0, 0), R(r), G(g), B(b), max_width(line_length),
-	  font(gui_font) {
-	text = scumm_strdup(str);
-	if (text == nullptr)
-		error("GUI_Text: failed to allocate memory for text\n");
-
-	int w, h;
-	font->textExtent(text, &w, &h, max_width);
-
-	area.setWidth(w);
-	area.setHeight(h);
+	  font(gui_font), text(nullptr) {
+	setText(str);
 }
 
 GUI_Text::~GUI_Text() {
-	delete[] text;
+	free(text);
 }
 
 
 /* Show the widget  */
-void GUI_Text:: Display(bool full_redraw) {
+void GUI_Text::Display(bool full_redraw) {
 	font->setTransparency(true);
 	font->setColoring(R, G, B);
 	font->textOut(surface, area.left, area.top, text, max_width);
@@ -66,5 +58,19 @@ void GUI_Text:: Display(bool full_redraw) {
 	DisplayChildren();
 }
 
+void GUI_Text::setText(const char *txt) {
+	if (text)
+		free(text);
+	text = scumm_strdup(txt);
+	if (text == nullptr)
+		error("GUI_Text: failed to allocate memory for text");
+
+	int w, h;
+	font->textExtent(text, &w, &h, max_width);
+
+	area.setWidth(w);
+	area.setHeight(h);
+}
+
 } // End of namespace Nuvie
 } // End of namespace Ultima
diff --git a/engines/ultima/nuvie/gui/gui_text.h b/engines/ultima/nuvie/gui/gui_text.h
index cb7a980a61b..db8d9f7a96e 100644
--- a/engines/ultima/nuvie/gui/gui_text.h
+++ b/engines/ultima/nuvie/gui/gui_text.h
@@ -44,6 +44,7 @@ public:
 	/* Show the widget  */
 	void Display(bool full_redraw) override;
 
+	void setText(const char *txt);
 };
 
 } // End of namespace Nuvie
diff --git a/engines/ultima/nuvie/keybinding/key_actions.cpp b/engines/ultima/nuvie/keybinding/key_actions.cpp
index 89f560575fe..5a0dd6bebef 100644
--- a/engines/ultima/nuvie/keybinding/key_actions.cpp
+++ b/engines/ultima/nuvie/keybinding/key_actions.cpp
@@ -477,6 +477,10 @@ void ActionUseItem(int const *params) {
 	// printf("ActionUseItem obj_n = %d, qual = %d, match_qual = %s, frame_n = %d, match_frame_n = %s\n", obj_n, qual, match_qual ? "true": "false", frame_n, match_frame_n ? "true": "false");
 }
 
+void ActionAssetViewer(int const *params) {
+	EVENT->assetViewer();
+}
+
 void ActionShowEggs(int const *params) {
 	bool show_eggs = !GAME->get_obj_manager()->is_showing_eggs();
 	GAME->get_obj_manager()->set_show_eggs(show_eggs);
diff --git a/engines/ultima/nuvie/keybinding/key_actions.h b/engines/ultima/nuvie/keybinding/key_actions.h
index 58987c20c75..f8c5690f677 100644
--- a/engines/ultima/nuvie/keybinding/key_actions.h
+++ b/engines/ultima/nuvie/keybinding/key_actions.h
@@ -89,6 +89,7 @@ void ActionIncreaseDebug(int const *params);
 void ActionCloseGumps(int const *params);
 void ActionUseItem(int const *params);
 
+void ActionAssetViewer(int const *params);
 void ActionShowEggs(int const *params);
 void ActionToggleHackmove(int const *params);
 void ActionToggleEggSpawn(int const *params);
diff --git a/engines/ultima/nuvie/keybinding/keys.cpp b/engines/ultima/nuvie/keybinding/keys.cpp
index 7656b410ea4..d927423ba22 100644
--- a/engines/ultima/nuvie/keybinding/keys.cpp
+++ b/engines/ultima/nuvie/keybinding/keys.cpp
@@ -114,6 +114,7 @@ const Action NuvieActions[] = {
 	{ "INCREASE_DEBUG", ActionIncreaseDebug, "Increase debug", Action::normal_keys, true, INCREASE_DEBUG_KEY },
 	{ "CLOSE_GUMPS", ActionCloseGumps, "Close gumps", Action::normal_keys, true, OTHER_KEY },
 	{ "USE_ITEM", ActionUseItem, "Use item", Action::normal_keys, true, OTHER_KEY },
+	{ "ASSET_VIEWER", ActionAssetViewer, "Open the asset viewer", Action::normal_keys, true, OTHER_KEY },
 	{ "SHOW_EGGS", ActionShowEggs, "Show eggs", Action::cheat_keys, true, OTHER_KEY },
 	{ "TOGGLE_HACKMOVE", ActionToggleHackmove, "Toggle hack move", Action::cheat_keys, true, OTHER_KEY },
 	{ "TOGGLE_EGG_SPAWN", ActionToggleEggSpawn, "Toggle egg spawn", Action::cheat_keys, true, OTHER_KEY },
diff --git a/engines/ultima/nuvie/menus/asset_viewer_dialog.cpp b/engines/ultima/nuvie/menus/asset_viewer_dialog.cpp
new file mode 100644
index 00000000000..f6d2c0432d4
--- /dev/null
+++ b/engines/ultima/nuvie/menus/asset_viewer_dialog.cpp
@@ -0,0 +1,287 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/nuvie/core/nuvie_defs.h"
+#include "ultima/nuvie/gui/gui.h"
+#include "ultima/nuvie/gui/gui_types.h"
+#include "ultima/nuvie/gui/gui_text.h"
+#include "ultima/nuvie/gui/gui_button.h"
+#include "ultima/nuvie/gui/gui_callback.h"
+#include "ultima/nuvie/gui/gui_area.h"
+#include "ultima/nuvie/gui/gui_dialog.h"
+#include "ultima/nuvie/menus/asset_viewer_dialog.h"
+#include "ultima/nuvie/menus/video_dialog.h"
+#include "ultima/nuvie/menus/audio_dialog.h"
+#include "ultima/nuvie/menus/gameplay_dialog.h"
+#include "ultima/nuvie/menus/input_dialog.h"
+#include "ultima/nuvie/menus/cheats_dialog.h"
+#include "ultima/nuvie/misc/u6_misc.h"
+#include "ultima/nuvie/core/events.h"
+#include "ultima/nuvie/keybinding/keys.h"
+#include "ultima/nuvie/nuvie.h"
+#include "ultima/nuvie/files/u6_shape.h"
+#include "ultima/nuvie/files/u6_bmp.h"
+
+#include "common/keyboard.h"
+
+namespace Ultima {
+namespace Nuvie {
+
+static const int AVD_WIDTH = 320;
+static const int AVD_HEIGHT = 200;
+
+AssetViewerDialog::AssetViewerDialog(CallBack *callback)
+	: GUI_Dialog(Game::get_game()->get_game_x_offset() + (Game::get_game()->get_game_width() - AVD_WIDTH) / 2,
+	             Game::get_game()->get_game_y_offset() + (Game::get_game()->get_game_height() - AVD_HEIGHT) / 2,
+	             AVD_WIDTH, AVD_HEIGHT, 100, 100, 100, GUI_DIALOG_UNMOVABLE),
+			callback_object(callback), _viewMode(TileViewMode) {
+	init();
+	grab_focus();
+}
+
+bool AssetViewerDialog::init() {
+	_curIdx = 0;
+	_shapeIdx = 0;
+	_curShape = nullptr;
+
+	GUI *gui = GUI::get_gui();
+	GUI_Font *font = gui->get_font();
+	TileManager *tileman = Game::get_game()->get_tile_manager();
+	
+	_maxIdx = tileman->get_numtiles();
+	
+	Common::String title = Common::String::format("Tile %d / %d", _curIdx, _maxIdx);
+	_titleTxt = new GUI_Text(10, 10, 0, 0, 0, title.c_str(), font);
+	AddWidget(_titleTxt);
+	_infoTxt = new GUI_Text(10, 25, 0, 0, 0, "info text about the asset will appear here", font);
+	AddWidget(_infoTxt);
+	updateInfoTxt();
+
+	return true;
+}
+
+AssetViewerDialog::~AssetViewerDialog() {
+}
+
+GUI_status AssetViewerDialog::close_dialog() {
+	if (_curShape)
+		delete _curShape;
+	Delete(); // mark dialog as deleted. it will be freed by the GUI object
+	callback_object->callback(GAMEMENUDIALOG_CB_DELETE, nullptr, this);
+	GUI::get_gui()->unlock_input();
+	return GUI_YUM;
+}
+
+void AssetViewerDialog::Display(bool full_redraw) {
+	GUI_Dialog::Display(full_redraw);
+
+	if (_viewMode == TileViewMode) {
+		TileManager *tileman = Game::get_game()->get_tile_manager();
+		Screen *screen = Game::get_game()->get_screen();
+		const Tile *tile = tileman->get_tile(_curIdx);
+		
+		if (tile) {
+			screen->blit(offset_x + 100, offset_y + 100, tile->data, 8, 16, 16, 16, tile->transparent);
+			if (tile->dbl_width) {
+				const Tile *left = tileman->get_tile(_curIdx - 1);
+				screen->blit(offset_x + 100 - 16, offset_y + 100, left->data, 8, 16, 16, 16, left->transparent);
+			}
+			if (tile->dbl_height && !tile->dbl_width) {
+				const Tile *top = tileman->get_tile(_curIdx - 1);
+				screen->blit(offset_x + 100, offset_y + 100 - 16, top->data, 8, 16, 16, 16, top->transparent);
+			} else if (tile->dbl_height) {
+				// dbl width and double-height
+				const Tile *topleft = tileman->get_tile(_curIdx - 3);
+				screen->blit(offset_x + 100 - 16, offset_y + 100 - 16, topleft->data, 8, 16, 16, 16, topleft->transparent);
+				const Tile *top = tileman->get_tile(_curIdx - 2);
+				screen->blit(offset_x + 100, offset_y + 100 - 16, top->data, 8, 16, 16, 16, top->transparent);
+			}
+		}
+	} else {
+		assert(_viewMode == ScreenViewMode && _curShape);
+		if (_curShape->get_data()) {
+			uint16 w = 0;
+			uint16 h = 0;
+			_curShape->get_size(&w, &h);
+			screen->blit(offset_x + 10, offset_y + 40, _curShape->get_data(), 8, w, h, w, true);
+		}
+	}
+}
+
+void AssetViewerDialog::updateInfoTxt() {
+	if (_viewMode == TileViewMode) {
+		TileManager *tileman = Game::get_game()->get_tile_manager();
+		const Tile *tile = tileman->get_tile(_curIdx);
+
+		Common::String title = Common::String::format("Tile %d / %d", _curIdx, _maxIdx);
+		_titleTxt->setText(title.c_str());
+
+		if (!tile) {
+			_infoTxt->setText("((null tile))");
+		} else {
+			Common::String txt;
+			if (tile->damages)
+				txt += "Dmg ";
+			if (tile->transparent)
+				txt += "Trnsp ";
+			if (tile->boundary)
+				txt += "Bndry ";
+			if (tile->dbl_height)
+				txt += "DblH ";
+			if (tile->dbl_width)
+				txt += "DblW ";
+			if (tile->passable)
+				txt += "Pass ";
+			if (tile->water)
+				txt += "Water ";
+			if (tile->toptile)
+				txt += "Top ";
+
+			_infoTxt->setText(txt.c_str());
+		}
+	} else {
+		Common::String title = Common::String::format("Screen %d,%d / %d", _shapeIdx, _curIdx, _maxIdx);
+		_titleTxt->setText(title.c_str());
+		if (_curShape && _curShape->get_data()) {
+			uint16 w = 0;
+			uint16 h = 0;
+			_curShape->get_size(&w, &h);
+			if (w == 0 || h == 0) {
+				_infoTxt->setText("(empty shape)");
+			} else {
+				uint16 x = 0;
+				uint16 y = 0;
+				_curShape->get_hot_point(&x, &y);
+				Common::String info = Common::String::format("sz (%d,%d) hot (%d,%d)", w, h, x, y);
+				_infoTxt->setText(info.c_str());
+			}
+		} else {
+			_infoTxt->setText("(null shape)");
+		}
+	}
+}
+
+void AssetViewerDialog::updateShape() {
+	if (_viewMode == ScreenViewMode) {
+		if (_curShape)
+			delete _curShape;
+		if (Game::get_game()->get_game_type() == NUVIE_GAME_U6) {
+			_curShape = new U6Bmp();
+			_curShape->load(_screenFile);
+		} else {
+			_curShape = new U6Shape();
+			_curShape->load_from_lzc(_screenFile, _shapeIdx, _curIdx);
+		}
+	}
+}
+
+GUI_status AssetViewerDialog::KeyDown(const Common::KeyState &key) {
+	KeyBinder *keybinder = Game::get_game()->get_keybinder();
+	ActionType a = keybinder->get_ActionType(key);
+	nuvie_game_t game_type = Game::get_game()->get_game_type();
+	Configuration *config = Game::get_game()->get_config();
+
+	switch (keybinder->GetActionKeyType(a)) {
+	case NEXT_PARTY_MEMBER_KEY:
+		_shapeIdx++;
+		if (_shapeIdx > 2)
+			_shapeIdx = 0;
+		updateShape();
+		updateInfoTxt();
+		break;
+	case PREVIOUS_PARTY_MEMBER_KEY:
+		_shapeIdx--;
+		if (_shapeIdx < 0)
+			_shapeIdx = 2;
+		updateShape();
+		updateInfoTxt();
+		break;
+	case NORTH_KEY:
+		if (key.flags & Common::KBD_SHIFT)
+			_curIdx -= 10;
+		else
+			_curIdx--;
+		if (_curIdx < 0)
+			_curIdx = _maxIdx + _curIdx;
+
+		updateShape();
+		updateInfoTxt();
+		break;
+	case SOUTH_KEY:
+		if (key.flags & Common::KBD_SHIFT)
+			_curIdx += 10;
+		else
+			_curIdx++;
+		if (_curIdx >= _maxIdx)
+			_curIdx -= _maxIdx;
+
+		updateShape();
+		updateInfoTxt();
+		break;
+	case WEST_KEY:
+	case EAST_KEY:
+		_curIdx = 0;
+		if (_viewMode == TileViewMode) {
+			_viewMode = ScreenViewMode;
+			_screenFile = "";
+			if (game_type == NUVIE_GAME_MD) {
+				config_get_path(config, "mdscreen.lzc", _screenFile);
+				_maxIdx = 4;
+			} else if (game_type == NUVIE_GAME_SE) {
+				config_get_path(config, "screen.lzc", _screenFile);
+				_maxIdx = 4;
+			} else { // U6
+				config_get_path(config, "paper.bmp", _screenFile);
+				_maxIdx = 1;
+			}
+			updateShape();
+		} else {
+			delete _curShape;
+			_curShape = nullptr;
+			_viewMode = TileViewMode;
+			_maxIdx = Game::get_game()->get_tile_manager()->get_numtiles();
+		}
+		updateInfoTxt();
+		break;
+	case CANCEL_ACTION_KEY:
+		return close_dialog();
+	default:
+		keybinder->handle_always_available_keys(a);
+		break;
+	}
+
+	return GUI_YUM;
+}
+
+GUI_status AssetViewerDialog::callback(uint16 msg, GUI_CallBack *caller, void *data) {
+	GUI *gui = GUI::get_gui();
+
+	if (caller == this) {
+		close_dialog();
+	} else {
+		gui->lock_input(this);
+		return GUI_PASS;
+	}
+	return GUI_YUM;
+}
+
+} // End of namespace Nuvie
+} // End of namespace Ultima
diff --git a/engines/ultima/nuvie/menus/asset_viewer_dialog.h b/engines/ultima/nuvie/menus/asset_viewer_dialog.h
new file mode 100644
index 00000000000..2c597cd88cd
--- /dev/null
+++ b/engines/ultima/nuvie/menus/asset_viewer_dialog.h
@@ -0,0 +1,71 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef NUVIE_MENUS_ASSET_VIEWER_DIALOG_H
+#define NUVIE_MENUS_ASSET_VIEWER_DIALOG_H
+
+#include "ultima/nuvie/gui/gui_dialog.h"
+#include "ultima/nuvie/core/nuvie_defs.h"
+
+namespace Ultima {
+namespace Nuvie {
+
+#define GAMEMENUDIALOG_CB_DELETE 3
+
+class GUI;
+class GUI_CallBack;
+class GUI_Button;
+class GUI_Text;
+class U6Shape;
+
+class AssetViewerDialog : public GUI_Dialog {
+	enum ViewMode {
+		TileViewMode,
+		ScreenViewMode,
+	};
+
+protected:
+	CallBack *callback_object;
+	GUI_Text *_titleTxt, *_infoTxt;
+	int _curIdx, _maxIdx;
+	int _shapeIdx;
+	ViewMode _viewMode;
+	U6Shape *_curShape;
+	Std::string _screenFile;
+public:
+	AssetViewerDialog(CallBack *callback);
+	~AssetViewerDialog() override;
+
+	void Display(bool full_redraw) override;
+	GUI_status close_dialog();
+	GUI_status KeyDown(const Common::KeyState &key) override;
+	GUI_status callback(uint16 msg, GUI_CallBack *caller, void *data) override;
+
+private:
+	void updateInfoTxt();
+	void updateShape();
+	bool init();
+};
+
+} // End of namespace Nuvie
+} // End of namespace Ultima
+
+#endif


Commit: bb6c14a007731bfaf54733a57092a29078189cf6
    https://github.com/scummvm/scummvm/commit/bb6c14a007731bfaf54733a57092a29078189cf6
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2023-12-09T13:56:09+11:00

Commit Message:
ULTIMA: NUVIE: Add switch toggling for Martian Dreams UI

Changed paths:
    engines/ultima/nuvie/core/events.cpp
    engines/ultima/nuvie/gui/widgets/command_bar.cpp
    engines/ultima/nuvie/gui/widgets/command_bar.h


diff --git a/engines/ultima/nuvie/core/events.cpp b/engines/ultima/nuvie/core/events.cpp
index dc8227b7202..3b7b0c4b68c 100644
--- a/engines/ultima/nuvie/core/events.cpp
+++ b/engines/ultima/nuvie/core/events.cpp
@@ -3427,7 +3427,7 @@ bool Events::newAction(EventMode new_mode) {
 	if (game->user_paused())
 		return false;
 	cursor_mode = false;
-// FIXME: make ATTACK_MODE use INPUT_MODE
+	// FIXME: make ATTACK_MODE use INPUT_MODE
 	if (mode == ATTACK_MODE && new_mode == ATTACK_MODE) {
 		close_gumps();
 		doAction();
@@ -3441,6 +3441,10 @@ bool Events::newAction(EventMode new_mode) {
 	// a mode would be requested again to complete the action
 	assert(mode != new_mode);
 
+	CommandBar *commandbar = game->get_command_bar();
+	if (commandbar)
+		commandbar->on_new_action(new_mode);
+
 	// called again (same key pressed twice); equivalent of pressing ENTER so call doAction() to set input
 	if (mode == INPUT_MODE && new_mode == last_mode) {
 		doAction();
@@ -3564,6 +3568,10 @@ void Events::endAction(bool prompt) {
 		map_window->set_show_cursor(false);
 	}
 
+	// Clear any switches in MD
+	if (game->get_command_bar())
+		game->get_command_bar()->on_new_action(MOVE_MODE);
+
 	// Revert to the previous mode, instead of MOVE_MODE.
 	/* Switching from INPUT_MODE, clear state indicating the type of input
 	     to return, but leave returned input. Clear returned input only when
diff --git a/engines/ultima/nuvie/gui/widgets/command_bar.cpp b/engines/ultima/nuvie/gui/widgets/command_bar.cpp
index 4e2f1b9c1bd..32bc550020b 100644
--- a/engines/ultima/nuvie/gui/widgets/command_bar.cpp
+++ b/engines/ultima/nuvie/gui/widgets/command_bar.cpp
@@ -86,12 +86,13 @@ static Tile placeholder_tile = {
 
 CommandBar::CommandBar() : GUI_Widget(nullptr), game(nullptr), event(nullptr),
 		background(nullptr), font(nullptr), selected_action(-1), offset(0),
-		combat_mode(false), bg_color(0), font_color(0) {
+		combat_mode(false), bg_color(0), font_color(0), active_action_num(-1),
+		lever_up(nullptr), lever_down(nullptr) {
 }
 
 CommandBar::CommandBar(Game *g) : GUI_Widget(nullptr), game(g),
-		background(nullptr), combat_mode(false), bg_color(0),
-		font_color(0) {
+		background(nullptr), combat_mode(false), bg_color(0), active_action_num(-1),
+		font_color(0), lever_up(nullptr), lever_down(nullptr) {
 	Weather *weather;
 	uint16 x_off = game->get_game_x_offset();
 	uint16 y_off =  game->get_game_y_offset();
@@ -162,8 +163,7 @@ CommandBar::CommandBar(Game *g) : GUI_Widget(nullptr), game(g),
 	wind = "?";
 
 	bg_color = game->get_palette()->get_bg_color();
-	if (game->get_game_type() == NUVIE_GAME_U6)
-		init_buttons();
+	init_buttons();
 
 	weather->add_wind_change_notification_callback((CallBack *)this); //we want to know when the wind direction changes.
 }
@@ -171,6 +171,10 @@ CommandBar::CommandBar(Game *g) : GUI_Widget(nullptr), game(g),
 CommandBar::~CommandBar() {
 	if (background)
 		delete background;
+	if (lever_up)
+		delete lever_up;
+	if (lever_down)
+		delete lever_down;
 }
 
 bool CommandBar::init_buttons() {
@@ -195,6 +199,14 @@ bool CommandBar::init_buttons() {
 		icon[8] = &placeholder_tile; // load/save
 		icon[9] = &placeholder_tile; // quick save
 		icon[10] = &placeholder_tile; // quick load
+
+		Std::string filename;
+		Configuration *config = Game::get_game()->get_config();
+		config_get_path(config, "mdscreen.lzc", filename);
+		lever_up = new U6Shape();
+		lever_down = new U6Shape();
+		lever_up->load_from_lzc(filename, 2, 1);
+		lever_down->load_from_lzc(filename, 2, 0);
 	} else { // SE
 		icon[0] = &placeholder_tile; // move
 		icon[1] = &placeholder_tile; // get
@@ -327,7 +339,7 @@ bool CommandBar::try_selected_action(sint8 command_num) {
 		quick_load_num = 11;
 	}
 
-// CommandBarNewUI only commands
+	// CommandBarNewUI only commands
 	if (command_num == save_num) {
 		g_engine->openMainMenuDialog();
 		return false;
@@ -338,7 +350,7 @@ bool CommandBar::try_selected_action(sint8 command_num) {
 	else if (command_num >= save_num)
 		return false;
 
-// original CommandBar commands (also used in CommandBarNewUI)
+	// original CommandBar commands (also used in CommandBarNewUI)
 	if (game->get_game_type() == NUVIE_GAME_U6)
 		mode = U6_mode_tbl[command_num];
 	else if (game->get_game_type() == NUVIE_GAME_MD)
@@ -405,7 +417,7 @@ void CommandBar::Display(bool full_redraw) {
 				scr->fill(9, area.left + selected_action * 16, area.top + 24, 16, 1);
 		} else if (game->get_game_type() == NUVIE_GAME_SE) {
 			if (!game->is_orig_style()) {
-				unsigned char *se_ptr = background->get_data();
+				const unsigned char *se_ptr = background->get_data();
 				se_ptr += ((320 * 178) + 8); // ((bg_w * image_y_off)  + image_x_off)
 				scr->blit(area.left, area.top, se_ptr, 8, 163, 19, 320, true); // drawing command bar icons from background
 			}
@@ -413,14 +425,31 @@ void CommandBar::Display(bool full_redraw) {
 				fill_square(6);
 		} else { // MD
 			if (!game->is_orig_style()) {
-				unsigned char *md_bg_ptr = background->get_data();
+				const unsigned char *md_bg_ptr = background->get_data();
 				md_bg_ptr += ((320 * 163) + 15); // ((bg_w * image_y_off)  + image_x_off)
 				scr->fill(0, area.left, area.top, area.width(), area.height()); // lever slots, text, top, and bottom have transparency so we need to fill in black first
 				scr->blit(area.left, area.top, md_bg_ptr, 8, area.width(), area.height(), 320, true); // drawing command bar icons from background
 				scr->fill(0, area.left, area.top, 1, area.height()); // make left black so it looks better
 				scr->fill(0, area.left + area.width() - 1, area.top, 1, area.height()); // make right black so it looks better
 			}
-			// FIXME code to display the switched levers goes here (the selected action and the current action will be have the lever down)
+
+			//
+			// Display the switched levers. Original MD has lever down for:
+			// * the right-click action (left click is move)
+			// * a current action pressed via lever or keyboard (eg, drop)
+			// * combat lever if in combat mode
+			//
+			// TODO: Switch the right-click action down to match original.
+			//
+			const U6Shape *lever;
+			uint16 w, h;
+			lever_up->get_size(&w, &h);
+			for (int i = 0; i < 7; i++) {
+				lever = (i == active_action_num) ? lever_down : lever_up;
+				scr->blit(area.left + 18 * i + 6, area.top + 6, lever->get_data(), 8, w, h, w);
+			}
+			lever = (combat_mode ? lever_down : lever_up);
+			scr->blit(area.left + 18 * 7 + 6, area.top + 6, lever->get_data(), 8, w, h, w);
 		}
 
 		scr->update(area.left, area.top, area.width(), area.height());
@@ -434,6 +463,29 @@ void CommandBar::display_information() {
 	font->drawString(screen, infostring.c_str(), area.left + 8, area.top, font_color, font_color);
 }
 
+void CommandBar::on_new_action(EventMode action) {
+	// This is only really needed on MD, but keep track on others too.
+	const EventMode *modetbl;
+	int modetblsz;
+	if (game->get_game_type() == NUVIE_GAME_U6) {
+		modetbl = U6_mode_tbl;
+		modetblsz = ARRAYSIZE(U6_mode_tbl);
+	} else if (game->get_game_type() == NUVIE_GAME_MD) {
+		modetbl = MD_mode_tbl;
+		modetblsz = ARRAYSIZE(MD_mode_tbl);
+	} else { // SE
+		modetbl = SE_mode_tbl;
+		modetblsz = ARRAYSIZE(SE_mode_tbl);
+	}
+
+	active_action_num = -1;
+	for (int i = 0; i < modetblsz; i++) {
+		if (action == modetbl[i])
+			active_action_num = i;
+	}
+	update_display = true;
+}
+
 uint16 CommandBar::callback(uint16 msg, CallBack *caller, void *data) {
 	Weather *weather = game->get_weather();
 
diff --git a/engines/ultima/nuvie/gui/widgets/command_bar.h b/engines/ultima/nuvie/gui/widgets/command_bar.h
index 05ff4be146a..1d16d51fb18 100644
--- a/engines/ultima/nuvie/gui/widgets/command_bar.h
+++ b/engines/ultima/nuvie/gui/widgets/command_bar.h
@@ -54,7 +54,11 @@ protected:
 	Tile *icon[13];
 	U6Shape *background; // used to display the WoU command bar backgrounds
 
+	U6Shape *lever_up;	  // The lever in the up state (MD only)
+	U6Shape *lever_down;  // The lever in the down state (MD only)
+
 	sint8 selected_action; // underlined icon (-1 = none)
+	sint8 active_action_num; // the last action that was activated (for MD levers)
 	bool combat_mode; // state of combat icon
 	Std::string wind; // wind direction
 	void fill_square(uint8 pal_index);
@@ -89,6 +93,10 @@ public:
 		return selected_action;
 	}
 
+	// Called when a mode is being changed from here
+	// *or* keyboard - so MD can update levers
+	void on_new_action(EventMode action);
+
 	GUI_status callback(uint16 msg, GUI_CallBack *caller, void *data) override {
 		return GUI_PASS;
 	}


Commit: b4414af5aaa036c4ee0f4eb1713adac50fd027a8
    https://github.com/scummvm/scummvm/commit/b4414af5aaa036c4ee0f4eb1713adac50fd027a8
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2023-12-09T13:56:10+11:00

Commit Message:
ULTIMA: NUVIE: Remove nuvie-specific scaler code

Scalers have all been disabled in ScummVM, and should all be handled through
the main ScummVM system now.

Changed paths:
  R engines/ultima/nuvie/screen/scale.cpp
  R engines/ultima/nuvie/screen/scale.h
  R engines/ultima/nuvie/screen/scale.inl
    engines/ultima/module.mk
    engines/ultima/nuvie/gui/gui.cpp
    engines/ultima/nuvie/gui/gui.h
    engines/ultima/nuvie/menus/video_dialog.cpp
    engines/ultima/nuvie/menus/video_dialog.h
    engines/ultima/nuvie/screen/screen.cpp
    engines/ultima/nuvie/screen/screen.h


diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index 89d792d9cc7..b5f592d4097 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -338,7 +338,6 @@ MODULE_OBJS += \
 	nuvie/save/save_game.o \
 	nuvie/screen/dither.o \
 	nuvie/screen/game_palette.o \
-	nuvie/screen/scale.o \
 	nuvie/screen/screen.o \
 	nuvie/screen/surface.o \
 	nuvie/script/script.o \
diff --git a/engines/ultima/nuvie/gui/gui.cpp b/engines/ultima/nuvie/gui/gui.cpp
index 388e669054d..ac69b1af5ed 100644
--- a/engines/ultima/nuvie/gui/gui.cpp
+++ b/engines/ultima/nuvie/gui/gui.cpp
@@ -45,7 +45,6 @@ GUI::GUI(const Configuration *c, Screen *s) : config(c), screen(s), numwidgets(0
 	Graphics::ManagedSurface *sdl_surface;
 
 	gui = this;
-	screen_scale_factor = screen->get_scale_factor();
 
 	sdl_surface = screen->get_sdl_surface();
 
@@ -216,17 +215,6 @@ GUI_status GUI::HandleEvent(Common::Event *event) {
 	int hit;
 	GUI_status status = GUI_PASS;
 
-	if (screen_scale_factor != 1) {
-		if (Shared::isMouseDownEvent(event->type) || Shared::isMouseUpEvent(event->type)) {
-			event->mouse.x /= screen_scale_factor;
-			event->mouse.y /= screen_scale_factor;
-		}
-		if (event->type == Common::EVENT_MOUSEMOVE) {
-			event->mouse.x /= screen_scale_factor;
-			event->mouse.y /= screen_scale_factor;
-		}
-	}
-
 	if (dragging) { //&& !block_input)
 		if (Shared::isMouseUpEvent(event->type)) { //FIX for button up that doesn't hit a widget.
 			for (hit = false, i = numwidgets - 1; (i >= 0) && (hit == false); --i) {
diff --git a/engines/ultima/nuvie/gui/gui.h b/engines/ultima/nuvie/gui/gui.h
index d2af16c2ae9..59111938ac6 100644
--- a/engines/ultima/nuvie/gui/gui.h
+++ b/engines/ultima/nuvie/gui/gui.h
@@ -49,8 +49,6 @@ protected:
 	/* The display surface */
 	Screen *screen;
 
-	int screen_scale_factor;
-
 	GUI_Font *gui_font;
 	GUI_DragManager *gui_drag_manager;
 
diff --git a/engines/ultima/nuvie/menus/video_dialog.cpp b/engines/ultima/nuvie/menus/video_dialog.cpp
index 16968662857..1a8c9408472 100644
--- a/engines/ultima/nuvie/menus/video_dialog.cpp
+++ b/engines/ultima/nuvie/menus/video_dialog.cpp
@@ -30,7 +30,6 @@
 #include "ultima/nuvie/gui/gui_area.h"
 #include "ultima/nuvie/misc/u6_misc.h"
 #include "ultima/nuvie/screen/dither.h"
-#include "ultima/nuvie/screen/scale.h"
 #include "ultima/nuvie/screen/screen.h"
 #include "ultima/nuvie/gui/widgets/map_window.h"
 #include "ultima/nuvie/gui/gui_dialog.h"
@@ -56,7 +55,7 @@ VideoDialog::VideoDialog(GUI_CallBack *callback)
 }
 
 bool VideoDialog::init() {
-	int colX[] = { 9, 29, 63, 232, 270};
+	const int colX[] = { 9, 29, 63, 232, 270};
 	int height = 12;
 	int yesno_width = 32;
 	int buttonY = 9;
@@ -64,155 +63,38 @@ bool VideoDialog::init() {
 	uint8 row_h = 13;
 	last_index = 0;
 	b_index_num = -1;
-	bool no_fullscreen = false; // no compatible fullscreen setting found
 	GUI_Widget *widget;
 	GUI *gui = GUI::get_gui();
 	GUI_Font *font = gui->get_font();
 	Game *game = Game::get_game();
 	Screen *scr = game->get_screen();
 	const char *const yesno_text[] = { "no", "yes" };
-#define SCALER_AND_SCALE_CANNOT_BE_CHANGED 1 // FIXME need to be able to change these in game -- they also haven't been updated for keyboard controls and the size of the gump isn't right
-#if SCALER_AND_SCALE_CANNOT_BE_CHANGED
 	only2x_button = nullptr;
-	scale_button = scaler_button = scale_win_button = scaler_win_button = nullptr;
 
-	no_fullscreen = false;
-
-#else
-	uint16 scrWidth = scr->get_width();
-	uint16 scrHeight = scr->get_height();
-	uint16 bpp = scr->get_bpp();
-
-	int textY[] = { 11, 24, 37, 50, 63 , 76, 89, 102, 115, 128, 141 };
-	int buttonY[] = { 9, 22, 35, 48, 61, 74, 87, 100, 113, 126, 139, 152 };
-// scaler
-	int num_scalers = scr->get_scaler_reg()->GetNumScalers();
-	const char *scaler_text[num_scalers];
-	for (int i = 0; i <= num_scalers; i++)
-		scaler_text[i] = scr->get_scaler_reg()->GetNameForIndex(i);
-
-	widget = new GUI_Text(colX[0], textY[0], 0, 0, 0, "Scaler:", font);
+	// fullscreen_toggle
+	widget = new GUI_Text(colX[0], textY, 0, 0, 0, "Fullscreen:", gui->get_font());
 	AddWidget(widget);
-// scaler(fullscreen)
-	int num_scalers_fullscreen, fullscreen_scaler_selection;
-	bool no_only2x_scalers = !SDL_VideoModeOK(scrWidth * 2, scrHeight * 2, bpp, SDL_FULLSCREEN);
-	if (no_only2x_scalers) {
-		num_scalers_fullscreen = 2;
-		fullscreen_scaler_selection = (scr->get_scaler_index() == 1) ? 1 : 0;
-	} else {
-		num_scalers_fullscreen = num_scalers;
-		fullscreen_scaler_selection = scr->get_scaler_index();
-	}
-	scaler_button = new GUI_TextToggleButton(this, colX[2], buttonY[0], 208, height, scaler_text, num_scalers_fullscreen, fullscreen_scaler_selection, font, BUTTON_TEXTALIGN_CENTER, this, 0);
-	AddWidget(scaler_button);
-// scaler (windowed)
-	scaler_win_button = new GUI_TextToggleButton(this, colX[2], buttonY[0], 208, height, scaler_text, num_scalers, scr->get_scaler_index(), font, BUTTON_TEXTALIGN_CENTER, this, 0);
-	AddWidget(scaler_win_button);
-// scale
-	widget = new GUI_Text(colX[0], textY[1], 0, 0, 0, "Scale:", gui->get_font());
-	AddWidget(widget);
-	const char *scale_win_text[10];
-	scale_win_text[0] = "1";
-	scale_win_text[1] = "2";
-	scale_win_text[2] = "3";
-	scale_win_text[3] = "4";
-	scale_win_text[4] = "5";
-	scale_win_text[5] = "6";
-	scale_win_text[6] = "7";
-	scale_win_text[7] = "8";
-	int scale = scr->get_scale_factor();
-	char buff [4];
-	itoa(scale, buff, 10);  // write current scale to buff
-// scale (fullscreen)
-	const char *scale_text[10];
-	int num_scale = 0;
-	int scale_selection = 9;
-
-	for (int i = 1; i < 9; i++) {
-		if (SDL_VideoModeOK(scrWidth * i, scrHeight * i, bpp, SDL_FULLSCREEN)) {
-			scale_text[num_scale] = scale_win_text[i - 1];
-			if (i == scale)
-				scale_selection = num_scale;
-			num_scale++;
-		}
-	}
-	if (scale_selection == 9) { // current scale is greater than 8 (or wasn't returned as okay)
-		if (scr->is_fullscreen() || (scale > 8 && SDL_VideoModeOK(scrWidth * scale, scrHeight * scale, bpp, SDL_FULLSCREEN))) {
-			scale_selection = num_scale;
-			scaler_text[num_scale] = buff; // current scale
-			num_scale++;
-		} else if (num_scale > 0) {
-			scale_selection = 0;
-		} else {
-			no_fullscreen = true;
-		}
-	}
-	if (no_fullscreen) {
-		scale_button = nullptr;
-		scaler_button->Delete();
-		scaler_button = nullptr;
-	} else {
-		scale_button = new GUI_TextToggleButton(this, colX[4], buttonY[1], yesno_width, height, scale_text, num_scale, scale_selection, font, BUTTON_TEXTALIGN_CENTER, this, 0);
-		AddWidget(scale_button);
-	}
-// scale (windowed)
-	int num_win_scale, scale_win_selection;
-	if (scale < 9) {
-		num_win_scale = 8;
-		scale_win_selection = scale - 1;
-	} else {
-		num_win_scale = 9;
-		scale_win_selection = 8;
-		scale_win_text[8] = buff;
-	}
-	scale_win_button = new GUI_TextToggleButton(this, colX[4], buttonY[1], yesno_width, height, scale_win_text, num_win_scale, scale_win_selection, font, BUTTON_TEXTALIGN_CENTER, this, 0);
-	AddWidget(scale_win_button);
-// scale (only2x scale button for scalers that aren't point or interlaced)
-	only2x_button = new GUI_Button(this, colX[3], buttonY[1], 70, height, "2x only", font, BUTTON_TEXTALIGN_CENTER, 0, this, 0);
-	AddWidget(only2x_button);
-// fullscreen_toggle
-	fullscreen_button = new GUI_TextToggleButton(this, colX[4], buttonY[2], yesno_width, height, yesno_text, 2, scr->is_fullscreen(), font, BUTTON_TEXTALIGN_CENTER, this, 0);
-	AddWidget(fullscreen_button);
-
-	if (no_fullscreen && !scr->is_fullscreen()) {
-		fullscreen_button->Hide();
-	} else {
-		widget = new GUI_Text(colX[0], textY[2], 0, 0, 0, "Fullscreen:", gui->get_font());
-		AddWidget(widget);
-	}
-#endif /* !SCALER_AND_SCALE_CANNOT_BE_CHANGED */
-
-	bool first_index = true;
-#if SCALER_AND_SCALE_CANNOT_BE_CHANGED
-// fullscreen_toggle
-	if (!no_fullscreen || scr->is_fullscreen()) {
-		widget = new GUI_Text(colX[0], textY, 0, 0, 0, "Fullscreen:", gui->get_font());
-		AddWidget(widget);
 
-		fullscreen_button = new GUI_TextToggleButton(this, colX[4], buttonY, yesno_width, height, yesno_text, 2, scr->is_fullscreen(), font, BUTTON_TEXTALIGN_CENTER, this, 0);
-		AddWidget(fullscreen_button);
-		button_index[last_index] = fullscreen_button;
-
-		widget = new GUI_Text(colX[0], textY += row_h, 0, 0, 0, "Non-square pixels:", gui->get_font());
-		AddWidget(widget);
-		non_square_pixels_button = new GUI_TextToggleButton(this, colX[4], buttonY += row_h, yesno_width, height, yesno_text, 2, scr->is_non_square_pixels(), font, BUTTON_TEXTALIGN_CENTER, this, 0);
-		AddWidget(non_square_pixels_button);
-		button_index[last_index += 1] = non_square_pixels_button;
+	fullscreen_button = new GUI_TextToggleButton(this, colX[4], buttonY, yesno_width, height, yesno_text, 2, scr->is_fullscreen(), font, BUTTON_TEXTALIGN_CENTER, this, 0);
+	AddWidget(fullscreen_button);
+	button_index[last_index] = fullscreen_button;
 
-		first_index = false;
-	} else
-		fullscreen_button = nullptr;
-#endif
+	widget = new GUI_Text(colX[0], textY += row_h, 0, 0, 0, "Non-square pixels:", gui->get_font());
+	AddWidget(widget);
+	non_square_pixels_button = new GUI_TextToggleButton(this, colX[4], buttonY += row_h, yesno_width, height, yesno_text, 2, scr->is_non_square_pixels(), font, BUTTON_TEXTALIGN_CENTER, this, 0);
+	AddWidget(non_square_pixels_button);
+	button_index[last_index += 1] = non_square_pixels_button;
 
 	Configuration *config = Game::get_game()->get_config();
 
-// show roofs
-	widget = new GUI_Text(colX[0], textY += first_index ? 0 : row_h, 0, 0, 0, "Show roofs:", gui->get_font());
+	// show roofs
+	widget = new GUI_Text(colX[0], textY += row_h, 0, 0, 0, "Show roofs:", gui->get_font());
 	AddWidget(widget);
-	roof_button = new GUI_TextToggleButton(this, colX[4], buttonY += first_index ? 0 : row_h, yesno_width, height, yesno_text, 2, game->is_roof_mode(), font, BUTTON_TEXTALIGN_CENTER, this, 0);
+	roof_button = new GUI_TextToggleButton(this, colX[4], buttonY += row_h, yesno_width, height, yesno_text, 2, game->is_roof_mode(), font, BUTTON_TEXTALIGN_CENTER, this, 0);
 	AddWidget(roof_button);
-	button_index[(last_index += first_index ? 0 : 1)] = roof_button;
-// use_new_dolls
+	button_index[(last_index += 1)] = roof_button;
+
+	// use_new_dolls
 	if (game->is_new_style()) {
 		doll_button = nullptr;
 		old_use_new_dolls = true;
@@ -226,24 +108,28 @@ bool VideoDialog::init() {
 		AddWidget(doll_button);
 		button_index[last_index += 1] = doll_button;
 	}
-// tile_lighting_b
+
+	// tile_lighting_b
 	widget = new GUI_Text(colX[0], textY += row_h, 0, 0, 0, "Use lighting data from map tiles:", gui->get_font());
 	AddWidget(widget);
 	old_use_tile_lighting = game->get_map_window()->using_map_tile_lighting;
 	tile_lighting_b = new GUI_TextToggleButton(this, colX[4], buttonY += row_h, yesno_width, height, yesno_text, 2, old_use_tile_lighting, font, BUTTON_TEXTALIGN_CENTER, this, 0);
 	AddWidget(tile_lighting_b);
 	button_index[last_index += 1] = tile_lighting_b;
-// needs restart text
+
+	// needs restart text
 	widget = new GUI_Text(colX[0], textY += row_h * 2, 0, 0, 0, "The following require a restart:", gui->get_font());
 	AddWidget(widget);
-// lighting (needs reset)
+
+	// lighting (needs reset)
 	widget = new GUI_Text(colX[1], textY += row_h, 0, 0, 0, "Lighting mode:", gui->get_font());
 	AddWidget(widget);
 	const char *const lighting_text[] = { "none", "smooth", "original" };
-	lighting_button = new GUI_TextToggleButton(this, colX[3], buttonY += row_h * 3, 70, height, lighting_text, 3, scr->get_old_lighting_style(), font, BUTTON_TEXTALIGN_CENTER, this, 0);
+	lighting_button = new GUI_TextToggleButton(this, colX[3], buttonY += row_h * 3, 70, height, lighting_text, ARRAYSIZE(lighting_text), scr->get_old_lighting_style(), font, BUTTON_TEXTALIGN_CENTER, this, 0);
 	AddWidget(lighting_button);
 	button_index[last_index += 1] = lighting_button;
-// sprites (needs reset)
+
+	// sprites (needs reset)
 	widget = new GUI_Text(colX[1], textY += row_h, 0, 0, 0, "Use custom actor tiles:", gui->get_font());
 	AddWidget(widget);
 	const char *const sprite_text[] = { "no", "yes", "default" };
@@ -254,28 +140,31 @@ bool VideoDialog::init() {
 		custom_tiles = 2;
 	else
 		custom_tiles = custom_tile_str == "yes" ? 1 : 0;
-	sprites_b = new GUI_TextToggleButton(this, colX[3], buttonY += row_h, 70, height, sprite_text, 3, custom_tiles, font, BUTTON_TEXTALIGN_CENTER, this, 0);
+	sprites_b = new GUI_TextToggleButton(this, colX[3], buttonY += row_h, 70, height, sprite_text, ARRAYSIZE(sprite_text), custom_tiles, font, BUTTON_TEXTALIGN_CENTER, this, 0);
 	AddWidget(sprites_b);
 	button_index[last_index += 1] = sprites_b;
-// game_style (needs reset)
-	const char *game_style_text[4];
-	game_style_text[0] = "original style";
-	game_style_text[1] = "new style";
-	game_style_text[2] = "original+";
-	game_style_text[3] = "original+ full map";
+
+	// game_style (needs reset)
+	const char *game_style_text[] = {
+		"original style",
+		"new style",
+		"original+",
+		"original+ full map"};
 	widget = new GUI_Text(colX[1], textY += row_h, 0, 0, 0, "Game style:", gui->get_font());
 	AddWidget(widget);
-	game_style_button = new GUI_TextToggleButton(this, colX[3] - 84, buttonY += row_h, 154, height, game_style_text, 4, game->get_game_style(), font, BUTTON_TEXTALIGN_CENTER, this, 0);
+	game_style_button = new GUI_TextToggleButton(this, colX[3] - 84, buttonY += row_h, 154, height, game_style_text, ARRAYSIZE(game_style_text), game->get_game_style(), font, BUTTON_TEXTALIGN_CENTER, this, 0);
 	AddWidget(game_style_button);
 	button_index[last_index += 1] = game_style_button;
-// dithering (needs reset)
+
+	// dithering (needs reset)
 	widget = new GUI_Text(colX[1], textY += row_h, 0, 0, 0, "Old video graphics:", gui->get_font());
 	AddWidget(widget);
 	const char *const dither_text[] = { "no", "CGA", "EGA" };
-	dither_button = new GUI_TextToggleButton(this, colX[4], buttonY += row_h, yesno_width, height, dither_text, 3, game->get_dither()->get_mode(), font, BUTTON_TEXTALIGN_CENTER, this, 0);
+	dither_button = new GUI_TextToggleButton(this, colX[4], buttonY += row_h, yesno_width, height, dither_text, ARRAYSIZE(dither_text), game->get_dither()->get_mode(), font, BUTTON_TEXTALIGN_CENTER, this, 0);
 	AddWidget(dither_button);
 	button_index[last_index += 1] = dither_button;
-// cancel/save buttons
+
+	// cancel/save buttons
 	cancel_button = new GUI_Button(this, 95, VD_HEIGHT - 20, 54, height, "Cancel", font, BUTTON_TEXTALIGN_CENTER, 0, this, 0);
 	AddWidget(cancel_button);
 	button_index[last_index += 1] = cancel_button;
@@ -283,61 +172,12 @@ bool VideoDialog::init() {
 	AddWidget(save_button);
 	button_index[last_index += 1] = save_button;
 
-	rebuild_buttons(true);
 	return true;
 }
 
 VideoDialog::~VideoDialog() {
 }
 
-void VideoDialog::rebuild_buttons(bool init) {
-#if SCALER_AND_SCALE_CANNOT_BE_CHANGED
-	return;
-#endif
-	int scaler;
-	bool fullscreen;
-	Screen *scr = Game::get_game()->get_screen();
-
-	if (init) {
-		scaler = scr->get_scaler_index();
-		fullscreen = scr->is_fullscreen();
-	} else {
-		fullscreen = fullscreen_button->GetSelection();
-		if (fullscreen)
-			scaler = scaler_button->GetSelection();
-		else
-			scaler = scaler_win_button->GetSelection();
-	}
-// scaler buttons
-	if (fullscreen) {
-		if (scaler_button)
-			scaler_button->Show();
-		scaler_win_button->Hide();
-	} else {
-		if (scaler_button)
-			scaler_button->Hide();
-		scaler_win_button->Show();
-	}
-// scale buttons
-	if (scaler > 1) {
-		if (scale_button)
-			scale_button->Hide();
-		scale_win_button->Hide();
-		only2x_button->Show();
-	} else {
-		only2x_button->Hide();
-		if (fullscreen) {
-			if (scale_button)
-				scale_button->Show();
-			scale_win_button->Hide();
-		} else {
-			if (scale_button)
-				scale_button->Hide();
-			scale_win_button->Show();
-		}
-	}
-}
-
 GUI_status VideoDialog::close_dialog() {
 	Delete(); // mark dialog as deleted. it will be freed by the GUI object
 	callback_object->callback(0, this, this);
@@ -386,52 +226,17 @@ GUI_status VideoDialog::KeyDown(const Common::KeyState &key) {
 GUI_status VideoDialog::callback(uint16 msg, GUI_CallBack *caller, void *data) {
 	if (caller == cancel_button) {
 		return close_dialog();
-	} else if (fullscreen_button && caller == fullscreen_button) {
-		rebuild_buttons(false);
-#ifndef SCALER_AND_SCALE_CANNOT_BE_CHANGED
-	} else if (caller == scaler_button) {
-		if (scaler_button->GetSelection() > 1) {
-			scale_button->Hide();
-			only2x_button->Show();
-		} else {
-			scale_button->Show();
-			only2x_button->Hide();
-		}
-	} else if (caller == scaler_win_button) {
-		if (scaler_win_button->GetSelection() > 1) {
-			scale_win_button->Hide();
-			only2x_button->Show();
-		} else {
-			scale_win_button->Show();
-			only2x_button->Hide();
-		}
-#endif /* !SCALER_AND_SCALE_CANNOT_BE_CHANGED */
 	} else if (caller == save_button) {
 		Game *game = Game::get_game();
 		Screen *scr = Game::get_game()->get_screen();
 		Configuration *config = Game::get_game()->get_config();
+
 		bool fullscreen = fullscreen_button ? fullscreen_button->GetSelection() : scr->is_fullscreen();
-#if SCALER_AND_SCALE_CANNOT_BE_CHANGED
 		if (fullscreen != scr->is_fullscreen())
 			scr->toggle_fullscreen();
 		bool non_square_pixels = non_square_pixels_button ? (bool)non_square_pixels_button->GetSelection() : false;
 		scr->set_non_square_pixels(non_square_pixels);
-#else
-		// scaler
-		int scaler;
-		if (fullscreen)
-			scaler = scaler_button->GetSelection();
-		else
-			scaler = scaler_win_button->GetSelection();
-		config->set("config/video/scale_method", scr->get_scaler_reg()->GetNameForIndex(scaler));
-		// scale
-		int scale;
-		if (fullscreen)
-			scale = scale_button->GetSelection() + 1;
-		else
-			scale = scale_win_button->GetSelection() + 1;
-		config->set("config/video/scale_factor", scale);
-#endif
+
 		// fullscreen
 		config->set("config/fullscreen", fullscreen ? "yes" : "no");
 		game->get_screen()->set_fullscreen(fullscreen);
@@ -452,12 +257,14 @@ GUI_status VideoDialog::callback(uint16 msg, GUI_CallBack *caller, void *data) {
 			if (vm->get_current_view() == iv) // showing a doll so need to reset
 				iv->set_party_member(iv->get_party_member_num());
 		}
+
 		// tile_lighting_b
 		if (old_use_tile_lighting != (bool)tile_lighting_b->GetSelection()) {
 			config->set(config_get_game_key(config) + "/map_tile_lighting", tile_lighting_b->GetSelection() ? "yes" : "no");
 			game->get_map_window()->using_map_tile_lighting = tile_lighting_b->GetSelection() == 1;
 			game->get_map_window()->updateAmbience();
 		}
+
 		// lighting
 		const char *lighting_char;
 		int lighting = lighting_button->GetSelection();
@@ -468,6 +275,7 @@ GUI_status VideoDialog::callback(uint16 msg, GUI_CallBack *caller, void *data) {
 		else
 			lighting_char = "original";
 		config->set("config/general/lighting", lighting_char);
+
 		// sprites
 		const char *sprite_char;
 		if (sprites_b->GetSelection() == 2)
@@ -475,13 +283,15 @@ GUI_status VideoDialog::callback(uint16 msg, GUI_CallBack *caller, void *data) {
 		else
 			sprite_char = sprites_b->GetSelection() ? "yes" : "no";
 		config->set(config_get_game_key(config) + "/custom_actor_tiles", sprite_char);
+
 		// game_style
-		const char *game_style_text[4];
-		game_style_text[0] = "original";
-		game_style_text[1] = "new";
-		game_style_text[2] = "original+";
-		game_style_text[3] = "original+_full_map";
+		const char *game_style_text[] = {
+				"original",
+				"new",
+				"original+",
+				"original+_full_map"};
 		config->set("config/video/game_style", game_style_text[game_style_button->GetSelection()]);
+
 		// dither
 		const char *dither_char;
 		uint8 dither = dither_button->GetSelection();
diff --git a/engines/ultima/nuvie/menus/video_dialog.h b/engines/ultima/nuvie/menus/video_dialog.h
index f0a7fc63adc..af01db4e2a8 100644
--- a/engines/ultima/nuvie/menus/video_dialog.h
+++ b/engines/ultima/nuvie/menus/video_dialog.h
@@ -39,11 +39,9 @@ protected:
 	bool old_use_new_dolls, old_use_tile_lighting;
 	GUI_CallBack *callback_object;
 	GUI_Button *save_button, *cancel_button, *only2x_button;
-	GUI_TextToggleButton *scale_button, *scale_win_button, *scaler_button, *scaler_win_button,
-	                     *fullscreen_button, *non_square_pixels_button, *roof_button, *lighting_button, *dither_button,
+	GUI_TextToggleButton *fullscreen_button, *non_square_pixels_button, *roof_button, *lighting_button, *dither_button,
 	                     *game_style_button, *doll_button, *tile_lighting_b, *sprites_b;
 	GUI_Button *button_index[11]; // add to here when you add a button. Keep buttons in order by height
-	void rebuild_buttons(bool init);
 public:
 	VideoDialog(GUI_CallBack *callback);
 	~VideoDialog() override;
diff --git a/engines/ultima/nuvie/screen/scale.cpp b/engines/ultima/nuvie/screen/scale.cpp
deleted file mode 100644
index b065c3ec9bb..00000000000
--- a/engines/ultima/nuvie/screen/scale.cpp
+++ /dev/null
@@ -1,391 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "ultima/nuvie/core/nuvie_defs.h"
-#include "ultima/nuvie/conf/misc.h"
-#include "ultima/nuvie/screen/scale.h"
-#include "ultima/nuvie/screen/surface.h"
-// Include all the Template Scaler Code
-#include "ultima/nuvie/screen/scale.inl"
-
-namespace Ultima {
-namespace Nuvie {
-
-//
-// The Array of Scalers
-//
-const ScalerStruct ScalerRegistry::scaler_array[] = {
-
-	// Point (this MUST be first)
-	{
-		"Point",
-		0,
-		Scalers<uint16, ManipRGBGeneric>::Scale_point,
-		Scalers<uint16, ManipRGBGeneric>::Scale_point,
-		Scalers<uint16, ManipRGBGeneric>::Scale_point,
-		Scalers<uint32, ManipRGBGeneric>::Scale_point,
-		Scalers<uint32, ManipRGBGeneric>::Scale_point
-	},
-
-	// Interlaced
-	{
-		"Interlaced",
-		0,
-		Scalers<uint16, ManipRGBGeneric>::Scale_interlaced,
-		Scalers<uint16, ManipRGBGeneric>::Scale_interlaced,
-		Scalers<uint16, ManipRGBGeneric>::Scale_interlaced,
-		Scalers<uint32, ManipRGBGeneric>::Scale_interlaced,
-		Scalers<uint32, ManipRGBGeneric>::Scale_interlaced
-	},
-
-	// 2xSaI
-	{
-		"2xSaI",
-		SCALER_FLAG_2X_ONLY,
-		Scalers<uint16, ManipRGBGeneric>::Scale_2xSaI,
-		Scalers<uint16, ManipRGB555>::Scale_2xSaI,
-		Scalers<uint16, ManipRGB565>::Scale_2xSaI,
-		Scalers<uint32, ManipRGBGeneric>::Scale_2xSaI,
-		Scalers<uint32, ManipRGB888>::Scale_2xSaI
-	},
-
-	// Super2xSaI
-	{
-		"Super2xSaI",
-		SCALER_FLAG_2X_ONLY,
-		Scalers<uint16, ManipRGBGeneric>::Scale_Super2xSaI,
-		Scalers<uint16, ManipRGB555>::Scale_Super2xSaI,
-		Scalers<uint16, ManipRGB565>::Scale_Super2xSaI,
-		Scalers<uint32, ManipRGBGeneric>::Scale_Super2xSaI,
-		Scalers<uint32, ManipRGB888>::Scale_Super2xSaI
-	},
-
-
-	// Scale2x - AdvanceMAME
-	{
-		"Scale2x",
-		SCALER_FLAG_2X_ONLY,
-		Scalers<uint16, ManipRGBGeneric>::Scale_Scale2x,
-		Scalers<uint16, ManipRGB555>::Scale_Scale2x,
-		Scalers<uint16, ManipRGB565>::Scale_Scale2x,
-		Scalers<uint32, ManipRGBGeneric>::Scale_Scale2x,
-		Scalers<uint32, ManipRGB888>::Scale_Scale2x
-	},
-
-	// SuperEagle
-	{
-		"SuperEagle",
-		SCALER_FLAG_2X_ONLY,
-		Scalers<uint16, ManipRGBGeneric>::Scale_SuperEagle,
-		Scalers<uint16, ManipRGB555>::Scale_SuperEagle,
-		Scalers<uint16, ManipRGB565>::Scale_SuperEagle,
-		Scalers<uint32, ManipRGBGeneric>::Scale_SuperEagle,
-		Scalers<uint32, ManipRGB888>::Scale_SuperEagle
-	},
-
-	// Bilinear
-	{
-		"Bilinear",
-		SCALER_FLAG_2X_ONLY,
-		Scalers<uint16, ManipRGBGeneric>::Scale_Bilinear,
-		Scalers<uint16, ManipRGB555>::Scale_Bilinear,
-		Scalers<uint16, ManipRGB565>::Scale_Bilinear,
-		Scalers<uint32, ManipRGBGeneric>::Scale_Bilinear,
-		Scalers<uint32, ManipRGB888>::Scale_Bilinear
-	},
-
-	// BilinearPlus
-	{
-		"BilinearPlus",
-		SCALER_FLAG_2X_ONLY,
-		Scalers<uint16, ManipRGBGeneric>::Scale_BilinearPlus,
-		Scalers<uint16, ManipRGB555>::Scale_BilinearPlus,
-		Scalers<uint16, ManipRGB565>::Scale_BilinearPlus,
-		Scalers<uint32, ManipRGBGeneric>::Scale_BilinearPlus,
-		Scalers<uint32, ManipRGB888>::Scale_BilinearPlus
-	},
-
-	// BilinearInterlaced
-	{
-		"BilinearInterlaced",
-		SCALER_FLAG_2X_ONLY,
-		Scalers<uint16, ManipRGBGeneric>::Scale_BilinearInterlaced,
-		Scalers<uint16, ManipRGB555>::Scale_BilinearInterlaced,
-		Scalers<uint16, ManipRGB565>::Scale_BilinearInterlaced,
-		Scalers<uint32, ManipRGBGeneric>::Scale_BilinearInterlaced,
-		Scalers<uint32, ManipRGB888>::Scale_BilinearInterlaced
-	},
-
-	// BilinearHalfInterlaced
-	{
-		"BilinearHalfInterlaced",
-		SCALER_FLAG_2X_ONLY,
-		Scalers<uint16, ManipRGBGeneric>::Scale_BilinearHalfInterlaced,
-		Scalers<uint16, ManipRGB555>::Scale_BilinearHalfInterlaced,
-		Scalers<uint16, ManipRGB565>::Scale_BilinearHalfInterlaced,
-		Scalers<uint32, ManipRGBGeneric>::Scale_BilinearHalfInterlaced,
-		Scalers<uint32, ManipRGB888>::Scale_BilinearHalfInterlaced
-	},
-
-	// BilinearQuarterInterlaced
-	{
-		"BilinearQuarterInterlaced",
-		SCALER_FLAG_2X_ONLY,
-		Scalers<uint16, ManipRGBGeneric>::Scale_BilinearQuarterInterlaced,
-		Scalers<uint16, ManipRGB555>::Scale_BilinearQuarterInterlaced,
-		Scalers<uint16, ManipRGB565>::Scale_BilinearQuarterInterlaced,
-		Scalers<uint32, ManipRGBGeneric>::Scale_BilinearQuarterInterlaced,
-		Scalers<uint32, ManipRGB888>::Scale_BilinearQuarterInterlaced
-	},
-
-	// Null Scaler (Terminator)
-	{
-		0,
-		0,
-		0,
-		0,
-		0,
-		0,
-		0
-	}
-};
-
-//
-// Constructor
-//
-ScalerRegistry::ScalerRegistry() : num_scalers(0) {
-	// Count number of scalers
-	while (scaler_array[num_scalers].name) {
-//		Std::cout << "Scaler " << num_scalers << ": " << scaler_array[num_scalers].name << Std::endl;
-		num_scalers++;
-	}
-//	Std::cout << num_scalers << " Scalers." << Std::endl;
-}
-
-//
-// Destructor
-//
-ScalerRegistry::~ScalerRegistry() {
-}
-
-//
-// Get the Index of a scaler from it's Name
-//
-int ScalerRegistry::GetIndexForName(const Std::string &name) {
-	// Make the name uppercase
-	//FIX Std::string sclr = to_uppercase(name);
-
-	for (int index = 0; index < num_scalers; index++) {
-
-		// Make this name also uppercase
-		//  Std::string sclr2 = to_uppercase(scaler_array[index].name);
-
-//		if (sclr == sclr2) return index;
-		if (string_i_compare(name, scaler_array[index].name)) return index;
-
-	}
-
-	return -1;
-}
-
-//
-// Get Name of a Scaler from its Index
-//
-const char *ScalerRegistry::GetNameForIndex(int index) {
-	if (index < 0 || index >= num_scalers) return 0;
-
-	return scaler_array[index].name;
-}
-
-
-//
-// Get a Scaler from it's Index
-//
-const ScalerStruct *ScalerRegistry::GetScaler(int index) {
-	if (index < 0 || index >= num_scalers) return 0;
-
-	return scaler_array + index;
-}
-
-//
-// Get a Scaler from it's Index
-//
-const ScalerStruct *ScalerRegistry::GetPointScaler() {
-	// Point scaler is always first
-	return scaler_array;
-}
-
-
-#if 0
-
-//
-// BlurFilter
-//
-void Application::show_8to16_blur
-(
-	int x, int y, int w, int h  // Area to show.
-) {
-	Manip8to16 manip(palette,
-	                 sdl_surf->format);
-	BlurFilter<unsigned char, uint16, Manip8to16>
-	(screen->pixels, x, y, w, h,
-	 screen->w, screen->h, screen->pitch,
-	 (uint16 *) sdl_surf->pixels,
-	 sdl_surf->pitch /
-	 sdl_surf->format->BytesPerPixel,
-	 manip);
-}
-
-void Application::show_8to555_blur
-(
-	int x, int y, int w, int h  // Area to show.
-) {
-	Manip8to555 manip(palette);
-	BlurFilter<unsigned char, uint16, Manip8to555>
-	(screen->pixels, x, y, w, h,
-	 screen->w, screen->h, screen->pitch,
-	 (uint16 *) sdl_surf->pixels,
-	 sdl_surf->pitch /
-	 sdl_surf->format->BytesPerPixel,
-	 manip);
-}
-
-void Application::show_8to565_blur
-(
-	int x, int y, int w, int h  // Area to show.
-) {
-	Manip8to565 manip(palette);
-	BlurFilter<unsigned char, uint16, Manip8to565>
-	(screen->pixels, x, y, w, h,
-	 screen->w, screen->h, screen->pitch,
-	 (uint16 *) sdl_surf->pixels,
-	 sdl_surf->pitch /
-	 sdl_surf->format->BytesPerPixel,
-	 manip);
-}
-
-void Application::show_8to32_blur
-(
-	int x, int y, int w, int h  // Area to show.
-) {
-	Manip8to32 manip(palette,
-	                 sdl_surf->format);
-	BlurFilter<unsigned char, uint32, Manip8to32>
-	(screen->pixels, x, y, w, h,
-	 screen->w, screen->h, screen->pitch,
-	 (uint32 *) sdl_surf->pixels,
-	 sdl_surf->pitch /
-	 sdl_surf->format->BytesPerPixel,
-	 manip);
-}
-
-//
-// Rotator
-//
-#if 0
-// Flips vertically
-#define RotatorFunc(DestType)                                               \
-	Rotator(                                                                \
-	        screen->pixels,             /* ->source pixels. */                  \
-	        x, y,                       /* Start of rectangle within src. */    \
-	        w, h,                       /* Dims. of rectangle. */               \
-	        screen->w,                  /* Source width. */                     \
-	        screen->h,                  /* Source height. */                    \
-	        screen->pitch,              /* Pixels/line for source. */           \
-	        \
-	        (DestType*)( ((char*)sdl_surf->pixels) + (screen->h-1)*sdl_surf->pitch),/* ->dest pixels. */                    \
-	        x, y,                       /* Start of rectangle within dest. */   \
-	        w, h,                       /* Dims. of rectangle. */               \
-	        screen->w,                  /* Dest height. */                      \
-	        screen->h,                  /* Dest width. */                       \
-	        1,                          /* Amount to increment for each y pixel */\
-	        -(sdl_surf->pitch/sdl_surf->format->BytesPerPixel),/* Amount to increment for each x pixel */\
-	        manip);                     /* Manipulator methods. */
-// Flips horizontally
-#define RotatorFunc(DestType)                                               \
-	Rotator(                                                                \
-	        screen->pixels,             /* ->source pixels. */                  \
-	        x, y,                       /* Start of rectangle within src. */    \
-	        w, h,                       /* Dims. of rectangle. */               \
-	        screen->w,                  /* Source width. */                     \
-	        screen->h,                  /* Source height. */                    \
-	        screen->pitch,              /* Pixels/line for source. */           \
-	        \
-	        (DestType*)(sdl_surf->pixels) + screen->w-1, /* ->dest pixels. */   \
-	        x, y,                       /* Start of rectangle within dest. */   \
-	        w, h,                       /* Dims. of rectangle. */               \
-	        screen->w,                  /* Dest height. */                      \
-	        screen->h,                  /* Dest width. */                       \
-	        -1,                         /* Amount to increment for each y pixel */\
-	        (sdl_surf->pitch/sdl_surf->format->BytesPerPixel),/* Amount to increment for each x pixel */\
-	        manip);                     /* Manipulator methods. */
-#endif
-// Rotates
-#define RotatorFunc(DestType)                                               \
-	Rotator(                                                                \
-	        screen->pixels,             /* ->source pixels. */                  \
-	        x, y,                       /* Start of rectangle within src. */    \
-	        w, h,                       /* Dims. of rectangle. */               \
-	        screen->w,                  /* Source width. */                     \
-	        screen->h,                  /* Source height. */                    \
-	        screen->pitch,              /* Pixels/line for source. */           \
-	        \
-	        (DestType*)(sdl_surf->pixels)+screen->h-1, /* ->dest pixels. */ \
-	        (sdl_surf->pitch/sdl_surf->format->BytesPerPixel),/* Amount to increment for each x pixel */\
-	        -1,                         /* Amount to increment for each y pixel */\
-	        manip);                     /* Manipulator methods. */
-
-void Application::show_8to16_rotated
-(
-	int x, int y, int w, int h  // Area to show.
-) {
-	Manip8to16 manip(palette, sdl_surf->format);
-
-	RotatorFunc(uint16);
-}
-
-void Application::show_8to555_rotated
-(
-	int x, int y, int w, int h  // Area to show.
-) {
-	Manip8to555 manip(palette);
-	RotatorFunc(uint16);
-}
-
-void Application::show_8to565_rotated
-(
-	int x, int y, int w, int h  // Area to show.
-) {
-	Manip8to565 manip(palette);
-	RotatorFunc(uint16);
-}
-
-void Application::show_8to32_rotated
-(
-	int x, int y, int w, int h  // Area to show.
-) {
-	Manip8to32 manip(palette, sdl_surf->format);
-	RotatorFunc(uint32);
-}
-#endif
-
-} // End of namespace Nuvie
-} // End of namespace Ultima
diff --git a/engines/ultima/nuvie/screen/scale.h b/engines/ultima/nuvie/screen/scale.h
deleted file mode 100644
index 17ac41ed391..00000000000
--- a/engines/ultima/nuvie/screen/scale.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef NUVIE_SCREEN_SCALE_H
-#define NUVIE_SCREEN_SCALE_H
-
-#include "ultima/shared/std/string.h"
-
-namespace Ultima {
-namespace Nuvie {
-
-#define SCALER_FLAG_2X_ONLY         1
-#define SCALER_FLAG_16BIT_ONLY      2
-#define SCALER_FLAG_32BIT_ONLY      4
-
-struct ScalerStruct {
-	typedef void (*ScalerType16)(uint16 *, int , int , int , int , const int , const int , uint16 *, const int, int);
-	typedef void (*ScalerType32)(uint32 *, int , int , int , int , const int , const int , uint32 *, const int, int);
-
-	const char      *name;
-	uint32          flags;              // Scaler flags
-
-	ScalerType16    scale16;
-	ScalerType16    scale555;
-	ScalerType16    scale565;
-
-	ScalerType32    scale32;
-	ScalerType32    scale888;
-
-	// Call this to scale a section of the screen
-	inline void     Scale(
-	    int type,                   // Format type of buffers 16, 555, 565, 32 or 888
-	    void *source,               // ->source pixels.
-	    int srcx, int srcy,         // Start of rectangle within src.
-	    int srcw, int srch,         // Dims. of rectangle.
-	    const int sline_pixels,     // Pixels /line for source.
-	    const int sheight,          // Source height.
-	    void *dest,                 // ->dest pixels.
-	    const int dline_pixels,     // Pixels /line for dest.
-	    int scale_factor            // Scale factor
-	) const {
-		if (type == 16) {
-			scale16((uint16 *) source, srcx, srcy, srcw, srch, sline_pixels, sheight, (uint16 *) dest, dline_pixels, scale_factor);
-		} else if (type == 555) {
-			scale16((uint16 *) source, srcx, srcy, srcw, srch, sline_pixels, sheight, (uint16 *) dest, dline_pixels, scale_factor);
-		} else if (type == 565) {
-			scale16((uint16 *) source, srcx, srcy, srcw, srch, sline_pixels, sheight, (uint16 *) dest, dline_pixels, scale_factor);
-		} else if (type == 32) {
-			scale32((uint32 *) source, srcx, srcy, srcw, srch, sline_pixels, sheight, (uint32 *) dest, dline_pixels, scale_factor);
-		} else if (type == 888) {
-			scale888((uint32 *) source, srcx, srcy, srcw, srch, sline_pixels, sheight, (uint32 *) dest, dline_pixels, scale_factor);
-		}
-	}
-
-};
-
-//
-// This entire class is just static
-//
-class ScalerRegistry {
-	static const            ScalerStruct scaler_array[];
-	int                     num_scalers;
-
-public:
-
-	// Constructor
-	ScalerRegistry();
-
-	// Destructor
-	~ScalerRegistry();
-
-	// Get the total Number of scalers
-	int             GetNumScalers() {
-		return num_scalers;
-	}
-
-	// Get the Scaler Index from it's name
-	int             GetIndexForName(const Std::string &name);
-
-	// Get Name of a Scaler from its Index
-	const char      *GetNameForIndex(int index);
-
-	// Get a Scaler from it's Index
-	const ScalerStruct  *GetScaler(int index);
-
-	// Get the Point Sampling Scaler
-	const ScalerStruct  *GetPointScaler();
-};
-
-} // End of namespace Nuvie
-} // End of namespace Ultima
-
-#endif
diff --git a/engines/ultima/nuvie/screen/scale.inl b/engines/ultima/nuvie/screen/scale.inl
deleted file mode 100644
index dea76bf2656..00000000000
--- a/engines/ultima/nuvie/screen/scale.inl
+++ /dev/null
@@ -1,2050 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef SCALE_INL_INCLUDED
-#define SCALE_INL_INCLUDED
-
-namespace Ultima {
-namespace Nuvie {
-
-/*
- *	Manipulate 16-bit 555 format.
- */
-class ManipRGB555
-{
-public:
-	inline static uint16 rgb(unsigned int r, unsigned int g, unsigned int b)
-	{
-		return ((r>>3)<<10)|((g>>3)<<5)|(b>>3);
-	}
-	inline static void split_col(uint16 pix, unsigned int& r, unsigned int& g, unsigned int& b)
-	{
-		r = ((pix&0x7c00)>>10)<<3;
-		g = ((pix&0x03e0)>>5)<<3;
-		b =  (pix&0x001f)<<3;
-	}
-};
-
-/*
- *	Manipulate 16-bit 565 format.
- */
-class ManipRGB565
-{
-public:
-	inline static uint16 rgb(unsigned int r, unsigned int g, unsigned int b)
-	{
-		return ((r>>3)<<11)|((g>>2)<<5)|(b>>3);
-	}
-	inline static void split_col(uint16 pix, unsigned int& r, unsigned int& g, unsigned int& b)
-	{
-		r = ((pix&0xf800)>>11)<<3;
-		g = ((pix&0x07e0)>>5)<<2;
-		b =  (pix&0x001f)<<3;
-	}
-};
-
-/*
- *	Manipulate 32-bit 888 format.
- */
-class ManipRGB888
-{
-public:
-	inline static uint32 rgb(unsigned int r, unsigned int g, unsigned int b)
-	{
-		return (r<<16)|(g<<8)|(b);
-	}
-	inline static void split_col(uint32 pix, unsigned int& r, unsigned int& g, unsigned int& b)
-	{
-		r = (pix&0xFF0000)>>16;
-		g = (pix&0x00FF00)>>8;
-		b = (pix&0x0000FF);
-	}
-};
-
-/*
- *	Manipulate from 16-bit to 16-bit pixels or 32-bit to 32-bit.
- */
-class ManipRGBGeneric
-{
-public:
-	inline static uint32 rgb(unsigned int r, unsigned int g, unsigned int b)
-	{
-		return ((r>>RenderSurface::Rloss)<<RenderSurface::Rshift) |
-		       ((g>>RenderSurface::Gloss)<<RenderSurface::Gshift) |
-		       ((b>>RenderSurface::Bloss)<<RenderSurface::Bshift);
-	}
-	inline static void split_col(uint32 pix, unsigned int& r, unsigned int& g, unsigned int& b)
-	{
-		r = ((pix&RenderSurface::Rmask)>>RenderSurface::Rshift)<<RenderSurface::Rloss;
-		g = ((pix&RenderSurface::Gmask)>>RenderSurface::Gshift)<<RenderSurface::Gloss;
-		b = ((pix&RenderSurface::Bmask)>>RenderSurface::Bshift)<<RenderSurface::Bloss;
-	}
-};
-
-
-template <class Pixel_type, class Manip_pixels> class Scalers {
-public:
-
-
-/**
- ** 2xSaI scaling filter source code adapted for Exult
- ** August 29 2000, originally written in May 1999
- ** by Derek Liauw Kie Fa (DerekL666 at yahoo.com/D.A.K.L.LiauwKieFa at student.tudelft.nl)
- ** This source is made available under the terms of the GNU GPL
- ** I'd appreciate it I am given credit in the program or documentation
- **/
-
-static inline Pixel_type Interpolate_2xSaI (Pixel_type colorA, Pixel_type colorB)
-{
-	unsigned int r0, r1, g0, g1, b0, b1;
-	Manip_pixels::split_col(colorA, r0, g0, b0);
-	Manip_pixels::split_col(colorB, r1, g1, b1);
-	int r = (r0 + r1)>>1;
-	int g = (g0 + g1)>>1;
-	int b = (b0 + b1)>>1;
-	return Manip_pixels::rgb(r, g, b);
-}
-
-static inline Pixel_type OInterpolate_2xSaI (Pixel_type colorA, Pixel_type colorB, Pixel_type colorC)
-{
-	unsigned int r0, r1, g0, g1, b0, b1;
-	unsigned int r2, g2, b2;
-	Manip_pixels::split_col(colorA, r0, g0, b0);
-	Manip_pixels::split_col(colorB, r1, g1, b1);
-	Manip_pixels::split_col(colorC, r2, g2, b2);
-	unsigned int r = ((r0<<2) + (r0<<1) + r1 + r2)>>3;
-	unsigned int g = ((g0<<2) + (g0<<1) + g1 + g2)>>3;
-	unsigned int b = ((b0<<2) + (b0<<1) + b1 + b2)>>3;
-	return Manip_pixels::rgb(r, g, b);
-}
-
-static inline Pixel_type QInterpolate_2xSaI (Pixel_type colorA, Pixel_type colorB, Pixel_type colorC, Pixel_type colorD)
-{
-	unsigned int r0, r1, g0, g1, b0, b1;
-	unsigned int r2, r3, g2, g3, b2, b3;
-	Manip_pixels::split_col(colorA, r0, g0, b0);
-	Manip_pixels::split_col(colorB, r1, g1, b1);
-	Manip_pixels::split_col(colorC, r2, g2, b2);
-	Manip_pixels::split_col(colorD, r3, g3, b3);
-	unsigned int r = (r0 + r1 + r2 + r3)>>2;
-	unsigned int g = (g0 + g1 + g2 + g3)>>2;
-	unsigned int b = (b0 + b1 + b2 + b3)>>2;
-	return Manip_pixels::rgb(r, g, b);
-}
-
-static inline int GetResult1(Pixel_type A, Pixel_type B, Pixel_type C, Pixel_type D)
-{
-	int x = 0;
-	int y = 0;
-	int r = 0;
-	if (A == C) x+=1; else if (B == C) y+=1;
-	if (A == D) x+=1; else if (B == D) y+=1;
-	if (x <= 1) r+=1;
-	if (y <= 1) r-=1;
-	return r;
-}
-
-static inline int GetResult2(Pixel_type A, Pixel_type B, Pixel_type C, Pixel_type D)
-{
-	int x = 0;
-	int y = 0;
-	int r = 0;
-	if (A == C) x+=1; else if (B == C) y+=1;
-	if (A == D) x+=1; else if (B == D) y+=1;
-	if (x <= 1) r-=1;
-	if (y <= 1) r+=1;
-	return r;
-}
-
-//
-// 2xSaI Scaler
-//
-static void Scale_2xSaI
-(
-	Pixel_type *source,			// ->source pixels.
-	int srcx, int srcy,			// Start of rectangle within src.
-	int srcw, int srch,			// Dims. of rectangle.
-	const int sline_pixels,		// Pixels (words)/line for source.
-	const int sheight,			// Source height.
-	Pixel_type *dest,			// ->dest pixels.
-	const int dline_pixels,		// Pixels (words)/line for dest.
-	int scale_factor			// Scale Factor
-)
-{
-	Pixel_type *srcPtr = source + (srcx + srcy*sline_pixels);
-	Pixel_type *dstPtr = dest + (2*srcy*dline_pixels + 2*srcx);
-
-	if (srcx + srcw >= (int)sline_pixels)
-	{
-		srcw = sline_pixels - srcx;
-	}
-					// Init offset to prev. line, next 2.
-	int prev1_yoff = srcy ? sline_pixels : 0;
-	int next1_yoff = sline_pixels, next2_yoff = 2*sline_pixels;
-					// Figure threshholds for counters.
-	int ybeforelast = sheight - 2 - srcy;
-	int xbeforelast = sline_pixels - 2 - srcx;
-	for (int y = 0; y < srch; y++, prev1_yoff = sline_pixels)
-	{
-		if (y >= ybeforelast)	// Last/next-to-last row?
-		{
-			if (y == ybeforelast)
-				next2_yoff = sline_pixels;
-			else		// Very last line?
-				next2_yoff = next1_yoff = 0;
-		}
-
-		Pixel_type *bP = srcPtr;
-		Pixel_type *dP = dstPtr;
-		int prev1_xoff = srcx ? 1 : 0;
-		int next1_xoff = 1, next2_xoff = 2;
-
-		for (int x = 0; x < srcw; x++)
-		{
-			Pixel_type colorA, colorB;
-			Pixel_type colorC, colorD,
-				colorE, colorF, colorG, colorH,
-				colorI, colorJ, colorK, colorL,
-				colorM, colorN, colorO; // , colorP;
-			Pixel_type product, product1, product2;
-
-				// Last/next-to-last row?
-			if (x >= xbeforelast)
-			{
-				if (x == xbeforelast)
-					next2_xoff = 1;
-				else
-					next2_xoff = next1_xoff = 0;
-			}
-
-			//---------------------------------------
-			// Map of the pixels:                    I|E F|J
-			//                                       G|A B|K
-			//                                       H|C D|L
-			//                                       M|N O|P
-			colorI = *(bP- prev1_yoff - prev1_xoff);
-			colorE = *(bP- prev1_yoff);
-			colorF = *(bP- prev1_yoff + next1_xoff);
-			colorJ = *(bP- prev1_yoff + next2_xoff);
-
-			colorG = *(bP - prev1_xoff);
-			colorA = *(bP);
-			colorB = *(bP + next1_xoff);
-			colorK = *(bP + next2_xoff);
-
-			colorH = *(bP + next1_yoff - prev1_xoff);
-			colorC = *(bP + next1_yoff);
-			colorD = *(bP + next1_yoff + next1_xoff);
-			colorL = *(bP + next1_yoff + next2_xoff);
-
-			colorM = *(bP + next2_yoff - prev1_xoff);
-			colorN = *(bP + next2_yoff);
-			colorO = *(bP + next2_yoff + next1_xoff);
-			//colorP = *(bP + next2_yoff + next2_xoff);
-
-			if ((colorA == colorD) && (colorB != colorC))
-			{
-			   if ( ((colorA == colorE) && (colorB == colorL)) ||
-					((colorA == colorC) && (colorA == colorF) && (colorB != colorE) && (colorB == colorJ)) )
-			   {
-				  product = colorA;
-			   }
-			   else
-			   {
-				  //product = INTERPOLATE(colorA, colorB);
-				  product = Interpolate_2xSaI(colorA, colorB);
-			   }
-
-			   if (((colorA == colorG) && (colorC == colorO)) ||
-				   ((colorA == colorB) && (colorA == colorH) && (colorG != colorC) && (colorC == colorM)) )
-			   {
-				  product1 = colorA;
-			   }
-			   else
-			   {
-				  //product1 = INTERPOLATE(colorA, colorC);
-				  product1 = Interpolate_2xSaI(colorA, colorC);
-			   }
-			   product2 = colorA;
-			}
-			else
-			if ((colorB == colorC) && (colorA != colorD))
-			{
-			   if (((colorB == colorF) && (colorA == colorH)) ||
-				   ((colorB == colorE) && (colorB == colorD) && (colorA != colorF) && (colorA == colorI)) )
-			   {
-				  product = colorB;
-			   }
-			   else
-			   {
-				  //product = INTERPOLATE(colorA, colorB);
-				  product = Interpolate_2xSaI(colorA, colorB);
-			   }
-
-			   if (((colorC == colorH) && (colorA == colorF)) ||
-				   ((colorC == colorG) && (colorC == colorD) && (colorA != colorH) && (colorA == colorI)) )
-			   {
-				  product1 = colorC;
-			   }
-			   else
-			   {
-				  //product1 = INTERPOLATE(colorA, colorC);
-				  product1 = Interpolate_2xSaI(colorA, colorC);
-			   }
-			   product2 = colorB;
-			}
-			else
-			if ((colorA == colorD) && (colorB == colorC))
-			{
-			   if (colorA == colorB)
-			   {
-				  product = colorA;
-				  product1 = colorA;
-				  product2 = colorA;
-			   }
-			   else
-			   {
-			   	  int r = 0;
-				  //product1 = INTERPOLATE(colorA, colorC);
-				  product1 = Interpolate_2xSaI(colorA, colorC);
-				  //product = INTERPOLATE(colorA, colorB);
-				  product = Interpolate_2xSaI(colorA, colorB);
-
-				  r += GetResult1 (colorA, colorB, colorG, colorE);
-				  r += GetResult2 (colorB, colorA, colorK, colorF);
-				  r += GetResult2 (colorB, colorA, colorH, colorN);
-				  r += GetResult1 (colorA, colorB, colorL, colorO);
-
-				  if (r > 0)
-					  product2 = colorA;
-				  else
-				  if (r < 0)
-					  product2 = colorB;
-				  else
-				  {
-					  //product2 = Q_INTERPOLATE(colorA, colorB, colorC, colorD);
-					  product2 = QInterpolate_2xSaI(colorA, colorB, colorC, colorD);
-				  }
-			   }
-			}
-			else
-			{
-			   //product2 = Q_INTERPOLATE(colorA, colorB, colorC, colorD);
-			   product2 = QInterpolate_2xSaI(colorA, colorB, colorC, colorD);
-
-			   if ((colorA == colorC) && (colorA == colorF) && (colorB != colorE) && (colorB == colorJ))
-			   {
-				  product = colorA;
-			   }
-			   else
-			   if ((colorB == colorE) && (colorB == colorD) && (colorA != colorF) && (colorA == colorI))
-			   {
-				  product = colorB;
-			   }
-			   else
-			   {
-				  //product = INTERPOLATE(colorA, colorB);
-				  product = Interpolate_2xSaI(colorA, colorB);
-			   }
-
-			   if ((colorA == colorB) && (colorA == colorH) && (colorG != colorC) && (colorC == colorM))
-			   {
-				  product1 = colorA;
-			   }
-			   else
-			   if ((colorC == colorG) && (colorC == colorD) && (colorA != colorH) && (colorA == colorI))
-			   {
-				  product1 = colorC;
-			   }
-			   else
-			   {
-				  //product1 = INTERPOLATE(colorA, colorC);
-				  product1 = Interpolate_2xSaI(colorA, colorC);
-			   }
-			}
-
-
-			//product = colorA | (product << 16);
-			//product1 = product1 | (product2 << 16);
-			*dP = colorA;
-			*(dP+1) = product;
-			*(dP+dline_pixels) = product1;
-			*(dP+dline_pixels+1) = product2;
-
-			bP += 1;
-			dP += 2;
-		}//end of for ( finish= width etc..)
-
-		srcPtr += sline_pixels;
-		dstPtr += 2*dline_pixels;
-	};
-}
-
-//
-// Super2xSaI Scaler
-//
-static void Scale_Super2xSaI
-(
-	Pixel_type *source,			// ->source pixels.
-	int srcx, int srcy,			// Start of rectangle within src.
-	int srcw, int srch,			// Dims. of rectangle.
-	const int sline_pixels,		// Pixels (words)/line for source.
-	const int sheight,			// Source height.
-	Pixel_type *dest,			// ->dest pixels.
-	const int dline_pixels,		// Pixels (words)/line for dest.
-	int scale_factor			// Scale Factor
-)
-{
-
-	Pixel_type *srcPtr = source + (srcx + srcy*sline_pixels);
-	Pixel_type *dstPtr = dest + (2*srcy*dline_pixels + 2*srcx);
-
-	if (srcx + srcw >= (int)sline_pixels)
-	{
-		srcw = sline_pixels - srcx;
-	}
-
-    int ybeforelast1 = sheight - 1 - srcy;
-    int ybeforelast2 = sheight - 2 - srcy;
-    int xbeforelast1 = sline_pixels - 1 - srcx;
-    int xbeforelast2 = sline_pixels - 2 - srcx;
-
-    for (int y = 0; y < srch; y++)
-	{
-		Pixel_type *bP = srcPtr;
-		Pixel_type *dP = dstPtr;
-
-		for (int x = 0; x < srcw; x++)
-		{
-           Pixel_type color4, color5, color6;
-           Pixel_type color1, color2, color3;
-           Pixel_type colorA0, colorA1, colorA2, colorA3,
-						colorB0, colorB1, colorB2, colorB3,
-						colorS1, colorS2;
-           Pixel_type product1a, product1b,
-					 product2a, product2b;
-
-			//---------------------------------------  B0 B1 B2 B3
-			//                                         4  5  6  S2
-			//                                         1  2  3  S1
-			//                                         A0 A1 A2 A3
-			//--------------------------------------
-			int add1, add2;
-			int sub1;
-			int nextl1, nextl2;
-			int prevl1;
-
-			if (x == 0)
-				sub1 = 0;
-			else
-				sub1 = 1;
-
-			if (x >= xbeforelast2)
-				add2 = 0;
-			else add2 = 1;
-
-			if (x >= xbeforelast1)
-				add1 = 0;
-			else add1 = 1;
-
-			if (y == 0)
-				prevl1 = 0;
-			else
-				prevl1 = sline_pixels;
-
-			if (y >= ybeforelast2)
-				nextl2 = 0;
-			else nextl2 = sline_pixels;
-
-			if (y >= ybeforelast1)
-				nextl1 = 0;
-			else nextl1 = sline_pixels;
-
-
-            colorB0 = *(bP- prevl1 - sub1);
-            colorB1 = *(bP- prevl1);
-            colorB2 = *(bP- prevl1 + add1);
-            colorB3 = *(bP- prevl1 + add1 + add2);
-
-            color4 = *(bP - sub1);
-            color5 = *(bP);
-            color6 = *(bP + add1);
-            colorS2 = *(bP + add1 + add2);
-
-            color1 = *(bP + nextl1 - sub1);
-            color2 = *(bP + nextl1);
-            color3 = *(bP + nextl1 + add1);
-            colorS1 = *(bP + nextl1 + add1 + add2);
-
-            colorA0 = *(bP + nextl1 + nextl2 - sub1);
-            colorA1 = *(bP + nextl1 + nextl2);
-            colorA2 = *(bP + nextl1 + nextl2 + add1);
-            colorA3 = *(bP + nextl1 + nextl2 + add1 + add2);
-
-			if (color2 == color6 && color5 != color3)
-			{
-			   product2b = product1b = color2;
-			}
-			else
-			if (color5 == color3 && color2 != color6)
-			{
-			   product2b = product1b = color5;
-			}
-			else
-			if (color5 == color3 && color2 == color6)
-			{
-			   	int r = 0;
-
-               	//r += GetResult (color6, color5, color1, colorA1);
-               	//r += GetResult (color6, color5, color4, colorB1);
-               	//r += GetResult (color6, color5, colorA2, colorS1);
-               	//r += GetResult (color6, color5, colorB2, colorS2);
-			   	r += GetResult1 (color5, color6, color4, colorB1);
-			   	r += GetResult2 (color6, color5, colorA2, colorS1);
-			   	r += GetResult2 (color6, color5, color1, colorA1);
- 			   	r += GetResult1 (color5, color6, colorB2, colorS2);
-
-			   	if (r > 0)
-				{
-				 	product2b = product1b = color6;
-				}
-			   	else
-			   	if (r < 0)
-				{
-					product2b = product1b = color5;
-				}
-			   	else
-			   	{
-				  	//product2b = product1b = INTERPOLATE (color5, color6);
-				  	product1b = product2b = Interpolate_2xSaI(color5, color6);
-			   	}
-
-			}
-			else
-			{
-
-			   if (color6 == color3 && color3 == colorA1 && color2 != colorA2 && color3 != colorA0)
-				  	//product2b = Q_INTERPOLATE (color3, color3, color3, color2);
-				  	product2b = QInterpolate_2xSaI(color3, color3, color3, color2);
-			   else
-			   if (color5 == color2 && color2 == colorA2 && colorA1 != color3 && color2 != colorA3)
-				  	//product2b = Q_INTERPOLATE (color2, color2, color2, color3);
-				   	product2b = QInterpolate_2xSaI(color3, color2, color2, color2);
-			   else
-				  	//product2b = INTERPOLATE (color2, color3);
-				  	product2b = Interpolate_2xSaI(color2, color3);
-
-
-			   if (color6 == color3 && color6 == colorB1 && color5 != colorB2 && color6 != colorB0)
-				  	//product1b = Q_INTERPOLATE (color6, color6, color6, color5);
-				   	product1b = QInterpolate_2xSaI(color5, color6, color6, color6);
-			   else
-			   if (color5 == color2 && color5 == colorB2 && colorB1 != color6 && color5 != colorB3)
-				  	//product1b = Q_INTERPOLATE (color6, color5, color5, color5);
-				   	product1b = QInterpolate_2xSaI(color6, color5, color5, color5);
-			   else
-				  	//product1b = INTERPOLATE (color5, color6);
-				  	product1b = Interpolate_2xSaI(color5, color6);
-
-			}
-
-			if (color5 == color3 && color2 != color6 && color4 == color5 && color5 != colorA2)
-			   	//product2a = INTERPOLATE (color2, color5);
-			  	product2a = Interpolate_2xSaI(color5, color2);
-			else
-			if (color5 == color1 && color6 == color5 && color4 != color2 && color5 != colorA0)
-			   	//product2a = INTERPOLATE(color2, color5);
-			  	product2a = Interpolate_2xSaI(color5, color2);
-			else
-			   	product2a = color2;
-
-
-			if (color2 == color6 && color5 != color3 && color1 == color2 && color2 != colorB2)
-			   	//product1a = INTERPOLATE (color2, color5);
-			  	product1a = Interpolate_2xSaI(color5, color2);
-			else
-			if (color4 == color2 && color3 == color2 && color1 != color5 && color2 != colorB0)
-			   	//product1a = INTERPOLATE(color2, color5);
-			  	product1a = Interpolate_2xSaI(color5, color2);
-			else
-			   	product1a = color5;
-
-
-			*dP = product1a;
-			*(dP+1) = product1b;
-			*(dP+dline_pixels) = product2a;
-			*(dP+dline_pixels+1) = product2b;
-
-			bP += 1;
-			dP += 2;
-
-		}
-		srcPtr += sline_pixels;
-		dstPtr += 2*dline_pixels;
-	};
-}
-
-//
-// SuperEagle Scaler
-//
-static void Scale_SuperEagle
-(
-	Pixel_type *source,			// ->source pixels.
-	int srcx, int srcy,			// Start of rectangle within src.
-	int srcw, int srch,			// Dims. of rectangle.
-	const int sline_pixels,		// Pixels (words)/line for source.
-	const int sheight,			// Source height.
-	Pixel_type *dest,			// ->dest pixels.
-	const int dline_pixels,		// Pixels (words)/line for dest.
-	int scale_factor			// Scale Factor
-)
-{
-
-	// Need to ensure that the update is alligned to 4 pixels - Colourless
-	// The idea was to prevent artifacts from appearing, but it doesn't seem
-	// to help
-	/*
-	{
-		int sx = ((srcx-4)/4)*4;
-		int ex = ((srcx+srcw+7)/4)*4;
-		int sy = ((srcy-4)/4)*4;
-		int ey = ((srcy+srch+7)/4)*4;
-
-		if (sx < 0) sx = 0;
-		if (sy < 0) sy = 0;
-		if (ex > sline_pixels) ex = sline_pixels;
-		if (ey > sheight) ey = sheight;
-
-		srcx = sx;
-		srcy = sy;
-		srcw = ex - sx;
-		srch = ey - sy;
-	}
-	*/
-
-	Pixel_type *srcPtr = source + (srcx + srcy*sline_pixels);
-	Pixel_type *dstPtr = dest + (2*srcy*dline_pixels + 2*srcx);
-
-	if (srcx + srcw >= (int)sline_pixels)
-	{
-		srcw = sline_pixels - srcx;
-	}
-
-    int ybeforelast1 = sheight - 1 - srcy;
-    int ybeforelast2 = sheight - 2 - srcy;
-    int xbeforelast1 = sline_pixels - 1 - srcx;
-    int xbeforelast2 = sline_pixels - 2 - srcx;
-
-    for (int y = 0; y < srch; y++)
-	{
-		Pixel_type *bP = srcPtr;
-		Pixel_type *dP = dstPtr;
-
-		for (int x = 0; x < srcw; x++)
-		{
-           Pixel_type color4, color5, color6;
-           Pixel_type color1, color2, color3;
-		   Pixel_type colorA1, colorA2; // , colorA0, colorA3,
-		   Pixel_type colorB1, colorB2; // , colorB0, colorB3,
-		   Pixel_type colorS1, colorS2;
-           Pixel_type product1a, product1b,
-				product2a, product2b;
-
-			//---------------------------------------  B0 B1 B2 B3
-			//                                         4  5  6  S2
-			//                                         1  2  3  S1
-			//                                         A0 A1 A2 A3
-			//--------------------------------------
-			int add1, add2;
-			int sub1;
-			int nextl1, nextl2;
-			int prevl1;
-
-			if (x == 0)
-				sub1 = 0;
-			else
-				sub1 = 1;
-
-			if (x >= xbeforelast2)
-				add2 = 0;
-			else add2 = 1;
-
-			if (x >= xbeforelast1)
-				add1 = 0;
-			else add1 = 1;
-
-			if (y == 0)
-				prevl1 = 0;
-			else
-				prevl1 = sline_pixels;
-
-			if (y >= ybeforelast2)
-				nextl2 = 0;
-			else nextl2 = sline_pixels;
-
-			if (y >= ybeforelast1)
-				nextl1 = 0;
-			else nextl1 = sline_pixels;
-
-
-            //colorB0 = *(bP- prevl1 - sub1);
-            colorB1 = *(bP- prevl1);
-            colorB2 = *(bP- prevl1 + add1);
-            //colorB3 = *(bP- prevl1 + add1 + add2);
-
-            color4 = *(bP - sub1);
-            color5 = *(bP);
-            color6 = *(bP + add1);
-            colorS2 = *(bP + add1 + add2);
-
-            color1 = *(bP + nextl1 - sub1);
-            color2 = *(bP + nextl1);
-            color3 = *(bP + nextl1 + add1);
-            colorS1 = *(bP + nextl1 + add1 + add2);
-
-            //colorA0 = *(bP + nextl1 + nextl2 - sub1);
-            colorA1 = *(bP + nextl1 + nextl2);
-            colorA2 = *(bP + nextl1 + nextl2 + add1);
-            //colorA3 = *(bP + nextl1 + nextl2 + add1 + add2);
-
-
-			if (color2 == color6 && color5 != color3)
-			{
-			   product1b = product2a = color2;
-			   product1b = product2a;
-
-
-			   if ((color1 == color2) || (color6 == colorB2))
-			   {
-				   //product1a = INTERPOLATE (color2, color5);
-				   //product1a = INTERPOLATE (color2, product1a);
-				   product1a = QInterpolate_2xSaI(color2, color2, color2, color5);
-
-			   }
-			   else
-			   {
-				   //product1a = INTERPOLATE (color5, color6);
-				   product1a = Interpolate_2xSaI(color6, color5);
-			   }
-
-			   if ((color6 == colorS2) || (color2 == colorA1))
-               {
-                   //product2b = INTERPOLATE (color2, color3);
-                   //product2b = INTERPOLATE (color2, product2b);
-				   product2b = QInterpolate_2xSaI(color2, color2, color2, color3);
-
-               }
-               else
-               {
-                   //product2b = INTERPOLATE (color2, color3);
-				   product2b = Interpolate_2xSaI(color2, color3);
-               }
-            }
-            else
-            if (color5 == color3 && color2 != color6)
-            {
-               product2b = product1a = color5;
-			   product2b = product1a;
-
-
-               if ((colorB1 == color5) ||  (color3 == colorS1))
-               {
-                   //product1b = INTERPOLATE (color5, color6);
-				   //product1b = INTERPOLATE (color5, product1b);
-				   product1b = QInterpolate_2xSaI(color5, color5, color5, color6);
-               }
-               else
-               {
-                  //product1b = INTERPOLATE (color5, color6);
-				  product1b = Interpolate_2xSaI(color5, color6);
-               }
-
-			   if ((color3 == colorA2) || (color4 == color5))
-               {
-                   //product2a = INTERPOLATE (color5, color2);
-                   //product2a = INTERPOLATE (color5, product2a);
-				   product2a = QInterpolate_2xSaI(color2, color5, color5, color5);
-               }
-               else
-               {
-                  //product2a = INTERPOLATE (color2, color3);
-				  product2a = Interpolate_2xSaI(color3, color2);
-               }
-
-            }
-            else
-            if (color5 == color3 && color2 == color6)
-            {
-               int r = 0;
-
-               //r += GetResult (color6, color5, color1, colorA1);
-               //r += GetResult (color6, color5, color4, colorB1);
-               //r += GetResult (color6, color5, colorA2, colorS1);
-               //r += GetResult (color6, color5, colorB2, colorS2);
-			   r += GetResult1 (color5, color6, color4, colorB1);
-			   r += GetResult2 (color6, color5, colorA2, colorS1);
-			   r += GetResult2 (color6, color5, color1, colorA1);
- 			   r += GetResult1 (color5, color6, colorB2, colorS2);
-
-               if (r > 0)
-               {
-                  product1b = product2a = color2;
-                  //product1a = product2b = INTERPOLATE (color5, color6);
-				  product1a = product2b = Interpolate_2xSaI(color5, color6);
-               }
-               else
-               if (r < 0)
-               {
-                  product2b = product1a = color5;
-                  //product1b = product2a = INTERPOLATE (color5, color6);
-				  product1b = product2a = Interpolate_2xSaI(color5, color6);
-               }
-               else
-               {
-                  product2b = product1a = color5;
-                  product1b = product2a = color2;
-               }
-            }
-            else
-            {
-                  //product2b = product1a = INTERPOLATE (color2, color6);
-                  //product2b = Q_INTERPOLATE (color3, color3, color3, product2b);
-                  //product1a = Q_INTERPOLATE (color5, color5, color5, product1a);
-				  product2b = OInterpolate_2xSaI(color3, color2, color6);
-				  product1a = OInterpolate_2xSaI(color5, color6, color2);
-
-                  //product2a = product1b = INTERPOLATE (color5, color3);
-                  //product2a = Q_INTERPOLATE (color2, color2, color2, product2a);
-                  //product1b = Q_INTERPOLATE (color6, color6, color6, product1b);
-				  product2a = OInterpolate_2xSaI(color2, color5, color3);
-				  product1b = OInterpolate_2xSaI(color6, color5, color3);
-			}
-
-			*dP = product1a;
-			*(dP+1) = product1b;
-			*(dP+dline_pixels) = product2a;
-			*(dP+dline_pixels+1) = product2b;
-
-			bP += 1;
-			dP += 2;
-
-		}
-		srcPtr += sline_pixels;
-		dstPtr += 2*dline_pixels;
-	};
-}
-
-
-
-/**
- ** End of 2xSaI code
- **/
-
-
-//
-// Scale2X algorithm by Andrea Mazzoleni.
-//
-/* This file is part of the Scale2x project.
- *
- * Copyright (C) 2001-2002 Andrea Mazzoleni
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-static void Scale_Scale2x
-(
-	Pixel_type *src,			// ->source pixels.
-	int srcx, int srcy,			// Start of rectangle within src.
-	int srcw, int srch,			// Dims. of rectangle.
-	const int sline_pixels,		// Pixels (words)/line for source.
-	const int sheight,			// Source height.
-	Pixel_type *dest,			// ->dest pixels.
-	const int dline_pixels,		// Pixels (words)/line for dest.
-	int scale_factor			// Scale Factor
-)
-{
-	dest += srcy*2*dline_pixels + srcx*2;
-	Pixel_type *dest0 = dest, *dest1 = dest + dline_pixels;
-					// ->current row.
-	Pixel_type *src1 = src + srcy*sline_pixels + srcx;
-	Pixel_type *src0 = src1 - sline_pixels;	// ->prev. row.
-	Pixel_type *src2 = src1 + sline_pixels;	// ->next row.
-	Pixel_type * limit_y = src1 + srch*sline_pixels;
-	Pixel_type * limit_x = src1 + srcw;
-					// Very end of source surface:
-	Pixel_type * end_src = src + sheight*sline_pixels;
-
-	if (src0 < src)
-		src0 = src1;		// Don't go before row 0.
-	if (srcx + srcw == sline_pixels)	// Going to right edge?
-		limit_x--;		// Stop 1 pixel before it.
-	while (src1 < limit_y)
-		{
-		if (src2 > end_src)
-			src2 = src1;	// On last row.
-		if (srcx == 0)		// First pixel.
-			{
-			dest0[0] = dest1[0] = src1[0];
-			if (src1[1] == src0[0] && src2[0] != src0[0])
-				dest0[1] = src0[0];
-			else
-				dest0[1] = src1[0];
-			if (src1[1] == src2[0] && src0[0] != src2[0])
-				dest1[1] = src2[0];
-			else
-				dest1[1] = src1[0];
-			++src0; ++src1; ++src2;
-			dest0 += 2; dest1 += 2;
-			}
-					// Middle pixels.
-		while (src1 < limit_x)
-			{
-			if (src1[-1] == src0[0] && src2[0] != src0[0] &&
-			    src1[1] != src0[0])
-				dest0[0] = src0[0];
-			else
-				dest0[0] = src1[0];
-			if (src1[1] == src0[0] && src2[0] != src0[0] &&
-			    src1[-1] != src0[0])
-				dest0[1] = src0[0];
-			else
-				dest0[1] = src1[0];
-			if (src1[-1] == src2[0] && src0[0] != src2[0] &&
-			    src1[1] != src2[0])
-				dest1[0] = src2[0];
-			else
-				dest1[0] = src1[0];
-			if (src1[1] == src2[0] && src0[0] != src2[0] &&
-			    src1[-1] != src2[0])
-				dest1[1] = src2[0];
-			else
-				dest1[1] = src1[0];
-			++src0; ++src1; ++src2;
-			dest0 += 2; dest1 += 2;
-			}
-		if (srcx + srcw == sline_pixels)
-			{		// End pixel in row.
-			if (src1[-1] == src0[0] && src2[0] != src0[0])
-				dest0[0] = src0[0];
-			else
-				dest0[0] = src1[0];
-			if (src1[-1] == src2[0] && src0[0] != src2[0])
-				dest1[0] = src2[0];
-			else
-				dest1[0] = src1[0];
-			dest0[1] = src1[0];
-			dest1[1] = src1[0];
-			++src0; ++src1; ++src2;
-			dest0 += 2; dest1 += 2;
-			}
-		src0 += sline_pixels - srcw;
-		src1 += sline_pixels - srcw;
-		src2 += sline_pixels - srcw;
-		dest1 += dline_pixels - 2*srcw;
-		if (src0 == src1)	// End of first row?
-			src0 -= sline_pixels;
-		limit_x += sline_pixels;
-		dest0 = dest1;
-		dest1 += dline_pixels;
-		}
-}
-
-
-
-typedef unsigned int COMPONENT;
-
-
-// fill `row' with the disassembled color components from the original
-// pixel values in `from'; if we run out of source pixels, just keep copying
-// the last one we got
-static inline void fill_rgb_row
-	(
-	 Pixel_type *from,
-	 int src_width,	// number of pixels to read from 'from'
-	 COMPONENT *row,
-	 int width		// number of pixels to write into 'row'
-	 )
-{
-	COMPONENT *copy_start = row + src_width*3;
-	COMPONENT *all_stop = row + width*3;
-	while (row < copy_start)
-		{
-		COMPONENT& r = *row++;
-		COMPONENT& g = *row++;
-		COMPONENT& b = *row++;
-		Manip_pixels::split_col(*from++, r, g, b);
-		}
-	// any remaining elements to be written to 'row' are a replica of the
-	// preceding pixel
-	COMPONENT *p = row-3;
-	while (row < all_stop) {
-		// we're guaranteed three elements per pixel; could unroll the loop
-		// further, especially with a Duff's Device, but the gains would be
-		// probably limited (judging by profiler output)
-		*row++ = *p++;
-		*row++ = *p++;
-		*row++ = *p++;
-	}
-}
-
-//
-// Bilinear Scaler
-//
-static void Scale_Bilinear
-(
-	Pixel_type *source,			// ->source pixels.
-	int srcx, int srcy,			// Start of rectangle within src.
-	int srcw, int srch,			// Dims. of rectangle.
-	const int sline_pixels,		// Pixels (words)/line for source.
-	const int sheight,			// Source height.
-	Pixel_type *dest,			// ->dest pixels.
-	const int dline_pixels,		// Pixels (words)/line for dest.
-	int scale_factor			// Scale Factor
-)
-{
-	Pixel_type *from = source + srcy*sline_pixels + srcx;
-	Pixel_type *to = dest + 2*srcy*dline_pixels + 2*srcx;
-	Pixel_type *to_odd = to + dline_pixels;
-
-	// the following are static because we don't want to be freeing and
-	// reallocating space on each call, as malloc()s are usually very
-	// expensive; we do allow it to grow though
-	static int buff_size = 0;
-	static COMPONENT *rgb_row_cur  = 0;
-	static COMPONENT *rgb_row_next = 0;
-	if (buff_size < sline_pixels+1) {
-		delete [] rgb_row_cur;
-		delete [] rgb_row_next;
-		buff_size = sline_pixels+1;
-		rgb_row_cur  = new COMPONENT[buff_size*3];
-		rgb_row_next = new COMPONENT[buff_size*3];
-	}
-
-	int from_width = sline_pixels - srcx;
-	if (srcw+1 < from_width)
-		from_width = srcw+1;
-
-	fill_rgb_row(from, from_width, rgb_row_cur, srcw+1);
-
-	for (int y=0; y < srch; y++)
-		{
-		Pixel_type *from_orig = from;
-		Pixel_type *to_orig = to;
-
-		if (y+1 < sheight)
-			fill_rgb_row(from+sline_pixels, from_width, rgb_row_next,
-						 srcw+1);
-		else
-			fill_rgb_row(from, from_width, rgb_row_next, srcw+1);
-
-		// every pixel in the src region, is extended to 4 pixels in the
-		// destination, arranged in a square 'quad'; if the current src
-		// pixel is 'a', then in what follows 'b' is the src pixel to the
-		// right, 'c' is the src pixel below, and 'd' is the src pixel to
-		// the right and down
-		COMPONENT *cur_row  = rgb_row_cur;
-		COMPONENT *next_row = rgb_row_next;
-		COMPONENT *ar = cur_row++;
-		COMPONENT *ag = cur_row++;
-		COMPONENT *ab = cur_row++;
-		COMPONENT *cr = next_row++;
-		COMPONENT *cg = next_row++;
-		COMPONENT *cb = next_row++;
-		for (int x=0; x < srcw; x++)
-			{
-			COMPONENT *br = cur_row++;
-			COMPONENT *bg = cur_row++;
-			COMPONENT *bb = cur_row++;
-			COMPONENT *dr = next_row++;
-			COMPONENT *dg = next_row++;
-			COMPONENT *db = next_row++;
-
-			// upper left pixel in quad: just copy it in
-			*to++ = Manip_pixels::rgb(*ar, *ag, *ab);
-
-			// upper right
-			*to++ = Manip_pixels::rgb((*ar+*br)>>1, (*ag+*bg)>>1, (*ab+*bb)>>1);
-
-			// lower left
-			*to_odd++ = Manip_pixels::rgb((*ar+*cr)>>1, (*ag+*cg)>>1, (*ab+*cb)>>1);
-
-			// lower right
-			*to_odd++ = Manip_pixels::rgb((*ar+*br+*cr+*dr)>>2,
-					  		      (*ag+*bg+*cg+*dg)>>2,
-							      (*ab+*bb+*cb+*db)>>2);
-
-			// 'b' becomes 'a', 'd' becomes 'c'
-			ar = br;
-			ag = bg;
-			ab = bb;
-			cr = dr;
-			cg = dg;
-			cb = db;
-			}
-
-		// the "next" rgb row becomes the current; the old current rgb row is
-		// recycled and serves as the new "next" row
-		COMPONENT *temp;
-		temp = rgb_row_cur;
-		rgb_row_cur = rgb_row_next;
-		rgb_row_next = temp;
-
-		// update the pointers for start of next pair of lines
-		from = from_orig + sline_pixels;
-		to = to_orig + 2*dline_pixels;
-		to_odd = to + dline_pixels;
-		}
-}
-
-//
-// BilinearInterlaced Scaler
-//
-static void Scale_BilinearInterlaced
-(
-	Pixel_type *source,			// ->source pixels.
-	int srcx, int srcy,			// Start of rectangle within src.
-	int srcw, int srch,			// Dims. of rectangle.
-	const int sline_pixels,		// Pixels (words)/line for source.
-	const int sheight,			// Source height.
-	Pixel_type *dest,			// ->dest pixels.
-	const int dline_pixels,		// Pixels (words)/line for dest.
-	int scale_factor			// Scale Factor
-)
-{
-	Pixel_type *from = source + srcy*sline_pixels + srcx;
-	Pixel_type *to = dest + 2*srcy*dline_pixels + 2*srcx;
-
-	// the following are static because we don't want to be freeing and
-	// reallocating space on each call, as malloc()s are usually very
-	// expensive; we do allow it to grow though
-	static int buff_size = 0;
-	static COMPONENT *rgb_row_cur  = 0;
-	if (buff_size < sline_pixels+1) {
-		delete [] rgb_row_cur;
-		buff_size = sline_pixels+1;
-		rgb_row_cur  = new COMPONENT[buff_size*3];
-	}
-
-	int from_width = sline_pixels - srcx;
-	if (srcw+1 < from_width)
-		from_width = srcw+1;
-
-	for (int y=0; y < srch; y++)
-	{
-		Pixel_type *from_orig = from;
-		Pixel_type *to_orig = to;
-
-		fill_rgb_row(from, from_width, rgb_row_cur, srcw+1);
-
-		// every pixel in the src region, is extended to 4 pixels in the
-		// destination, arranged in a square 'quad'; if the current src
-		// pixel is 'a', then in what follows 'b' is the src pixel to the
-		// right, 'c' is the src pixel below, and 'd' is the src pixel to
-		// the right and down
-		COMPONENT *cur_row  = rgb_row_cur;
-		COMPONENT *ar = cur_row++;
-		COMPONENT *ag = cur_row++;
-		COMPONENT *ab = cur_row++;
-		for (int x=0; x < srcw; x++)
-		{
-			COMPONENT *br = cur_row++;
-			COMPONENT *bg = cur_row++;
-			COMPONENT *bb = cur_row++;
-
-			// upper left pixel in quad: just copy it in
-			*to++ = Manip_pixels::rgb(*ar, *ag, *ab);
-
-			// upper right
-			*to++ = Manip_pixels::rgb((*ar+*br)>>1, (*ag+*bg)>>1, (*ab+*bb)>>1);
-
-			// 'b' becomes 'a', 'd' becomes 'c'
-			ar = br;
-			ag = bg;
-			ab = bb;
-		}
-
-		// update the pointers for start of next pair of lines
-		from = from_orig + sline_pixels;
-		to = to_orig + 2*dline_pixels;
-	}
-}
-
-//
-// BilinearHalfInterlaced Scaler
-//
-static void Scale_BilinearHalfInterlaced
-(
-	Pixel_type *source,			// ->source pixels.
-	int srcx, int srcy,			// Start of rectangle within src.
-	int srcw, int srch,			// Dims. of rectangle.
-	const int sline_pixels,		// Pixels (words)/line for source.
-	const int sheight,			// Source height.
-	Pixel_type *dest,			// ->dest pixels.
-	const int dline_pixels,		// Pixels (words)/line for dest.
-	int scale_factor			// Scale Factor
-)
-{
-	Pixel_type *from = source + srcy*sline_pixels + srcx;
-	Pixel_type *to = dest + 2*srcy*dline_pixels + 2*srcx;
-	Pixel_type *to_odd = to + dline_pixels;
-
-	// the following are static because we don't want to be freeing and
-	// reallocating space on each call, as malloc()s are usually very
-	// expensive; we do allow it to grow though
-	static int buff_size = 0;
-	static COMPONENT *rgb_row_cur  = 0;
-	static COMPONENT *rgb_row_next = 0;
-	if (buff_size < sline_pixels+1) {
-		delete [] rgb_row_cur;
-		delete [] rgb_row_next;
-		buff_size = sline_pixels+1;
-		rgb_row_cur  = new COMPONENT[buff_size*3];
-		rgb_row_next = new COMPONENT[buff_size*3];
-	}
-
-	int from_width = sline_pixels - srcx;
-	if (srcw+1 < from_width)
-		from_width = srcw+1;
-
-	fill_rgb_row(from, from_width, rgb_row_cur, srcw+1);
-
-	for (int y=0; y < srch; y++)
-		{
-		Pixel_type *from_orig = from;
-		Pixel_type *to_orig = to;
-
-		if (y+1 < sheight)
-			fill_rgb_row(from+sline_pixels, from_width, rgb_row_next,
-						 srcw+1);
-		else
-			fill_rgb_row(from, from_width, rgb_row_next, srcw+1);
-
-		// every pixel in the src region, is extended to 4 pixels in the
-		// destination, arranged in a square 'quad'; if the current src
-		// pixel is 'a', then in what follows 'b' is the src pixel to the
-		// right, 'c' is the src pixel below, and 'd' is the src pixel to
-		// the right and down
-		COMPONENT *cur_row  = rgb_row_cur;
-		COMPONENT *next_row = rgb_row_next;
-		COMPONENT *ar = cur_row++;
-		COMPONENT *ag = cur_row++;
-		COMPONENT *ab = cur_row++;
-		COMPONENT *cr = next_row++;
-		COMPONENT *cg = next_row++;
-		COMPONENT *cb = next_row++;
-		for (int x=0; x < srcw; x++)
-			{
-			COMPONENT *br = cur_row++;
-			COMPONENT *bg = cur_row++;
-			COMPONENT *bb = cur_row++;
-			COMPONENT *dr = next_row++;
-			COMPONENT *dg = next_row++;
-			COMPONENT *db = next_row++;
-
-			// upper left pixel in quad: just copy it in
-			*to++ = Manip_pixels::rgb(*ar, *ag, *ab);
-
-			// upper right
-			*to++ = Manip_pixels::rgb((*ar+*br)>>1, (*ag+*bg)>>1, (*ab+*bb)>>1);
-
-			// lower left
-			*to_odd++ = Manip_pixels::rgb((*ar+*cr)>>2, (*ag+*cg)>>2, (*ab+*cb)>>2);
-
-			// lower right
-			*to_odd++ = Manip_pixels::rgb((*ar+*br+*cr+*dr)>>3,
-					  		      (*ag+*bg+*cg+*dg)>>3,
-							      (*ab+*bb+*cb+*db)>>3);
-
-			// 'b' becomes 'a', 'd' becomes 'c'
-			ar = br;
-			ag = bg;
-			ab = bb;
-			cr = dr;
-			cg = dg;
-			cb = db;
-			}
-
-		// the "next" rgb row becomes the current; the old current rgb row is
-		// recycled and serves as the new "next" row
-		COMPONENT *temp;
-		temp = rgb_row_cur;
-		rgb_row_cur = rgb_row_next;
-		rgb_row_next = temp;
-
-		// update the pointers for start of next pair of lines
-		from = from_orig + sline_pixels;
-		to = to_orig + 2*dline_pixels;
-		to_odd = to + dline_pixels;
-		}
-}
-
-//
-// BilinearQuarterInterlaced Scaler
-//
-static void Scale_BilinearQuarterInterlaced
-(
-	Pixel_type *source,			// ->source pixels.
-	int srcx, int srcy,			// Start of rectangle within src.
-	int srcw, int srch,			// Dims. of rectangle.
-	const int sline_pixels,		// Pixels (words)/line for source.
-	const int sheight,			// Source height.
-	Pixel_type *dest,			// ->dest pixels.
-	const int dline_pixels,		// Pixels (words)/line for dest.
-	int scale_factor			// Scale Factor
-)
-{
-	Pixel_type *from = source + srcy*sline_pixels + srcx;
-	Pixel_type *to = dest + 2*srcy*dline_pixels + 2*srcx;
-	Pixel_type *to_odd = to + dline_pixels;
-
-	// the following are static because we don't want to be freeing and
-	// reallocating space on each call, as malloc()s are usually very
-	// expensive; we do allow it to grow though
-	static int buff_size = 0;
-	static COMPONENT *rgb_row_cur  = 0;
-	static COMPONENT *rgb_row_next = 0;
-	if (buff_size < sline_pixels+1) {
-		delete [] rgb_row_cur;
-		delete [] rgb_row_next;
-		buff_size = sline_pixels+1;
-		rgb_row_cur  = new COMPONENT[buff_size*3];
-		rgb_row_next = new COMPONENT[buff_size*3];
-	}
-
-	int from_width = sline_pixels - srcx;
-	if (srcw+1 < from_width)
-		from_width = srcw+1;
-
-	fill_rgb_row(from, from_width, rgb_row_cur, srcw+1);
-
-	for (int y=0; y < srch; y++)
-		{
-		Pixel_type *from_orig = from;
-		Pixel_type *to_orig = to;
-
-		if (y+1 < sheight)
-			fill_rgb_row(from+sline_pixels, from_width, rgb_row_next,
-						 srcw+1);
-		else
-			fill_rgb_row(from, from_width, rgb_row_next, srcw+1);
-
-		// every pixel in the src region, is extended to 4 pixels in the
-		// destination, arranged in a square 'quad'; if the current src
-		// pixel is 'a', then in what follows 'b' is the src pixel to the
-		// right, 'c' is the src pixel below, and 'd' is the src pixel to
-		// the right and down
-		COMPONENT *cur_row  = rgb_row_cur;
-		COMPONENT *next_row = rgb_row_next;
-		COMPONENT *ar = cur_row++;
-		COMPONENT *ag = cur_row++;
-		COMPONENT *ab = cur_row++;
-		COMPONENT *cr = next_row++;
-		COMPONENT *cg = next_row++;
-		COMPONENT *cb = next_row++;
-		for (int x=0; x < srcw; x++)
-			{
-			COMPONENT *br = cur_row++;
-			COMPONENT *bg = cur_row++;
-			COMPONENT *bb = cur_row++;
-			COMPONENT *dr = next_row++;
-			COMPONENT *dg = next_row++;
-			COMPONENT *db = next_row++;
-
-			// upper left pixel in quad: just copy it in
-			*to++ = Manip_pixels::rgb(*ar, *ag, *ab);
-
-			// upper right
-			*to++ = Manip_pixels::rgb((*ar+*br)>>1, (*ag+*bg)>>1, (*ab+*bb)>>1);
-
-			// lower left
-			*to_odd++ = Manip_pixels::rgb(
-				((*ar+*cr)+((*ar+*cr)<<1))>>3,
-				((*ag+*cg)+((*ag+*cg)<<1))>>3,
-				((*ab+*cb)+((*ab+*cb)<<1))>>3
-			);
-
-			// lower right
-			*to_odd++ = Manip_pixels::rgb(
-				((*ar+*br+*cr+*dr)+((*ar+*br+*cr+*dr)<<1))>>4,
-				((*ag+*bg+*cg+*dg)+((*ag+*bg+*cg+*dg)<<1))>>4,
-				((*ab+*bb+*cb+*db)+((*ab+*bb+*cb+*db)<<1))>>4
-			);
-
-			// 'b' becomes 'a', 'd' becomes 'c'
-			ar = br;
-			ag = bg;
-			ab = bb;
-			cr = dr;
-			cg = dg;
-			cb = db;
-			}
-
-		// the "next" rgb row becomes the current; the old current rgb row is
-		// recycled and serves as the new "next" row
-		COMPONENT *temp;
-		temp = rgb_row_cur;
-		rgb_row_cur = rgb_row_next;
-		rgb_row_next = temp;
-
-		// update the pointers for start of next pair of lines
-		from = from_orig + sline_pixels;
-		to = to_orig + 2*dline_pixels;
-		to_odd = to + dline_pixels;
-		}
-}
-
-//
-// BilinearPlus Scaler
-//
-static void Scale_BilinearPlus
-(
-	Pixel_type *source,			// ->source pixels.
-	int srcx, int srcy,			// Start of rectangle within src.
-	int srcw, int srch,			// Dims. of rectangle.
-	const int sline_pixels,		// Pixels (words)/line for source.
-	const int sheight,			// Source height.
-	Pixel_type *dest,			// ->dest pixels.
-	const int dline_pixels,		// Pixels (words)/line for dest.
-	int scale_factor			// Scale Factor
-)
-{
-	Pixel_type *from = source + srcy*sline_pixels + srcx;
-	Pixel_type *to = dest + 2*srcy*dline_pixels + 2*srcx;
-	Pixel_type *to_odd = to + dline_pixels;
-
-	// the following are static because we don't want to be freeing and
-	// reallocating space on each call, as malloc()s are usually very
-	// expensive; we do allow it to grow though
-	static int buff_size = 0;
-	static COMPONENT *rgb_row_cur  = 0;
-	static COMPONENT *rgb_row_next = 0;
-	if (buff_size < sline_pixels+1) {
-		delete [] rgb_row_cur;
-		delete [] rgb_row_next;
-		buff_size = sline_pixels+1;
-		rgb_row_cur  = new COMPONENT[buff_size*3];
-		rgb_row_next = new COMPONENT[buff_size*3];
-	}
-
-	int from_width = sline_pixels - srcx;
-	if (srcw+1 < from_width)
-		from_width = srcw+1;
-
-	fill_rgb_row(from, from_width, rgb_row_cur, srcw+1);
-
-	for (int y=0; y < srch; y++)
-		{
-		Pixel_type *from_orig = from;
-		Pixel_type *to_orig = to;
-
-		if (y+1 < sheight)
-			fill_rgb_row(from+sline_pixels, from_width, rgb_row_next,
-						 srcw+1);
-		else
-			fill_rgb_row(from, from_width, rgb_row_next, srcw+1);
-
-		// every pixel in the src region, is extended to 4 pixels in the
-		// destination, arranged in a square 'quad'; if the current src
-		// pixel is 'a', then in what follows 'b' is the src pixel to the
-		// right, 'c' is the src pixel below, and 'd' is the src pixel to
-		// the right and down
-		COMPONENT *cur_row  = rgb_row_cur;
-		COMPONENT *next_row = rgb_row_next;
-		COMPONENT *ar = cur_row++;
-		COMPONENT *ag = cur_row++;
-		COMPONENT *ab = cur_row++;
-		COMPONENT *cr = next_row++;
-		COMPONENT *cg = next_row++;
-		COMPONENT *cb = next_row++;
-		for (int x=0; x < srcw; x++)
-			{
-			COMPONENT *br = cur_row++;
-			COMPONENT *bg = cur_row++;
-			COMPONENT *bb = cur_row++;
-			COMPONENT *dr = next_row++;
-			COMPONENT *dg = next_row++;
-			COMPONENT *db = next_row++;
-
-			// upper left pixel in quad: just copy it in
-			//*to++ = Manip_pixels::rgb(*ar, *ag, *ab);
-#ifdef USE_ORIGINAL_BILINEAR_PLUS
-			*to++ = Manip_pixels::rgb(
-			(((*ar)<<2) +((*ar)) + (*cr+*br+*br) )>> 3,
-			(((*ag)<<2) +((*ag)) + (*cg+*bg+*bg) )>> 3,
-			(((*ab)<<2) +((*ab)) + (*cb+*bb+*bb) )>> 3);
-#else
-			*to++ = Manip_pixels::rgb(
-			(((*ar)<<3) +((*ar)<<1) + (*cr+*br+*br+*cr) )>> 4,
-			(((*ag)<<3) +((*ag)<<1) + (*cg+*bg+*bg+*cg) )>> 4,
-			(((*ab)<<3) +((*ab)<<1) + (*cb+*bb+*bb+*cb) )>> 4);
-#endif
-
-			// upper right
-			*to++ = Manip_pixels::rgb((*ar+*br)>>1, (*ag+*bg)>>1, (*ab+*bb)>>1);
-
-			// lower left
-			*to_odd++ = Manip_pixels::rgb((*ar+*cr)>>1, (*ag+*cg)>>1, (*ab+*cb)>>1);
-
-			// lower right
-			*to_odd++ = Manip_pixels::rgb((*ar+*br+*cr+*dr)>>2,
-					  		      (*ag+*bg+*cg+*dg)>>2,
-							      (*ab+*bb+*cb+*db)>>2);
-
-			// 'b' becomes 'a', 'd' becomes 'c'
-			ar = br;
-			ag = bg;
-			ab = bb;
-			cr = dr;
-			cg = dg;
-			cb = db;
-			}
-
-		// the "next" rgb row becomes the current; the old current rgb row is
-		// recycled and serves as the new "next" row
-		COMPONENT *temp;
-		temp = rgb_row_cur;
-		rgb_row_cur = rgb_row_next;
-		rgb_row_next = temp;
-
-		// update the pointers for start of next pair of lines
-		from = from_orig + sline_pixels;
-		to = to_orig + 2*dline_pixels;
-		to_odd = to + dline_pixels;
-		}
-}
-
-//
-// Point Sampling Scaler
-//
-static void Scale_point
-(
-	Pixel_type *src,			// ->source pixels.
-	int srcx, int srcy,			// Start of rectangle within src.
-	int srcw, int srch,			// Dims. of rectangle.
-	const int sline_pixels,		// Pixels (words)/line for source.
-	const int sheight,			// Source height.
-	Pixel_type *dst,			// ->dest pixels.
-	const int dline_pixels,		// Pixels (words)/line for dest.
-	int factor					// Scale Factor
-)
-{
-	static Pixel_type *dest;
-	static const Pixel_type *source;
-	static const Pixel_type *limit_y;
-	static const Pixel_type *limit_x;
-	static int pitch_src;
-	static int add_dst;
-
-	source = src + srcy*sline_pixels + srcx;
-	dest = dst + srcy*factor*dline_pixels + srcx*factor;
-
-	limit_y = source + srch*sline_pixels;
-	limit_x = source + srcw;
-
-	pitch_src = sline_pixels;
-	add_dst = dline_pixels - srcw*factor;
-
-	// Slightly Optimzed 16 bit 2x
-	if (factor == 2 && sizeof(Pixel_type) == 2) {
-		static Pixel_type *dest2;
-		uint32 data;
-		static int add_src;
-		add_src = pitch_src - srcw;
-		while (source < limit_y)
-		{
-			dest2 = dest;
-			dest += dline_pixels;
-
-			while (source < limit_x)
-			{
-				data = *source++;
-				data |= data << 16;
-				*(uint32*)dest2 = data;
-				dest2+=2;
-				*(uint32*)dest = data;
-				dest+=2;
-			}
-			dest += add_dst;
-			limit_x += sline_pixels;
-			source += add_src;
-		}
-	}
-	// Slightly Optimzed 32 bit 2x
-	else if (factor == 2) {
-		Pixel_type data;
-		static Pixel_type *dest2;
-		static int add_src;
-		add_src = pitch_src - srcw;
-		while (source < limit_y)
-		{
-			dest2 = dest;
-			dest += dline_pixels;
-
-			while (source < limit_x)
-			{
-				data = *source++;
-				*dest2++ = data;
-				*dest2++ = data;
-				*dest++ = data;
-				*dest++ = data;
-			}
-			dest += add_dst;
-			limit_x += sline_pixels;
-			source += add_src;
-		}
-	}
-	else
-	{
-		Pixel_type data;
-		static unsigned int src_sub;
-		static unsigned int scale_factor;
-		static unsigned int dline_pixels_scaled;
-		static const Pixel_type * limit_y2;
-		static const Pixel_type * limit_x2;
-
-		src_sub = srcw;
-		scale_factor = factor;
-		dline_pixels_scaled = dline_pixels*scale_factor;
-		limit_y2 = dest;
-
-		while (source < limit_y)
-		{
-			limit_y2 += dline_pixels_scaled;
-			while (dest < limit_y2)
-			{
-				limit_x2 = dest;
-				while (source < limit_x)
-				{
-					data = *source++;
-					limit_x2 += scale_factor;
-					while (dest < limit_x2) *dest++ = data;
-				}
-				dest += add_dst;
-				source -= src_sub;
-			}
-			limit_x += pitch_src;
-			source += pitch_src;
-		}
-	}
-}
-
-//
-// Interlaced Scaler
-//
-static void Scale_interlaced
-(
-	Pixel_type *src,			// ->source pixels.
-	int srcx, int srcy,			// Start of rectangle within src.
-	int srcw, int srch,			// Dims. of rectangle.
-	const int sline_pixels,		// Pixels (words)/line for source.
-	const int sheight,			// Source height.
-	Pixel_type *dst,			// ->dest pixels.
-	const int dline_pixels,		// Pixels (words)/line for dest.
-	int factor					// Scale Factor
-)
-{
-	static Pixel_type *dest;
-	static const Pixel_type *source;
-	static const Pixel_type *limit_y;
-	static const Pixel_type *limit_x;
-	static int pitch_src;
-	static int add_dst;
-
-	source = src + srcy*sline_pixels + srcx;
-	dest = dst + srcy*factor*dline_pixels + srcx*factor;
-
-	limit_y = source + srch*sline_pixels;
-	limit_x = source + srcw;
-
-	pitch_src = sline_pixels;
-	add_dst = dline_pixels - srcw*factor;
-
-	// Slightly Optimzed 16 bit 2x
-	if (factor == 2 && sizeof(Pixel_type) == 2) {
-		uint32 data;
-		static int add_src;
-		add_src = pitch_src - srcw;
-		add_dst += dline_pixels;
-		while (source < limit_y)
-		{
-			while (source < limit_x)
-			{
-				data = *source++;
-				*(uint32*)dest = data | (data << 16);
-				dest+=2;
-			}
-			dest += add_dst;
-			limit_x += sline_pixels;
-			source += add_src;
-		}
-	}
-	// Slightly Optimzed 32 bit 2x
-	else if (factor == 2) {
-		Pixel_type data;
-		static int add_src;
-		add_src = pitch_src - srcw;
-		add_dst += dline_pixels;
-		while (source < limit_y)
-		{
-			while (source < limit_x)
-			{
-				data = *source++;
-				*dest++ = data;
-				*dest++ = data;
-			}
-			dest += add_dst;
-			limit_x += sline_pixels;
-			source += add_src;
-		}
-	}
-	else
-	{
-		Pixel_type data;
-		static unsigned int src_sub;
-		static unsigned int scale_factor;
-		static unsigned int dline_pixels_scaled;
-		static unsigned int	skipped;
-		static const Pixel_type * limit_y2;
-		static const Pixel_type * limit_x2;
-
-		src_sub = srcw;
-		scale_factor = factor;
-		dline_pixels_scaled = dline_pixels*scale_factor;
-		limit_y2 = dest;
-		skipped = (srcy*scale_factor)%2;
-
-		while (source < limit_y)
-		{
-			limit_y2 += dline_pixels_scaled;
-			while (dest < limit_y2)
-			{
-				limit_x2 = dest;
-				if (!skipped) {
-					while (source < limit_x)
-					{
-						data = *source++;
-						limit_x2 += scale_factor;
-						while (dest < limit_x2) *dest++ = data;
-					}
-					dest += add_dst;
-					source -= src_sub;
-				}
-				else {
-					dest += dline_pixels;
-				}
-
-				skipped = 1-skipped;
-			}
-			limit_x += pitch_src;
-			source += pitch_src;
-		}
-	}
-}
-
-};	// End of class Scalers
-
-
-#if 0
-
-// Colourless's Experimental BlurFilter
-// Note this doesn't actually scale, it just blurs
-template <class Pixel_type, class Manip_pixels>
-void BlurFilter
-	(
-	Pixel_type *source,		// ->source pixels.
-	int srcx, int srcy,			// Start of rectangle within src.
-	int srcw, int srch,			// Dims. of rectangle.
-	const int swidth,			// Source width.
-	const int sheight,			// Source height.
-	int spitch,					// Pixels/line for source.
-	Pixel_type *dest,			// ->dest pixels.
-	int dpitch					// Pixels/line for dest.
-	)
-{
-/*
-	What we do is combine 9 source pixels into 1 destination pixel. It's just a
-	simple blur using these weights, then scaled by 16. In a sense this has the
-	same effect as super sampling with bilinear filtering
-
-	Normal Pixel
-    +--+--+--+
-	| 1| 2| 1|
-    +--+--+--+
-	| 2| 4| 2|
-    +--+--+--+
-	| 1| 2| 1|
-    +--+--+--+
-
-	Left/Right Edge Pixel
-    +--+--+
-	| 1| 1|
-    +--+--+
-	| 2| 2|
-    +--+--+
-	| 1| 1|
-    +--+--+
-
-	Top/Bottom Edge Pixel
-    +--+--+--+
-	| 1| 2| 1|
-    +--+--+--+
-	| 1| 2| 1|
-    +--+--+--+
-
-	Corner Pixel
-    +--+--+
-	| 1| 1|
-    +--+--+
-	| 1| 1|
-    +--+--+
-*/
-
-#define add_source(src,ar,ag,ab) split_col(src,r,g,b); ar+=r; ag+=g; ab+=b;
-#define add_shift(src,ar,ag,ab,shift) split_col(src,r,g,b); ar+=r<<shift; ag+=g<<shift; ab+=b<<shift;
-
-	// Number to add to source at end of line
-	uint32 source_add = spitch - srcw;
-	uint32 dest_add = dpitch - srcw;
-
-	// Set true if first and last column handling is required
-	const bool first_col = srcx == 0;
-	const bool last_col = srcx+srcw == swidth;
-
-	// Pointers to end of source, and start of last line
-	const Pixel_type *last = source + (srcy+sheight-1)*spitch;
-	const Pixel_type *end = source + (srcy+srch-1)*spitch+ srcx+srcw;
-
-	// Pointer to the end of the line
-	const Pixel_type *end_of_line = source + srcy*spitch + srcx+srcw;
-	if (last_col) end_of_line--;
-
-	// Read buffers
-	COMPONENT r;
-	COMPONENT g;
-	COMPONENT b;
-
-	// Accumulators
-	COMPONENT ar;
-	COMPONENT ag;
-	COMPONENT ab;
-
-	// Point buffers to first pixel
-	const Pixel_type *sourceP = source + (srcy-1)*spitch + srcx;	// Previous line
-	const Pixel_type *sourceN = source + (srcy+1)*spitch + srcx;	// Next line
-	source += srcy*spitch + srcx;
-	dest += srcy*dpitch + srcx;
-
-	// Special handling for first line
-	if (srcy == 0) {
-
-		// Special Handling for first column
-		if (first_col) {
-			Manip_pixels::split_col(*source,      ar, ag, ab);
-			Manip_pixels::add_source  (*++source,    ar, ag, ab);
-			Manip_pixels::add_source  (*sourceN,     ar, ag, ab);
-			Manip_pixels::add_source  (*++sourceN,   ar, ag, ab);
-			*dest++ = Manip_pixels::rgb(ar>>2, ag>>2, ab>>2);
-		}
-
-		// Handle all normal pixels
-		while (source < end_of_line) {
-			Manip_pixels::split_col(*(source-1),  ar, ag, ab);
-			Manip_pixels::add_shift   (*source,      ar, ag, ab, 1);
-			Manip_pixels::add_source  (*++source,    ar, ag, ab);
-			Manip_pixels::add_source  (*(sourceN-1), ar, ag, ab);
-			Manip_pixels::add_shift   (*sourceN,     ar, ag, ab, 1);
-			Manip_pixels::add_source  (*++sourceN,   ar, ag, ab);
-			*dest++ = Manip_pixels::rgb(ar>>3, ag>>3, ab>>3);
-		}
-
-		// Special Handling for last column
-		if (last_col) {
-			Manip_pixels::split_col(*(source-1),  ar, ag, ab);
-			Manip_pixels::add_source  (*source,      ar, ag, ab);
-			++source;
-			Manip_pixels::add_source  (*sourceN,     ar, ag, ab);
-			Manip_pixels::add_source  (*(sourceN-1), ar, ag, ab);
-			++sourceN;
-			*dest++ = Manip_pixels::rgb(ar>>2, ag>>2, ab>>2);
-		}
-
-
-		// Increment buffer pointers to the next line
-		dest += dest_add;
-		end_of_line += spitch;
-		sourceP += spitch;
-		source += source_add;
-		sourceN += source_add;
-	}
-
-
-	// Do all normal lines
-	while (source < last && source < end) {
-
-		// Special Handling for first column
-		if (first_col) {
-			Manip_pixels::split_col(*sourceP,     ar, ag, ab);
-			Manip_pixels::add_source  (*++sourceP,   ar, ag, ab);
-			Manip_pixels::add_shift   (*source,      ar, ag, ab, 1);
-			Manip_pixels::add_shift   (*++source,    ar, ag, ab, 1);
-			Manip_pixels::add_source  (*sourceN,     ar, ag, ab);
-			Manip_pixels::add_source  (*++sourceN,   ar, ag, ab);
-			*dest++ = Manip_pixels::rgb(ar>>3, ag>>3, ab>>3);
-		}
-
-		// Handle all normal pixels
-		while (source < end_of_line) {
-			Manip_pixels::split_col(*(sourceP-1), ar, ag, ab);
-			Manip_pixels::add_shift   (*sourceP,     ar, ag, ab, 1);
-			Manip_pixels::add_source  (*++sourceP,   ar, ag, ab);
-			Manip_pixels::add_shift   (*(source-1),  ar, ag, ab, 1);
-			Manip_pixels::add_shift   (*source,      ar, ag, ab, 2);
-			Manip_pixels::add_shift   (*++source,    ar, ag, ab, 1);
-			Manip_pixels::add_source  (*(sourceN-1), ar, ag, ab);
-			Manip_pixels::add_shift   (*sourceN,     ar, ag, ab, 1);
-			Manip_pixels::add_source  (*++sourceN,   ar, ag, ab);
-			*dest++ = Manip_pixels::rgb(ar>>4, ag>>4, ab>>4);
-		}
-
-		// Special Handling for last column
-		if (last_col) {
-			Manip_pixels::split_col(*(sourceP-1), ar, ag, ab);
-			Manip_pixels::add_source  (*sourceP,     ar, ag, ab);
-			++sourceP;
-			Manip_pixels::add_shift   (*(source-1),  ar, ag, ab, 1);
-			Manip_pixels::add_shift   (*source,      ar, ag, ab, 1);
-			++source;
-			Manip_pixels::add_source  (*(sourceN-1), ar, ag, ab);
-			Manip_pixels::add_source  (*sourceN,     ar, ag, ab);
-			++sourceN;
-			*dest++ = Manip_pixels::rgb(ar>>3, ag>>3, ab>>3);
-		}
-
-		// Increment buffer pointers to the next line
-		dest += dest_add;
-		end_of_line += spitch;
-		sourceP += source_add;
-		source += source_add;
-		sourceN += source_add;
-	}
-
-
-	// Special handling for last line
-	if (srcy+srch == sheight) {
-
-		// Special Handling for first column
-		if (first_col) {
-			Manip_pixels::split_col(*source,    ar, ag, ab);
-			Manip_pixels::add_source  (*++source,  ar, ag, ab);
-			Manip_pixels::add_source  (*sourceP,   ar, ag, ab);
-			Manip_pixels::add_source  (*++sourceP, ar, ag, ab);
-			*dest++ = Manip_pixels::rgb(ar>>2, ag>>2, ab>>2);
-		}
-
-		// Handle all normal pixels
-		while (source < end_of_line) {
-			Manip_pixels::split_col(*(source-1),  ar, ag, ab);
-			Manip_pixels::add_shift   (*source,      ar, ag, ab, 1);
-			Manip_pixels::add_source  (*++source,    ar, ag, ab);
-			Manip_pixels::add_source  (*(sourceP-1), ar, ag, ab);
-			Manip_pixels::add_shift   (*sourceP,     ar, ag, ab, 1);
-			Manip_pixels::add_source  (*++sourceP,   ar, ag, ab);
-			*dest++ = Manip_pixels::rgb(ar>>3, ag>>3, ab>>3);
-		}
-
-
-		// Special Handling for last column
-		if (last_col) {
-			Manip_pixels::split_col(*(source-1),  ar, ag, ab);
-			Manip_pixels::add_source  (*source,      ar, ag, ab);
-			++source;
-			Manip_pixels::add_source  (*sourceP,     ar, ag, ab);
-			Manip_pixels::add_source  (*(sourceP-1), ar, ag, ab);
-			++sourceP;
-			*dest++ = Manip_pixels::rgb(ar>>2, ag>>2, ab>>2);
-		}
-	}
-}
-
-// Rotator
-template <class Pixel_type, class Manip_pixels>
-void Rotator
-	(
-	Pixel_type *source,			// ->source pixels.
-	const int srcx, const int srcy,	// Start of rectangle within src.
-	const int srcw, const int srch,	// Dims. of rectangle.
-	const int swidth,				// Source width.
-	const int sheight,				// Source height.
-	const int spitch,				// Pixels/line for source.
-	Pixel_type *dest,				// ->dest pixels.
-	const int dincx,				// Amount to increment for each x pixel (can be negetive)
-	const int dincy					// Pixels/line for dest. (amount to increment for each y pixel)
-	)
-{
-
-	// Number to add to source at end of line
-	const uint32 source_add = spitch - srcw;
-	const sint32 dest_add = dincy - srcw*dincx;
-
-	// Pointers to end of source, and start of last line
-	const Pixel_type *end = source + (srcy+srch)*spitch;
-
-	// Pointer to the end of the line
-	const Pixel_type *end_of_line = source + srcy*spitch + srcx+srcw;
-
-	// Point buffers to first pixel
-	source += srcy*spitch + srcx;
-	dest += srcy*dincy + srcx*dincx;
-
-	int y = srcy;
-	// Do all normal lines
-	while (source < end) {
-
-		// Handle all normal pixels
-		while (source < end_of_line) {
-			dest = *source++;
-			dest += dincx;
-		}
-
-		// Increment buffer pointers to the next line
-		source += source_add;
-		dest += dest_add;
-		end_of_line += spitch;
-	}
-}
-
-#endif
-
-} // End of namespace Nuvie
-} // End of namespace Ultima
-
-#endif // SCALE_INL_INCLUDED
diff --git a/engines/ultima/nuvie/screen/screen.cpp b/engines/ultima/nuvie/screen/screen.cpp
index 60fdf417fe8..67fa67b6428 100644
--- a/engines/ultima/nuvie/screen/screen.cpp
+++ b/engines/ultima/nuvie/screen/screen.cpp
@@ -23,7 +23,6 @@
 #include "ultima/nuvie/misc/u6_misc.h"
 #include "ultima/nuvie/conf/configuration.h"
 #include "ultima/nuvie/screen/surface.h"
-#include "ultima/nuvie/screen/scale.h"
 #include "ultima/nuvie/screen/screen.h"
 #include "ultima/nuvie/gui/widgets/map_window.h"
 #include "ultima/nuvie/gui/widgets/background.h"
@@ -42,10 +41,8 @@ static const sint32 globeradius[]   = { 36, 112, 148, 192, 448 };
 static const sint32 globeradius_2[] = { 18, 56, 74, 96, 224 };
 
 Screen::Screen(const Configuration *cfg) : config(cfg), _rawSurface(nullptr),
-		_renderSurface(nullptr), scaler(nullptr), shading_data(nullptr),
-		scaler_index(0), scale_factor(2), doubleBuffer(false),
-		is_no_darkness(false), non_square_pixels(false), shading_ambient(255),
-		width(320), height(200) {
+		_renderSurface(nullptr), shading_data(nullptr), is_no_darkness(false),
+		non_square_pixels(false), shading_ambient(255), width(320), height(200) {
 	ARRAYCLEAR(shading_tile);
 
 	Std::string str_lighting_style;
@@ -90,15 +87,6 @@ bool Screen::init() {
 	width = (uint16)new_width;
 	height = (uint16)new_height;
 
-	config->value("config/video/scale_method", str, "---");
-	scaler_index = scaler_reg.GetIndexForName(str);
-	if (scaler_index == -1) {
-		//config.set("config/video/scale_method","SuperEagle",true);
-		scaler_index = scaler_reg.GetIndexForName("SuperEagle");
-	}
-
-	config->value("config/video/scale_factor", scale_factor, 1);
-
 	config->value("config/video/non_square_pixels", non_square_pixels, false);
 
 	set_screen_mode();
@@ -161,19 +149,6 @@ bool Screen::rotate_palette(uint8 pos, uint8 length) {
 	return true;
 }
 
-uint16 Screen::get_translated_x(uint16 x) const {
-	if (scale_factor != 1)
-		x /= scale_factor;
-
-	return x;
-}
-
-uint16 Screen::get_translated_y(uint16 y) const {
-	if (scale_factor != 1)
-		y /= scale_factor;
-
-	return y;
-}
 bool Screen::clear(sint16 x, sint16 y, sint16 w, sint16 h, Common::Rect *clip_rect) {
 	uint8 *pixels;
 	uint16 i;
@@ -550,10 +525,7 @@ inline bool Screen::blit16(uint16 dest_x, uint16 dest_y, const byte *src_buf, ui
 }
 
 inline bool Screen::blit16WithOpacity(uint16 dest_x, uint16 dest_y, const byte *src_buf, uint16 src_bpp, uint16 src_w, uint16 src_h, uint16 src_pitch, bool trans, uint8 opacity) {
-	uint16 *pixels;
-	uint16 i, j;
-
-	pixels = (uint16 *)_renderSurface->pixels;
+	uint16 *pixels = (uint16 *)_renderSurface->pixels;
 
 	pixels += dest_y * _renderSurface->w + dest_x;
 
@@ -580,10 +552,7 @@ inline bool Screen::blit16WithOpacity(uint16 dest_x, uint16 dest_y, const byte *
 }
 
 bool Screen::blit32(uint16 dest_x, uint16 dest_y, const byte *src_buf, uint16 src_bpp, uint16 src_w, uint16 src_h, uint16 src_pitch, bool trans) {
-	uint32 *pixels;
-	uint16 i, j;
-
-	pixels = (uint32 *)_renderSurface->pixels;
+	uint32 *pixels = (uint32 *)_renderSurface->pixels;
 
 	pixels += dest_y * _renderSurface->w + dest_x;
 
@@ -611,10 +580,7 @@ bool Screen::blit32(uint16 dest_x, uint16 dest_y, const byte *src_buf, uint16 sr
 }
 
 bool Screen::blit32WithOpacity(uint16 dest_x, uint16 dest_y, const byte *src_buf, uint16 src_bpp, uint16 src_w, uint16 src_h, uint16 src_pitch, bool trans, uint8 opacity) {
-	uint32 *pixels;
-	uint16 i, j;
-
-	pixels = (uint32 *)_renderSurface->pixels;
+	uint32 *pixels = (uint32 *)_renderSurface->pixels;
 
 	pixels += dest_y * _renderSurface->w + dest_x;
 
@@ -651,10 +617,7 @@ void Screen::blitbitmap(uint16 dest_x, uint16 dest_y, const byte *src_buf, uint1
 }
 
 void Screen::blitbitmap16(uint16 dest_x, uint16 dest_y, const byte *src_buf, uint16 src_w, uint16 src_h, uint8 fg_color, uint8 bg_color) {
-	uint16 *pixels;
-	uint16 i, j;
-
-	pixels = (uint16 *)_renderSurface->pixels;
+	uint16 *pixels = (uint16 *)_renderSurface->pixels;
 
 	pixels += dest_y * _renderSurface->w + dest_x;
 
@@ -673,10 +636,7 @@ void Screen::blitbitmap16(uint16 dest_x, uint16 dest_y, const byte *src_buf, uin
 }
 
 void Screen::blitbitmap32(uint16 dest_x, uint16 dest_y, const byte *src_buf, uint16 src_w, uint16 src_h, uint8 fg_color, uint8 bg_color) {
-	uint32 *pixels;
-	uint16 i, j;
-
-	pixels = (uint32 *)_renderSurface->pixels;
+	uint32 *pixels = (uint32 *)_renderSurface->pixels;
 
 	pixels += dest_y * _renderSurface->w + dest_x;
 
@@ -902,7 +862,6 @@ void Screen::buildalphamap8() {
 
 
 void Screen::drawalphamap8globe(sint16 x, sint16 y, uint16 r) {
-	sint16 i, j;
 // check shouldn't be needed since items only have 3 intensites
 	//Clamp lighting globe size to 0-4 (5 levels) // 4 - 10 (7 levels) now in orig_style now like original
 //    if( r > NUM_GLOBES && lighting_style != LIGHTING_STYLE_ORIGINAL)
@@ -960,7 +919,6 @@ void Screen::blitalphamap8(sint16 x, sint16 y, Common::Rect *clip_rect) {
 	if (lighting_style == LIGHTING_STYLE_NONE)
 		return;
 
-	uint16 i, j;
 	Game *game = Game::get_game();
 
 	if (lighting_style == LIGHTING_STYLE_ORIGINAL) {
@@ -1123,7 +1081,6 @@ Graphics::ManagedSurface *Screen::create_sdl_surface_8(byte *src_buf, uint16 src
 
 Graphics::ManagedSurface *Screen::create_sdl_surface_from(byte *src_buf, uint16 src_bpp, uint16 src_w, uint16 src_h, uint16 src_pitch) {
 	Graphics::ManagedSurface *new_surface;
-	uint16 i, j;
 
 	new_surface = RenderSurface::createSurface(src_w, src_h,
 		_renderSurface->getFormat());
@@ -1154,14 +1111,6 @@ Graphics::ManagedSurface *Screen::create_sdl_surface_from(byte *src_buf, uint16
 
 }
 
-uint16 Screen::get_pitch() {
-	return (uint16)_renderSurface->pitch;
-}
-
-uint16 Screen::get_bpp() {
-	return _renderSurface->bits_per_pixel;
-}
-
 void Screen::update() {
 	_rawSurface->markAllDirty();
 	_rawSurface->update();
@@ -1190,35 +1139,7 @@ void Screen::preformUpdate() {
 	_rawSurface->update();
 }
 
-void Screen::lock() {
-// SDL_LockSurface(scaled_surface);
-
-	return;
-}
-
-void Screen::unlock() {
-//SDL_UnlockSurface(scaled_surface);
-
-	return;
-}
-
-bool Screen::initScaler() {
-	Std::string scaler_name;
-
-	return true;
-}
-
-int Screen::get_screen_bpp() {
-	// Get info. about video.
-	Graphics::PixelFormat pf = g_system->getScreenFormat();
-	return pf.bpp();
-}
-
 void Screen::set_screen_mode() {
-	if (scale_factor == 0) scale_factor = 1;
-	scaler = 0;
-	scale_factor = 1;
-
 	Graphics::PixelFormat SCREEN_FORMAT(2, 5, 6, 5, 0, 11, 5, 0, 0);
 	initGraphics(width, height, &SCREEN_FORMAT);
 	_rawSurface = new Graphics::Screen(width, height, SCREEN_FORMAT);
@@ -1239,7 +1160,6 @@ bool Screen::set_fullscreen(bool value) {
 	g_system->beginGFXTransaction();
 	g_system->setFeatureState(OSystem::kFeatureFullscreenMode, value);
 	g_system->endGFXTransaction();
-
 	return true;
 }
 
@@ -1251,42 +1171,34 @@ byte *Screen::copy_area(Common::Rect *area, uint16 down_scale) {
 	return copy_area32(area, down_scale);
 }
 
-byte *Screen::copy_area16(Common::Rect *area, uint16 down_scale) {
-	Graphics::PixelFormat *fmt;
+byte *Screen::copy_area16(const Common::Rect *area, uint16 down_scale) {
 	Graphics::ManagedSurface *main_surface = get_sdl_surface();
-	byte *dst_pixels = nullptr;
-	byte *ptr;
-	const uint16 *src_pixels;
-	uint32 r, g, b;
-	uint32 ra, ga, ba;
-	uint16 x, y;
-	uint8 x1, y1;
 
-	dst_pixels = new unsigned char[((area->width() / down_scale) * (area->height() / down_scale)) * 3];
-	ptr = dst_pixels;
+	byte *dst_pixels = new unsigned char[((area->width() / down_scale) * (area->height() / down_scale)) * 3];
+	byte *ptr = dst_pixels;
 
-	fmt = &main_surface->format;
+	const Graphics::PixelFormat *fmt = &main_surface->format;
 
 	for (int y = 0; y < area->height(); y += down_scale) {
 		for (int x = 0; x < area->width(); x += down_scale) {
-			r = 0;
-			g = 0;
-			b = 0;
+			uint32 r = 0;
+			uint32 g = 0;
+			uint32 b = 0;
 
-			src_pixels = (const uint16 *)main_surface->getPixels();
+			const uint16 *src_pixels = (const uint16 *)main_surface->getPixels();
 			src_pixels += ((area->top + y) * _renderSurface->w + (area->left + x));
 
-			for (y1 = 0; y1 < down_scale; y1++) {
-				for (x1 = 0; x1 < down_scale; x1++) {
-					ra = *src_pixels & fmt->rMax();
+			for (int y1 = 0; y1 < down_scale; y1++) {
+				for (int x1 = 0; x1 < down_scale; x1++) {
+					uint32 ra = *src_pixels & fmt->rMax();
 					ra >>= fmt->rShift;
 					ra <<= fmt->rLoss;
 
-					ga = *src_pixels & fmt->gMax();
+					uint32 ga = *src_pixels & fmt->gMax();
 					ga >>= fmt->gShift;
 					ga <<= fmt->gLoss;
 
-					ba = *src_pixels & fmt->bMax();
+					uint32 ba = *src_pixels & fmt->bMax();
 					ba >>= fmt->bShift;
 					ba <<= fmt->bLoss;
 
@@ -1309,42 +1221,33 @@ byte *Screen::copy_area16(Common::Rect *area, uint16 down_scale) {
 	return dst_pixels;
 }
 
-byte *Screen::copy_area32(Common::Rect *area, uint16 down_scale) {
-	Graphics::PixelFormat *fmt;
+byte *Screen::copy_area32(const Common::Rect *area, uint16 down_scale) {
 	Graphics::ManagedSurface *main_surface = get_sdl_surface();
-	byte *dst_pixels = nullptr;
-	byte *ptr;
-	const uint32 *src_pixels;
-	uint32 r, g, b;
-	uint32 ra, ga, ba;
-	uint16 x, y;
-	uint8 x1, y1;
-
-	dst_pixels = new unsigned char[((area->width() / down_scale) * (area->height() / down_scale)) * 3];
-	ptr = dst_pixels;
+	byte *dst_pixels = new unsigned char[((area->width() / down_scale) * (area->height() / down_scale)) * 3];
+	byte *ptr = dst_pixels;
 
-	fmt = &main_surface->format;
+	const Graphics::PixelFormat *fmt = &main_surface->format;
 
 	for (int y = 0; y < area->height(); y += down_scale) {
 		for (int x = 0; x < area->width(); x += down_scale) {
-			r = 0;
-			g = 0;
-			b = 0;
+			uint32 r = 0;
+			uint32 g = 0;
+			uint32 b = 0;
 
-			src_pixels = (const uint32 *)main_surface->getPixels();
+			const uint32 *src_pixels = (const uint32 *)main_surface->getPixels();
 			src_pixels += ((area->top + y) * _renderSurface->w + (area->left + x));
 
-			for (y1 = 0; y1 < down_scale; y1++) {
-				for (x1 = 0; x1 < down_scale; x1++) {
-					ra = *src_pixels & fmt->rMax();
+			for (int y1 = 0; y1 < down_scale; y1++) {
+				for (int x1 = 0; x1 < down_scale; x1++) {
+					uint32 ra = *src_pixels & fmt->rMax();
 					ra >>= fmt->rShift;
 					ra <<= fmt->rLoss;
 
-					ga = *src_pixels & fmt->gMax();
+					uint32 ga = *src_pixels & fmt->gMax();
 					ga >>= fmt->gShift;
 					ga <<= fmt->gLoss;
 
-					ba = *src_pixels & fmt->bMax();
+					uint32 ba = *src_pixels & fmt->bMax();
 					ba >>= fmt->bShift;
 					ba <<= fmt->bLoss;
 
@@ -1396,13 +1299,13 @@ void Screen::restore_area(byte *pixels, Common::Rect *area,
 }
 
 
-byte *Screen::copy_area32(Common::Rect *area, byte *buf) {
+byte *Screen::copy_area32(const Common::Rect *area, byte *buf) {
 	uint32 *copied = (uint32 *)buf;
 	if (buf == nullptr) {
 		copied = (uint32 *)malloc(area->width() * area->height() * 4);
 	}
 	uint32 *dest = copied;
-	uint32 *src = (uint32 *)_renderSurface->pixels;
+	const uint32 *src = (const uint32 *)_renderSurface->pixels;
 	uint16 src_x_off = ABS(area->left);
 	uint16 src_y_off = ABS(area->top);
 	uint16 src_w = area->width();
@@ -1436,13 +1339,13 @@ byte *Screen::copy_area32(Common::Rect *area, byte *buf) {
 		dest += area->width();
 		src += _renderSurface->w;
 	}
-	return ((byte *)copied);
+	return (byte *)copied;
 }
 
 
-void Screen::restore_area32(byte *pixels, Common::Rect *area,
-							byte *target, Common::Rect *target_area, bool free_src) {
-	uint32 *src = (uint32 *)pixels;
+void Screen::restore_area32(byte *pixels, const Common::Rect *area,
+							byte *target, const Common::Rect *target_area, bool free_src) {
+	const uint32 *src = (const uint32 *)pixels;
 	uint32 *dest = (uint32 *)_renderSurface->pixels;
 	dest += area->top * _renderSurface->w + area->left;
 	if (target) { // restore to target instead of screen
@@ -1461,13 +1364,13 @@ void Screen::restore_area32(byte *pixels, Common::Rect *area,
 }
 
 
-byte *Screen::copy_area16(Common::Rect *area, byte *buf) {
+byte *Screen::copy_area16(const Common::Rect *area, byte *buf) {
 	uint16 *copied = (uint16 *)buf;
 	if (buf == nullptr) {
 		copied = (uint16 *)malloc(area->width() * area->height() * 2);
 	}
 	uint16 *dest = copied;
-	uint16 *src = (uint16 *)_renderSurface->pixels;
+	const uint16 *src = (const uint16 *)_renderSurface->pixels;
 	uint16 src_x_off = ABS(area->left);
 	uint16 src_y_off = ABS(area->top);
 	uint16 src_w = area->width();
@@ -1501,13 +1404,13 @@ byte *Screen::copy_area16(Common::Rect *area, byte *buf) {
 		dest += area->width();
 		src += _renderSurface->w;
 	}
-	return ((byte *)copied);
+	return (byte *)copied;
 }
 
 
-void Screen::restore_area16(byte *pixels, Common::Rect *area,
-							byte *target, Common::Rect *target_area, bool free_src) {
-	uint16 *src = (uint16 *)pixels;
+void Screen::restore_area16(byte *pixels, const Common::Rect *area,
+							byte *target, const Common::Rect *target_area, bool free_src) {
+	const uint16 *src = (const uint16 *)pixels;
 	uint16 *dest = (uint16 *)_renderSurface->pixels;
 	dest += area->top * _renderSurface->w + area->left;
 	if (target) { // restore to target instead of screen
diff --git a/engines/ultima/nuvie/screen/screen.h b/engines/ultima/nuvie/screen/screen.h
index fd5577f8591..1923bb653df 100644
--- a/engines/ultima/nuvie/screen/screen.h
+++ b/engines/ultima/nuvie/screen/screen.h
@@ -25,7 +25,6 @@
 #include "ultima/shared/std/string.h"
 #include "ultima/nuvie/core/game.h"
 #include "ultima/nuvie/screen/surface.h"
-#include "ultima/nuvie/screen/scale.h"
 #include "graphics/screen.h"
 
 namespace Ultima {
@@ -42,12 +41,7 @@ private:
 	const Configuration *config;
 	Graphics::Screen *_rawSurface;
 	RenderSurface *_renderSurface;
-	ScalerRegistry     scaler_reg;     // Scaler Registry
-	const ScalerStruct *scaler;        // Scaler
-	int scaler_index;  // Index of Current Scaler
-	int scale_factor;  // Scale factor
 
-	bool doubleBuffer;
 	bool is_no_darkness;
 	bool non_square_pixels;
 
@@ -70,12 +64,6 @@ public:
 	bool is_non_square_pixels() {
 		return non_square_pixels;
 	}
-	int get_scaler_index() {
-		return scaler_index;
-	}
-	ScalerRegistry *get_scaler_reg() {
-		return &scaler_reg;
-	}
 	bool toggle_darkness_cheat();
 	bool toggle_fullscreen();
 	bool set_fullscreen(bool value);
@@ -85,15 +73,10 @@ public:
 	bool clear(sint16 x, sint16 y, sint16 w, sint16 h, Common::Rect *clip_rect = nullptr);
 	void *get_pixels();
 	const byte *get_surface_pixels() {
-		return (_renderSurface->get_pixels());
+		return _renderSurface->get_pixels();
 	}
-	uint16 get_pitch();
 	Graphics::ManagedSurface *create_sdl_surface_from(byte *src_buf, uint16 src_bpp, uint16 src_w, uint16 src_h, uint16 src_pitch);
 	Graphics::ManagedSurface *create_sdl_surface_8(byte *src_buf, uint16 src_w, uint16 src_h);
-	uint16 get_bpp();
-	int get_scale_factor() const {
-		return scale_factor;
-	}
 	Graphics::ManagedSurface *get_sdl_surface();
 	uint16 get_width() const {
 		return width;
@@ -101,8 +84,6 @@ public:
 	uint16 get_height() const {
 		return height;
 	}
-	uint16 get_translated_x(uint16 x) const;
-	uint16 get_translated_y(uint16 y) const;
 
 	bool fill(uint8 colour_num, uint16 x, uint16 y, sint16 w, sint16 h);
 	void fade(uint16 dest_x, uint16 dest_y, uint16 src_w, uint16 src_h, uint8 opacity, uint8 fade_bg_color = 0);
@@ -136,10 +117,6 @@ public:
 	void update();
 	void update(int x, int y, uint16 w, uint16 h);
 	void preformUpdate();
-	void lock();
-	void unlock();
-
-	bool initScaler();
 
 	byte *copy_area(Common::Rect *area = nullptr, byte *buf = nullptr);
 	byte *copy_area(Common::Rect *area, uint16 down_scale);
@@ -174,19 +151,17 @@ protected:
 
 	inline void blitbitmap32(uint16 dest_x, uint16 dest_y, const byte *src_buf, uint16 src_w, uint16 src_h, uint8 fg_color, uint8 bg_color);
 
-	byte *copy_area16(Common::Rect *area, uint16 down_scale);
-	byte *copy_area32(Common::Rect *area, uint16 down_scale);
+	byte *copy_area16(const Common::Rect *area, uint16 down_scale);
+	byte *copy_area32(const Common::Rect *area, uint16 down_scale);
 
-	byte *copy_area16(Common::Rect *area, byte *buf);
-	byte *copy_area32(Common::Rect *area, byte *buf);
-	void restore_area16(byte *pixels, Common::Rect *area, byte *target = nullptr, Common::Rect *target_area = nullptr, bool free_src = true);
-	void restore_area32(byte *pixels, Common::Rect *area, byte *target = nullptr, Common::Rect *target_area = nullptr, bool free_src = true);
+	byte *copy_area16(const Common::Rect *area, byte *buf);
+	byte *copy_area32(const Common::Rect *area, byte *buf);
+	void restore_area16(byte *pixels, const Common::Rect *area, byte *target = nullptr, const Common::Rect *target_area = nullptr, bool free_src = true);
+	void restore_area32(byte *pixels, const Common::Rect *area, byte *target = nullptr, const Common::Rect *target_area = nullptr, bool free_src = true);
 
 	void set_screen_mode();
 
 private:
-	int get_screen_bpp();
-
 	bool sdl1_toggle_fullscreen();
 };
 


Commit: d85afbefdf5a30a9cf0f51a673e7efc1e929d962
    https://github.com/scummvm/scummvm/commit/d85afbefdf5a30a9cf0f51a673e7efc1e929d962
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2023-12-09T13:56:10+11:00

Commit Message:
ULTIMA: NUVIE: Clean up more unused screen features

Changed paths:
    engines/ultima/nuvie/core/game.cpp
    engines/ultima/nuvie/gui/gui.cpp
    engines/ultima/nuvie/gui/gui_console.cpp
    engines/ultima/nuvie/gui/gui_types.h
    engines/ultima/nuvie/gui/widgets/console.cpp
    engines/ultima/nuvie/gui/widgets/map_window.cpp
    engines/ultima/nuvie/misc/sdl_compat.cpp
    engines/ultima/nuvie/misc/sdl_compat.h
    engines/ultima/nuvie/screen/screen.cpp
    engines/ultima/nuvie/screen/screen.h
    engines/ultima/nuvie/script/script_cutscene.cpp


diff --git a/engines/ultima/nuvie/core/game.cpp b/engines/ultima/nuvie/core/game.cpp
index 522ff1d32f5..eaff2659734 100644
--- a/engines/ultima/nuvie/core/game.cpp
+++ b/engines/ultima/nuvie/core/game.cpp
@@ -620,7 +620,7 @@ void Game::play() {
 		gui->Display();
 		if (cursor) cursor->display();
 
-		screen->preformUpdate();
+		screen->performUpdate();
 		sound_manager->update();
 		event->wait();
 	}
@@ -665,7 +665,7 @@ void Game::update_once_display() {
 	gui->Display();
 	if (cursor) cursor->display();
 
-	screen->preformUpdate();
+	screen->performUpdate();
 	sound_manager->update();
 	event->wait();
 }
diff --git a/engines/ultima/nuvie/gui/gui.cpp b/engines/ultima/nuvie/gui/gui.cpp
index ac69b1af5ed..bcada75ff37 100644
--- a/engines/ultima/nuvie/gui/gui.cpp
+++ b/engines/ultima/nuvie/gui/gui.cpp
@@ -42,14 +42,9 @@ GUI::GUI(const Configuration *c, Screen *s) : config(c), screen(s), numwidgets(0
 		maxwidgets(0), widgets(nullptr), display(1), running(0), dragging(false),
 		full_redraw(true), focused_widget(nullptr), locked_widget(nullptr),
 		block_input(false) {
-	Graphics::ManagedSurface *sdl_surface;
-
 	gui = this;
-
-	sdl_surface = screen->get_sdl_surface();
-
 	selected_color = new GUI_Color(10, 10, 50);
-	selected_color->map_color(sdl_surface);
+	selected_color->map_color(screen->get_sdl_surface()->format);
 
 	gui_font = new GUI_Font();
 	gui_drag_manager = new GUI_DragManager(screen);
diff --git a/engines/ultima/nuvie/gui/gui_console.cpp b/engines/ultima/nuvie/gui/gui_console.cpp
index 78741c2de4f..e685f782d91 100644
--- a/engines/ultima/nuvie/gui/gui_console.cpp
+++ b/engines/ultima/nuvie/gui/gui_console.cpp
@@ -46,16 +46,12 @@ GUI_Console::~GUI_Console() {
 /* Map the color to the display */
 void GUI_Console::SetDisplay(Screen *s) {
 	GUI_Widget::SetDisplay(s);
-	bg_color->map_color(surface);
+	bg_color->map_color(surface->format);
 }
 
 /* Show the widget  */
 void GUI_Console:: Display(bool full_redraw) {
-	Common::Rect framerect;
-
-	framerect = area;
-
-	SDL_FillRect(surface, &framerect, bg_color->sdl_color);
+	SDL_FillRect(surface, &area, bg_color->sdl_color);
 
 	uint16 i = 0;
 	for (const Std::string &s : data) {
diff --git a/engines/ultima/nuvie/gui/gui_types.h b/engines/ultima/nuvie/gui/gui_types.h
index 80f290c3077..f2d100a3914 100644
--- a/engines/ultima/nuvie/gui/gui_types.h
+++ b/engines/ultima/nuvie/gui/gui_types.h
@@ -56,18 +56,14 @@ public:
 
 public:
 
-	GUI_Color(uint8 red, uint8 green, uint8 blue) {
-		r = red;
-		g = green;
-		b = blue;
-		sdl_color = 0;
+	GUI_Color(uint8 red, uint8 green, uint8 blue)
+		: r(red), g(green), b(blue), sdl_color(0) {
 	};
-	GUI_Color() {
-		r = g = b = 0;
-		sdl_color = 0;
+	GUI_Color()
+		: r(0), g(0), b(0), sdl_color(0) {
 	};
-	void map_color(Graphics::ManagedSurface *surface) {
-		sdl_color = SDL_MapRGB(surface->format, r, g, b);
+	void map_color(const Graphics::PixelFormat &format) {
+		sdl_color = SDL_MapRGB(format, r, g, b);
 	};
 
 };
diff --git a/engines/ultima/nuvie/gui/widgets/console.cpp b/engines/ultima/nuvie/gui/widgets/console.cpp
index 4d995ff11c3..896654bee58 100644
--- a/engines/ultima/nuvie/gui/widgets/console.cpp
+++ b/engines/ultima/nuvie/gui/widgets/console.cpp
@@ -49,7 +49,7 @@ void Console::AddLine(const Std::string &line) {
 
 	if (status == WIDGET_VISIBLE) {
 		gui->Display();
-		screen->preformUpdate();
+		screen->performUpdate();
 	}
 }
 
diff --git a/engines/ultima/nuvie/gui/widgets/map_window.cpp b/engines/ultima/nuvie/gui/widgets/map_window.cpp
index 79f2d93df81..e98c651b04e 100644
--- a/engines/ultima/nuvie/gui/widgets/map_window.cpp
+++ b/engines/ultima/nuvie/gui/widgets/map_window.cpp
@@ -681,7 +681,7 @@ void MapWindow::createLightOverlay() {
 	else if (weather->is_eclipse())  //solar eclipse
 		a = cur_min_brightness;
 	else if (h == 19) { //Dusk -- Smooth transition between 255 and min_brightness during first 59 minutes
-		if (screen->get_lighting_style() == LIGHTING_STYLE_SMOOTH) {
+		if (screen->get_lighting_style() == LightingSmooth) {
 			dawn_or_dusk = true;
 			a = 255 - (uint8)((255.0f - cur_min_brightness) * (float)clock->get_minute() / 59.0f);
 		} else {
@@ -690,7 +690,7 @@ void MapWindow::createLightOverlay() {
 				a = cur_min_brightness;
 		}
 	} else if (h == 5) { //Dawn -- Smooth transition between min_brightness and 255 during first 59 minutes
-		if (screen->get_lighting_style() == LIGHTING_STYLE_SMOOTH) {
+		if (screen->get_lighting_style() == LightingSmooth) {
 			dawn_or_dusk = true;
 			a = cur_min_brightness + (255.0f - cur_min_brightness) * (float)clock->get_minute() / 59.0f;
 		} else {
@@ -708,10 +708,10 @@ void MapWindow::createLightOverlay() {
 
 	bool party_light_source;
 	// smooth seems to need an enormous range in order to have smooth transitions
-	if (a < (screen->get_lighting_style() == LIGHTING_STYLE_SMOOTH ? 248 : 81) &&
+	if (a < (screen->get_lighting_style() == LightingSmooth ? 248 : 81) &&
 	        (game->get_party()->has_light_source() || clock->get_timer(GAMECLOCK_TIMER_U6_LIGHT) != 0)) { //FIXME U6 specific
 		party_light_source = true;
-		if (screen->get_lighting_style() == LIGHTING_STYLE_SMOOTH) {
+		if (screen->get_lighting_style() == LightingSmooth) {
 			if (!dawn_or_dusk) // preserve a when dusk or dawn so we have the correct opacity
 				a = cur_min_brightness;
 		} else
diff --git a/engines/ultima/nuvie/misc/sdl_compat.cpp b/engines/ultima/nuvie/misc/sdl_compat.cpp
index dbe6c9df4df..48926ae9b02 100644
--- a/engines/ultima/nuvie/misc/sdl_compat.cpp
+++ b/engines/ultima/nuvie/misc/sdl_compat.cpp
@@ -41,7 +41,7 @@ void SDL_FreeSurface(Graphics::ManagedSurface *&s) {
 	s = nullptr;
 }
 
-uint32 SDL_MapRGB(Graphics::PixelFormat &format, byte r, byte g, byte b) {
+uint32 SDL_MapRGB(const Graphics::PixelFormat &format, byte r, byte g, byte b) {
 	return format.RGBToColor(r, g, b);
 }
 
@@ -60,7 +60,7 @@ int SDL_BlitSurface(const Graphics::ManagedSurface *src, const Common::Rect *src
 	return 0;
 }
 
-int SDL_FillRect(Graphics::ManagedSurface *surf, Common::Rect *rect, uint color) {
+int SDL_FillRect(Graphics::ManagedSurface *surf, const Common::Rect *rect, uint color) {
 	surf->fillRect(rect ? *rect : Common::Rect(0, 0, surf->w, surf->h), color);
 	return 0;
 }
diff --git a/engines/ultima/nuvie/misc/sdl_compat.h b/engines/ultima/nuvie/misc/sdl_compat.h
index 883fcdf71bb..8f7a1b014c7 100644
--- a/engines/ultima/nuvie/misc/sdl_compat.h
+++ b/engines/ultima/nuvie/misc/sdl_compat.h
@@ -34,10 +34,10 @@ namespace Nuvie {
 
 extern uint32 SDL_GetTicks();
 extern void SDL_FreeSurface(Graphics::ManagedSurface *&s);
-extern uint32 SDL_MapRGB(Graphics::PixelFormat &format, byte r, byte g, byte b);
+extern uint32 SDL_MapRGB(const Graphics::PixelFormat &format, byte r, byte g, byte b);
 extern int SDL_BlitSurface(const Graphics::ManagedSurface *src, const Common::Rect *srcrect,
 	Graphics::ManagedSurface *dst, Common::Rect *dstrect);
-extern int SDL_FillRect(Graphics::ManagedSurface *surf, Common::Rect *rect, uint color);
+extern int SDL_FillRect(Graphics::ManagedSurface *surf, const Common::Rect *rect, uint color);
 extern Graphics::ManagedSurface *SDL_LoadBMP(const char *filename);
 extern int SDL_SetColorKey(Graphics::ManagedSurface *surface, int flag, uint32 key);
 extern int SDL_WaitEvent(Common::Event *event);
diff --git a/engines/ultima/nuvie/screen/screen.cpp b/engines/ultima/nuvie/screen/screen.cpp
index 67fa67b6428..5de8d3a5dff 100644
--- a/engines/ultima/nuvie/screen/screen.cpp
+++ b/engines/ultima/nuvie/screen/screen.cpp
@@ -49,11 +49,11 @@ Screen::Screen(const Configuration *cfg) : config(cfg), _rawSurface(nullptr),
 	config->value("config/general/lighting", str_lighting_style);
 
 	if (str_lighting_style == "none")
-		lighting_style = LIGHTING_STYLE_NONE;
+		lighting_style = LightingNone;
 	else if (str_lighting_style == "smooth")
-		lighting_style = LIGHTING_STYLE_SMOOTH;
+		lighting_style = LightingSmooth;
 	else
-		lighting_style = LIGHTING_STYLE_ORIGINAL;
+		lighting_style = LightingOriginal;
 	old_lighting_style = lighting_style;
 	memset(shading_globe, 0, sizeof(shading_globe));
 }
@@ -72,8 +72,6 @@ Screen::~Screen() {
 }
 
 bool Screen::init() {
-	Std::string str;
-
 	int new_width, new_height;
 	config->value("config/video/screen_width", new_width, 320);
 	config->value("config/video/screen_height", new_height, 200);
@@ -94,32 +92,27 @@ bool Screen::init() {
 	return true;
 }
 
-void Screen::set_lighting_style(int lighting) {
-	lighting_style = lighting;
-	old_lighting_style = lighting;
-}
-
 bool Screen::toggle_darkness_cheat() {
 	is_no_darkness = !is_no_darkness;
 	if (is_no_darkness) {
 		old_lighting_style = lighting_style;
-		lighting_style = LIGHTING_STYLE_NONE;
+		lighting_style = LightingNone;
 	} else
 		lighting_style = old_lighting_style;
 	return is_no_darkness;
 }
 
 
-bool Screen::set_palette(uint8 *p) {
+bool Screen::set_palette(const uint8 *p) {
 	if (_renderSurface == nullptr || p == nullptr)
 		return false;
 
 	for (int i = 0; i < 256; ++i) {
-		uint32  r = p[i * 3];
-		uint32  g = p[i * 3 + 1];
-		uint32  b = p[i * 3 + 2];
+		uint32 r = p[i * 3];
+		uint32 g = p[i * 3 + 1];
+		uint32 b = p[i * 3 + 2];
 
-		uint32  c = ((r >> RenderSurface::Rloss) << RenderSurface::Rshift) | ((g >> RenderSurface::Gloss) << RenderSurface::Gshift) | ((b >> RenderSurface::Bloss) << RenderSurface::Bshift);
+		uint32 c = ((r >> RenderSurface::Rloss) << RenderSurface::Rshift) | ((g >> RenderSurface::Gloss) << RenderSurface::Gshift) | ((b >> RenderSurface::Bloss) << RenderSurface::Bshift);
 
 		_renderSurface->colour32[i] = c;
 	}
@@ -150,11 +143,7 @@ bool Screen::rotate_palette(uint8 pos, uint8 length) {
 }
 
 bool Screen::clear(sint16 x, sint16 y, sint16 w, sint16 h, Common::Rect *clip_rect) {
-	uint8 *pixels;
-	uint16 i;
-	uint16 x1, y1;
-
-	pixels = (uint8 *)_renderSurface->pixels;
+	uint8 *pixels = (uint8 *)_renderSurface->pixels;
 
 	if (x >= width || y >= height)
 		return false;
@@ -184,8 +173,8 @@ bool Screen::clear(sint16 x, sint16 y, sint16 w, sint16 h, Common::Rect *clip_re
 		h = height - y;
 
 	if (clip_rect) {
-		x1 = x;
-		y1 = y;
+		uint16 x1 = x;
+		uint16 y1 = y;
 		if (x < clip_rect->left)
 			x = clip_rect->left;
 
@@ -207,7 +196,7 @@ bool Screen::clear(sint16 x, sint16 y, sint16 w, sint16 h, Common::Rect *clip_re
 
 	pixels += y * _renderSurface->pitch + (x * _renderSurface->bytes_per_pixel);
 
-	for (i = 0; i < h; i++) {
+	for (uint16 i = 0; i < h; i++) {
 		memset(pixels, 0, w * _renderSurface->bytes_per_pixel);
 		pixels += _renderSurface->pitch;
 	}
@@ -235,15 +224,12 @@ bool Screen::fill(uint8 colour_num, uint16 x, uint16 y, sint16 w, sint16 h) {
 }
 
 bool Screen::fill16(uint8 colour_num, uint16 x, uint16 y, sint16 w, sint16 h) {
-	uint16 *pixels;
-	uint16 i, j;
-
-	pixels = (uint16 *)_renderSurface->pixels;
+	uint16 *pixels = (uint16 *)_renderSurface->pixels;
 
 	pixels += y * _renderSurface->w + x;
 
-	for (i = 0; i < h; i++) {
-		for (j = 0; j < w; j++)
+	for (uint16 i = 0; i < h; i++) {
+		for (uint16 j = 0; j < w; j++)
 			pixels[j] = (uint16)_renderSurface->colour32[colour_num];
 
 		pixels += _renderSurface->w;
@@ -253,16 +239,12 @@ bool Screen::fill16(uint8 colour_num, uint16 x, uint16 y, sint16 w, sint16 h) {
 }
 
 bool Screen::fill32(uint8 colour_num, uint16 x, uint16 y, sint16 w, sint16 h) {
-	uint32 *pixels;
-	uint16 i, j;
-
-
-	pixels = (uint32 *)_renderSurface->pixels;
+	uint32 *pixels = (uint32 *)_renderSurface->pixels;
 
 	pixels += y * _renderSurface->w + x;
 
-	for (i = 0; i < h; i++) {
-		for (j = 0; j < w; j++)
+	for (uint16 i = 0; i < h; i++) {
+		for (uint16 j = 0; j < w; j++)
 			pixels[j] = _renderSurface->colour32[colour_num];
 
 		pixels += _renderSurface->w;
@@ -270,6 +252,7 @@ bool Screen::fill32(uint8 colour_num, uint16 x, uint16 y, sint16 w, sint16 h) {
 
 	return true;
 }
+
 void Screen::fade(uint16 dest_x, uint16 dest_y, uint16 src_w, uint16 src_h, uint8 opacity, uint8 fade_bg_color) {
 	if (_renderSurface->bits_per_pixel == 16)
 		fade16(dest_x, dest_y, src_w, src_h, opacity, fade_bg_color);
@@ -279,15 +262,12 @@ void Screen::fade(uint16 dest_x, uint16 dest_y, uint16 src_w, uint16 src_h, uint
 
 void Screen::fade16(uint16 dest_x, uint16 dest_y, uint16 src_w, uint16 src_h, uint8 opacity, uint8 fade_bg_color) {
 	uint16 bg = (uint16)_renderSurface->colour32[fade_bg_color];
-	uint16 *pixels;
-	uint16 i, j;
-
-	pixels = (uint16 *)_renderSurface->pixels;
+	uint16 *pixels = (uint16 *)_renderSurface->pixels;
 
 	pixels += dest_y * _renderSurface->w + dest_x;
 
-	for (i = 0; i < src_h; i++) {
-		for (j = 0; j < src_w; j++) {
+	for (uint16 i = 0; i < src_h; i++) {
+		for (uint16 j = 0; j < src_w; j++) {
 			pixels[j] = blendpixel16(bg, pixels[j], opacity);
 		}
 
@@ -299,15 +279,12 @@ void Screen::fade16(uint16 dest_x, uint16 dest_y, uint16 src_w, uint16 src_h, ui
 
 void Screen::fade32(uint16 dest_x, uint16 dest_y, uint16 src_w, uint16 src_h, uint8 opacity, uint8 fade_bg_color) {
 	uint32 bg = _renderSurface->colour32[fade_bg_color];
-	uint32 *pixels;
-	uint16 i, j;
-
-	pixels = (uint32 *)_renderSurface->pixels;
+	uint32 *pixels = (uint32 *)_renderSurface->pixels;
 
 	pixels += dest_y * _renderSurface->w + dest_x;
 
-	for (i = 0; i < src_h; i++) {
-		for (j = 0; j < src_w; j++) {
+	for (uint16 i = 0; i < src_h; i++) {
+		for (uint16 j = 0; j < src_w; j++) {
 			pixels[j] = blendpixel32(bg, pixels[j], opacity);
 		}
 
@@ -384,14 +361,6 @@ void Screen::put_pixel(uint8 colour_num, uint16 x, uint16 y) {
 	}
 }
 
-void *Screen::get_pixels() {
-//if(scaled_surface == nullptr)
-//   return nullptr;
-
-//return scaled_surface->pixels;
-	return nullptr;
-}
-
 Graphics::ManagedSurface *Screen::get_sdl_surface() {
 	if (_renderSurface)
 		return _renderSurface->get_sdl_surface();
@@ -402,10 +371,7 @@ Graphics::ManagedSurface *Screen::get_sdl_surface() {
 bool Screen::blit(int32 dest_x, int32 dest_y, const byte *src_buf, uint16 src_bpp,
 		uint16 src_w, uint16 src_h, uint16 src_pitch, bool trans,
 		const Common::Rect *clip_rect, uint8 opacity) {
-	uint16 src_x = 0;
-	uint16 src_y = 0;
-
-// clip to screen.
+	// clip to screen.
 
 	if (dest_x >= width || dest_y >= height)
 		return false;
@@ -436,9 +402,10 @@ bool Screen::blit(int32 dest_x, int32 dest_y, const byte *src_buf, uint16 src_bp
 	if (dest_y + src_h >= height)
 		src_h = height - dest_y;
 
-//clip to rect if required.
-
+	//clip to rect if required.
 	if (clip_rect) {
+		uint16 src_x = 0;
+		uint16 src_y = 0;
 		if (dest_x + src_w < clip_rect->left || dest_y + src_h < clip_rect->top)
 			return false;
 
@@ -498,9 +465,7 @@ inline uint32 Screen::blendpixel32(uint32 p, uint32 p1, uint8 opacity) {
 }
 
 inline bool Screen::blit16(uint16 dest_x, uint16 dest_y, const byte *src_buf, uint16 src_bpp, uint16 src_w, uint16 src_h, uint16 src_pitch, bool trans) {
-	uint16 *pixels = (uint16 *)_renderSurface->pixels;
-
-	pixels += dest_y * _renderSurface->w + dest_x;
+	uint16 *pixels = (uint16 *)_renderSurface->pixels + dest_y * _renderSurface->w + dest_x;
 
 	if (trans) {
 		for (int i = 0; i < src_h; i++) {
@@ -525,9 +490,7 @@ inline bool Screen::blit16(uint16 dest_x, uint16 dest_y, const byte *src_buf, ui
 }
 
 inline bool Screen::blit16WithOpacity(uint16 dest_x, uint16 dest_y, const byte *src_buf, uint16 src_bpp, uint16 src_w, uint16 src_h, uint16 src_pitch, bool trans, uint8 opacity) {
-	uint16 *pixels = (uint16 *)_renderSurface->pixels;
-
-	pixels += dest_y * _renderSurface->w + dest_x;
+	uint16 *pixels = (uint16 *)_renderSurface->pixels + dest_y * _renderSurface->w + dest_x;
 
 	if (trans) {
 		for (int i = 0; i < src_h; i++) {
@@ -552,10 +515,7 @@ inline bool Screen::blit16WithOpacity(uint16 dest_x, uint16 dest_y, const byte *
 }
 
 bool Screen::blit32(uint16 dest_x, uint16 dest_y, const byte *src_buf, uint16 src_bpp, uint16 src_w, uint16 src_h, uint16 src_pitch, bool trans) {
-	uint32 *pixels = (uint32 *)_renderSurface->pixels;
-
-	pixels += dest_y * _renderSurface->w + dest_x;
-
+	uint32 *pixels = (uint32 *)_renderSurface->pixels + dest_y * _renderSurface->w + dest_x;
 
 	if (trans) {
 		for (int i = 0; i < src_h; i++) {
@@ -580,10 +540,7 @@ bool Screen::blit32(uint16 dest_x, uint16 dest_y, const byte *src_buf, uint16 sr
 }
 
 bool Screen::blit32WithOpacity(uint16 dest_x, uint16 dest_y, const byte *src_buf, uint16 src_bpp, uint16 src_w, uint16 src_h, uint16 src_pitch, bool trans, uint8 opacity) {
-	uint32 *pixels = (uint32 *)_renderSurface->pixels;
-
-	pixels += dest_y * _renderSurface->w + dest_x;
-
+	uint32 *pixels = (uint32 *)_renderSurface->pixels + dest_y * _renderSurface->w + dest_x;
 
 	if (trans) {
 		for (int i = 0; i < src_h; i++) {
@@ -617,9 +574,7 @@ void Screen::blitbitmap(uint16 dest_x, uint16 dest_y, const byte *src_buf, uint1
 }
 
 void Screen::blitbitmap16(uint16 dest_x, uint16 dest_y, const byte *src_buf, uint16 src_w, uint16 src_h, uint8 fg_color, uint8 bg_color) {
-	uint16 *pixels = (uint16 *)_renderSurface->pixels;
-
-	pixels += dest_y * _renderSurface->w + dest_x;
+	uint16 *pixels = (uint16 *)_renderSurface->pixels + dest_y * _renderSurface->w + dest_x;
 
 	for (int i = 0; i < src_h; i++) {
 		for (int j = 0; j < src_w; j++) {
@@ -636,9 +591,7 @@ void Screen::blitbitmap16(uint16 dest_x, uint16 dest_y, const byte *src_buf, uin
 }
 
 void Screen::blitbitmap32(uint16 dest_x, uint16 dest_y, const byte *src_buf, uint16 src_w, uint16 src_h, uint8 fg_color, uint8 bg_color) {
-	uint32 *pixels = (uint32 *)_renderSurface->pixels;
-
-	pixels += dest_y * _renderSurface->w + dest_x;
+	uint32 *pixels = (uint32 *)_renderSurface->pixels + dest_y * _renderSurface->w + dest_x;
 
 	for (int i = 0; i < src_h; i++) {
 		for (int j = 0; j < src_w; j++) {
@@ -774,12 +727,12 @@ static const char TileGlobe[][11 * 11] = {
 void Screen::clearalphamap8(uint16 x, uint16 y, uint16 w, uint16 h, uint8 opacity, bool party_light_source) {
 	switch (lighting_style) {
 	default:
-	case LIGHTING_STYLE_NONE:
+	case LightingNone:
 		return;
-	case LIGHTING_STYLE_SMOOTH:
+	case LightingSmooth:
 		shading_ambient = opacity;
 		break;
-	case LIGHTING_STYLE_ORIGINAL:
+	case LightingOriginal:
 		if (opacity < 0xFF)
 			shading_ambient = 0;
 		else
@@ -790,10 +743,10 @@ void Screen::clearalphamap8(uint16 x, uint16 y, uint16 w, uint16 h, uint8 opacit
 	if (shading_data == nullptr) {
 		shading_rect.left = x;
 		shading_rect.top = y;
-		if (lighting_style == LIGHTING_STYLE_ORIGINAL) {
+		if (lighting_style == LightingOriginal) {
 			shading_rect.setWidth(w + (SHADING_BORDER * 2));
 			shading_rect.setHeight(h + (SHADING_BORDER * 2));
-		} else { // LIGHTING_STYLE_SMOOTH
+		} else { // LightingSmooth
 			shading_rect.setWidth((w + (SHADING_BORDER * 2)) * 16 + 8);
 			shading_rect.setHeight((h + (SHADING_BORDER * 2)) * 16 + 8);
 		}
@@ -815,9 +768,9 @@ void Screen::clearalphamap8(uint16 x, uint16 y, uint16 w, uint16 h, uint8 opacit
 	else
 		x_off = 0;
 	//Light globe around the avatar
-	if (lighting_style == LIGHTING_STYLE_ORIGINAL)
+	if (lighting_style == LightingOriginal)
 		drawalphamap8globe((shading_rect.width() - 1 + x_off / 16) / 2 - SHADING_BORDER, (shading_rect.height() - 1) / 2 - SHADING_BORDER, opacity / 20 + 4); //range 4 - 10
-	else if (lighting_style == LIGHTING_STYLE_SMOOTH)
+	else if (lighting_style == LightingSmooth)
 		drawalphamap8globe((((shading_rect.width() - 8 + x_off) / 16) - 1) / 2 - SHADING_BORDER, (((shading_rect.height() - 8) / 16) - 1) / 2 - SHADING_BORDER, party_light_source ? 5 : 4);
 }
 
@@ -864,15 +817,15 @@ void Screen::buildalphamap8() {
 void Screen::drawalphamap8globe(sint16 x, sint16 y, uint16 r) {
 // check shouldn't be needed since items only have 3 intensites
 	//Clamp lighting globe size to 0-4 (5 levels) // 4 - 10 (7 levels) now in orig_style now like original
-//    if( r > NUM_GLOBES && lighting_style != LIGHTING_STYLE_ORIGINAL)
+//    if( r > NUM_GLOBES && lighting_style != LightingOriginal)
 //        r = NUM_GLOBES;
 	if (r < 1)
 		return;
 	if (shading_ambient == 0xFF)
 		return;
-	if (lighting_style == LIGHTING_STYLE_NONE)
+	if (lighting_style == LightingNone)
 		return;
-	if (lighting_style == LIGHTING_STYLE_ORIGINAL) {
+	if (lighting_style == LightingOriginal) {
 		uint8 rad;
 		if (r < 6)
 			rad = r - 1;
@@ -916,12 +869,12 @@ void Screen::blitalphamap8(sint16 x, sint16 y, Common::Rect *clip_rect) {
 
 	if (shading_ambient == 0xFF)
 		return;
-	if (lighting_style == LIGHTING_STYLE_NONE)
+	if (lighting_style == LightingNone)
 		return;
 
 	Game *game = Game::get_game();
 
-	if (lighting_style == LIGHTING_STYLE_ORIGINAL) {
+	if (lighting_style == LightingOriginal) {
 
 		for (int j = SHADING_BORDER; j < shading_rect.height() - SHADING_BORDER; j++) {
 			for (int i = SHADING_BORDER; i < shading_rect.width() - SHADING_BORDER; i++) {
@@ -938,7 +891,7 @@ void Screen::blitalphamap8(sint16 x, sint16 y, Common::Rect *clip_rect) {
 	uint16 src_x = SHADING_BORDER * 16;
 	uint16 src_y = SHADING_BORDER * 16;
 
-	uint8 *src_buf = shading_data;
+	const uint8 *src_buf = shading_data;
 
 	// clip to screen.
 
@@ -1008,9 +961,8 @@ void Screen::blitalphamap8(sint16 x, sint16 y, Common::Rect *clip_rect) {
 
 
 	switch (_renderSurface->bits_per_pixel) {
-	case 16:
-		uint16 *pixels16;
-		pixels16 = (uint16 *)_renderSurface->pixels;
+	case 16: {
+		uint16 *pixels16 = (uint16 *)_renderSurface->pixels;
 
 		pixels16 += y * _renderSurface->w + x;
 
@@ -1023,12 +975,11 @@ void Screen::blitalphamap8(sint16 x, sint16 y, Common::Rect *clip_rect) {
 			pixels16 += _renderSurface->w;
 			src_buf += shading_rect.width();
 		}
-		return;
 		break;
+	}
 	case 24:
-	case 32:
-		uint32 *pixels;
-		pixels = (uint32 *)_renderSurface->pixels;
+	case 32: {
+		uint32 *pixels = (uint32 *)_renderSurface->pixels;
 
 		pixels += y * _renderSurface->w + x;
 
@@ -1041,25 +992,23 @@ void Screen::blitalphamap8(sint16 x, sint16 y, Common::Rect *clip_rect) {
 			pixels += _renderSurface->w;
 			src_buf += shading_rect.width();
 		}
-		return;
 		break;
+	}
 	default:
 		DEBUG(0, LEVEL_ERROR, "Screen::blitalphamap8() cannot handle your screen _renderSurface depth of %d\n", _renderSurface->bits_per_pixel);
 		break;
-		return;
 	}
-
 }
 
 
 /* Return an 8bit _renderSurface. Source format is assumed to be identical to screen. */
-Graphics::ManagedSurface *Screen::create_sdl_surface_8(byte *src_buf, uint16 src_w, uint16 src_h) {
+Graphics::ManagedSurface *Screen::create_sdl_surface_8(const byte *src_buf, uint16 src_w, uint16 src_h) {
 	Graphics::ManagedSurface *new_surface = new Graphics::ManagedSurface(src_w, src_h,
 		Graphics::PixelFormat::createFormatCLUT8());
 	byte *pixels = (byte *)new_surface->getPixels();
 
 	if (_renderSurface->bits_per_pixel == 16) {
-		uint16 *src = (uint16 *)src_buf;
+		const uint16 *src = (const uint16 *)src_buf;
 		for (int p = 0; p < (src_w * src_h); p++)
 			for (int i = 0; i < 256; i++) // convert to 8bpp
 				if (src[p] == (uint16)_renderSurface->colour32[i]) {
@@ -1079,11 +1028,8 @@ Graphics::ManagedSurface *Screen::create_sdl_surface_8(byte *src_buf, uint16 src
 }
 
 
-Graphics::ManagedSurface *Screen::create_sdl_surface_from(byte *src_buf, uint16 src_bpp, uint16 src_w, uint16 src_h, uint16 src_pitch) {
-	Graphics::ManagedSurface *new_surface;
-
-	new_surface = RenderSurface::createSurface(src_w, src_h,
-		_renderSurface->getFormat());
+Graphics::ManagedSurface *Screen::create_sdl_surface_from(const byte *src_buf, uint16 src_bpp, uint16 src_w, uint16 src_h, uint16 src_pitch) {
+	Graphics::ManagedSurface *new_surface = RenderSurface::createSurface(src_w, src_h, _renderSurface->getFormat());
 
 	if (_renderSurface->bits_per_pixel == 16) {
 		uint16 *pixels = (uint16 *)new_surface->getPixels();
@@ -1135,12 +1081,12 @@ void Screen::update(int x, int y, uint16 w, uint16 h) {
 	_rawSurface->getSubArea(Common::Rect(x, y, x + width, y + height));
 }
 
-void Screen::preformUpdate() {
+void Screen::performUpdate() {
 	_rawSurface->update();
 }
 
 void Screen::set_screen_mode() {
-	Graphics::PixelFormat SCREEN_FORMAT(2, 5, 6, 5, 0, 11, 5, 0, 0);
+	const Graphics::PixelFormat SCREEN_FORMAT(2, 5, 6, 5, 0, 11, 5, 0, 0);
 	initGraphics(width, height, &SCREEN_FORMAT);
 	_rawSurface = new Graphics::Screen(width, height, SCREEN_FORMAT);
 
@@ -1164,7 +1110,7 @@ bool Screen::set_fullscreen(bool value) {
 }
 
 //Note! assumes area divides evenly by down_scale factor
-byte *Screen::copy_area(Common::Rect *area, uint16 down_scale) {
+byte *Screen::copy_area(const Common::Rect *area, uint16 down_scale) {
 	if (_renderSurface->bits_per_pixel == 16)
 		return copy_area16(area, down_scale);
 
@@ -1272,7 +1218,7 @@ byte *Screen::copy_area32(const Common::Rect *area, uint16 down_scale) {
 
 // _renderSurface -> byte *
 // (nullptr area = entire screen)
-byte *Screen::copy_area(Common::Rect *area, byte *buf) {
+byte *Screen::copy_area(const Common::Rect *area, byte *buf) {
 	Common::Rect screen_area(0, 0, _renderSurface->w, _renderSurface->h);
 	if (!area)
 		area = &screen_area;
@@ -1286,8 +1232,8 @@ byte *Screen::copy_area(Common::Rect *area, byte *buf) {
 // byte * -> _renderSurface
 // byte * -> target (src area still means location on screen, not relative to target)
 // (nullptr area = entire screen)
-void Screen::restore_area(byte *pixels, Common::Rect *area,
-						  byte *target, Common::Rect *target_area, bool free_src) {
+void Screen::restore_area(byte *pixels, const Common::Rect *area,
+						  byte *target, const Common::Rect *target_area, bool free_src) {
 	Common::Rect screen_area(0, 0, _renderSurface->w, _renderSurface->h);
 	if (!area)
 		area = &screen_area;
@@ -1333,8 +1279,8 @@ byte *Screen::copy_area32(const Common::Rect *area, byte *buf) {
 
 	src += src_y_off * _renderSurface->w + src_x_off;
 
-	for (uint32 i = 0; i < src_h; i++) {
-		for (uint32 j = 0; j < src_w; j++)
+	for (int i = 0; i < src_h; i++) {
+		for (int j = 0; j < src_w; j++)
 			dest[j] = src[j];
 		dest += area->width();
 		src += _renderSurface->w;
@@ -1398,8 +1344,8 @@ byte *Screen::copy_area16(const Common::Rect *area, byte *buf) {
 
 	src += src_y_off * _renderSurface->w + src_x_off;
 
-	for (uint32 i = 0; i < src_h; i++) {
-		for (uint32 j = 0; j < src_w; j++)
+	for (int i = 0; i < src_h; i++) {
+		for (int j = 0; j < src_w; j++)
 			dest[j] = src[j];
 		dest += area->width();
 		src += _renderSurface->w;
diff --git a/engines/ultima/nuvie/screen/screen.h b/engines/ultima/nuvie/screen/screen.h
index 1923bb653df..a961f3b613d 100644
--- a/engines/ultima/nuvie/screen/screen.h
+++ b/engines/ultima/nuvie/screen/screen.h
@@ -30,12 +30,14 @@
 namespace Ultima {
 namespace Nuvie {
 
-#define LIGHTING_STYLE_NONE 0
-#define LIGHTING_STYLE_SMOOTH 1
-#define LIGHTING_STYLE_ORIGINAL 2
-
 class Configuration;
 
+enum LightingStyle {
+	LightingNone,
+	LightingSmooth,
+	LightingOriginal
+};
+
 class Screen {
 private:
 	const Configuration *config;
@@ -61,22 +63,18 @@ public:
 	bool init();
 
 	bool is_fullscreen() const;
-	bool is_non_square_pixels() {
+	bool is_non_square_pixels() const {
 		return non_square_pixels;
 	}
 	bool toggle_darkness_cheat();
 	bool toggle_fullscreen();
 	bool set_fullscreen(bool value);
-	bool set_palette(uint8 *palette);
+	bool set_palette(const uint8 *palette);
 	bool set_palette_entry(uint8 idx, uint8 r, uint8 g, uint8 b);
 	bool rotate_palette(uint8 pos, uint8 length);
 	bool clear(sint16 x, sint16 y, sint16 w, sint16 h, Common::Rect *clip_rect = nullptr);
-	void *get_pixels();
-	const byte *get_surface_pixels() {
-		return _renderSurface->get_pixels();
-	}
-	Graphics::ManagedSurface *create_sdl_surface_from(byte *src_buf, uint16 src_bpp, uint16 src_w, uint16 src_h, uint16 src_pitch);
-	Graphics::ManagedSurface *create_sdl_surface_8(byte *src_buf, uint16 src_w, uint16 src_h);
+	Graphics::ManagedSurface *create_sdl_surface_from(const byte *src_buf, uint16 src_bpp, uint16 src_w, uint16 src_h, uint16 src_pitch);
+	Graphics::ManagedSurface *create_sdl_surface_8(const byte *src_buf, uint16 src_w, uint16 src_h);
 	Graphics::ManagedSurface *get_sdl_surface();
 	uint16 get_width() const {
 		return width;
@@ -99,13 +97,12 @@ public:
 	void drawalphamap8globe(sint16 x, sint16 y, uint16 radius);
 	void blitalphamap8(sint16 x, sint16 y, Common::Rect *clip_rect);
 
-	int get_lighting_style() const {
+	LightingStyle get_lighting_style() const {
 		return lighting_style;
 	}
-	int get_old_lighting_style() const {
+	LightingStyle get_old_lighting_style() const {
 		return old_lighting_style;    // return the lighting_style before cheats applied
 	}
-	void set_lighting_style(int lighting);
 
 	uint8 get_ambient() const {
 		return shading_ambient;
@@ -116,12 +113,12 @@ public:
 
 	void update();
 	void update(int x, int y, uint16 w, uint16 h);
-	void preformUpdate();
+	void performUpdate();
 
-	byte *copy_area(Common::Rect *area = nullptr, byte *buf = nullptr);
-	byte *copy_area(Common::Rect *area, uint16 down_scale);
+	byte *copy_area(const Common::Rect *area = nullptr, byte *buf = nullptr);
+	byte *copy_area(const Common::Rect *area, uint16 down_scale);
 
-	void restore_area(byte *pixels, Common::Rect *area = nullptr, byte *target = nullptr, Common::Rect *target_area = nullptr, bool free_src = true);
+	void restore_area(byte *pixels, const Common::Rect *area = nullptr, byte *target = nullptr, const Common::Rect *target_area = nullptr, bool free_src = true);
 
 	void draw_line(int sx, int sy, int ex, int ey, uint8 color);
 
@@ -130,7 +127,7 @@ public:
 	void set_non_square_pixels(bool value);
 
 protected:
-	int lighting_style, old_lighting_style;
+	LightingStyle lighting_style, old_lighting_style;
 	bool fill16(uint8 colour_num, uint16 x, uint16 y, sint16 w, sint16 h);
 
 	bool fill32(uint8 colour_num, uint16 x, uint16 y, sint16 w, sint16 h);
@@ -160,9 +157,6 @@ protected:
 	void restore_area32(byte *pixels, const Common::Rect *area, byte *target = nullptr, const Common::Rect *target_area = nullptr, bool free_src = true);
 
 	void set_screen_mode();
-
-private:
-	bool sdl1_toggle_fullscreen();
 };
 
 } // End of namespace Nuvie
diff --git a/engines/ultima/nuvie/script/script_cutscene.cpp b/engines/ultima/nuvie/script/script_cutscene.cpp
index 24efbf9e6f3..7a744bb068b 100644
--- a/engines/ultima/nuvie/script/script_cutscene.cpp
+++ b/engines/ultima/nuvie/script/script_cutscene.cpp
@@ -1541,7 +1541,7 @@ void ScriptCutscene::update() {
 		}
 	}
 	gui->Display();
-	screen->preformUpdate();
+	screen->performUpdate();
 	sound_manager->update();
 	wait();
 }


Commit: dca991cc54be5a8f7a66cd87ea898ac81c3f5878
    https://github.com/scummvm/scummvm/commit/dca991cc54be5a8f7a66cd87ea898ac81c3f5878
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2023-12-09T13:56:10+11:00

Commit Message:
ULTIMA: NUVIE: Remove thin SDL compat wrappers

Changed paths:
    engines/ultima/nuvie/core/effect.cpp
    engines/ultima/nuvie/core/timed_event.cpp
    engines/ultima/nuvie/fonts/bmp_font.cpp
    engines/ultima/nuvie/fonts/bmp_font.h
    engines/ultima/nuvie/gui/gui.cpp
    engines/ultima/nuvie/gui/gui_area.cpp
    engines/ultima/nuvie/gui/gui_button.cpp
    engines/ultima/nuvie/gui/gui_dialog.cpp
    engines/ultima/nuvie/gui/gui_font.cpp
    engines/ultima/nuvie/gui/gui_font.h
    engines/ultima/nuvie/gui/gui_scroll_bar.cpp
    engines/ultima/nuvie/gui/gui_scroller.cpp
    engines/ultima/nuvie/gui/gui_text_input.cpp
    engines/ultima/nuvie/gui/gui_types.h
    engines/ultima/nuvie/gui/widgets/console.cpp
    engines/ultima/nuvie/gui/widgets/converse_gump_wou.cpp
    engines/ultima/nuvie/gui/widgets/map_window.cpp
    engines/ultima/nuvie/keybinding/keys.cpp
    engines/ultima/nuvie/keybinding/keys.h
    engines/ultima/nuvie/misc/sdl_compat.cpp
    engines/ultima/nuvie/misc/sdl_compat.h
    engines/ultima/nuvie/views/doll_view_gump.cpp
    engines/ultima/nuvie/views/doll_widget.cpp
    engines/ultima/nuvie/views/draggable_view.cpp
    engines/ultima/nuvie/views/spell_view_gump.cpp
    engines/ultima/nuvie/views/sun_moon_ribbon.cpp
    engines/ultima/nuvie/views/view_manager.cpp


diff --git a/engines/ultima/nuvie/core/effect.cpp b/engines/ultima/nuvie/core/effect.cpp
index 684c4cdb91e..bfa3d4a4a57 100644
--- a/engines/ultima/nuvie/core/effect.cpp
+++ b/engines/ultima/nuvie/core/effect.cpp
@@ -982,8 +982,10 @@ void FadeEffect::delete_self() {
 		delete viewport;
 		if (fade_dir == FADE_IN) // overlay should be empty now, so just delete it
 			map_window->set_overlay(nullptr);
-		if (fade_from)
-			SDL_FreeSurface(fade_from);
+		if (fade_from) {
+			delete fade_from;
+			fade_from = nullptr;
+		}
 
 		current_fade = nullptr;
 	}
@@ -1245,7 +1247,7 @@ FadeObjectEffect::FadeObjectEffect(Obj *obj, FadeDirection dir) {
 //        obj_manager->remove_obj(fade_obj);
 		game->get_map_window()->updateBlacking();
 	}
-	SDL_FreeSurface(capture);
+	delete capture;
 
 	game->pause_user();
 }
@@ -1271,7 +1273,7 @@ VanishEffect::VanishEffect(bool pause_user)
 //                                 new FadeEffect(FADE_PIXELATED, FADE_OUT, capture, 0, 0, 128000));
 	effect_manager->watch_effect(this, /* call me */
 	                             new FadeEffect(FADE_PIXELATED, FADE_OUT, capture));
-	SDL_FreeSurface(capture);
+	delete capture;
 
 	if (input_blocked == VANISH_WAIT)
 		game->pause_user();
diff --git a/engines/ultima/nuvie/core/timed_event.cpp b/engines/ultima/nuvie/core/timed_event.cpp
index fde3b7a4542..5de44040fda 100644
--- a/engines/ultima/nuvie/core/timed_event.cpp
+++ b/engines/ultima/nuvie/core/timed_event.cpp
@@ -401,7 +401,7 @@ void TimedPartyMove::change_location() {
 			// start fade-to
 			effect_mgr->watch_effect(this, /* call me */
 			                         new FadeEffect(FADE_PIXELATED, FADE_OUT, mapwindow_capture));
-			SDL_FreeSurface(mapwindow_capture);
+			delete mapwindow_capture;
 
 			Game::get_game()->pause_anims();
 			wait_for_effect = 1;
diff --git a/engines/ultima/nuvie/fonts/bmp_font.cpp b/engines/ultima/nuvie/fonts/bmp_font.cpp
index 844db5142fa..fe3e9fe4e7a 100644
--- a/engines/ultima/nuvie/fonts/bmp_font.cpp
+++ b/engines/ultima/nuvie/fonts/bmp_font.cpp
@@ -30,17 +30,15 @@ namespace Ultima {
 namespace Nuvie {
 
 BMPFont::BMPFont() : char_w(0), char_h(0), font_width_data(nullptr),
-		sdl_font_data(nullptr), rune_mode(false), dual_font_mode(false) {
+		font_surface(nullptr), rune_mode(false), dual_font_mode(false) {
 }
 
 BMPFont::~BMPFont() {
-	if (sdl_font_data) {
-		SDL_FreeSurface(sdl_font_data);
-	}
+	if (font_surface)
+		delete font_surface;
 
-	if (font_width_data) {
+	if (font_width_data)
 		free(font_width_data);
-	}
 }
 
 bool BMPFont::init(Std::string bmp_filename, bool dual_fontmap) {
@@ -51,12 +49,12 @@ bool BMPFont::init(Std::string bmp_filename, bool dual_fontmap) {
 
 	full_filename += ".bmp";
 
-	sdl_font_data = SDL_LoadBMP(full_filename.c_str());
+	font_surface = SDL_LoadBMP(full_filename.c_str());
 
-	SDL_SetColorKey(sdl_font_data, SDL_TRUE, SDL_MapRGB(sdl_font_data->format, 0, 0x70, 0xfc));
+	font_surface->setTransparentColor(font_surface->format.RGBToColor(0, 0x70, 0xfc));
 
-	char_w = sdl_font_data->w / 16;
-	char_h = sdl_font_data->h / 16;
+	char_w = font_surface->w / 16;
+	char_h = font_surface->h / 16;
 
 	//read font width data. For variable width fonts.
 	full_filename = bmp_filename;
@@ -126,7 +124,7 @@ uint16 BMPFont::drawChar(Screen *screen, uint8 char_num, uint16 x, uint16 y,
 	dst.setWidth(char_w);
 	dst.setHeight(char_h);
 
-	SDL_BlitSurface(sdl_font_data, &src, screen->get_sdl_surface(), &dst);
+	SDL_BlitSurface(font_surface, &src, screen->get_sdl_surface(), &dst);
 
 	return getCharWidth(char_num);
 }
diff --git a/engines/ultima/nuvie/fonts/bmp_font.h b/engines/ultima/nuvie/fonts/bmp_font.h
index 61ea612b021..e2963c34e5f 100644
--- a/engines/ultima/nuvie/fonts/bmp_font.h
+++ b/engines/ultima/nuvie/fonts/bmp_font.h
@@ -31,7 +31,7 @@ class Configuration;
 class Screen;
 
 class BMPFont : public Font {
-	Graphics::ManagedSurface *sdl_font_data;
+	Graphics::ManagedSurface *font_surface;
 	uint8 *font_width_data;
 
 	uint16 char_w, char_h;
diff --git a/engines/ultima/nuvie/gui/gui.cpp b/engines/ultima/nuvie/gui/gui.cpp
index bcada75ff37..43baf958e29 100644
--- a/engines/ultima/nuvie/gui/gui.cpp
+++ b/engines/ultima/nuvie/gui/gui.cpp
@@ -26,6 +26,7 @@
 #include "ultima/nuvie/gui/gui.h"
 #include "ultima/nuvie/gui/gui_types.h"
 #include "ultima/nuvie/keybinding/keys.h"
+#include "common/system.h"
 
 namespace Ultima {
 namespace Nuvie {
@@ -326,16 +327,17 @@ void GUI::Run(GUI_IdleProc idle, int once, int multitaskfriendly) {
 
 ///////////////////////////////////////////////////////////////// Polling is time consuming - instead:
 		if (multitaskfriendly && (idle == nullptr)) {
-			SDL_WaitEvent(&event);
+			while (!Events::get()->pollEvent(event))
+				g_system->delayMillis(5);
 			HandleEvent(&event);
 		} else
 /////////////////////////////////////////////////////////////////
 			/* Handle events, or run idle functions */
-			if (SDL_PollEvent(&event)) {
+			if (Events::get()->pollEvent(event)) {
 				/* Handle all pending events */
 				do {
 					HandleEvent(&event);
-				} while (SDL_PollEvent(&event));
+				} while (Events::get()->pollEvent(event));
 			} else {
 				if (idle != nullptr) {
 					HandleStatus(idle());
diff --git a/engines/ultima/nuvie/gui/gui_area.cpp b/engines/ultima/nuvie/gui/gui_area.cpp
index 22ea4dc4f15..64d68583073 100644
--- a/engines/ultima/nuvie/gui/gui_area.cpp
+++ b/engines/ultima/nuvie/gui/gui_area.cpp
@@ -41,9 +41,9 @@ GUI_Area:: GUI_Area(int x, int y, int w, int h, uint8 r, uint8 g, uint8 b,
 void
 GUI_Area:: SetDisplay(Screen *s) {
 	GUI_Widget::SetDisplay(s);
-	color = SDL_MapRGB(surface->format, R, G, B);
+	color = surface->format.RGBToColor(R, G, B);
 	if (useFrame)
-		frameColor = SDL_MapRGB(surface->format, fR, fG, fB);
+		frameColor = surface->format.RGBToColor(fR, fG, fB);
 }
 
 /* Show the widget  */
diff --git a/engines/ultima/nuvie/gui/gui_button.cpp b/engines/ultima/nuvie/gui/gui_button.cpp
index 98326204259..01019dfb4fc 100644
--- a/engines/ultima/nuvie/gui/gui_button.cpp
+++ b/engines/ultima/nuvie/gui/gui_button.cpp
@@ -89,9 +89,9 @@ GUI_Button::GUI_Button(void *data, int x, int y, int w, int h, const char *text,
 GUI_Button::~GUI_Button() {
 	if (freebutton) {
 		if (button)
-			SDL_FreeSurface(button);
+			delete button;
 		if (button2)
-			SDL_FreeSurface(button2);
+			delete button2;
 	}
 	if (freefont)
 		delete buttonFont;
@@ -112,9 +112,9 @@ void GUI_Button::ChangeTextButton(int x, int y, int w, int h, const char *text,
 
 	if (freebutton) {
 		if (button)
-			SDL_FreeSurface(button);
+			delete button;
 		if (button2)
-			SDL_FreeSurface(button2);
+			delete button2;
 		if (flatbutton) {
 			button = CreateTextButtonImage(BUTTON2D_UP, text, alignment);
 			button2 = CreateTextButtonImage(BUTTON2D_DOWN, text, alignment);
@@ -148,7 +148,7 @@ void GUI_Button:: Display(bool full_redraw) {
 	}
 	if (!enabled) {
 		uint8 *pointer;
-		int pixel = SDL_MapRGB(surface->format, 0, 0, 0);
+		int pixel = surface->format.RGBToColor(0, 0, 0);
 		uint8 bytepp = surface->format.bytesPerPixel;
 
 		for (int y = 0; y < area.height(); y += 2) {
@@ -250,10 +250,10 @@ Graphics::ManagedSurface *GUI_Button::CreateTextButtonImage(int style, const cha
 	if (img == nullptr)
 		return nullptr;
 
-	uint32 color1 = SDL_MapRGB(img->format, BL_R, BL_G, BL_B);
-	uint32 color2 = SDL_MapRGB(img->format, BS_R, BS_G, BS_B);
-	uint32 color3 = SDL_MapRGB(img->format, BF_R, BF_G, BF_B);
-	uint32 color4 = SDL_MapRGB(img->format, BI2_R, BI2_G, BI2_B);
+	uint32 color1 = img->format.RGBToColor(BL_R, BL_G, BL_B);
+	uint32 color2 = img->format.RGBToColor(BS_R, BS_G, BS_B);
+	uint32 color3 = img->format.RGBToColor(BF_R, BF_G, BF_B);
+	uint32 color4 = img->format.RGBToColor(BI2_R, BI2_G, BI2_B);
 
 
 	buttonFont->setColoring(0, 0, 0);
diff --git a/engines/ultima/nuvie/gui/gui_dialog.cpp b/engines/ultima/nuvie/gui/gui_dialog.cpp
index 715c8bcedeb..83fb57b72e5 100644
--- a/engines/ultima/nuvie/gui/gui_dialog.cpp
+++ b/engines/ultima/nuvie/gui/gui_dialog.cpp
@@ -41,8 +41,8 @@ GUI_Dialog::~GUI_Dialog() {
 	if (backingstore)
 		free(backingstore);
 
-	for (int i = 0; i < 8; i++)
-		SDL_FreeSurface(border[i]);
+	for (int i = 0; i < ARRAYSIZE(border); i++)
+		delete border[i];
 }
 
 void GUI_Dialog::loadBorderImages() {
@@ -63,16 +63,13 @@ void GUI_Dialog::loadBorderImages() {
 /* Map the color to the display */
 void GUI_Dialog::SetDisplay(Screen *s) {
 	GUI_Widget::SetDisplay(s);
-	bg_color = SDL_MapRGB(surface->format, R, G, B);
+	bg_color = surface->format.RGBToColor(R, G, B);
 }
 
 /* Show the widget  */
 void
-GUI_Dialog:: Display(bool full_redraw) {
+GUI_Dialog::Display(bool full_redraw) {
 	int i;
-	Common::Rect framerect;
-	Common::Rect src, dst;
-
 	if (old_x != area.left || old_y != area.top) {
 		if (backingstore) {
 			screen->restore_area(backingstore, &backingstore_rect, nullptr, nullptr, false);
@@ -87,12 +84,13 @@ GUI_Dialog:: Display(bool full_redraw) {
 		old_y = area.top;
 	}
 
-	framerect = area;
+	Common::Rect framerect = area;
 	framerect.grow(-8);
 	SDL_FillRect(surface, &framerect, bg_color);
 
 // Draw border corners
 
+	Common::Rect dst;
 	dst = area;
 	dst.setWidth(8);
 	dst.setHeight(8);
@@ -133,6 +131,7 @@ GUI_Dialog:: Display(bool full_redraw) {
 	}
 
 	if (i < area.left + area.width() - 8) { // draw partial border images
+		Common::Rect src;
 		src.left = 0;
 		src.top = 0;
 		src.setWidth(area.left + area.width() - 8 - i);
@@ -169,6 +168,7 @@ GUI_Dialog:: Display(bool full_redraw) {
 	}
 
 	if (i < area.top + area.height() - 8) { // draw partial border images
+		Common::Rect src;
 		src.left = 0;
 		src.top = 0;
 		src.setWidth(8);
@@ -213,13 +213,11 @@ GUI_status GUI_Dialog::MouseUp(int x, int y, Shared::MouseButton button) {
 }
 
 GUI_status GUI_Dialog::MouseMotion(int x, int y, uint8 state) {
-	int dx, dy;
-
 	if (!drag)
 		return GUI_PASS;
 
-	dx = x - button_x;
-	dy = y - button_y;
+	int dx = x - button_x;
+	int dy = y - button_y;
 
 	button_x = x;
 	button_y = y;
diff --git a/engines/ultima/nuvie/gui/gui_font.cpp b/engines/ultima/nuvie/gui/gui_font.cpp
index 4b9aaec301e..af35c6617e6 100644
--- a/engines/ultima/nuvie/gui/gui_font.cpp
+++ b/engines/ultima/nuvie/gui/gui_font.cpp
@@ -40,7 +40,9 @@ GUI_Font::GUI_Font(uint8 fontType) : _wData(nullptr) {
 	} else
 		temp = GUI_DefaultFont();
 
-	_fontStore = SDL_ConvertSurface(temp, temp->format, SDL_SWSURFACE);
+	_fontStore = new Graphics::ManagedSurface(temp->w, temp->h, temp->format);
+	_fontStore->blitFrom(*temp);
+
 	_charH = _fontStore->h / 16;
 	_charW = _fontStore->w / 16;
 	_disposeFont = DisposeAfterUse::YES;
@@ -48,7 +50,7 @@ GUI_Font::GUI_Font(uint8 fontType) : _wData(nullptr) {
 }
 
 /* open named BMP file */
-GUI_Font::GUI_Font(char *name) {
+GUI_Font::GUI_Font(const char *name) {
 	_fontStore = SDL_LoadBMP(name);
 	if (_fontStore != nullptr) {
 		_charH = _fontStore->h / 16;
@@ -75,17 +77,6 @@ GUI_Font::GUI_Font(Graphics::ManagedSurface *bitmap) {
 	_wData = nullptr;
 }
 
-/* copy constructor */
-GUI_Font::GUI_Font(GUI_Font &font) {
-	Graphics::ManagedSurface *temp = font._fontStore;
-	_fontStore = SDL_ConvertSurface(temp, temp->format, SDL_SWSURFACE);
-	_charH = _fontStore->h / 16;
-	_charW = _fontStore->w / 16;
-	_disposeFont = DisposeAfterUse::YES;
-	setTransparency(true);
-	_wData = nullptr;
-}
-
 GUI_Font::~GUI_Font() {
 	if (_disposeFont == DisposeAfterUse::YES)
 		delete _fontStore;
@@ -121,14 +112,12 @@ void GUI_Font::setColoring(uint8 fr, uint8 fg, uint8 fb, uint8 fr1, uint8 fg1, u
 
 /* put the text onto the given surface using the preset mode and colors */
 void GUI_Font::textOut(Graphics::ManagedSurface *context, int x, int y, const char *text, int line_wrap) {
-	int i;
-	int j;
 	uint8 ch;
 	Common::Rect src(_charW, _charH - 1);
 	Common::Rect dst(_charW, _charH - 1);
 
-	i = 0;
-	j = 0;
+	int i = 0;
+	int j = 0;
 	while ((ch = text[i])) { // single "=" is correct!
 		if (line_wrap && j == line_wrap) {
 			j = 0;
diff --git a/engines/ultima/nuvie/gui/gui_font.h b/engines/ultima/nuvie/gui/gui_font.h
index b6e47275a10..bb4b7279b9e 100644
--- a/engines/ultima/nuvie/gui/gui_font.h
+++ b/engines/ultima/nuvie/gui/gui_font.h
@@ -51,13 +51,12 @@ public:
 	GUI_Font(uint8 fontType = GUI_FONT_DEFAULT);
 
 	/* open named BMP file */
-	GUI_Font(char *name);
+	GUI_Font(const char *name);
 
 	/* use given YxY surface */
 	GUI_Font(Graphics::ManagedSurface *bitmap);
 
-	/* copy constructor */
-	GUI_Font(GUI_Font &font);
+	GUI_Font(const GUI_Font &font) = delete;
 
 	virtual ~GUI_Font();
 
diff --git a/engines/ultima/nuvie/gui/gui_scroll_bar.cpp b/engines/ultima/nuvie/gui/gui_scroll_bar.cpp
index fc9716c58cb..db239a15d8f 100644
--- a/engines/ultima/nuvie/gui/gui_scroll_bar.cpp
+++ b/engines/ultima/nuvie/gui/gui_scroll_bar.cpp
@@ -96,12 +96,12 @@ void GUI_ScrollBar::loadButtons() {
 void GUI_ScrollBar::SetDisplay(Screen *s) {
 	GUI_Widget::SetDisplay(s);
 
-	slider_highlight_c = SDL_MapRGB(surface->format, SLIDER_HIGHLIGHT_R, SLIDER_HIGHLIGHT_G, SLIDER_HIGHLIGHT_B);
-	slider_shadow_c = SDL_MapRGB(surface->format, SLIDER_SHADOW_R, SLIDER_SHADOW_G, SLIDER_SHADOW_B);
-	slider_base_c = SDL_MapRGB(surface->format, SLIDER_BASE_R, SLIDER_BASE_G, SLIDER_BASE_B);
+	slider_highlight_c = surface->format.RGBToColor(SLIDER_HIGHLIGHT_R, SLIDER_HIGHLIGHT_G, SLIDER_HIGHLIGHT_B);
+	slider_shadow_c = surface->format.RGBToColor(SLIDER_SHADOW_R, SLIDER_SHADOW_G, SLIDER_SHADOW_B);
+	slider_base_c = surface->format.RGBToColor(SLIDER_BASE_R, SLIDER_BASE_G, SLIDER_BASE_B);
 
-	track_border_c = SDL_MapRGB(surface->format, TRACK_BORDER_R, TRACK_BORDER_G, TRACK_BORDER_B);
-	track_base_c = SDL_MapRGB(surface->format, TRACK_BASE_R, TRACK_BASE_G, TRACK_BASE_B);
+	track_border_c = surface->format.RGBToColor(TRACK_BORDER_R, TRACK_BORDER_G, TRACK_BORDER_B);
+	track_base_c = surface->format.RGBToColor(TRACK_BASE_R, TRACK_BASE_G, TRACK_BASE_B);
 }
 
 void GUI_ScrollBar::set_slider_length(float percentage) {
diff --git a/engines/ultima/nuvie/gui/gui_scroller.cpp b/engines/ultima/nuvie/gui/gui_scroller.cpp
index ce99c3d1f9a..619560414ff 100644
--- a/engines/ultima/nuvie/gui/gui_scroller.cpp
+++ b/engines/ultima/nuvie/gui/gui_scroller.cpp
@@ -42,7 +42,7 @@ GUI_Scroller::GUI_Scroller(int x, int y, int w, int h, uint8 r, uint8 g, uint8 b
 /* Map the color to the display */
 void GUI_Scroller::SetDisplay(Screen *s) {
 	GUI_Widget::SetDisplay(s);
-	bg_color = SDL_MapRGB(surface->format, R, G, B);
+	bg_color = surface->format.RGBToColor(R, G, B);
 }
 
 int GUI_Scroller::AddWidget(GUI_Widget *widget) {
diff --git a/engines/ultima/nuvie/gui/gui_text_input.cpp b/engines/ultima/nuvie/gui/gui_text_input.cpp
index 6c80a03e145..e821c2828af 100644
--- a/engines/ultima/nuvie/gui/gui_text_input.cpp
+++ b/engines/ultima/nuvie/gui/gui_text_input.cpp
@@ -268,8 +268,8 @@ void GUI_TextInput::set_text(const char *new_text) {
 /* Map the color to the display */
 void GUI_TextInput::SetDisplay(Screen *s) {
 	GUI_Widget::SetDisplay(s);
-	cursor_color = SDL_MapRGB(surface->format, 0xff, 0, 0);
-	selected_bgcolor = SDL_MapRGB(surface->format, 0x5a, 0x6e, 0x91);
+	cursor_color = surface->format.RGBToColor(0xff, 0, 0);
+	selected_bgcolor = surface->format.RGBToColor(0x5a, 0x6e, 0x91);
 }
 
 
diff --git a/engines/ultima/nuvie/gui/gui_types.h b/engines/ultima/nuvie/gui/gui_types.h
index f2d100a3914..0062c86ac21 100644
--- a/engines/ultima/nuvie/gui/gui_types.h
+++ b/engines/ultima/nuvie/gui/gui_types.h
@@ -63,7 +63,7 @@ public:
 		: r(0), g(0), b(0), sdl_color(0) {
 	};
 	void map_color(const Graphics::PixelFormat &format) {
-		sdl_color = SDL_MapRGB(format, r, g, b);
+		sdl_color = format.RGBToColor(r, g, b);
 	};
 
 };
diff --git a/engines/ultima/nuvie/gui/widgets/console.cpp b/engines/ultima/nuvie/gui/widgets/console.cpp
index 896654bee58..40647caba39 100644
--- a/engines/ultima/nuvie/gui/widgets/console.cpp
+++ b/engines/ultima/nuvie/gui/widgets/console.cpp
@@ -106,7 +106,7 @@ void ConsolePause() {
 	Common::Event event;
 	bool waiting = true;
 	for (; waiting;) {
-		while (!SDL_PollEvent(&event)) {
+		while (!Events::get()->pollEvent(event)) {
 			if (event.type == Common::EVENT_KEYDOWN || event.type == Common::EVENT_QUIT) {
 				waiting = false;
 				break;
diff --git a/engines/ultima/nuvie/gui/widgets/converse_gump_wou.cpp b/engines/ultima/nuvie/gui/widgets/converse_gump_wou.cpp
index fbd764bf0d2..37e163c2bbb 100644
--- a/engines/ultima/nuvie/gui/widgets/converse_gump_wou.cpp
+++ b/engines/ultima/nuvie/gui/widgets/converse_gump_wou.cpp
@@ -89,7 +89,7 @@ ConverseGumpWOU::ConverseGumpWOU(const Configuration *cfg, Font *f, Screen *s)
 
 ConverseGumpWOU::~ConverseGumpWOU() {
 	if (bg_image)
-		SDL_FreeSurface(bg_image);
+		delete bg_image;
 }
 
 void ConverseGumpWOU::set_talking(bool state, Actor *actor) {
diff --git a/engines/ultima/nuvie/gui/widgets/map_window.cpp b/engines/ultima/nuvie/gui/widgets/map_window.cpp
index e98c651b04e..9ae102fb4a2 100644
--- a/engines/ultima/nuvie/gui/widgets/map_window.cpp
+++ b/engines/ultima/nuvie/gui/widgets/map_window.cpp
@@ -150,9 +150,8 @@ MapWindow::~MapWindow() {
 	set_overlay(nullptr); // free
 	free(tmp_map_buf);
 	delete anim_manager;
-	if (roof_tiles) {
-		SDL_FreeSurface(roof_tiles);
-	}
+	if (roof_tiles)
+		delete roof_tiles;
 }
 
 bool MapWindow::init(TileManager *tm, ObjManager *om, ActorManager *am) {
@@ -2500,7 +2499,7 @@ Graphics::ManagedSurface *MapWindow::get_overlay() {
 /* Set the overlay surface. The current overlay is deleted if necessary. */
 void MapWindow::set_overlay(Graphics::ManagedSurface *surfpt) {
 	if (overlay && (overlay != surfpt))
-		SDL_FreeSurface(overlay);
+		delete overlay;
 	overlay = surfpt;
 }
 
@@ -2559,7 +2558,7 @@ void MapWindow::set_roof_mode(bool roofs) {
 			loadRoofTiles();
 	} else {
 		if (roof_tiles) {
-			SDL_FreeSurface(roof_tiles);
+			delete roof_tiles;
 			roof_tiles = nullptr;
 		}
 	}
@@ -2569,7 +2568,7 @@ void MapWindow::loadRoofTiles() {
 	const Std::string imagefile = map->getRoofTilesetFilename();
 	roof_tiles = SDL_LoadBMP(imagefile.c_str());
 	if (roof_tiles) {
-		SDL_SetColorKey(roof_tiles, SDL_TRUE, SDL_MapRGB(roof_tiles->format, 0, 0x70, 0xfc));
+		roof_tiles->setTransparentColor(roof_tiles->format.RGBToColor(0, 0x70, 0xfc));
 	}
 }
 
diff --git a/engines/ultima/nuvie/keybinding/keys.cpp b/engines/ultima/nuvie/keybinding/keys.cpp
index d927423ba22..43638bf883c 100644
--- a/engines/ultima/nuvie/keybinding/keys.cpp
+++ b/engines/ultima/nuvie/keybinding/keys.cpp
@@ -452,13 +452,13 @@ static void skipspace(string &s) {
 }
 
 
-void KeyBinder::ParseLine(char *line) {
+void KeyBinder::ParseLine(const char *line) {
 	size_t i;
 	Common::KeyState k;
 	ActionType a;
 	k.keycode = Common::KEYCODE_INVALID;
 	k.flags = 0;
-	string s = line, u;
+	string s = line;
 	string d, keycode;
 	bool show;
 
@@ -468,8 +468,8 @@ void KeyBinder::ParseLine(char *line) {
 	if (s.empty() || s.hasPrefix("#"))
 		return;
 
-	u = s;
-	u = Std::to_uppercase(u);
+	string u = s;
+	u.toUppercase();
 
 	// get key
 	while (!s.empty() && !Common::isSpace(s[0])) {
@@ -530,8 +530,7 @@ void KeyBinder::ParseLine(char *line) {
 	s.erase(0, i);
 	t = Std::to_uppercase(t);
 
-	ParseActionMap::iterator action_index;
-	action_index = _actions.find(t);
+	ParseActionMap::iterator action_index = _actions.find(t);
 	if (action_index != _actions.end()) {
 		a.action = (const Action *)(*action_index)._value;
 	} else {
@@ -616,9 +615,7 @@ void KeyBinder::LoadFromFileInternal(const char *filename) {
 }
 
 void KeyBinder::LoadFromFile(const char *filename) {
-
 	Flush();
-
 	ConsoleAddInfo("Loading keybindings from file %s", filename);
 	LoadFromFileInternal(filename);
 }
diff --git a/engines/ultima/nuvie/keybinding/keys.h b/engines/ultima/nuvie/keybinding/keys.h
index fc124560829..fb3ca3f6df9 100644
--- a/engines/ultima/nuvie/keybinding/keys.h
+++ b/engines/ultima/nuvie/keybinding/keys.h
@@ -141,7 +141,7 @@ public:
 
 private:
 	void ParseText(char *text, int len);
-	void ParseLine(char *line);
+	void ParseLine(const char *line);
 	void FillParseMaps();
 
 	joy_axes_pairs get_axes_pair(int axis) const;
diff --git a/engines/ultima/nuvie/misc/sdl_compat.cpp b/engines/ultima/nuvie/misc/sdl_compat.cpp
index 48926ae9b02..86ea8eeb5aa 100644
--- a/engines/ultima/nuvie/misc/sdl_compat.cpp
+++ b/engines/ultima/nuvie/misc/sdl_compat.cpp
@@ -36,15 +36,6 @@ uint32 SDL_GetTicks() {
 	return g_system->getMillis();
 }
 
-void SDL_FreeSurface(Graphics::ManagedSurface *&s) {
-	delete s;
-	s = nullptr;
-}
-
-uint32 SDL_MapRGB(const Graphics::PixelFormat &format, byte r, byte g, byte b) {
-	return format.RGBToColor(r, g, b);
-}
-
 int SDL_BlitSurface(const Graphics::ManagedSurface *src, const Common::Rect *srcrect,
 		Graphics::ManagedSurface *dst, Common::Rect *dstrect) {
 	Common::Rect srcRect = srcrect ? *srcrect : Common::Rect(0, 0, src->w, src->h);
@@ -76,41 +67,14 @@ Graphics::ManagedSurface *SDL_LoadBMP(const char *filename) {
 
 	const Graphics::Surface *src = decoder.getSurface();
 	Screen *const screen = Game::get_game()->get_screen();
-	assert (screen);
+	assert(screen);
 	Graphics::ManagedSurface *const screenSurface = screen->get_sdl_surface();
-	assert (screenSurface);
+	assert(screenSurface);
 	Graphics::ManagedSurface *dest = new Graphics::ManagedSurface(src->w, src->h, screenSurface->format);
 	dest->blitFrom(*src, decoder.getPalette());
 
 	return dest;
 }
 
-int SDL_SetColorKey(Graphics::ManagedSurface *surface, int flag, uint32 key) {
-	if (flag)
-		surface->setTransparentColor(key);
-	else
-		surface->clearTransparentColor();
-
-	return 0;
-}
-
-int SDL_WaitEvent(Common::Event *event) {
-	while (!Events::get()->pollEvent(*event))
-		g_system->delayMillis(5);
-	return 0;
-}
-
-int SDL_PollEvent(Common::Event *event) {
-	return Events::get()->pollEvent(*event);
-}
-
-Graphics::ManagedSurface *SDL_ConvertSurface(Graphics::ManagedSurface *src,
-		const Graphics::PixelFormat &fmt, uint32 flags) {
-	Graphics::ManagedSurface *dest = new Graphics::ManagedSurface(src->w, src->h, fmt);
-	dest->blitFrom(*src);
-
-	return dest;
-}
-
 } // End of namespace Nuvie
 } // End of namespace Ultima
diff --git a/engines/ultima/nuvie/misc/sdl_compat.h b/engines/ultima/nuvie/misc/sdl_compat.h
index 8f7a1b014c7..e9e754b36bf 100644
--- a/engines/ultima/nuvie/misc/sdl_compat.h
+++ b/engines/ultima/nuvie/misc/sdl_compat.h
@@ -33,17 +33,10 @@ namespace Nuvie {
 #define SDL_SWSURFACE 0
 
 extern uint32 SDL_GetTicks();
-extern void SDL_FreeSurface(Graphics::ManagedSurface *&s);
-extern uint32 SDL_MapRGB(const Graphics::PixelFormat &format, byte r, byte g, byte b);
 extern int SDL_BlitSurface(const Graphics::ManagedSurface *src, const Common::Rect *srcrect,
 	Graphics::ManagedSurface *dst, Common::Rect *dstrect);
 extern int SDL_FillRect(Graphics::ManagedSurface *surf, const Common::Rect *rect, uint color);
 extern Graphics::ManagedSurface *SDL_LoadBMP(const char *filename);
-extern int SDL_SetColorKey(Graphics::ManagedSurface *surface, int flag, uint32 key);
-extern int SDL_WaitEvent(Common::Event *event);
-extern int SDL_PollEvent(Common::Event *event);
-extern Graphics::ManagedSurface *SDL_ConvertSurface(Graphics::ManagedSurface *src,
-	const Graphics::PixelFormat &fmt, uint32 flags);
 
 } // End of namespace Nuvie
 } // End of namespace Ultima
diff --git a/engines/ultima/nuvie/views/doll_view_gump.cpp b/engines/ultima/nuvie/views/doll_view_gump.cpp
index 73334118ab0..df5b6989183 100644
--- a/engines/ultima/nuvie/views/doll_view_gump.cpp
+++ b/engines/ultima/nuvie/views/doll_view_gump.cpp
@@ -47,7 +47,7 @@ DollViewGump::~DollViewGump() {
 	if (font)
 		delete font;
 	if (actor_doll)
-		SDL_FreeSurface(actor_doll);
+		delete actor_doll;
 }
 
 bool DollViewGump::init(Screen *tmp_screen, void *view_manager, uint16 x, uint16 y, Actor *a, Font *f, Party *p, TileManager *tm, ObjManager *om) {
@@ -133,8 +133,8 @@ bool DollViewGump::init(Screen *tmp_screen, void *view_manager, uint16 x, uint16
 
 void DollViewGump::setColorKey(Graphics::ManagedSurface *image) {
 	if (image) {
-		bg_color_key = SDL_MapRGB(image->format, 0xf1, 0x0f, 0xc4);
-		SDL_SetColorKey(image, SDL_TRUE, bg_color_key);
+		bg_color_key = image->format.RGBToColor(0xf1, 0x0f, 0xc4);
+		image->setTransparentColor(bg_color_key);
 	}
 }
 
diff --git a/engines/ultima/nuvie/views/doll_widget.cpp b/engines/ultima/nuvie/views/doll_widget.cpp
index 34322439222..a4c534d77e8 100644
--- a/engines/ultima/nuvie/views/doll_widget.cpp
+++ b/engines/ultima/nuvie/views/doll_widget.cpp
@@ -147,11 +147,11 @@ bool DollWidget::init(Actor *a, uint16 x, uint16 y, TileManager *tm, ObjManager
 
 void DollWidget::free_doll_shapes() {
 	if (actor_doll) {
-		SDL_FreeSurface(actor_doll);
+		delete actor_doll;
 		actor_doll = nullptr;
 	}
 	if (doll_bg) {
-		SDL_FreeSurface(doll_bg);
+		delete doll_bg;
 		doll_bg = nullptr;
 	}
 	if (md_doll_shp) {
@@ -162,8 +162,8 @@ void DollWidget::free_doll_shapes() {
 
 void DollWidget::setColorKey(Graphics::ManagedSurface *image) {
 	if (image) {
-		uint32 bg_color_key = SDL_MapRGB(image->format, 0xf1, 0x0f, 0xc4);
-		SDL_SetColorKey(image, SDL_TRUE, bg_color_key);
+		uint32 bg_color_key = image->format.RGBToColor(0xf1, 0x0f, 0xc4);
+		image->setTransparentColor(bg_color_key);
 	}
 }
 
diff --git a/engines/ultima/nuvie/views/draggable_view.cpp b/engines/ultima/nuvie/views/draggable_view.cpp
index 5d0b4dcc9e6..4d0cfb2fc80 100644
--- a/engines/ultima/nuvie/views/draggable_view.cpp
+++ b/engines/ultima/nuvie/views/draggable_view.cpp
@@ -48,15 +48,15 @@ DraggableView::DraggableView(const Configuration *cfg) : View(cfg),
 
 DraggableView::~DraggableView() {
 	if (bg_image) {
-		SDL_FreeSurface(bg_image);
+		delete bg_image;
 		bg_image = nullptr;
 	}
 }
 
 void DraggableView::set_bg_color_key(uint8 r, uint8 g, uint8 b) {
 	if (bg_image) {
-		bg_color_key = SDL_MapRGB(bg_image->format, 0, 0x70, 0xfc);
-		SDL_SetColorKey(bg_image, SDL_TRUE, bg_color_key);
+		bg_color_key = bg_image->format.RGBToColor(0, 0x70, 0xfc);
+		bg_image->setTransparentColor(bg_color_key);
 	}
 }
 
diff --git a/engines/ultima/nuvie/views/spell_view_gump.cpp b/engines/ultima/nuvie/views/spell_view_gump.cpp
index 65c15c860fa..d39cc6d8183 100644
--- a/engines/ultima/nuvie/views/spell_view_gump.cpp
+++ b/engines/ultima/nuvie/views/spell_view_gump.cpp
@@ -105,12 +105,9 @@ uint8 SpellViewGump::fill_cur_spell_list() {
 	datadir = path;
 
 	Std::string imagefile;
-
-	SDL_FreeSurface(bg_image);
-
-	//build_path(datadir, "", spellbookdir);
-
 	build_path(datadir, "spellbook_bg.bmp", imagefile);
+
+	delete bg_image;
 	bg_image = bmp.getSdlSurface32(imagefile);
 	if (bg_image == nullptr) {
 		DEBUG(0, LEVEL_ERROR, "Failed to load spellbook_bg.bmp from '%s' directory\n", datadir.c_str());
@@ -138,7 +135,7 @@ uint8 SpellViewGump::fill_cur_spell_list() {
 			dst.setHeight(13);
 
 			SDL_BlitSurface(spell_image, nullptr, bg_image, &dst);
-			SDL_FreeSurface(spell_image);
+			delete spell_image;
 			printSpellQty(cur_spells[i], dst.left + ((spell < 5) ? 50 : 48), dst.top);
 		}
 	}
diff --git a/engines/ultima/nuvie/views/sun_moon_ribbon.cpp b/engines/ultima/nuvie/views/sun_moon_ribbon.cpp
index 9e5eee98f62..5af2027ef18 100644
--- a/engines/ultima/nuvie/views/sun_moon_ribbon.cpp
+++ b/engines/ultima/nuvie/views/sun_moon_ribbon.cpp
@@ -74,11 +74,11 @@ void SunMoonRibbon::loadBgImage(uint8 num) {
 	build_path(datadir, filename, imagefile);
 
 	if (bg_data)
-		SDL_FreeSurface(bg_data);
+		delete bg_data;
 	bg_data = bmp.getSdlSurface32(imagefile);
 
-	uint32 bg_color_key = SDL_MapRGB(bg_data->format, 0xb3, 0x94, 0x78);
-	SDL_SetColorKey(bg_data, SDL_TRUE, bg_color_key);
+	uint32 bg_color_key = bg_data->format.RGBToColor(0xb3, 0x94, 0x78);
+	bg_data->setTransparentColor(bg_color_key);
 }
 
 void SunMoonRibbon::Display(bool full_redraw) {
diff --git a/engines/ultima/nuvie/views/view_manager.cpp b/engines/ultima/nuvie/views/view_manager.cpp
index c6ed0f9e96d..356e7021c10 100644
--- a/engines/ultima/nuvie/views/view_manager.cpp
+++ b/engines/ultima/nuvie/views/view_manager.cpp
@@ -536,8 +536,8 @@ Graphics::ManagedSurface *ViewManager::loadAvatarDollImage(Graphics::ManagedSurf
 	} else {
 		build_path(getDollDataDirString(), filename, imagefile);
 	}
-	if (avatar_doll != nullptr)
-		SDL_FreeSurface(avatar_doll);
+	if (avatar_doll)
+		delete avatar_doll;
 	NuvieBmpFile bmp;
 	avatar_doll = bmp.getSdlSurface32(imagefile);
 	if (avatar_doll == nullptr)
@@ -549,8 +549,8 @@ Graphics::ManagedSurface *ViewManager::loadCustomActorDollImage(Graphics::Manage
 	char filename[17]; //actor_nn_nnn.bmp\0
 	Std::string imagefile;
 
-	if (actor_doll != nullptr)
-		SDL_FreeSurface(actor_doll);
+	if (actor_doll)
+		delete actor_doll;
 
 	Common::sprintf_s(filename, "actor_%s_%03d.bmp", get_game_tag(Game::get_game()->get_game_type()), actor_num);
 	if (orig) {


Commit: 12a47d956ee00f62ed235c4009eb57ad0dbda19d
    https://github.com/scummvm/scummvm/commit/12a47d956ee00f62ed235c4009eb57ad0dbda19d
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2023-12-09T13:56:10+11:00

Commit Message:
ULTIMA: NUVIE: Add support for ScummVM keymapper

Mostly maintain backward compatibility with Nuvie's keyboard mapper, but update
human-readable descriptions to match ScummVM standard.

Changed paths:
  A engines/ultima/nuvie/keybinding/key_help_dialog.cpp
  A engines/ultima/nuvie/keybinding/key_help_dialog.h
    engines/ultima/metaengine.cpp
    engines/ultima/module.mk
    engines/ultima/nuvie/core/events.cpp
    engines/ultima/nuvie/gui/gui.cpp
    engines/ultima/nuvie/gui/widgets/gui_widget.cpp
    engines/ultima/nuvie/gui/widgets/gui_widget.h
    engines/ultima/nuvie/keybinding/key_actions.cpp
    engines/ultima/nuvie/keybinding/key_actions.h
    engines/ultima/nuvie/keybinding/keys.cpp
    engines/ultima/nuvie/keybinding/keys.h
    engines/ultima/nuvie/metaengine.cpp
    engines/ultima/nuvie/metaengine.h
    engines/ultima/nuvie/screen/game_palette.cpp


diff --git a/engines/ultima/metaengine.cpp b/engines/ultima/metaengine.cpp
index c834c9ac50e..18d41d05002 100644
--- a/engines/ultima/metaengine.cpp
+++ b/engines/ultima/metaengine.cpp
@@ -255,6 +255,12 @@ Common::KeymapArray UltimaMetaEngine::initKeymaps(const char *target) const {
 	if (gameId == "ultima4" || gameId == "ultima4_enh")
 		return Ultima::Ultima4::MetaEngine::initKeymaps();
 #endif
+#ifdef ENABLE_ULTIMA6
+	if (gameId == "ultima6" || gameId == "ultima6_enh"
+			|| gameId == "martiandreams" || gameId == "martiandreams_enh"
+			|| gameId == "savageempire" || gameId == "savageempire_enh")
+		return Ultima::Nuvie::MetaEngine::initKeymaps(gameId);
+#endif
 #ifdef ENABLE_ULTIMA8
 	if (gameId == "ultima8" || gameId == "remorse" || gameId == "regret")
 		return Ultima::Ultima8::MetaEngine::initKeymaps(gameId);
diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index b5f592d4097..a94959421b9 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -309,6 +309,7 @@ MODULE_OBJS += \
 	nuvie/gui/widgets/map_window.o \
 	nuvie/keybinding/keys.o \
 	nuvie/keybinding/key_actions.o \
+	nuvie/keybinding/key_help_dialog.o \
 	nuvie/menus/asset_viewer_dialog.o \
 	nuvie/menus/audio_dialog.o \
 	nuvie/menus/cheats_dialog.o \
diff --git a/engines/ultima/nuvie/core/events.cpp b/engines/ultima/nuvie/core/events.cpp
index 3b7b0c4b68c..d5e748913c5 100644
--- a/engines/ultima/nuvie/core/events.cpp
+++ b/engines/ultima/nuvie/core/events.cpp
@@ -359,6 +359,11 @@ bool Events::handleEvent(const Common::Event *event_) {
 	case Common::EVENT_QUIT:
 		return false;
 
+	case Common::EVENT_CUSTOM_ENGINE_ACTION_START:
+		keybinder->handleScummVMBoundEvent(event_);
+		break;
+
+	case Common::EVENT_CUSTOM_ENGINE_ACTION_END:
 	default:
 		break;
 	}
diff --git a/engines/ultima/nuvie/gui/gui.cpp b/engines/ultima/nuvie/gui/gui.cpp
index 43baf958e29..6086b2960d7 100644
--- a/engines/ultima/nuvie/gui/gui.cpp
+++ b/engines/ultima/nuvie/gui/gui.cpp
@@ -28,6 +28,8 @@
 #include "ultima/nuvie/keybinding/keys.h"
 #include "common/system.h"
 
+#include "backends/keymapper/keymapper.h"
+
 namespace Ultima {
 namespace Nuvie {
 
@@ -122,10 +124,13 @@ bool GUI::removeWidget(GUI_Widget *widget) {
 
 void GUI::CleanupDeletedWidgets(bool redraw) {
 	/* Garbage collection */
-	if (locked_widget && locked_widget->Status() == WIDGET_DELETED)
-		locked_widget = 0;
+	if (locked_widget && locked_widget->Status() == WIDGET_DELETED) {
+		locked_widget = nullptr;
+		// Re-enable the global keymapper
+		g_system->getEventManager()->getKeymapper()->setEnabled(true);
+	}
 	if (focused_widget && focused_widget->Status() == WIDGET_DELETED)
-		focused_widget = 0;
+		focused_widget = nullptr;
 
 	for (int i = 0; i < numwidgets;) {
 		if (widgets[i]->Status() == WIDGET_DELETED) {
@@ -383,9 +388,13 @@ bool GUI::set_focus(GUI_Widget *widget) {
 }
 
 void GUI::lock_input(GUI_Widget *widget) {
-	for (int i = 0; i < numwidgets; ++i)
-		if (!widget || (widgets[i] == widget)) // must be managed by GUI
+	for (int i = 0; i < numwidgets; ++i) {
+		if (!widget || (widgets[i] == widget)) {// must be managed by GUI
 			locked_widget = widget;
+			// Disable the keymapper so direct keys can go into the input
+			g_system->getEventManager()->getKeymapper()->setEnabled(locked_widget == nullptr);
+		}
+	}
 }
 
 Std::string GUI::get_data_dir() const {
diff --git a/engines/ultima/nuvie/gui/widgets/gui_widget.cpp b/engines/ultima/nuvie/gui/widgets/gui_widget.cpp
index ce56e480807..9d10a4585cf 100644
--- a/engines/ultima/nuvie/gui/widgets/gui_widget.cpp
+++ b/engines/ultima/nuvie/gui/widgets/gui_widget.cpp
@@ -165,7 +165,7 @@ void GUI_Widget::PlaceOnScreen(Screen *s, GUI_DragManager *dm, int x, int y) {
 }
 
 /* Report status to GUI */
-int GUI_Widget::Status(void) const {
+WIDGET_status GUI_Widget::Status(void) const {
 	return status;
 }
 
diff --git a/engines/ultima/nuvie/gui/widgets/gui_widget.h b/engines/ultima/nuvie/gui/widgets/gui_widget.h
index 3a11e286153..703071fc1d8 100644
--- a/engines/ultima/nuvie/gui/widgets/gui_widget.h
+++ b/engines/ultima/nuvie/gui/widgets/gui_widget.h
@@ -49,7 +49,7 @@ protected:
 	int offset_x, offset_y; /* original offsets to parent */
 
 	/* Flag -- whether or not the widget should be freed */
-	int status;
+	WIDGET_status status;
 
 	/* should we redraw this widget */
 	bool update_display;
@@ -108,7 +108,7 @@ public:
 	void moveToFront();
 	virtual void PlaceOnScreen(Screen *s, GUI_DragManager *dm, int x, int y);
 
-	virtual int  Status(void) const;  /* Reports status to GUI */
+	virtual WIDGET_status Status(void) const;  /* Reports status to GUI */
 
 	/* Set the bounds of the widget.
 	   If 'w' or 'h' is -1, that parameter will not be changed.
diff --git a/engines/ultima/nuvie/keybinding/key_actions.cpp b/engines/ultima/nuvie/keybinding/key_actions.cpp
index 5a0dd6bebef..b4ffa43d92c 100644
--- a/engines/ultima/nuvie/keybinding/key_actions.cpp
+++ b/engines/ultima/nuvie/keybinding/key_actions.cpp
@@ -53,39 +53,39 @@ namespace Nuvie {
 #define ACTOR_VIEW Game::get_game()->get_view_manager()->get_actor_view()
 #define MAP_WINDOW Game::get_game()->get_map_window()
 
-void ActionWalkWest(int const *params) {
+void ActionWalkWest(int param) {
 	EVENT->move(-1, 0);
 }
 
-void ActionWalkEast(int const *params) {
+void ActionWalkEast(int param) {
 	EVENT->move(1, 0);
 }
 
-void ActionWalkNorth(int const *params) {
+void ActionWalkNorth(int param) {
 	EVENT->move(0, -1);
 }
 
-void ActionWalkSouth(int const *params) {
+void ActionWalkSouth(int param) {
 	EVENT->move(0, 1);
 }
 
-void ActionWalkNorthEast(int const *params) {
+void ActionWalkNorthEast(int param) {
 	EVENT->move(1, -1);
 }
 
-void ActionWalkSouthEast(int const *params) {
+void ActionWalkSouthEast(int param) {
 	EVENT->move(1, 1);
 }
 
-void ActionWalkNorthWest(int const *params) {
+void ActionWalkNorthWest(int param) {
 	EVENT->move(-1, -1);
 }
 
-void ActionWalkSouthWest(int const *params) {
+void ActionWalkSouthWest(int param) {
 	EVENT->move(-1, 1);
 }
 
-void ActionCast(int const *params) {
+void ActionCast(int param) {
 	if (GAME->get_game_type() != NUVIE_GAME_U6) {
 		GAME->get_keybinder()->handle_wrong_key_pressed();
 		return;
@@ -95,44 +95,44 @@ void ActionCast(int const *params) {
 		EVENT->newAction(CAST_MODE);
 }
 
-void ActionLook(int const *params) {
+void ActionLook(int param) {
 	EVENT->newAction(LOOK_MODE);
 }
 
-void ActionTalk(int const *params) {
+void ActionTalk(int param) {
 	EVENT->newAction(TALK_MODE);
 }
 
-void ActionUse(int const *params) {
+void ActionUse(int param) {
 	EVENT->newAction(USE_MODE);
 }
 
-void ActionGet(int const *params) {
+void ActionGet(int param) {
 	EVENT->newAction(GET_MODE);
 }
 
-void ActionMove(int const *params) {
+void ActionMove(int param) {
 	EVENT->newAction(PUSH_MODE);
 }
 
-void ActionDrop(int const *params) {
+void ActionDrop(int param) {
 	EVENT->set_drop_from_key(true);
 	EVENT->newAction(DROP_MODE);
 }
 
-void ActionToggleCombat(int const *params) {
+void ActionToggleCombat(int param) {
 	EVENT->newAction(COMBAT_MODE);
 }
 
-void ActionAttack(int const *params) {
+void ActionAttack(int param) {
 	EVENT->newAction(ATTACK_MODE);
 }
 
-void ActionRest(int const *params) {
+void ActionRest(int param) {
 	EVENT->newAction(REST_MODE);
 }
 
-void ActionMultiUse(int const *params) {
+void ActionMultiUse(int param) {
 	if (EVENT->get_mode() == ATTACK_MODE)
 		EVENT->doAction();
 	else
@@ -142,19 +142,19 @@ void ActionMultiUse(int const *params) {
 static const sint8 SE_command_tbl[] = {6, -1, 4, 5, 1, 2, 0, 3, 7, 8}; // convert U6 indexes
 static const sint8 MD_command_tbl[] = {0, -1, 1, 2, 3, 4, 5, 6, -1, 7};
 
-void ActionSelectCommandBar(int const *params) {
+void ActionSelectCommandBar(int param) {
 	CommandBar *cb = GAME->get_command_bar();
-	if (params[0] < 0 || params[0] > 9) // deactivate
+	if (param < 0 || param > 9) // deactivate
 		cb->select_action(-1);
 	else if (GAME->get_game_type() == NUVIE_GAME_U6)
-		cb->select_action(params[0]);
+		cb->select_action(param);
 	else if (GAME->get_game_type() == NUVIE_GAME_SE)
-		cb->select_action(SE_command_tbl[params[0]]);
+		cb->select_action(SE_command_tbl[param]);
 	else // MD
-		cb->select_action(MD_command_tbl[params[0]]);
+		cb->select_action(MD_command_tbl[param]);
 }
 
-void ActionSelectNewCommandBar(int const *params) {
+void ActionSelectNewCommandBar(int param) {
 	CommandBar *cb = GAME->get_new_command_bar();
 	if (!cb)
 		return;
@@ -164,55 +164,55 @@ void ActionSelectNewCommandBar(int const *params) {
 	GAME->get_keybinder()->set_enable_joy_repeat(false);
 }
 
-void ActionDollGump(int const *params) {
+void ActionDollGump(int param) {
 	if (EVENT->is_looking_at_spellbook()) {
 		EVENT->cancelAction();
 		return;
 	}
-	if (params[0] > 0) {
-		Actor *party_member = PARTY->get_actor(params[0] - 1);
+	if (param > 0) {
+		Actor *party_member = PARTY->get_actor(param - 1);
 		if (party_member)
 			VIEW_MANAGER->open_doll_view(party_member);
 	} else
 		VIEW_MANAGER->open_doll_view(nullptr);
 }
 
-void ActionShowStats(int const *params) {
+void ActionShowStats(int param) {
 	if (EVENT->using_control_cheat())
 		return;
-	Actor *party_member = PARTY->get_actor(params[0] - 1);
+	Actor *party_member = PARTY->get_actor(param - 1);
 	if (party_member == nullptr)
 		return;
 	if (!GAME->is_new_style()) {
-		ACTOR_VIEW->set_party_member(params[0] - 1);
+		ACTOR_VIEW->set_party_member(param - 1);
 		VIEW_MANAGER->set_actor_mode();
 	} else
 		VIEW_MANAGER->open_portrait_gump(party_member);
 }
 
-void ActionInventory(int const *params) {
+void ActionInventory(int param) {
 	if (EVENT->is_looking_at_spellbook()) {
 		EVENT->cancelAction();
 		return;
 	}
-	if (EVENT->using_control_cheat() || params[0] == 0)
+	if (EVENT->using_control_cheat() || param == 0)
 		return;
-	if (PARTY->get_party_size() >= params[0]) {
+	if (PARTY->get_party_size() >= param) {
 		if (!GAME->is_new_style()) {
 			VIEW_MANAGER->set_inventory_mode();
-			INVENTORY_VIEW->set_party_member(params[0] - 1);
+			INVENTORY_VIEW->set_party_member(param - 1);
 		} else {
-			VIEW_MANAGER->open_container_view(PARTY->get_actor(params[0] - 1));
+			VIEW_MANAGER->open_container_view(PARTY->get_actor(param - 1));
 		}
 	}
 }
 
-void ActionPartyView(int const *params) {
+void ActionPartyView(int param) {
 	if (!EVENT->using_control_cheat())
 		VIEW_MANAGER->set_party_mode();
 }
 
-void ActionNextPartyMember(int const *params) {
+void ActionNextPartyMember(int param) {
 	if (EVENT->using_control_cheat())
 		return;
 	if (!GAME->is_new_style()) {
@@ -229,7 +229,7 @@ void ActionNextPartyMember(int const *params) {
 	}
 }
 
-void ActionPreviousPartyMember(int const *params) {
+void ActionPreviousPartyMember(int param) {
 	if (EVENT->using_control_cheat())
 		return;
 	if (!GAME->is_new_style()) {
@@ -245,7 +245,7 @@ void ActionPreviousPartyMember(int const *params) {
 	}
 }
 
-void ActionHome(int const *params) {
+void ActionHome(int param) {
 	if (EVENT->using_control_cheat())
 		return;
 	if (!GAME->is_new_style()) {
@@ -256,7 +256,7 @@ void ActionHome(int const *params) {
 	}
 }
 
-void ActionEnd(int const *params) {
+void ActionEnd(int param) {
 	if (EVENT->using_control_cheat())
 		return;
 	if (!GAME->is_new_style()) {
@@ -272,7 +272,7 @@ void ActionEnd(int const *params) {
 	}
 }
 
-void ActionToggleView(int const *params) {
+void ActionToggleView(int param) {
 	if (!GAME->is_new_style()) {
 		if (VIEW_MANAGER->get_current_view() == ACTOR_VIEW)
 			VIEW_MANAGER->set_inventory_mode();
@@ -281,8 +281,8 @@ void ActionToggleView(int const *params) {
 	}
 }
 
-void ActionSoloMode(int const *params) {
-	if (params[0] == 0) {
+void ActionSoloMode(int param) {
+	if (param == 0) {
 		if (PLAYER->in_party_mode())
 			EVENT->solo_mode(0);
 		else {
@@ -297,61 +297,61 @@ void ActionSoloMode(int const *params) {
 		return;
 	}
 	if (EVENT->get_mode() == INPUT_MODE)
-		EVENT->select_party_member(params[0] - 1);
+		EVENT->select_party_member(param - 1);
 	else if (PLAYER->is_in_vehicle())
 		EVENT->display_not_aboard_vehicle();
 	else
-		EVENT->solo_mode(params[0] - 1);
+		EVENT->solo_mode(param - 1);
 }
 
-void ActionPartyMode(int const *params) {
+void ActionPartyMode(int param) {
 	if (EVENT->get_mode() == MOVE_MODE)
 		EVENT->party_mode();
 	else
 		EVENT->cancelAction();
 }
 
-void ActionSaveDialog(int const *params) {
+void ActionSaveDialog(int param) {
 	g_engine->saveGameDialog();
 }
 
-void ActionLoadLatestSave(int const *params) {
+void ActionLoadLatestSave(int param) {
 	EVENT->close_gumps();
 	GAME->get_scroll()->display_string("Load game!\n");
 	g_engine->loadLatestSave();
 }
 
-void ActionQuickSave(int const *params) {
-	g_engine->quickSave(params[0], false);
+void ActionQuickSave(int param) {
+	g_engine->quickSave(param, false);
 }
 
-void ActionQuickLoad(int const *params) {
-	g_engine->quickSave(params[0], true);
+void ActionQuickLoad(int param) {
+	g_engine->quickSave(param, true);
 }
 
-void ActionQuitDialog(int const *params) {
+void ActionQuitDialog(int param) {
 	if (!EVENT) { // intro or used view ending command line
 	} // FIXME need way to quit
 	else
 		EVENT->quitDialog();
 }
 
-void ActionQuitNODialog(int const *params) {
+void ActionQuitNODialog(int param) {
 	GAME->quit();
 }
 
-void ActionGameMenuDialog(int const *params) {
+void ActionGameMenuDialog(int param) {
 	EVENT->gameMenuDialog();
 }
 
-void ActionToggleFullscreen(int const *params) {
+void ActionToggleFullscreen(int param) {
 	if (!GAME->get_screen()->toggle_fullscreen())
 		new TextEffect("Couldn't toggle fullscreen");
 	else
 		GAME->get_gui()->force_full_redraw();
 }
 
-void ActionToggleCursor(int const *params) {
+void ActionToggleCursor(int param) {
 	if (!GAME->is_new_style()) {
 		if (EVENT->get_input()->select_from_inventory == false)
 			EVENT->moveCursorToInventory();
@@ -367,35 +367,35 @@ void ActionToggleCursor(int const *params) {
 	}
 }
 
-void ActionToggleCombatStrategy(int const *params) {
+void ActionToggleCombatStrategy(int param) {
 	if (!GAME->is_new_style() && VIEW_MANAGER->get_current_view() == INVENTORY_VIEW)
 		INVENTORY_VIEW->simulate_CB_callback();
 }
 
-void ActionToggleFps(int const *params) {
+void ActionToggleFps(int param) {
 	if (EVENT)
 		EVENT->toggleFpsDisplay();
 }
 
-void ActionToggleAudio(int const *params) {
+void ActionToggleAudio(int param) {
 	bool audio = !GAME->get_sound_manager()->is_audio_enabled();
 	GAME->get_sound_manager()->set_audio_enabled(audio);
 	new TextEffect(audio ? "Audio enabled" : "Audio disabled");
 }
 
-void ActionToggleMusic(int const *params) {
+void ActionToggleMusic(int param) {
 	bool music = !GAME->get_sound_manager()->is_music_enabled();
 	GAME->get_sound_manager()->set_music_enabled(music);
 	new TextEffect(music ? "Music enabled" : "Music disabled");
 }
 
-void ActionToggleSFX(int const *params) {
+void ActionToggleSFX(int param) {
 	bool sfx = !GAME->get_sound_manager()->is_sfx_enabled();
 	GAME->get_sound_manager()->set_sfx_enabled(sfx);
 	new TextEffect(sfx ? "Sfx enabled" : "Sfx disabled");
 }
 
-void ActionToggleOriginalStyleCommandBar(int const *params) {
+void ActionToggleOriginalStyleCommandBar(int param) {
 	if (Game::get_game()->is_orig_style())
 		return;
 	CommandBar *cb = GAME->get_command_bar();
@@ -412,58 +412,51 @@ void ActionToggleOriginalStyleCommandBar(int const *params) {
 	config->write();
 }
 
-void ActionDoAction(int const *params) {
+void ActionDoAction(int param) {
 	EVENT->doAction();
 }
 
-void ActionCancelAction(int const *params) {
+void ActionCancelAction(int param) {
 	EVENT->cancelAction();
 }
 
-void ActionMsgScrollUP(int const *params) {
+void ActionMsgScrollUP(int param) {
 	if (!GAME->is_new_style())
 		GAME->get_scroll()->page_up();
 	else
 		GAME->get_scroll()->move_scroll_up();
 }
 
-void ActionMsgScrollDown(int const *params) {
+void ActionMsgScrollDown(int param) {
 	if (!GAME->is_new_style())
 		GAME->get_scroll()->page_down();
 	else
 		GAME->get_scroll()->move_scroll_down();
 }
 
-void ActionShowKeys(int const *params) {
+void ActionShowKeys(int param) {
 	GAME->get_keybinder()->ShowKeys();
 }
 
-void ActionDecreaseDebug(int const *params) {
+void ActionDecreaseDebug(int param) {
 	DEBUG(0, LEVEL_EMERGENCY, "!!decrease!!\n");
 }
-void ActionIncreaseDebug(int const *params) {
+void ActionIncreaseDebug(int param) {
 	DEBUG(0, LEVEL_EMERGENCY, "!!increase!!\n");
 }
 
-void ActionCloseGumps(int const *params) {
+void ActionCloseGumps(int param) {
 	EVENT->close_gumps();
 }
 
-void ActionUseItem(int const *params) {
+void ActionUseItem(int param) {
 	if (EVENT->get_mode() != MOVE_MODE && EVENT->get_mode() != EQUIP_MODE)
 		return;
-	uint16 obj_n = params[0] > 0 ? params[0] : 0;
-#if 0 // need to increase c_maxparams to 5 to use this many parameters
-	uint8 qual = params[1] > 0 ? params[1] : 0;
-	bool match_qual = params[2] == 1 ? true : false;
-	uint8 frame_n = params[3] > 0 ? params[3] : 0;
-	bool match_frame_n = params[4] == 1 ? true : false;
-#else
+	uint16 obj_n = param > 0 ? param : 0;
 	uint8 qual = 0;
 	bool match_qual = false;
 	uint8 frame_n = 0;
 	bool match_frame_n = false;
-#endif
 
 	// try player first
 	Obj *obj = PLAYER->get_actor()->inventory_get_object(obj_n, qual, match_qual, frame_n, match_frame_n);
@@ -477,75 +470,75 @@ void ActionUseItem(int const *params) {
 	// printf("ActionUseItem obj_n = %d, qual = %d, match_qual = %s, frame_n = %d, match_frame_n = %s\n", obj_n, qual, match_qual ? "true": "false", frame_n, match_frame_n ? "true": "false");
 }
 
-void ActionAssetViewer(int const *params) {
+void ActionAssetViewer(int param) {
 	EVENT->assetViewer();
 }
 
-void ActionShowEggs(int const *params) {
+void ActionShowEggs(int param) {
 	bool show_eggs = !GAME->get_obj_manager()->is_showing_eggs();
 	GAME->get_obj_manager()->set_show_eggs(show_eggs);
 	GAME->get_egg_manager()->set_egg_visibility(show_eggs);
 	new TextEffect(show_eggs ? "Showing eggs" : "Eggs invisible");
 }
 
-void ActionToggleHackmove(int const *params) {
+void ActionToggleHackmove(int param) {
 	bool hackmove = !GAME->using_hackmove();
 	GAME->set_hackmove(hackmove);
 	new TextEffect(hackmove ? "Hack move enabled" : "Hack move disabled");
 }
 
-void ActionToggleEggSpawn(int const *params) {
+void ActionToggleEggSpawn(int param) {
 	EggManager *egg_manager = GAME->get_obj_manager()->get_egg_manager();
 	bool spawning = !egg_manager->is_spawning_actors();
 	egg_manager->set_spawning_actors(spawning);
 	new TextEffect(spawning ? "Will spawn actors" : "Won't spawn actors");
 }
 
-void ActionToggleUnlimitedCasting(int const *params) {
+void ActionToggleUnlimitedCasting(int param) {
 	bool unlimited = !GAME->has_unlimited_casting();
 	GAME->set_unlimited_casting(unlimited);
 	new TextEffect(unlimited ? "Unlimited casting" : "Normal casting");
 }
 
-void ActionToggleNoDarkness(int const *params) {
+void ActionToggleNoDarkness(int param) {
 	bool no_darkness = GAME->get_screen()->toggle_darkness_cheat();
 	new TextEffect(no_darkness ? "No more darkness" : "Normal lighting");
 }
 
-void ActionTogglePickpocket(int const *params) {
+void ActionTogglePickpocket(int param) {
 	bool pickpocket = (EVENT->using_pickpocket_cheat = !EVENT->using_pickpocket_cheat);
 	new TextEffect(pickpocket ? "Pickpocket mode" : "Pickpocket disabled");
 }
 
-void ActionToggleGodMode(int const *params) {
+void ActionToggleGodMode(int param) {
 	bool god_mode = GAME->toggle_god_mode();
 	new TextEffect(god_mode ? "God mode enabled" : "God mode disabled");
 }
 
-void ActionToggleEthereal(int const *params) {
+void ActionToggleEthereal(int param) {
 	bool ethereal = !GAME->is_ethereal();
 	GAME->set_ethereal(ethereal);
 	PARTY->set_ethereal(ethereal);
 	new TextEffect(ethereal ? "Ethereal movement" : "Normal movement");
 }
 
-void ActionToggleX_Ray(int const *params) {
+void ActionToggleX_Ray(int param) {
 	bool x_ray = MAP_WINDOW->get_x_ray_view() <= X_RAY_OFF;
 	MAP_WINDOW->set_x_ray_view(x_ray ? X_RAY_CHEAT_ON : X_RAY_OFF, true);
 	new TextEffect(x_ray ? "X-ray mode" : "X-ray mode off");
 }
 
-void ActionHealParty(int const *params) {
+void ActionHealParty(int param) {
 	PARTY->heal();
 	PARTY->cure();
 	new TextEffect("Party healed");
 }
 
-void ActionTeleportToCursor(int const *params) {
+void ActionTeleportToCursor(int param) {
 	MAP_WINDOW->teleport_to_cursor();
 }
 
-void ActionToggleCheats(int const *params) {
+void ActionToggleCheats(int param) {
 	bool cheats = !GAME->are_cheats_enabled();
 	GAME->set_cheats_enabled(cheats);
 	new TextEffect(cheats ? "Cheats enabled" : "Cheats disabled");
@@ -562,7 +555,7 @@ void ActionToggleCheats(int const *params) {
 		MAP_WINDOW->set_x_ray_view(X_RAY_CHEAT_OFF);
 }
 
-void ActionDoNothing(int const *params) {
+void ActionDoNothing(int param) {
 }
 
 } // End of namespace Nuvie
diff --git a/engines/ultima/nuvie/keybinding/key_actions.h b/engines/ultima/nuvie/keybinding/key_actions.h
index f8c5690f677..b6e13f38e3d 100644
--- a/engines/ultima/nuvie/keybinding/key_actions.h
+++ b/engines/ultima/nuvie/keybinding/key_actions.h
@@ -25,85 +25,85 @@
 namespace Ultima {
 namespace Nuvie {
 
-void ActionWalkWest(int const *params);
-void ActionWalkEast(int const *params);
-void ActionWalkNorth(int const *params);
-void ActionWalkSouth(int const *params);
-void ActionWalkNorthEast(int const *params);
-void ActionWalkSouthEast(int const *params);
-void ActionWalkNorthWest(int const *params);
-void ActionWalkSouthWest(int const *params);
+void ActionWalkWest(int param);
+void ActionWalkEast(int param);
+void ActionWalkNorth(int param);
+void ActionWalkSouth(int param);
+void ActionWalkNorthEast(int param);
+void ActionWalkSouthEast(int param);
+void ActionWalkNorthWest(int param);
+void ActionWalkSouthWest(int param);
 
-void ActionCast(int const *params);
-void ActionLook(int const *params);
-void ActionTalk(int const *params);
-void ActionUse(int const *params);
-void ActionGet(int const *params);
-void ActionMove(int const *params); //PUSH EVENT
-void ActionDrop(int const *params);
-void ActionToggleCombat(int const *params);
-void ActionAttack(int const *params);
-void ActionRest(int const *params);
-void ActionMultiUse(int const *params);
-void ActionSelectCommandBar(int const *params);
-void ActionSelectNewCommandBar(int const *params);
+void ActionCast(int param);
+void ActionLook(int param);
+void ActionTalk(int param);
+void ActionUse(int param);
+void ActionGet(int param);
+void ActionMove(int param); //PUSH EVENT
+void ActionDrop(int param);
+void ActionToggleCombat(int param);
+void ActionAttack(int param);
+void ActionRest(int param);
+void ActionMultiUse(int param);
+void ActionSelectCommandBar(int param);
+void ActionSelectNewCommandBar(int param);
 
-void ActionDollGump(int const *params);
-void ActionShowStats(int const *params);
-void ActionInventory(int const *params);
-void ActionPartyView(int const *params);
-void ActionNextPartyMember(int const *params);
-void ActionPreviousPartyMember(int const *params);
-void ActionHome(int const *params);
-void ActionEnd(int const *params);
-void ActionToggleView(int const *params);
+void ActionDollGump(int param);
+void ActionShowStats(int param);
+void ActionInventory(int param);
+void ActionPartyView(int param);
+void ActionNextPartyMember(int param);
+void ActionPreviousPartyMember(int param);
+void ActionHome(int param);
+void ActionEnd(int param);
+void ActionToggleView(int param);
 
-void ActionSoloMode(int const *params);
-void ActionPartyMode(int const *params);
+void ActionSoloMode(int param);
+void ActionPartyMode(int param);
 
-void ActionSaveDialog(int const *params);
-void ActionLoadLatestSave(int const *params);
-void ActionQuickSave(int const *params);
-void ActionQuickLoad(int const *params);
-void ActionQuitDialog(int const *params);
-void ActionQuitNODialog(int const *params);
-void ActionGameMenuDialog(int const *params);
+void ActionSaveDialog(int param);
+void ActionLoadLatestSave(int param);
+void ActionQuickSave(int param);
+void ActionQuickLoad(int param);
+void ActionQuitDialog(int param);
+void ActionQuitNODialog(int param);
+void ActionGameMenuDialog(int param);
 
-void ActionToggleFullscreen(int const *params);
-void ActionToggleCursor(int const *params);
-void ActionToggleCombatStrategy(int const *params);
-void ActionToggleFps(int const *params);
-void ActionToggleAudio(int const *params);
-void ActionToggleMusic(int const *params);
-void ActionToggleSFX(int const *params);
-void ActionToggleOriginalStyleCommandBar(int const *params);
+void ActionToggleFullscreen(int param);
+void ActionToggleCursor(int param);
+void ActionToggleCombatStrategy(int param);
+void ActionToggleFps(int param);
+void ActionToggleAudio(int param);
+void ActionToggleMusic(int param);
+void ActionToggleSFX(int param);
+void ActionToggleOriginalStyleCommandBar(int param);
 
-void ActionDoAction(int const *params);
-void ActionCancelAction(int const *params);
+void ActionDoAction(int param);
+void ActionCancelAction(int param);
 
-void ActionMsgScrollUP(int const *params);
-void ActionMsgScrollDown(int const *params);
-void ActionShowKeys(int const *params);
-void ActionDecreaseDebug(int const *params);
-void ActionIncreaseDebug(int const *params);
-void ActionCloseGumps(int const *params);
-void ActionUseItem(int const *params);
+void ActionMsgScrollUP(int param);
+void ActionMsgScrollDown(int param);
+void ActionShowKeys(int param);
+void ActionDecreaseDebug(int param);
+void ActionIncreaseDebug(int param);
+void ActionCloseGumps(int param);
+void ActionUseItem(int param);
 
-void ActionAssetViewer(int const *params);
-void ActionShowEggs(int const *params);
-void ActionToggleHackmove(int const *params);
-void ActionToggleEggSpawn(int const *params);
-void ActionToggleUnlimitedCasting(int const *params);
-void ActionToggleNoDarkness(int const *params);
-void ActionTogglePickpocket(int const *params);
-void ActionToggleGodMode(int const *params);
-void ActionToggleEthereal(int const *params);
-void ActionToggleX_Ray(int const *params);
-void ActionHealParty(int const *params);
-void ActionTeleportToCursor(int const *params);
-void ActionToggleCheats(int const *params);
+void ActionAssetViewer(int param);
+void ActionShowEggs(int param);
+void ActionToggleHackmove(int param);
+void ActionToggleEggSpawn(int param);
+void ActionToggleUnlimitedCasting(int param);
+void ActionToggleNoDarkness(int param);
+void ActionTogglePickpocket(int param);
+void ActionToggleGodMode(int param);
+void ActionToggleEthereal(int param);
+void ActionToggleX_Ray(int param);
+void ActionHealParty(int param);
+void ActionTeleportToCursor(int param);
+void ActionToggleCheats(int param);
 
-void ActionDoNothing(int const *params);
+void ActionDoNothing(int param);
 
 } // End of namespace Nuvie
 } // End of namespace Ultima
diff --git a/engines/ultima/nuvie/keybinding/key_help_dialog.cpp b/engines/ultima/nuvie/keybinding/key_help_dialog.cpp
new file mode 100644
index 00000000000..cebc2aa312b
--- /dev/null
+++ b/engines/ultima/nuvie/keybinding/key_help_dialog.cpp
@@ -0,0 +1,46 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/nuvie/keybinding/key_help_dialog.h"
+#include "common/translation.h"
+#include "gui/gui-manager.h"
+#include "gui/ThemeEval.h"
+#include "gui/widget.h"
+#include "gui/widgets/richtext.h"
+
+namespace Ultima {
+namespace Nuvie {
+
+KeyHelpDialog::KeyHelpDialog(const Common::U32String &helpTxt)
+	: GUI::Dialog("HelpDialog") {
+	new GUI::RichTextWidget(this, "HelpDialog.TabWidget", helpTxt);
+	new GUI::ButtonWidget(this, "HelpDialog.Close", Common::U32String("Close"), Common::U32String(), GUI::kCloseCmd);
+}
+
+void KeyHelpDialog::handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data) {
+	switch (cmd) {
+		case GUI::kCloseCmd:
+			close();
+	}
+}
+
+} // End of namespace Nuvie
+} // End of namespace Ultima
diff --git a/engines/ultima/nuvie/keybinding/key_help_dialog.h b/engines/ultima/nuvie/keybinding/key_help_dialog.h
new file mode 100644
index 00000000000..3e9fe0fd103
--- /dev/null
+++ b/engines/ultima/nuvie/keybinding/key_help_dialog.h
@@ -0,0 +1,50 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef NUVIE_KEYHELP_DIALOG_H
+#define NUVIE_KEYHELP_DIALOG_H
+
+#include "gui/dialog.h"
+#include "common/str.h"
+#include "common/str-array.h"
+
+namespace GUI {
+	class CommandSender;
+}
+
+namespace Ultima {
+namespace Nuvie {
+
+/**
+ * Key help dialog - just a rich text and a close button.
+ */
+class KeyHelpDialog : public GUI::Dialog {
+public:
+	KeyHelpDialog(const Common::U32String &helpStr);
+
+	void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data) override;
+};
+
+
+} // End of namespace Nuvie
+} // End of namespace Ultima
+
+#endif
diff --git a/engines/ultima/nuvie/keybinding/keys.cpp b/engines/ultima/nuvie/keybinding/keys.cpp
index 43638bf883c..000bf3cac5a 100644
--- a/engines/ultima/nuvie/keybinding/keys.cpp
+++ b/engines/ultima/nuvie/keybinding/keys.cpp
@@ -21,6 +21,7 @@
 
 #include "ultima/nuvie/keybinding/keys.h"
 #include "ultima/nuvie/keybinding/key_actions.h"
+#include "ultima/nuvie/keybinding/key_help_dialog.h"
 #include "ultima/nuvie/core/nuvie_defs.h"
 #include "ultima/nuvie/core/game.h"
 #include "ultima/nuvie/core/player.h"
@@ -33,109 +34,124 @@
 #include "ultima/nuvie/gui/widgets/console.h"
 #include "ultima/nuvie/core/effect.h"
 #include "ultima/shared/conf/xml_tree.h"
+
 #include "common/hash-str.h"
+#include "common/system.h"
+#include "common/hashmap.h"
+#include "common/translation.h"
+#include "backends/keymapper/keymapper.h"
+#include "backends/keymapper/action.h"
+#include "backends/keymapper/hardware-input.h"
 
 #define ENCODE_KEY(key, mod) ((uint32)(key) | ((uint32)(mod) << 24))
 
 namespace Ultima {
 namespace Nuvie {
 
-static const char * whitespace = "\t\n\v\f\r ";
+static const char *whitespace = "\t\n\v\f\r ";
 
-typedef void(*ActionFunc)(int const *);
+typedef void(*ActionFunc)(int);
 
 struct Action {
-	const char *s;
+	const char *kId;
 	ActionFunc func; // called on keydown
-	const char *desc;
 	enum {
-		dont_show = 0,
-		normal_keys,
-		cheat_keys
-	} key_type;
-	bool allow_in_vehicle;
-	ActionKeyType action_key_type;
+		KeyNotShown = 0,
+		KeyNormal,
+		KeyCheat
+	} keyVisibility;
+	bool allowInVehicle;
+	ActionKeyType keyType;
 };
 
 const Action NuvieActions[] = {
-	{ "WALK_WEST", ActionWalkWest, "Walk west", Action::normal_keys, true, WEST_KEY  },
-	{ "WALK_EAST", ActionWalkEast, "Walk east", Action::normal_keys, true, EAST_KEY },
-	{ "WALK_NORTH", ActionWalkNorth, "Walk north", Action::normal_keys, true, NORTH_KEY },
-	{ "WALK_SOUTH", ActionWalkSouth, "Walk south", Action::normal_keys, true, SOUTH_KEY },
-	{ "WALK_NORTH_EAST", ActionWalkNorthEast, "Walk north-east", Action::normal_keys, true, NORTH_EAST_KEY },
-	{ "WALK_SOUTH_EAST", ActionWalkSouthEast, "Walk south-east", Action::normal_keys, true, SOUTH_EAST_KEY },
-	{ "WALK_NORTH_WEST", ActionWalkNorthWest, "Walk north-west", Action::normal_keys, true, NORTH_WEST_KEY },
-	{ "WALK_SOUTH_WEST", ActionWalkSouthWest, "Walk south-west", Action::normal_keys, true, SOUTH_WEST_KEY },
-	{ "CAST", ActionCast, "Cast", Action::normal_keys, true, OTHER_KEY }, // allow_in_vehicle is true, so the right message or cancel is done for WOU games
-	{ "LOOK", ActionLook, "Look", Action::normal_keys, true, OTHER_KEY },
-	{ "TALK", ActionTalk, "Talk", Action::normal_keys, true, OTHER_KEY },
-	{ "USE", ActionUse, "Use", Action::normal_keys, true, OTHER_KEY },
-	{ "GET", ActionGet, "Get", Action::normal_keys, false, OTHER_KEY },
-	{ "MOVE", ActionMove, "Move", Action::normal_keys, false, OTHER_KEY },
-	{ "DROP", ActionDrop, "Drop", Action::normal_keys, false, OTHER_KEY },
-	{ "TOGGLE_COMBAT", ActionToggleCombat, "Toggle combat", Action::normal_keys, false, OTHER_KEY },
-	{ "ATTACK", ActionAttack, "Attack", Action::normal_keys, true, OTHER_KEY },
-	{ "REST", ActionRest, "Rest", Action::normal_keys, true, OTHER_KEY },
-	{ "MULTI_USE", ActionMultiUse, "Multi-use", Action::normal_keys, true, OTHER_KEY },
-	{ "SELECT_COMMAND_BAR", ActionSelectCommandBar, "Select Command Bar", Action::normal_keys, true, OTHER_KEY },
-	{ "NEW_COMMAND_BAR", ActionSelectNewCommandBar, "Select New Command Bar", Action::normal_keys, true, NEW_COMMAND_BAR_KEY },
-	{ "DOLL_GUMP", ActionDollGump, "Doll gump", Action::normal_keys, true, OTHER_KEY },
-	{ "SHOW_STATS", ActionShowStats, "Shows the party member's stats", Action::normal_keys, true, OTHER_KEY },
-	{ "INVENTORY", ActionInventory, "inventory", Action::normal_keys, true, OTHER_KEY },
-	{ "PREVIOUS_PARTY_MEMBER", ActionPreviousPartyMember, "Previous party member", Action::normal_keys, true, PREVIOUS_PARTY_MEMBER_KEY },
-	{ "NEXT_PARTY_MEMBER", ActionNextPartyMember, "Next party member", Action::normal_keys, true, NEXT_PARTY_MEMBER_KEY },
-	{ "HOME_KEY", ActionHome, "Home key", Action::normal_keys, true, HOME_KEY },
-	{ "END_KEY", ActionEnd, "End key", Action::normal_keys, true, END_KEY },
-	{ "TOGGLE_VIEW", ActionToggleView, "Toggle between inventory and actor view", Action::normal_keys, true, OTHER_KEY },
-	{ "PARTY_VIEW", ActionPartyView, "Party view", Action::normal_keys, true, OTHER_KEY },
-	{ "SOLO_MODE", ActionSoloMode, "Solo mode", Action::normal_keys, true, OTHER_KEY },
-	{ "PARTY_MODE", ActionPartyMode, "Party mode", Action::normal_keys, true, OTHER_KEY },
-	{ "SAVE_MENU", ActionSaveDialog, "Save menu", Action::normal_keys, true, OTHER_KEY },
-	{ "LOAD_LATEST_SAVE", ActionLoadLatestSave, "Load latest save", Action::normal_keys, true, OTHER_KEY },
-	{ "QUICK_SAVE", ActionQuickSave, "Quick save", Action::normal_keys, true, OTHER_KEY },
-	{ "QUICK_LOAD", ActionQuickLoad, "Quick load", Action::normal_keys, true, OTHER_KEY },
-	{ "QUIT", ActionQuitDialog, "Quit", Action::normal_keys, true, QUIT_KEY },
-	{ "QUIT_NO_DIALOG", ActionQuitNODialog, "Quit without confirmation", Action::normal_keys, true, QUIT_KEY },
-	{ "GAME_MENU_DIALOG", ActionGameMenuDialog, "Show game menu; Cancel action if in middle of action", Action::normal_keys, true, CANCEL_ACTION_KEY },
-	{ "TOGGLE_FULLSCREEN", ActionToggleFullscreen, "Toggle Fullscreen", Action::normal_keys, true, TOGGLE_FULLSCREEN_KEY },
-	{ "TOGGLE_CURSOR", ActionToggleCursor, "Toggle Cursor", Action::normal_keys, true, TOGGLE_CURSOR_KEY },
-	{ "TOGGLE_COMBAT_STRATEGY", ActionToggleCombatStrategy, "Toggle combat strategy", Action::normal_keys, true, OTHER_KEY },
-	{ "TOGGLE_FPS_DISPLAY", ActionToggleFps, "Toggle frames per second display", Action::normal_keys, true, TOGGLE_FPS_KEY },
-	{ "TOGGLE_AUDIO", ActionToggleAudio, "Toggle audio", Action::normal_keys, true, TOGGLE_AUDIO_KEY },
-	{ "TOGGLE_MUSIC", ActionToggleMusic, "Toggle music", Action::normal_keys, true, TOGGLE_MUSIC_KEY },
-	{ "TOGGLE_SFX", ActionToggleSFX, "Toggle sfx", Action::normal_keys, true, TOGGLE_SFX_KEY },
-	{ "TOGGLE_ORIGINAL_STYLE_COMMAND_BAR", ActionToggleOriginalStyleCommandBar, "Show/hide original style command bar", Action::normal_keys, true, OTHER_KEY },
-	{ "DO_ACTION", ActionDoAction, "Do action", Action::normal_keys, true, DO_ACTION_KEY },
-	{ "CANCEL_ACTION", ActionCancelAction, "Cancel action", Action::normal_keys, true, CANCEL_ACTION_KEY },
-	{ "MSG_SCROLL_UP", ActionMsgScrollUP, "Msg scroll up", Action::normal_keys, true, MSGSCROLL_UP_KEY },
-	{ "MSG_SCROLL_DOWN", ActionMsgScrollDown, "Msg scroll down", Action::normal_keys, true, MSGSCROLL_DOWN_KEY },
-	{ "SHOW_KEYS", ActionShowKeys, "Show keys", Action::normal_keys, true, OTHER_KEY },
-	{ "DECREASE_DEBUG", ActionDecreaseDebug, "Decrease debug", Action::normal_keys, true, DECREASE_DEBUG_KEY },
-	{ "INCREASE_DEBUG", ActionIncreaseDebug, "Increase debug", Action::normal_keys, true, INCREASE_DEBUG_KEY },
-	{ "CLOSE_GUMPS", ActionCloseGumps, "Close gumps", Action::normal_keys, true, OTHER_KEY },
-	{ "USE_ITEM", ActionUseItem, "Use item", Action::normal_keys, true, OTHER_KEY },
-	{ "ASSET_VIEWER", ActionAssetViewer, "Open the asset viewer", Action::normal_keys, true, OTHER_KEY },
-	{ "SHOW_EGGS", ActionShowEggs, "Show eggs", Action::cheat_keys, true, OTHER_KEY },
-	{ "TOGGLE_HACKMOVE", ActionToggleHackmove, "Toggle hack move", Action::cheat_keys, true, OTHER_KEY },
-	{ "TOGGLE_EGG_SPAWN", ActionToggleEggSpawn, "Toggle egg spawn", Action::cheat_keys, true, OTHER_KEY },
-	{ "TOGGLE_UNLIMITED_CASTING", ActionToggleUnlimitedCasting, "Toggle unlimited casting", Action::cheat_keys, true, OTHER_KEY },
-	{ "TOGGLE_NO_DARKNESS", ActionToggleNoDarkness, "Toggle no darkness", Action::cheat_keys, true, OTHER_KEY },
-	{ "TOGGLE_PICKPOCKET_MODE", ActionTogglePickpocket, "Toggle pickpocket mode", Action::cheat_keys, true, OTHER_KEY },
-	{ "TOGGLE_GOD_MODE",  ActionToggleGodMode, "Toggle god mode", Action::cheat_keys, true, OTHER_KEY },
-	{ "TOGGLE_ETHEREAL",  ActionToggleEthereal, "Toggle ethereal mode", Action::cheat_keys, true, OTHER_KEY },
-	{ "TOGGLE_X_RAY",  ActionToggleX_Ray, "Toggle X-ray mode", Action::cheat_keys, true, OTHER_KEY },
-	{ "HEAL_PARTY", ActionHealParty, "Heal party", Action::cheat_keys, true, OTHER_KEY },
-	{ "TELEPORT_TO_CURSOR", ActionTeleportToCursor, "Teleport to cursor", Action::cheat_keys, true, OTHER_KEY },
-	{ "TOGGLE_CHEATS", ActionToggleCheats, "Toggle cheats", Action::normal_keys, true, OTHER_KEY },
-	{ "DO_NOTHING", ActionDoNothing, "", Action::dont_show, true, OTHER_KEY },
-	{ "", 0, "", Action::dont_show, false, OTHER_KEY } //terminator
+	{ "WALK_WEST", ActionWalkWest, Action::KeyNormal, true, WEST_KEY  },
+	{ "WALK_EAST", ActionWalkEast, Action::KeyNormal, true, EAST_KEY },
+	{ "WALK_NORTH", ActionWalkNorth, Action::KeyNormal, true, NORTH_KEY },
+	{ "WALK_SOUTH", ActionWalkSouth, Action::KeyNormal, true, SOUTH_KEY },
+	{ "WALK_NORTH_EAST", ActionWalkNorthEast, Action::KeyNormal, true, NORTH_EAST_KEY },
+	{ "WALK_SOUTH_EAST", ActionWalkSouthEast, Action::KeyNormal, true, SOUTH_EAST_KEY },
+	{ "WALK_NORTH_WEST", ActionWalkNorthWest, Action::KeyNormal, true, NORTH_WEST_KEY },
+	{ "WALK_SOUTH_WEST", ActionWalkSouthWest, Action::KeyNormal, true, SOUTH_WEST_KEY },
+	{ "CAST", ActionCast, Action::KeyNormal, true, OTHER_KEY }, // allow_in_vehicle is true, so the right message or cancel is done for WOU games
+	{ "LOOK", ActionLook, Action::KeyNormal, true, OTHER_KEY },
+	{ "TALK", ActionTalk, Action::KeyNormal, true, OTHER_KEY },
+	{ "USE", ActionUse, Action::KeyNormal, true, OTHER_KEY },
+	{ "GET", ActionGet, Action::KeyNormal, false, OTHER_KEY },
+	{ "MOVE", ActionMove, Action::KeyNormal, false, OTHER_KEY },
+	{ "DROP", ActionDrop, Action::KeyNormal, false, OTHER_KEY },
+	{ "TOGGLE_COMBAT", ActionToggleCombat, Action::KeyNormal, false, OTHER_KEY },
+	{ "ATTACK", ActionAttack, Action::KeyNormal, true, OTHER_KEY },
+	{ "REST", ActionRest, Action::KeyNormal, true, OTHER_KEY },
+	{ "MULTI_USE", ActionMultiUse, Action::KeyNormal, true, OTHER_KEY },
+	{ "SELECT_COMMAND_BAR", ActionSelectCommandBar, Action::KeyNormal, true, OTHER_KEY },
+	{ "NEW_COMMAND_BAR", ActionSelectNewCommandBar, Action::KeyNormal, true, NEW_COMMAND_BAR_KEY },
+	{ "DOLL_GUMP", ActionDollGump, Action::KeyNormal, true, OTHER_KEY },
+	{ "SHOW_STATS", ActionShowStats, Action::KeyNormal, true, OTHER_KEY },
+	{ "INVENTORY", ActionInventory, Action::KeyNormal, true, OTHER_KEY },
+	{ "PREVIOUS_PARTY_MEMBER", ActionPreviousPartyMember, Action::KeyNormal, true, PREVIOUS_PARTY_MEMBER_KEY },
+	{ "NEXT_PARTY_MEMBER", ActionNextPartyMember, Action::KeyNormal, true, NEXT_PARTY_MEMBER_KEY },
+	{ "HOME_KEY", ActionHome, Action::KeyNormal, true, HOME_KEY },
+	{ "END_KEY", ActionEnd, Action::KeyNormal, true, END_KEY },
+	{ "TOGGLE_VIEW", ActionToggleView, Action::KeyNormal, true, OTHER_KEY },
+	{ "PARTY_VIEW", ActionPartyView, Action::KeyNormal, true, OTHER_KEY },
+	{ "SOLO_MODE", ActionSoloMode, Action::KeyNormal, true, OTHER_KEY },
+	{ "PARTY_MODE", ActionPartyMode, Action::KeyNormal, true, OTHER_KEY },
+	{ "SAVE_MENU", ActionSaveDialog, Action::KeyNormal, true, OTHER_KEY },
+	{ "LOAD_LATEST_SAVE", ActionLoadLatestSave, Action::KeyNormal, true, OTHER_KEY },
+	{ "QUICK_SAVE", ActionQuickSave, Action::KeyNormal, true, OTHER_KEY },
+	{ "QUICK_LOAD", ActionQuickLoad, Action::KeyNormal, true, OTHER_KEY },
+	{ "QUIT", ActionQuitDialog, Action::KeyNormal, true, QUIT_KEY },
+	//{ "QUIT_NO_DIALOG", ActionQuitNODialog, Action::normal_keys, true, QUIT_KEY },
+	{ "GAME_MENU_DIALOG", ActionGameMenuDialog, Action::KeyNormal, true, CANCEL_ACTION_KEY },
+	//{ "TOGGLE_FULLSCREEN", ActionToggleFullscreen, "Toggle Fullscreen", Action::normal_keys, true, TOGGLE_FULLSCREEN_KEY },
+	{ "TOGGLE_CURSOR", ActionToggleCursor, Action::KeyNormal, true, TOGGLE_CURSOR_KEY },
+	{ "TOGGLE_COMBAT_STRATEGY", ActionToggleCombatStrategy, Action::KeyNormal, true, OTHER_KEY },
+	{ "TOGGLE_FPS_DISPLAY", ActionToggleFps, Action::KeyNormal, true, TOGGLE_FPS_KEY },
+	{ "TOGGLE_AUDIO", ActionToggleAudio, Action::KeyNormal, true, TOGGLE_AUDIO_KEY },
+	{ "TOGGLE_MUSIC", ActionToggleMusic, Action::KeyNormal, true, TOGGLE_MUSIC_KEY },
+	{ "TOGGLE_SFX", ActionToggleSFX, Action::KeyNormal, true, TOGGLE_SFX_KEY },
+	{ "TOGGLE_ORIGINAL_STYLE_COMMAND_BAR", ActionToggleOriginalStyleCommandBar, Action::KeyNormal, true, OTHER_KEY },
+	{ "DO_ACTION", ActionDoAction, Action::KeyNormal, true, DO_ACTION_KEY },
+	{ "CANCEL_ACTION", ActionCancelAction, Action::KeyNormal, true, CANCEL_ACTION_KEY },
+	{ "MSG_SCROLL_UP", ActionMsgScrollUP, Action::KeyNormal, true, MSGSCROLL_UP_KEY },
+	{ "MSG_SCROLL_DOWN", ActionMsgScrollDown, Action::KeyNormal, true, MSGSCROLL_DOWN_KEY },
+	{ "SHOW_KEYS", ActionShowKeys, Action::KeyNormal, true, OTHER_KEY },
+	{ "DECREASE_DEBUG", ActionDecreaseDebug, Action::KeyNormal, true, DECREASE_DEBUG_KEY },
+	{ "INCREASE_DEBUG", ActionIncreaseDebug, Action::KeyNormal, true, INCREASE_DEBUG_KEY },
+	{ "CLOSE_GUMPS", ActionCloseGumps, Action::KeyNormal, true, OTHER_KEY },
+	{ "USE_ITEM", ActionUseItem, Action::KeyNormal, true, OTHER_KEY },
+	{ "ASSET_VIEWER", ActionAssetViewer, Action::KeyNormal, true, OTHER_KEY },
+	{ "SHOW_EGGS", ActionShowEggs, Action::KeyCheat, true, OTHER_KEY },
+	{ "TOGGLE_HACKMOVE", ActionToggleHackmove, Action::KeyCheat, true, OTHER_KEY },
+	{ "TOGGLE_EGG_SPAWN", ActionToggleEggSpawn, Action::KeyCheat, true, OTHER_KEY },
+	{ "TOGGLE_UNLIMITED_CASTING", ActionToggleUnlimitedCasting, Action::KeyCheat, true, OTHER_KEY },
+	{ "TOGGLE_NO_DARKNESS", ActionToggleNoDarkness, Action::KeyCheat, true, OTHER_KEY },
+	{ "TOGGLE_PICKPOCKET_MODE", ActionTogglePickpocket, Action::KeyCheat, true, OTHER_KEY },
+	{ "TOGGLE_GOD_MODE",  ActionToggleGodMode, Action::KeyCheat, true, OTHER_KEY },
+	{ "TOGGLE_ETHEREAL",  ActionToggleEthereal, Action::KeyCheat, true, OTHER_KEY },
+	{ "TOGGLE_X_RAY",  ActionToggleX_Ray, Action::KeyCheat, true, OTHER_KEY },
+	{ "HEAL_PARTY", ActionHealParty, Action::KeyCheat, true, OTHER_KEY },
+	{ "TELEPORT_TO_CURSOR", ActionTeleportToCursor, Action::KeyCheat, true, OTHER_KEY },
+	{ "TOGGLE_CHEATS", ActionToggleCheats, Action::KeyNormal, true, OTHER_KEY },
+	{ "DO_NOTHING", ActionDoNothing, Action::KeyNotShown, true, OTHER_KEY },
+};
+
+const char *PerPartyMemberActions[] = {
+	"SOLO_MODE", "SHOW_STATS", "INVENTORY", "DOLL_GUMP"
 };
 
 struct KeycodeString {
 	const char *s;
 	Common::KeyCode k;
 };
-const KeycodeString StringTable[] = {
+
+//
+// These don't match the strings in backends/keymapper/hardware-input.cpp
+// but are from Nuvie before ScummVM integration.  Leave them here for
+// backward compatibility.
+//
+const KeycodeString KeycodeStringTable[] = {
 	{"LCTRL",     Common::KEYCODE_LCTRL},
 	{"RCTRL",     Common::KEYCODE_RCTRL},
 	{"LALT",      Common::KEYCODE_LALT},
@@ -250,10 +266,9 @@ const KeycodeString StringTable[] = {
 	{"JOY17",             JOY17},
 	{"JOY18",             JOY18},
 	{"JOY19",             JOY19},
-	{"", Common::KEYCODE_INVALID} // terminator
 };
 
-const Action doNothingAction = { "DO_NOTHING", ActionDoNothing, "", Action::dont_show, true, OTHER_KEY };
+const Action doNothingAction = { "DO_NOTHING", ActionDoNothing, Action::KeyNotShown, true, OTHER_KEY };
 
 KeyBinder::KeyBinder(const Configuration *config) : enable_joystick(false) {
 	FillParseMaps();
@@ -323,16 +338,16 @@ KeyBinder::~KeyBinder() {
 }
 
 void KeyBinder::AddKeyBinding(Common::KeyCode key, byte mod, const Action *action,
-							  int nparams, int *params) {
+							  int nparams, int param) {
 	Common::KeyState k;
 	ActionType a;
 	a.action = action;
 
-	int i;  // For MSVC
-	for (i = 0; i < c_maxparams && i < nparams; i++)
-		a.params[i] = params[i];
-	for (i = nparams; i < c_maxparams; i++)
-		a.params[i] = -1;
+	assert(nparams == 0 || nparams == 1);
+	if (nparams == 1)
+		a.param = param;
+	else
+		a.param = -1;
 
 	_bindings[ENCODE_KEY(key, mod)] = a;
 }
@@ -340,25 +355,25 @@ void KeyBinder::AddKeyBinding(Common::KeyCode key, byte mod, const Action *actio
 ActionType KeyBinder::get_ActionType(const Common::KeyState &key) {
 	KeyMap::iterator sdlkey_index = get_sdlkey_index(key);
 	if (sdlkey_index == _bindings.end()) {
-		ActionType actionType = {&doNothingAction, {0}};
+		ActionType actionType = {&doNothingAction, 0};
 		return actionType;
 	}
 	return (*sdlkey_index)._value;
 }
 
 ActionKeyType KeyBinder::GetActionKeyType(ActionType a) {
-	return a.action->action_key_type;
+	return a.action->keyType;
 }
 
 bool KeyBinder::DoAction(ActionType const &a) const {
-	if (!a.action->allow_in_vehicle && Game::get_game()->get_player()->is_in_vehicle() && Game::get_game()->get_game_type() != NUVIE_GAME_MD) {
+	if (!a.action->allowInVehicle && Game::get_game()->get_player()->is_in_vehicle() && Game::get_game()->get_game_type() != NUVIE_GAME_MD) {
 		Game::get_game()->get_event()->display_not_aboard_vehicle();
 		return true;
-	} else if (a.action->key_type == Action::cheat_keys && !Game::get_game()->are_cheats_enabled()) {
+	} else if (a.action->keyVisibility == Action::KeyCheat && !Game::get_game()->are_cheats_enabled()) {
 		new TextEffect("Cheats are disabled");
 		return true;
 	}
-	a.action->func(a.params);
+	a.action->func(a.param);
 
 	return true;
 }
@@ -369,13 +384,12 @@ KeyMap::iterator KeyBinder::get_sdlkey_index(const Common::KeyState &key) {
 
 bool KeyBinder::HandleEvent(const Common::Event *ev) {
 	Common::KeyState key = ev->kbd;
-	KeyMap::iterator sdlkey_index;
 
 	if (ev->type != Common::EVENT_KEYDOWN)
 		return false;
 
 	key.flags &= ~Common::KBD_STICKY;
-	sdlkey_index = get_sdlkey_index(key);
+	KeyMap::iterator sdlkey_index = get_sdlkey_index(key);
 	if (sdlkey_index != _bindings.end())
 		return DoAction((*sdlkey_index)._value);
 
@@ -387,6 +401,15 @@ bool KeyBinder::HandleEvent(const Common::Event *ev) {
 	return false;
 }
 
+bool KeyBinder::handleScummVMBoundEvent(const Common::Event *ev) {
+	ParseHashedActionMap::iterator iter = _actionsHashed.find(ev->customType);
+	if (iter != _actionsHashed.end()) {
+		const ActionType action = iter->_value;
+		return DoAction(action);
+	}
+	return false;
+}
+
 void KeyBinder::handle_wrong_key_pressed() {
 	if (Game::get_game()->get_event()->get_mode() != MOVE_MODE)
 		Game::get_game()->get_event()->cancelAction();
@@ -397,7 +420,7 @@ void KeyBinder::handle_wrong_key_pressed() {
 }
 
 bool KeyBinder::handle_always_available_keys(ActionType a) {
-	switch (a.action->action_key_type) {
+	switch (a.action->keyType) {
 	case TOGGLE_AUDIO_KEY: // FIXME - Shutting off the music in cutscenes will not have any music play when
 	case TOGGLE_MUSIC_KEY: //         you toggle it back on. It has to wait for the engine to play another song
 	case TOGGLE_SFX_KEY:
@@ -406,29 +429,56 @@ bool KeyBinder::handle_always_available_keys(ActionType a) {
 	case DECREASE_DEBUG_KEY:
 	case INCREASE_DEBUG_KEY:
 	case QUIT_KEY: // FIXME - doesn't currently work in intro or when viewing ending with command line cheat
-		a.action->func(a.params);
+		a.action->func(a.param);
 		return true;
 	default:
 		return false;
 	}
 }
 
-void KeyBinder::ShowKeys() const { // FIXME This doesn't look very good, the font is missing
-	// some characters, and it is longer than msgscroll can hold
-//	if(Game::get_game()->is_orig_style())
-	{
-		Std::vector<string>::const_iterator iter;
-		string keysStr;
-		MsgScroll *scroll = Game::get_game()->get_scroll();
-		scroll->set_autobreak(true);
-
-		for (iter = _keyHelp.begin(); iter != _keyHelp.end(); ++iter) {
-			keysStr = "\n";
-			keysStr.append(iter->c_str());
-			scroll->display_string(keysStr, 1);
+Common::Array<Common::U32String> KeyBinder::buildKeyHelp() const {
+	Common::Array<Common::U32String> keyHelp;
+	Common::HashMap<Common::String, const Action*> keyActionMap;
+
+	for (const Action &action : NuvieActions) {
+		keyActionMap.setVal(action.kId, &action);
+	}
+
+	Common::Keymapper *keymapper = g_system->getEventManager()->getKeymapper();
+	for (const Common::Keymap *map : keymapper->getKeymaps()) {
+		if (!map->isEnabled() || map->getType() != Common::Keymap::kKeymapTypeGame)
+			continue;
+
+		for (const Common::Action *action : map->getActions()) {
+			if (keyActionMap.contains(action->id) &&
+					keyActionMap[action->id]->keyVisibility != Action::KeyNormal)
+				continue;
+
+			Common::Array<Common::HardwareInput> inputs = map->getActionMapping(action);
+			if (inputs.size() > 0) {
+				Common::U32String desc;
+				// The * can't be bolded easily in markdown..
+				if (inputs[0].description == "*")
+					desc = "*";
+				else
+					desc = Common::U32String("**") + inputs[0].description + Common::U32String("**");
+				desc += Common::U32String(" - ") + action->description;
+				keyHelp.push_back(desc);
+			}
 		}
-		scroll->message("\n\n\t");
 	}
+
+	return keyHelp;
+}
+
+void KeyBinder::ShowKeys() const {
+	Common::Array<Common::U32String> keyHelp = buildKeyHelp();
+	Common::U32String helpStr;
+	for (const Common::U32String &help : keyHelp) {
+		helpStr += Common::U32String("\n") + help;
+	}
+	KeyHelpDialog helpDialog(helpStr);
+	helpDialog.runModal();
 }
 
 void KeyBinder::ParseText(char *text, int len) {
@@ -454,13 +504,9 @@ static void skipspace(string &s) {
 
 void KeyBinder::ParseLine(const char *line) {
 	size_t i;
-	Common::KeyState k;
-	ActionType a;
-	k.keycode = Common::KEYCODE_INVALID;
-	k.flags = 0;
+	Common::KeyState k(Common::KEYCODE_INVALID);
 	string s = line;
-	string d, keycode;
-	bool show;
+	string keycode;
 
 	skipspace(s);
 
@@ -488,7 +534,6 @@ void KeyBinder::ParseLine(const char *line) {
 			u.erase(0, 6);
 		} else {
 			i = s.findFirstOf(whitespace);
-
 			keycode = s.substr(0, i);
 			s.erase(0, i);
 			string t = Std::to_uppercase(keycode);
@@ -530,70 +575,33 @@ void KeyBinder::ParseLine(const char *line) {
 	s.erase(0, i);
 	t = Std::to_uppercase(t);
 
-	ParseActionMap::iterator action_index = _actions.find(t);
+	ParseActionMap::const_iterator action_index = _actions.find(t);
+	ActionType a;
 	if (action_index != _actions.end()) {
-		a.action = (const Action *)(*action_index)._value;
+		a.action = action_index->_value;
 	} else {
-		::error("Keybinder: unsupported action: %s", t.c_str());
+		::warning("Keybinder: unsupported action: %s", t.c_str());
+		return;
 	}
 
 	// get params
 	skipspace(s);
 
 	int np = 0;
-	while (!s.empty() && s[0] != '#' && np < c_maxparams) {
+	a.param = -1;
+	if (!s.empty() && s[0] != '#') {
 		i = s.findFirstOf(whitespace);
 		string tmp = s.substr(0, i);
 		s.erase(0, i);
 		skipspace(s);
 
 		int p = atoi(tmp.c_str());
-		a.params[np++] = p;
-	}
-
-	// read optional help comment
-	if (!s.empty() && s[0] == '#') {
-		if (s.length() >= 2 && s[1] == '-') {
-			show = false;
-		} else {
-			s.erase(0, 1);
-			skipspace(s);
-			d = s;
-			show = true;
-		}
-	} else {
-		d = a.action->desc;
-		show = a.action->key_type != Action::dont_show;
-	}
-
-	if (show) {
-		string desc;
-		if (k.flags & Common::KBD_CTRL)
-			desc += "Ctrl-";
-#if defined(MACOS) || defined(MACOSX)
-		if (k.flags & Common::KBD_ALT)
-			desc += "Cmd-";
-#else
-		if (k.flags & Common::KBD_ALT)
-			desc += "Alt-";
-#endif
-		if (k.flags & Common::KBD_SHIFT)
-			desc += "Shift-";
-		if (keycode == "`")
-			desc += "grave";
-		else
-			desc += keycode;
-		desc += " - " + d;
-
-		// add to help list
-		if (a.action->key_type == Action::normal_keys)
-			_keyHelp.push_back(desc);
-		else if (a.action->key_type == Action::cheat_keys)
-			_cheatHelp.push_back(desc);
+		a.param = p;
+		np = 1;
 	}
 
 	// bind key
-	AddKeyBinding(k.keycode, k.flags, a.action, np, a.params);
+	AddKeyBinding(k.keycode, k.flags, a.action, np, a.param);
 }
 
 void KeyBinder::LoadFromFileInternal(const char *filename) {
@@ -660,11 +668,30 @@ void KeyBinder::LoadFromPatch() { // FIXME default should probably be system spe
 
 // codes used in keybindings-files. (use uppercase here)
 void KeyBinder::FillParseMaps() {
-	for (int i = 0; strlen(StringTable[i].s) > 0; i++)
-		_keys[StringTable[i].s] = StringTable[i].k;
+	for (const KeycodeString keycodeStr : KeycodeStringTable)
+		_keys[keycodeStr.s] = keycodeStr.k;
+
+	for (const Action &action : NuvieActions) {
+		const Common::String keyId(action.kId);
+		_actions[keyId] = &action;
+		ActionType at;
+		at.action = &action;
+		at.param = 0;
+		_actionsHashed[keyId.hash()] = at;
+	}
 
-	for (int i = 0; strlen(NuvieActions[i].s) > 0; i++)
-		_actions[NuvieActions[i].s] = &(NuvieActions[i]);
+	for (const char *perMemberAction : PerPartyMemberActions) {
+		if (!_actions.contains(perMemberAction))
+			error("No base definition for per-party-member action %s", perMemberAction);
+		for (int i = 1; i <= 9; i++) {
+			Common::String actionId = Common::String::format("%s_%d", perMemberAction, i);
+			const Action *action = _actions[perMemberAction];
+			ActionType at;
+			at.action = action;
+			at.param = i;
+			_actionsHashed[actionId.hash()] = at;
+		}
+	}
 }
 
 uint8 KeyBinder::get_axis(uint8 index) const {
diff --git a/engines/ultima/nuvie/keybinding/keys.h b/engines/ultima/nuvie/keybinding/keys.h
index fb3ca3f6df9..bead46e9d00 100644
--- a/engines/ultima/nuvie/keybinding/keys.h
+++ b/engines/ultima/nuvie/keybinding/keys.h
@@ -36,23 +36,17 @@ enum joy_axes_pairs {
 	AXES_PAIR1, AXES_PAIR2, AXES_PAIR3, AXES_PAIR4, UNHANDLED_AXES_PAIR
 };
 
-struct str_int_pair {
-	const char *str;
-	int  num;
-};
-
-const int c_maxparams = 1;
-
 struct Action;
 struct ActionType {
 	const Action *action;
-	int params[c_maxparams];
+	int param;
 };
 
 typedef Common::HashMap<uint32, ActionType> KeyMap;
 
 typedef Common::HashMap<Common::String, Common::KeyCode> ParseKeyMap;
-typedef Common::HashMap<Common::String, const void *> ParseActionMap;
+typedef Common::HashMap<Common::String, const Action *> ParseActionMap;
+typedef Common::HashMap<uint32, ActionType> ParseHashedActionMap;
 
 class Configuration;
 
@@ -62,10 +56,9 @@ class KeyBinder {
 private:
 	KeyMap _bindings;
 
-	Std::vector<Std::string> _keyHelp;
-	Std::vector<Std::string> _cheatHelp;
 	ParseKeyMap _keys;
 	ParseActionMap _actions;
+	ParseHashedActionMap _actionsHashed;
 	int16 _joyAxisPositions[8];
 
 	bool repeat_hat, joy_repeat_enabled; // repeat hat instead of axis when hat is found
@@ -81,7 +74,7 @@ public:
 	~KeyBinder();
 	/* Add keybinding */
 	void AddKeyBinding(Common::KeyCode sym, byte mod, const Action *action,
-	                   int nparams, int *params);
+	                   int nparams, int param);
 
 	/* Delete keybinding */
 //	void DelKeyBinding(Common::KeyCode sym, int mod); // unused
@@ -89,14 +82,13 @@ public:
 	/* Other methods */
 	void Flush() {
 		_bindings.clear();
-		_keyHelp.clear();
-		_cheatHelp.clear();
 	}
 	ActionType get_ActionType(const Common::KeyState &key);
 	ActionKeyType GetActionKeyType(ActionType a);
 	bool DoAction(ActionType const &a) const;
 	KeyMap::iterator get_sdlkey_index(const Common::KeyState &key);
 	bool HandleEvent(const Common::Event *event);
+	bool handleScummVMBoundEvent(const Common::Event *event);
 
 	void LoadFromFile(const char *filename);
 	void LoadGameSpecificKeys();
@@ -146,6 +138,7 @@ private:
 
 	joy_axes_pairs get_axes_pair(int axis) const;
 	Common::KeyCode get_key_from_joy_button(uint8 button);
+	Common::Array<Common::U32String> buildKeyHelp() const;
 };
 
 } // End of namespace Nuvie
diff --git a/engines/ultima/nuvie/metaengine.cpp b/engines/ultima/nuvie/metaengine.cpp
index 5ec071a5aa3..f6896d99bf2 100644
--- a/engines/ultima/nuvie/metaengine.cpp
+++ b/engines/ultima/nuvie/metaengine.cpp
@@ -21,6 +21,9 @@
 
 #include "ultima/nuvie/metaengine.h"
 #include "common/translation.h"
+#include "backends/keymapper/action.h"
+#include "backends/keymapper/standard-actions.h"
+#include "ultima/nuvie/keybinding/keys_enum.h"
 
 namespace Ultima {
 namespace Nuvie {
@@ -41,5 +44,193 @@ void MetaEngine::listSaves(SaveStateList &saveList) {
 	Common::sort(saveList.begin(), saveList.end(), SaveStateDescriptorSlotComparator());
 }
 
+struct NuvieActionDescription {
+	const char *_id;
+	const char *_desc;
+	const char *_key1;
+	const char *_key2;
+};
+
+//
+// For associated actions for each of these IDs, see NuvieActions in
+// keybinding/keys.cpp
+//
+static const NuvieActionDescription NuvieActionDescriptions[] = {
+	{ "WALK_WEST", "Walk west", "LEFT", "KP4" },
+	{ "WALK_EAST", "Walk east", "RIGHT", "KP6" },
+	{ "WALK_NORTH", "Walk north", "UP", "KP8" },
+	{ "WALK_SOUTH", "Walk south", "DOWN", "KP2" },
+	{ "WALK_NORTH_EAST", "Walk north-east", "KP9", nullptr },
+	{ "WALK_SOUTH_EAST", "Walk south-east", "KP3", nullptr },
+	{ "WALK_NORTH_WEST", "Walk north-west", "KP7", nullptr },
+	{ "WALK_SOUTH_WEST", "Walk south-west", "KP1", nullptr },
+	{ "LOOK", "Look", "l", nullptr },
+	{ "TALK", "Talk", "t", nullptr },
+	{ "USE", "Use", "u", nullptr },
+	{ "GET", "Get", "g", nullptr },
+	{ "MOVE", "Move", "m", nullptr },
+	{ "DROP", "Drop", "d", nullptr },
+	{ "TOGGLE_COMBAT", "Toggle combat", "b", nullptr },
+	{ "ATTACK", "Attack", "a", nullptr },
+	{ "MULTI_USE", "Multi-use", "SEMICOLON", nullptr },
+	{ "SELECT_COMMAND_BAR", "Select Command Bar", nullptr, nullptr },
+	{ "NEW_COMMAND_BAR", "Select New Command Bar", "COMMA", nullptr },
+	{ "DOLL_GUMP", "Doll gump", "i", nullptr },
+	{ "PREVIOUS_PARTY_MEMBER", "Previous party member", "MINUS", "KP_MINUS" },
+	{ "NEXT_PARTY_MEMBER", "Next party member", "PLUS", "KP_PLUS" },
+	{ "HOME_KEY", "Home key", "HOME", nullptr },
+	{ "END_KEY", "End key", "END", nullptr },
+	{ "TOGGLE_VIEW", "Toggle between inventory and actor view", "KP_ASTERISK", "ASTERISK" },
+	{ "PARTY_VIEW", "Party view", "F10", "SLASH" },
+	{ "PARTY_MODE", "Party mode", "0", nullptr },
+	{ "SAVE_MENU", "Save menu", "s", nullptr },
+	{ "LOAD_LATEST_SAVE", "Load latest save", "C+l", "C+r" },
+	{ "QUICK_SAVE", "Quick save", nullptr, nullptr },
+	{ "QUICK_LOAD", "Quick load", nullptr, nullptr },
+	{ "QUIT", "Quit", "q", "C+q" },
+	//{ "QUIT_NO_DIALOG", "Quit without confirmation", "M+q", nullptr },
+	{ "GAME_MENU_DIALOG", "Show game menu; Cancel action if in middle of action", "ESCAPE", nullptr },
+	//{ "TOGGLE_FULLSCREEN", "Toggle Fullscreen", "M+RETURN", nullptr },
+	{ "TOGGLE_CURSOR", "Toggle Cursor", "TAB", nullptr },
+	{ "TOGGLE_COMBAT_STRATEGY", "Toggle combat strategy", "BACKQUOTE", nullptr },
+	{ "TOGGLE_FPS_DISPLAY", "Toggle frames per second display", "C+PLUS", nullptr },
+	{ "TOGGLE_AUDIO", "Toggle audio", "C+a", nullptr },
+	{ "TOGGLE_MUSIC", "Toggle music", "C+m", nullptr },
+	{ "TOGGLE_SFX", "Toggle sfx", "C+s", nullptr },
+	{ "TOGGLE_ORIGINAL_STYLE_COMMAND_BAR", "Show/hide original style command bar", nullptr, nullptr },
+	{ "DO_ACTION", "Do action", "RETURN", "KP_ENTER" },
+	{ "CANCEL_ACTION", "Cancel action", "SPACE", nullptr },
+	{ "MSG_SCROLL_UP", "Msg scroll up", "PAGEUP", nullptr },
+	{ "MSG_SCROLL_DOWN", "Msg scroll down", "PAGEDOWN", nullptr },
+	{ "SHOW_KEYS", "Show keys", "h", nullptr },
+	{ "DECREASE_DEBUG", "Decrease debug", "C+d", nullptr },
+	{ "INCREASE_DEBUG", "Increase debug", "C+i", nullptr },
+	{ "CLOSE_GUMPS", "Close gumps", "z", nullptr },
+	//{ "USE_ITEM", "Use item", nullptr, nullptr }, // TODO: this takes an item no parameter
+};
+
+static const NuvieActionDescription CheatKeyDescriptions[] = {
+	{ "ASSET_VIEWER", "Open the asset viewer", nullptr, nullptr },
+	{ "SHOW_EGGS", "Show eggs", "e", nullptr },
+	{ "TOGGLE_HACKMOVE", "Toggle hack move", "M+h", nullptr },
+	{ "TOGGLE_EGG_SPAWN", "Toggle egg spawn", "M+C+e", nullptr },
+	{ "TOGGLE_NO_DARKNESS", "Toggle no darkness", "M+i", nullptr },
+	{ "TOGGLE_PICKPOCKET_MODE", "Toggle pickpocket mode", "M+C+p", nullptr },
+	{ "TOGGLE_GOD_MODE", "Toggle god mode", "M+C+g", nullptr },
+	{ "TOGGLE_ETHEREAL", "Toggle ethereal mode", "M+e", nullptr},
+	{ "TOGGLE_X_RAY", "Toggle X-ray mode", "x", nullptr },
+	{ "HEAL_PARTY", "Heal party", "M+C+h", nullptr },
+	{ "TELEPORT_TO_CURSOR", "Teleport to cursor", "C+t", nullptr },
+	{ "TOGGLE_CHEATS", "Toggle cheats", "C+c", nullptr },
+};
+
+static const NuvieActionDescription PerPartyMemberActionDescriptions[] {
+	{ "SOLO_MODE_1", "Solo mode as Avatar", "1", nullptr },
+	{ "SOLO_MODE_2", "Solo mode as party member 2", "2", nullptr },
+	{ "SOLO_MODE_3", "Solo mode as party member 3", "3", nullptr },
+	{ "SOLO_MODE_4", "Solo mode as party member 4", "4", nullptr },
+	{ "SOLO_MODE_5", "Solo mode as party member 5", "5", nullptr },
+	{ "SOLO_MODE_6", "Solo mode as party member 6", "6", nullptr },
+	{ "SOLO_MODE_7", "Solo mode as party member 7", "7", nullptr },
+	{ "SOLO_MODE_8", "Solo mode as party member 8", "8", nullptr },
+	{ "SOLO_MODE_9", "Solo mode as party member 9", "9", nullptr },
+	{ "SHOW_STATS_1", "Show stats for Avatar", "C+1", nullptr },
+	{ "SHOW_STATS_2", "Show stats for party member 2", "C+2", nullptr },
+	{ "SHOW_STATS_3", "Show stats for party member 3", "C+3", nullptr },
+	{ "SHOW_STATS_4", "Show stats for party member 4", "C+4", nullptr },
+	{ "SHOW_STATS_5", "Show stats for party member 5", "C+5", nullptr },
+	{ "SHOW_STATS_6", "Show stats for party member 6", "C+6", nullptr },
+	{ "SHOW_STATS_7", "Show stats for party member 7", "C+7", nullptr },
+	{ "SHOW_STATS_8", "Show stats for party member 8", "C+8", nullptr },
+	{ "SHOW_STATS_9", "Show stats for party member 9", "C+9", nullptr },
+	{ "INVENTORY_1", "Show inventory for Avatar", "F1", nullptr },
+	{ "INVENTORY_2", "Show inventory for party member 2", "F2", nullptr },
+	{ "INVENTORY_3", "Show inventory for party member 3", "F3", nullptr },
+	{ "INVENTORY_4", "Show inventory for party member 4", "F4", nullptr },
+	{ "INVENTORY_5", "Show inventory for party member 5", "F5", nullptr },
+	{ "INVENTORY_6", "Show inventory for party member 6", "F6", nullptr },
+	{ "INVENTORY_7", "Show inventory for party member 7", "F7", nullptr },
+	{ "INVENTORY_8", "Show inventory for party member 8", "F8", nullptr },
+	{ "INVENTORY_9", "Show inventory for party member 9", "F9", nullptr },
+	{ "DOLL_GUMP_1", "Show doll gump for Avatar", "M+F1", nullptr },
+	{ "DOLL_GUMP_2", "Show doll gump for party member 2", "M+F2", nullptr },
+	{ "DOLL_GUMP_3", "Show doll gump for party member 3", "M+F3", nullptr },
+	{ "DOLL_GUMP_4", "Show doll gump for party member 4", "M+F4", nullptr },
+	{ "DOLL_GUMP_5", "Show doll gump for party member 5", "M+F5", nullptr },
+	{ "DOLL_GUMP_6", "Show doll gump for party member 6", "M+F6", nullptr },
+	{ "DOLL_GUMP_7", "Show doll gump for party member 7", "M+F7", nullptr },
+	{ "DOLL_GUMP_8", "Show doll gump for party member 8", "M+F8", nullptr },
+	{ "DOLL_GUMP_9", "Show doll gump for party member 9", "M+F9", nullptr },
+};
+
+static const NuvieActionDescription U6ActionDescriptions[] = {
+	{ "CAST", "Cast", "c", nullptr },
+	{ "REST", "Rest", "r", nullptr },
+	{ "TOGGLE_UNLIMITED_CASTING", "Toggle unlimited casting", "M+w", nullptr },
+};
+
+static const NuvieActionDescription SEActionDescriptions[] = {
+	{ "REST", "Rest", "r", nullptr },
+	{ "TOGGLE_UNLIMITED_CASTING", "Toggle unlimited casting", "M+w", nullptr },
+};
+
+
+static Common::Action *actionDescriptionFromNuvieAction(const NuvieActionDescription &n) {
+	Common::String idstr(n._id);
+	Common::Action *act = new Common::Action(n._id, _(n._desc));
+	act->setCustomEngineActionEvent(idstr.hash());
+	if (n._key1)
+		act->addDefaultInputMapping(n._key1);
+	if (n._key2)
+		act->addDefaultInputMapping(n._key2);
+	return act;
+}
+
+Common::KeymapArray MetaEngine::initKeymaps(const Common::String &gameId) {
+	Common::KeymapArray keymapArray;
+
+	// Core keymaps
+	Common::U32String desc;
+	if (gameId == "ultima6" || gameId == "ultima6_enh")
+		desc = _("Ultima VI");
+	else if (gameId == "martiandreams" || gameId == "martiandreams_enh")
+		desc = _("Martian Dreams");
+	else
+		desc = _("The Savage Empire");
+
+	Common::Keymap *keyMap = new Common::Keymap(Common::Keymap::kKeymapTypeGame, gameId, desc);
+	keymapArray.push_back(keyMap);
+
+	Common::Action *act;
+
+	act = new Common::Action(Common::kStandardActionLeftClick, _("Interact via Left Click"));
+	act->setLeftClickEvent();
+	act->addDefaultInputMapping("MOUSE_LEFT");
+	act->addDefaultInputMapping("JOY_A");
+	keyMap->addAction(act);
+
+	act = new Common::Action(Common::kStandardActionRightClick, _("Interact via Right Click"));
+	act->setRightClickEvent();
+	act->addDefaultInputMapping("MOUSE_RIGHT");
+	act->addDefaultInputMapping("JOY_B");
+	keyMap->addAction(act);
+
+	for (int i = 0; i < ARRAYSIZE(NuvieActionDescriptions); i++)
+		keyMap->addAction(actionDescriptionFromNuvieAction(NuvieActionDescriptions[i]));
+
+	if (gameId == "ultima6" || gameId == "ultima6_enh") {
+		for (int i = 0; i < ARRAYSIZE(U6ActionDescriptions); i++)
+			keyMap->addAction(actionDescriptionFromNuvieAction(U6ActionDescriptions[i]));
+	} else if (gameId == "savageempire" || gameId == "savageempire_enh") {
+		for (int i = 0; i < ARRAYSIZE(SEActionDescriptions); i++)
+			keyMap->addAction(actionDescriptionFromNuvieAction(SEActionDescriptions[i]));
+	}
+
+	for (int i = 0; i < ARRAYSIZE(PerPartyMemberActionDescriptions); i++)
+		keyMap->addAction(actionDescriptionFromNuvieAction(PerPartyMemberActionDescriptions[i]));
+
+	return keymapArray;
+}
+
 } // End of namespace Nuvie
 } // End of namespace Ultima
diff --git a/engines/ultima/nuvie/metaengine.h b/engines/ultima/nuvie/metaengine.h
index bbb8ac12a5f..e5625850a14 100644
--- a/engines/ultima/nuvie/metaengine.h
+++ b/engines/ultima/nuvie/metaengine.h
@@ -23,6 +23,7 @@
 #define ULTIMA_ULTIMA6_META_ENGINE
 
 #include "engines/savestate.h"
+#include "backends/keymapper/keymapper.h"
 
 namespace Ultima {
 namespace Nuvie {
@@ -34,6 +35,7 @@ enum {
 class MetaEngine {
 public:
 	static void listSaves(SaveStateList &saveList);
+	static Common::KeymapArray initKeymaps(const Common::String &gameId);
 };
 
 } // End of namespace Nuvie
diff --git a/engines/ultima/nuvie/screen/game_palette.cpp b/engines/ultima/nuvie/screen/game_palette.cpp
index 77bd95e0f44..017025ecc62 100644
--- a/engines/ultima/nuvie/screen/game_palette.cpp
+++ b/engines/ultima/nuvie/screen/game_palette.cpp
@@ -72,7 +72,7 @@ bool GamePalette::loadPalette() {
 
 	uint8 *pal_ptr = palette;
 
-	for (i = 0, j = 0; i < MIN(256U, file.get_size() / 3); i++, j += 3) {
+	for (i = 0, j = 0; i < MIN<uint32>(256U, file.get_size() / 3); i++, j += 3) {
 		pal_ptr[0] = buf[j] << 2;
 		pal_ptr[1] = buf[j + 1] << 2;
 		pal_ptr[2] = buf[j + 2] << 2;


Commit: c33020fcd03de873469a9a4224b7d3af13789f10
    https://github.com/scummvm/scummvm/commit/c33020fcd03de873469a9a4224b7d3af13789f10
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2023-12-09T13:56:10+11:00

Commit Message:
ULTIMA: NUVIE: Avoid crash if save file does not open

Changed paths:
    engines/ultima/nuvie/save/save_game.cpp


diff --git a/engines/ultima/nuvie/save/save_game.cpp b/engines/ultima/nuvie/save/save_game.cpp
index 42137b2af1b..6b9e3ff24e7 100644
--- a/engines/ultima/nuvie/save/save_game.cpp
+++ b/engines/ultima/nuvie/save/save_game.cpp
@@ -301,15 +301,13 @@ bool SaveGame::check_version(NuvieIOFileRead *loadfile, uint16 gameType) {
 
 bool SaveGame::load(const Common::String &filename) {
 	uint8 i;
-	uint32 objlist_size;
 	uint32 bytes_read;
 	NuvieIOFileRead loadFile;
-	unsigned char *data;
 	GameId gameType = g_engine->getGameId();
 	ObjManager *obj_manager = Game::get_game()->get_obj_manager();
 
 	Common::InSaveFile *saveFile = g_system->getSavefileManager()->openForLoading(filename);
-	if (!loadFile.open(saveFile))
+	if (!saveFile || !loadFile.open(saveFile))
 		return false;
 
 	ConsoleAddInfo("Loading Game: %s", filename.c_str());
@@ -339,8 +337,8 @@ bool SaveGame::load(const Common::String &filename) {
 		obj_manager->load_super_chunk(&loadFile, i + 1, 0);
 	}
 
-	objlist_size = loadFile.read4();
-	data = loadFile.readBuf(objlist_size, &bytes_read);
+	uint32 objlist_size = loadFile.read4();
+	unsigned char *data = loadFile.readBuf(objlist_size, &bytes_read);
 
 	objlist.open(data, objlist_size, NUVIE_BUF_COPY);
 




More information about the Scummvm-git-logs mailing list