Skip to content

Commit

Permalink
COMMON: Move Lua into Common and make it an engine feature
Browse files Browse the repository at this point in the history
SWORD25: Move the Lua header files from /engines/sword25/util to /common/lua

The Lua header files were moved to /common so that they can be used in
other game engines.

SWORD25: Move the Lua .cpp files from /sword25/util to /common/lua

The Lua .cpp files are moved to /common so that they can be used in more
engines

Revert "SWORD25: Move the Lua .cpp files from /sword25/util to /common/lua"

This reverts commit 9b61647.

Revert "SWORD25: Move the Lua header files from /engines/sword25/util to /common/lua"

This reverts commit 0289e01.

SWORD25: Revert the changes in the Lua header files

The commit introduced unnecessary changes to the codebase.

SWORD25: Move the Lua header files to common/lua

The Lua header files were moved to common/lua so they can be used in
other engines.

SWORD25: Move the Lua cpp files to common/lua

The Lua cpp files are moved to common so they can be used in other
engines. common/modules.mk and engines/sword25/modules.mk are
appropriately updated.

SWORD25: Move the Lua files to common/lua so they can be used in other
engines.

COMMON: Correct #include headers in common/lua

A few #include headers in common/lua that still referenced sword25/util
have been corrected.

COMMON: Move Lua COPYRIGHT, HISTORY and README to common/lua

COMMON: Add Lua Engine Feature

COMMON: Add Feature Flag for Lua

COMMON: Rework Lua engine feature as an option

COMMON: Add removed mt32emu config

COMMON: Wrap Lua .obj files in conditional

COMMON: Fix USE_LUA in common/module.mk
  • Loading branch information
nipunG314 committed Aug 13, 2019
1 parent fc6f9c9 commit 464e2f9
Show file tree
Hide file tree
Showing 71 changed files with 88 additions and 70 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Expand Up @@ -20,7 +20,7 @@
*
*/

#include "sword25/util/double_serialization.h"
#include "common/lua/double_serialization.h"

#include "common/scummsys.h"

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Expand Up @@ -44,16 +44,16 @@
*/


#include "sword25/util/lua_persistence.h"
#include "lua_persistence.h"

#include "sword25/util/double_serialization.h"
#include "sword25/util/lua_persistence_util.h"
#include "double_serialization.h"
#include "lua_persistence_util.h"

#include "common/stream.h"

#include "lua/lobject.h"
#include "lua/lstate.h"
#include "lua/lgc.h"
#include "lobject.h"
#include "lstate.h"
#include "lgc.h"


