Rename 'GlobalState' to 'SharedState' to avoid confusion with GLState
This was particularly nasty with the shorthand macros 'gState' and 'glState'. The former is now 'shState'.
This commit is contained in:
parent
807bee5748
commit
cb6f73f7df
32 changed files with 222 additions and 222 deletions
|
@ -20,7 +20,7 @@
|
|||
*/
|
||||
|
||||
#include "audio.h"
|
||||
#include "globalstate.h"
|
||||
#include "sharedstate.h"
|
||||
#include "binding-util.h"
|
||||
#include "exception.h"
|
||||
|
||||
|
@ -31,13 +31,13 @@
|
|||
mrb_int volume = 100; \
|
||||
mrb_int pitch = 100; \
|
||||
mrb_get_args(mrb, "z|ii", &filename, &volume, &pitch); \
|
||||
GUARD_EXC( gState->audio().entity##Play(filename, volume, pitch); ) \
|
||||
GUARD_EXC( shState->audio().entity##Play(filename, volume, pitch); ) \
|
||||
return mrb_nil_value(); \
|
||||
} \
|
||||
MRB_FUNCTION(audio_##entity##Stop) \
|
||||
{ \
|
||||
MRB_FUN_UNUSED_PARAM; \
|
||||
gState->audio().entity##Stop(); \
|
||||
shState->audio().entity##Stop(); \
|
||||
return mrb_nil_value(); \
|
||||
}
|
||||
|
||||
|
@ -46,7 +46,7 @@ MRB_FUNCTION(audio_##entity##Fade) \
|
|||
{ \
|
||||
mrb_int time; \
|
||||
mrb_get_args(mrb, "i", &time); \
|
||||
gState->audio().entity##Fade(time); \
|
||||
shState->audio().entity##Fade(time); \
|
||||
return mrb_nil_value(); \
|
||||
}
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
#include "SDL2/SDL_rwops.h"
|
||||
#include "SDL2/SDL_timer.h"
|
||||
|
||||
#include "globalstate.h"
|
||||
#include "sharedstate.h"
|
||||
#include "texpool.h"
|
||||
#include "eventthread.h"
|
||||
#include "filesystem.h"
|
||||
|
@ -161,7 +161,7 @@ showExcMessageBox(mrb_state *mrb, mrb_value exc)
|
|||
snprintf(msgBoxText, 512, "Script '%s' line %d: %s occured.\n\n%s",
|
||||
mrbValueString(file), mrb_fixnum(line), excClass, mrbValueString(mesg));
|
||||
|
||||
gState->eThread().showMessageBox(msgBoxText, SDL_MESSAGEBOX_ERROR);
|
||||
shState->eThread().showMessageBox(msgBoxText, SDL_MESSAGEBOX_ERROR);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -182,7 +182,7 @@ checkException(mrb_state *mrb)
|
|||
static void
|
||||
showError(const QByteArray &msg)
|
||||
{
|
||||
gState->eThread().showMessageBox(msg.constData());
|
||||
shState->eThread().showMessageBox(msg.constData());
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -244,7 +244,7 @@ runMrbFile(mrb_state *mrb, const char *filename)
|
|||
static void
|
||||
runRMXPScripts(mrb_state *mrb, mrbc_context *ctx)
|
||||
{
|
||||
const QByteArray &scriptPack = gState->rtData().config.game.scripts;
|
||||
const QByteArray &scriptPack = shState->rtData().config.game.scripts;
|
||||
|
||||
if (scriptPack.isEmpty())
|
||||
{
|
||||
|
@ -252,7 +252,7 @@ runRMXPScripts(mrb_state *mrb, mrbc_context *ctx)
|
|||
return;
|
||||
}
|
||||
|
||||
if (!gState->fileSystem().exists(scriptPack.constData()))
|
||||
if (!shState->fileSystem().exists(scriptPack.constData()))
|
||||
{
|
||||
showError("Unable to open '" + scriptPack + "'");
|
||||
return;
|
||||
|
@ -262,7 +262,7 @@ runRMXPScripts(mrb_state *mrb, mrbc_context *ctx)
|
|||
mrb_state *scriptMrb = mrb_open();
|
||||
SDL_RWops ops;
|
||||
|
||||
gState->fileSystem().openRead(ops, scriptPack.constData());
|
||||
shState->fileSystem().openRead(ops, scriptPack.constData());
|
||||
|
||||
mrb_value scriptArray = mrb_nil_value();
|
||||
QByteArray readError;
|
||||
|
@ -356,7 +356,7 @@ static void mrbBindingExecute()
|
|||
{
|
||||
mrb_state *mrb = mrb_open();
|
||||
|
||||
gState->setBindingData(mrb);
|
||||
shState->setBindingData(mrb);
|
||||
|
||||
MrbData mrbData(mrb);
|
||||
mrb->ud = &mrbData;
|
||||
|
@ -369,7 +369,7 @@ static void mrbBindingExecute()
|
|||
mrbc_context *ctx = mrbc_context_new(mrb);
|
||||
ctx->capture_errors = 1;
|
||||
|
||||
Config &conf = gState->rtData().config;
|
||||
Config &conf = shState->rtData().config;
|
||||
QByteArray &customScript = conf.customScript;
|
||||
QByteArray mrbFile = conf.bindingConf.value("mrbFile").toByteArray();
|
||||
|
||||
|
@ -382,8 +382,8 @@ static void mrbBindingExecute()
|
|||
|
||||
checkException(mrb);
|
||||
|
||||
gState->rtData().rqTermAck = true;
|
||||
gState->texPool().disable();
|
||||
shState->rtData().rqTermAck = true;
|
||||
shState->texPool().disable();
|
||||
|
||||
mrbc_context_free(mrb, ctx);
|
||||
mrb_close(mrb);
|
||||
|
@ -391,7 +391,7 @@ static void mrbBindingExecute()
|
|||
|
||||
static void mrbBindingTerminate()
|
||||
{
|
||||
mrb_state *mrb = static_cast<mrb_state*>(gState->bindingData());
|
||||
mrb_state *mrb = static_cast<mrb_state*>(shState->bindingData());
|
||||
MrbData *data = static_cast<MrbData*>(mrb->ud);
|
||||
|
||||
mrb_raise(mrb, data->exc[Shutdown], "");
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
*/
|
||||
|
||||
#include "graphics.h"
|
||||
#include "globalstate.h"
|
||||
#include "sharedstate.h"
|
||||
#include "mruby.h"
|
||||
#include "binding-util.h"
|
||||
#include "exception.h"
|
||||
|
@ -29,7 +29,7 @@ MRB_FUNCTION(graphicsUpdate)
|
|||
{
|
||||
MRB_FUN_UNUSED_PARAM;
|
||||
|
||||
gState->graphics().update();
|
||||
shState->graphics().update();
|
||||
|
||||
return mrb_nil_value();
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ MRB_FUNCTION(graphicsFreeze)
|
|||
{
|
||||
MRB_FUN_UNUSED_PARAM;
|
||||
|
||||
gState->graphics().freeze();
|
||||
shState->graphics().freeze();
|
||||
|
||||
return mrb_nil_value();
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ MRB_FUNCTION(graphicsTransition)
|
|||
|
||||
mrb_get_args(mrb, "|izi", &duration, &filename, &vague);
|
||||
|
||||
GUARD_EXC( gState->graphics().transition(duration, filename, vague); )
|
||||
GUARD_EXC( shState->graphics().transition(duration, filename, vague); )
|
||||
|
||||
return mrb_nil_value();
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ MRB_FUNCTION(graphicsFrameReset)
|
|||
{
|
||||
MRB_FUN_UNUSED_PARAM;
|
||||
|
||||
gState->graphics().frameReset();
|
||||
shState->graphics().frameReset();
|
||||
|
||||
return mrb_nil_value();
|
||||
}
|
||||
|
@ -69,13 +69,13 @@ MRB_FUNCTION(graphicsFrameReset)
|
|||
MRB_FUNCTION(graphics##Get##PropName) \
|
||||
{ \
|
||||
MRB_FUN_UNUSED_PARAM; \
|
||||
return mrb_fixnum_value(gState->graphics().get##PropName()); \
|
||||
return mrb_fixnum_value(shState->graphics().get##PropName()); \
|
||||
} \
|
||||
MRB_FUNCTION(graphics##Set##PropName) \
|
||||
{ \
|
||||
mrb_int value; \
|
||||
mrb_get_args(mrb, "i", &value); \
|
||||
gState->graphics().set##PropName(value); \
|
||||
shState->graphics().set##PropName(value); \
|
||||
return mrb_fixnum_value(value); \
|
||||
}
|
||||
|
||||
|
@ -83,13 +83,13 @@ MRB_FUNCTION(graphicsFrameReset)
|
|||
MRB_FUNCTION(graphics##Get##PropName) \
|
||||
{ \
|
||||
MRB_FUN_UNUSED_PARAM; \
|
||||
return mrb_bool_value(gState->graphics().get##PropName()); \
|
||||
return mrb_bool_value(shState->graphics().get##PropName()); \
|
||||
} \
|
||||
MRB_FUNCTION(graphics##Set##PropName) \
|
||||
{ \
|
||||
mrb_bool value; \
|
||||
mrb_get_args(mrb, "b", &value); \
|
||||
gState->graphics().set##PropName(value); \
|
||||
shState->graphics().set##PropName(value); \
|
||||
return mrb_bool_value(value); \
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
*/
|
||||
|
||||
#include "input.h"
|
||||
#include "globalstate.h"
|
||||
#include "sharedstate.h"
|
||||
#include "exception.h"
|
||||
#include "binding-util.h"
|
||||
|
||||
|
@ -28,7 +28,7 @@ MRB_FUNCTION(inputUpdate)
|
|||
{
|
||||
MRB_FUN_UNUSED_PARAM;
|
||||
|
||||
gState->input().update();
|
||||
shState->input().update();
|
||||
|
||||
return mrb_nil_value();
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ MRB_FUNCTION(inputPress)
|
|||
|
||||
Input::ButtonCode bc = (Input::ButtonCode) num;
|
||||
|
||||
return mrb_bool_value(gState->input().isPressed(bc));
|
||||
return mrb_bool_value(shState->input().isPressed(bc));
|
||||
}
|
||||
|
||||
MRB_FUNCTION(inputTrigger)
|
||||
|
@ -50,7 +50,7 @@ MRB_FUNCTION(inputTrigger)
|
|||
|
||||
Input::ButtonCode bc = (Input::ButtonCode) num;
|
||||
|
||||
return mrb_bool_value(gState->input().isTriggered(bc));
|
||||
return mrb_bool_value(shState->input().isTriggered(bc));
|
||||
}
|
||||
|
||||
MRB_FUNCTION(inputRepeat)
|
||||
|
@ -60,21 +60,21 @@ MRB_FUNCTION(inputRepeat)
|
|||
|
||||
Input::ButtonCode bc = (Input::ButtonCode) num;
|
||||
|
||||
return mrb_bool_value(gState->input().isRepeated(bc));
|
||||
return mrb_bool_value(shState->input().isRepeated(bc));
|
||||
}
|
||||
|
||||
MRB_FUNCTION(inputDir4)
|
||||
{
|
||||
MRB_FUN_UNUSED_PARAM;
|
||||
|
||||
return mrb_fixnum_value(gState->input().dir4Value());
|
||||
return mrb_fixnum_value(shState->input().dir4Value());
|
||||
}
|
||||
|
||||
MRB_FUNCTION(inputDir8)
|
||||
{
|
||||
MRB_FUN_UNUSED_PARAM;
|
||||
|
||||
return mrb_fixnum_value(gState->input().dir8Value());
|
||||
return mrb_fixnum_value(shState->input().dir8Value());
|
||||
}
|
||||
|
||||
/* Non-standard extensions */
|
||||
|
@ -82,14 +82,14 @@ MRB_FUNCTION(inputMouseX)
|
|||
{
|
||||
MRB_FUN_UNUSED_PARAM;
|
||||
|
||||
return mrb_fixnum_value(gState->input().mouseX());
|
||||
return mrb_fixnum_value(shState->input().mouseX());
|
||||
}
|
||||
|
||||
MRB_FUNCTION(inputMouseY)
|
||||
{
|
||||
MRB_FUN_UNUSED_PARAM;
|
||||
|
||||
return mrb_fixnum_value(gState->input().mouseY());
|
||||
return mrb_fixnum_value(shState->input().mouseY());
|
||||
}
|
||||
|
||||
#define DEF_CONST_I(name, value) \
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
|
||||
#include "../binding-util.h"
|
||||
#include "marshal.h"
|
||||
#include "globalstate.h"
|
||||
#include "sharedstate.h"
|
||||
#include "eventthread.h"
|
||||
#include "exception.h"
|
||||
#include "filesystem.h"
|
||||
|
@ -70,7 +70,7 @@ static void printP(mrb_state *mrb,
|
|||
mrb_str_buf_cat(mrb, buffer, sep, strlen(sep));
|
||||
}
|
||||
|
||||
gState->eThread().showMessageBox(RSTRING_PTR(buffer), SDL_MESSAGEBOX_INFORMATION);
|
||||
shState->eThread().showMessageBox(RSTRING_PTR(buffer), SDL_MESSAGEBOX_INFORMATION);
|
||||
}
|
||||
|
||||
MRB_FUNCTION(kernelP)
|
||||
|
@ -174,7 +174,7 @@ MRB_FUNCTION(kernelLoadData)
|
|||
mrb_get_args(mrb, "z", &filename);
|
||||
|
||||
SDL_RWops ops;
|
||||
GUARD_EXC( gState->fileSystem().openRead(ops, filename); )
|
||||
GUARD_EXC( shState->fileSystem().openRead(ops, filename); )
|
||||
|
||||
mrb_value obj;
|
||||
try { obj = marshalLoadInt(mrb, &ops); }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue