diff --git a/engines/got/game/init.cpp b/engines/got/game/init.cpp
new file mode 100644
index 00000000000..1fa3e4ffca8
--- /dev/null
+++ b/engines/got/game/init.cpp
@@ -0,0 +1,67 @@
+/* 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 .
+ *
+ */
+
+#include "got/game/init.h"
+#include "got/utils/file.h"
+#include "got/events.h"
+#include "got/vars.h"
+
+namespace Got {
+
+int setup_level() {
+ _G(bgPics).setArea(_G(area));
+
+ if (_G(load_game_flag) != 1) {
+ if (!load_sd_data())
+ return 0;
+ }
+
+ return 1;
+}
+
+int setup_player() {
+ memset(&_G(thor_info), 0, sizeof(_G(thor_info)));
+ _G(thor_info).inventory = 0;
+ if (_G(area) > 1) _G(thor_info).inventory |= APPLE_MAGIC + LIGHTNING_MAGIC;
+ if (_G(area) > 2) _G(thor_info).inventory |= BOOTS_MAGIC + WIND_MAGIC;
+
+ _G(thor)->health = 150;
+ _G(thor_info).magic = 0;
+ _G(thor_info).jewels = 0;
+ _G(thor_info).score = 0;
+ _G(thor_info).keys = 0;
+ _G(thor_info).last_item = 0;
+ _G(thor_info).object = 0;
+ _G(thor_info).object_name = nullptr;
+ _G(thor)->x = 152;
+ _G(thor)->y = 96;
+ _G(thor)->last_x[0] = _G(thor)->x;
+ _G(thor)->last_x[1] = _G(thor)->x;
+ _G(thor)->last_y[0] = _G(thor)->y;
+ _G(thor)->last_y[1] = _G(thor)->y;
+ _G(thor_info).last_icon = (6 * 20) + 8;
+ _G(thor_info).last_screen = 23;
+ _G(thor)->dir = 1;
+
+ return 1;
+}
+
+} // namespace Got
diff --git a/engines/got/game/init.h b/engines/got/game/init.h
new file mode 100644
index 00000000000..e0b05877b2f
--- /dev/null
+++ b/engines/got/game/init.h
@@ -0,0 +1,34 @@
+/* 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 .
+ *
+ */
+
+#ifndef GOT_GAME_INIT_H
+#define GOT_GAME_INIT_H
+
+#include "got/defines.h"
+
+namespace Got {
+
+extern int setup_level();
+extern int setup_player();
+
+} // namespace Got
+
+#endif
diff --git a/engines/got/module.mk b/engines/got/module.mk
index b66205c074a..d1040429588 100644
--- a/engines/got/module.mk
+++ b/engines/got/module.mk
@@ -8,6 +8,7 @@ MODULE_OBJS = \
metaengine.o \
sound.o \
vars.o \
+ game/init.o \
game/status.o \
gfx/font.o \
gfx/gfx_chunks.o \
diff --git a/engines/got/prototypes.h b/engines/got/prototypes.h
index 6b8f47dd670..20b489e33ac 100644
--- a/engines/got/prototypes.h
+++ b/engines/got/prototypes.h
@@ -158,18 +158,6 @@ void remove_objects(int y, int x);
void place_tile(int x, int y, int tile);
int bgtile(int x, int y);
-//G_IMAGE.C
-unsigned int make_mask(MASK_IMAGE *image,
- unsigned int page_start, char *Image, int image_width,
- int image_height);
-int load_standard_actors(void);
-void setup_actor(ACTOR *actr, char num, char dir, int x, int y);
-void show_enemies(void);
-int load_enemy(int type);
-int actor_visible(int invis_num);
-void setup_magic_item(int item);
-void load_new_thor(void);
-
//G_MOVE.C
void next_frame(ACTOR *actr);
int point_within(int x, int y, int x1, int y1, int x2, int y2);
diff --git a/engines/got/views/game.cpp b/engines/got/views/game.cpp
index 6fd77e17bc9..a1df7118b85 100644
--- a/engines/got/views/game.cpp
+++ b/engines/got/views/game.cpp
@@ -20,6 +20,7 @@
*/
#include "got/views/game.h"
+#include "got/game/init.h"
#include "got/gfx/image.h"
#include "got/metaengine.h"
#include "got/vars.h"
@@ -34,6 +35,11 @@ Game::Game() : View("Game") {
void Game::initialize() {
load_standard_actors();
+ if (!setup_player())
+ error("setup_player failed");
+ if (!setup_level())
+ error("setup_level failed");
+ // TODO
}
bool Game::msgFocus(const FocusMessage &msg) {