namespace Lua {
Expand Down
Expand Up @@ -46,7 +46,7 @@
#ifndef LUA_PERSISTENCE_H
#define LUA_PERSISTENCE_H

#include "sword25/util/lua/lua.h"
#include "lua.h"


namespace Common {
Expand Down
Expand Up @@ -67,14 +67,14 @@
*/


#include "sword25/util/lua_persistence_util.h"
#include "lua_persistence_util.h"

#include "common/scummsys.h"

#include "lua/lobject.h"
#include "lua/lstate.h"
#include "lua/lgc.h"
#include "lua/lopcodes.h"
#include "lobject.h"
#include "lstate.h"
#include "lgc.h"
#include "lopcodes.h"


namespace Lua {
Expand Down
Expand Up @@ -50,7 +50,7 @@

struct lua_State;

#include "lua/lobject.h"
#include "lobject.h"

typedef TValue *StkId;

Expand Down
Expand Up @@ -44,17 +44,17 @@
*/


#include "sword25/util/lua_persistence.h"
#include "lua_persistence.h"

#include "sword25/util/double_serialization.h"
#include "sword25/util/lua_persistence_util.h"
#include "double_serialization.h"
#include "lua_persistence_util.h"

#include "common/stream.h"

#include "lua/lobject.h"
#include "lua/lstate.h"
#include "lua/lgc.h"
#include "lua/lopcodes.h"
#include "lobject.h"
#include "lstate.h"
#include "lgc.h"
#include "lopcodes.h"


namespace Lua {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Expand Up @@ -20,7 +20,7 @@
*
*/

#include "sword25/util/lua/scummvm_file.h"
#include "scummvm_file.h"
#include "common/config-manager.h"
#include "common/language.h"

Expand Down
File renamed without changes.
37 changes: 37 additions & 0 deletions common/module.mk
Expand Up @@ -62,5 +62,42 @@ MODULE_OBJS += \
updates.o
endif

ifdef USE_LUA
MODULE_OBJS += \
lua/double_serialization.o \
lua/lapi.o \
lua/lauxlib.o \
lua/lbaselib.o \
lua/lcode.o \
lua/ldblib.o \
lua/ldblib.o \
lua/ldebug.o \
lua/ldo.o \
lua/lfunc.o \
lua/lgc.o \
lua/linit.o \
lua/liolib.o \
lua/llex.o \
lua/lmathlib.o \
lua/lmem.o \
lua/loadlib.o \
lua/lobject.o \
lua/lopcodes.o \
lua/loslib.o \
lua/lparser.o \
lua/lstate.o \
lua/lstring.o \
lua/lstrlib.o \
lua/ltable.o \
lua/ltablib.o \
lua/ltm.o \
lua/lua_persist.o \
lua/lua_persistence_util.o \
lua/lua_unpersist.o \
lua/lvm.o \
lua/lzio.o \
lua/scummvm_file.o
endif

# Include common rules
include $(srcdir)/rules.mk
16 changes: 14 additions & 2 deletions configure
Expand Up @@ -173,6 +173,7 @@ _use_cxx11=no
_verbose_build=no
_text_console=no
_mt32emu=yes
_lua=yes
_build_scalers=yes
_build_hq_scalers=yes
_enable_prof=no
Expand Down Expand Up @@ -253,8 +254,7 @@ add_feature png "PNG" "_png"
add_feature theoradec "libtheoradec" "_theoradec"
add_feature vorbis "Vorbis file support" "_vorbis _tremor"
add_feature zlib "zlib" "_zlib"


add_feature lua "lua" "_lua"

# Directories for installing ScummVM.
# This list is closely based on what GNU autoconf does,
Expand Down Expand Up @@ -1027,6 +1027,7 @@ Optional Features:
--enable-plugins enable the support for dynamic plugins
--default-dynamic make plugins dynamic by default
--disable-mt32emu don't enable the integrated MT-32 emulator
--disable-lua don't enable Lua support
--disable-nuked-opl don't build Nuked OPL driver
--disable-16bit don't enable 16bit color support
--disable-highres don't enable support for high resolution engines >320x240
Expand Down Expand Up @@ -1255,6 +1256,8 @@ for ac_option in $@; do
--default-dynamic) _plugins_default=dynamic;;
--enable-mt32emu) _mt32emu=yes ;;
--disable-mt32emu) _mt32emu=no ;;
--enable-lua) _lua=yes ;;
--disable-lua) _lua=no ;;
--enable-nuked-opl) _nuked_opl=yes ;;
--disable-nuked-opl) _nuked_opl=no ;;
--enable-translation) _translation=yes ;;
Expand Down Expand Up @@ -4107,6 +4110,11 @@ fi
#
define_in_config_if_yes "$_mt32emu" 'USE_MT32EMU'

#
# Check whether Lua support is requested
#
define_in_config_if_yes "$_lua" 'USE_LUA'

#
# Check whether Nuked OPL emulator support is disabled
#
Expand Down Expand Up @@ -5401,6 +5409,10 @@ if test "$_mt32emu" = yes ; then
echo_n ", MT-32 emulator"
fi

if test "$_lua" = yes ; then
echo_n ", Lua"
fi

if test "$_nuked_opl" = yes ; then
echo_n ", Nuked OPL emulator"
fi
Expand Down
1 change: 1 addition & 0 deletions devtools/create_project/create_project.cpp
Expand Up @@ -1074,6 +1074,7 @@ const Feature s_features[] = {
{ "16bit", "USE_RGB_COLOR", "", true, "16bit color support" },
{ "highres", "USE_HIGHRES", "", true, "high resolution" },
{ "mt32emu", "USE_MT32EMU", "", true, "integrated MT-32 emulator" },
{ "lua", "USE_LUA", "", true, "lua" },
{ "nasm", "USE_NASM", "", true, "IA-32 assembly support" }, // This feature is special in the regard, that it needs additional handling.
{ "opengl", "USE_OPENGL", "", true, "OpenGL support" },
{ "opengles", "USE_GLES", "", true, "forced OpenGL ES mode" },
Expand Down
2 changes: 1 addition & 1 deletion engines/sword25/configure.engine
@@ -1,3 +1,3 @@
# This file is included from the main "configure" script
# add_engine [name] [desc] [build-by-default] [subengines] [base games] [deps]
add_engine sword25 "Broken Sword 2.5" yes "" "" "png zlib 16bit highres"
add_engine sword25 "Broken Sword 2.5" yes "" "" "png zlib 16bit highres lua"
4 changes: 2 additions & 2 deletions engines/sword25/gfx/graphicengine.cpp
Expand Up @@ -50,8 +50,8 @@

#include "sword25/fmv/movieplayer.h"

#include "sword25/util/lua/lua.h"
#include "sword25/util/lua/lauxlib.h"
#include "common/lua/lua.h"
#include "common/lua/lauxlib.h"
enum {
BIT_DEPTH = 32,
BACKBUFFER_COUNT = 1
Expand Down
4 changes: 2 additions & 2 deletions engines/sword25/math/vertex.cpp
Expand Up @@ -31,8 +31,8 @@

#include "sword25/math/vertex.h"

#include "sword25/util/lua/lua.h"
#include "sword25/util/lua/lauxlib.h"
#include "common/lua/lua.h"
#include "common/lua/lauxlib.h"

namespace Sword25 {

Expand Down
34 changes: 1 addition & 33 deletions engines/sword25/module.mk
Expand Up @@ -53,39 +53,7 @@ MODULE_OBJS := \
script/luascript.o \
script/lua_extensions.o \
sfx/soundengine.o \
sfx/soundengine_script.o \
util/lua/lapi.o \
util/lua/lauxlib.o \
util/lua/lbaselib.o \
util/lua/lcode.o \
util/lua/ldblib.o \
util/lua/ldebug.o \
util/lua/ldo.o \
util/lua/lfunc.o \
util/lua/lgc.o \
util/lua/linit.o \
util/lua/liolib.o \
util/lua/llex.o \
util/lua/lmathlib.o \
util/lua/lmem.o \
util/lua/loadlib.o \
util/lua/lobject.o \
util/lua/lopcodes.o \
util/lua/loslib.o \
util/lua/lparser.o \
util/lua/lstate.o \
util/lua/lstring.o \
util/lua/lstrlib.o \
util/lua/ltable.o \
util/lua/ltablib.o \
util/lua/ltm.o \
util/lua/lvm.o \
util/lua/lzio.o \
util/lua/scummvm_file.o \
util/double_serialization.o \
util/lua_persistence_util.o \
util/lua_persist.o \
util/lua_unpersist.o
sfx/soundengine_script.o

# This module can be built as a plugin
ifeq ($(ENABLE_SWORD25), DYNAMIC_PLUGIN)
Expand Down
4 changes: 2 additions & 2 deletions engines/sword25/script/luabindhelper.h
Expand Up @@ -34,8 +34,8 @@

#include "sword25/kernel/common.h"

#include "sword25/util/lua/lua.h"
#include "sword25/util/lua/lauxlib.h"
#include "common/lua/lua.h"
#include "common/lua/lauxlib.h"

namespace Sword25 {

Expand Down
4 changes: 2 additions & 2 deletions engines/sword25/script/luacallback.cpp
Expand Up @@ -34,8 +34,8 @@
#include "sword25/script/luacallback.h"
#include "sword25/script/luabindhelper.h"

#include "sword25/util/lua/lua.h"
#include "sword25/util/lua/lauxlib.h"
#include "common/lua/lua.h"
#include "common/lua/lauxlib.h"

const char *CALLBACKTABLE_NAME = "__CALLBACKS";

Expand Down
8 changes: 4 additions & 4 deletions engines/sword25/script/luascript.cpp
Expand Up @@ -40,10 +40,10 @@
#include "sword25/kernel/outputpersistenceblock.h"
#include "sword25/kernel/inputpersistenceblock.h"

#include "sword25/util/lua/lua.h"
#include "sword25/util/lua/lualib.h"
#include "sword25/util/lua/lauxlib.h"
#include "sword25/util/lua_persistence.h"
#include "common/lua/lua.h"
#include "common/lua/lualib.h"
#include "common/lua/lauxlib.h"
#include "common/lua/lua_persistence.h"

namespace Sword25 {

Expand Down

0 comments on commit 464e2f9

Please sign in to comment.