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"
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -32,13 +32,13 @@
 | 
			
		|||
		int volume = 100; \
 | 
			
		||||
		int pitch = 100; \
 | 
			
		||||
		rb_get_args(argc, argv, "z|ii", &filename, &volume, &pitch, RB_ARG_END); \
 | 
			
		||||
		GUARD_EXC( gState->audio().entity##Play(filename, volume, pitch); ) \
 | 
			
		||||
		GUARD_EXC( shState->audio().entity##Play(filename, volume, pitch); ) \
 | 
			
		||||
		return Qnil; \
 | 
			
		||||
	} \
 | 
			
		||||
	RB_METHOD(audio_##entity##Stop) \
 | 
			
		||||
	{ \
 | 
			
		||||
		RB_UNUSED_PARAM; \
 | 
			
		||||
		gState->audio().entity##Stop(); \
 | 
			
		||||
		shState->audio().entity##Stop(); \
 | 
			
		||||
		return Qnil; \
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -48,7 +48,7 @@ RB_METHOD(audio_##entity##Fade) \
 | 
			
		|||
	RB_UNUSED_PARAM; \
 | 
			
		||||
	int time; \
 | 
			
		||||
	rb_get_args(argc, argv, "i", &time, RB_ARG_END); \
 | 
			
		||||
	gState->audio().bgmFade(time); \
 | 
			
		||||
	shState->audio().bgmFade(time); \
 | 
			
		||||
	return Qnil; \
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -21,7 +21,7 @@
 | 
			
		|||
 | 
			
		||||
#include "binding.h"
 | 
			
		||||
#include "binding-util.h"
 | 
			
		||||
#include "globalstate.h"
 | 
			
		||||
#include "sharedstate.h"
 | 
			
		||||
#include "eventthread.h"
 | 
			
		||||
#include "filesystem.h"
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -101,7 +101,7 @@ static void mriBindingInit()
 | 
			
		|||
static void
 | 
			
		||||
showMsg(const QByteArray &msg)
 | 
			
		||||
{
 | 
			
		||||
	gState->eThread().showMessageBox(msg.constData());
 | 
			
		||||
	shState->eThread().showMessageBox(msg.constData());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void printP(int argc, VALUE *argv,
 | 
			
		||||
| 
						 | 
				
			
			@ -185,7 +185,7 @@ struct Script
 | 
			
		|||
 | 
			
		||||
static void runRMXPScripts()
 | 
			
		||||
{
 | 
			
		||||
	const QByteArray &scriptPack = gState->rtData().config.game.scripts;
 | 
			
		||||
	const QByteArray &scriptPack = shState->rtData().config.game.scripts;
 | 
			
		||||
 | 
			
		||||
	if (scriptPack.isEmpty())
 | 
			
		||||
	{
 | 
			
		||||
| 
						 | 
				
			
			@ -193,7 +193,7 @@ static void runRMXPScripts()
 | 
			
		|||
		return;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (!gState->fileSystem().exists(scriptPack.constData()))
 | 
			
		||||
	if (!shState->fileSystem().exists(scriptPack.constData()))
 | 
			
		||||
	{
 | 
			
		||||
		showMsg("Unable to open '" + scriptPack + "'");
 | 
			
		||||
		return;
 | 
			
		||||
| 
						 | 
				
			
			@ -290,11 +290,11 @@ static void mriBindingExecute()
 | 
			
		|||
	ruby_setup();
 | 
			
		||||
 | 
			
		||||
	RbData rbData;
 | 
			
		||||
	gState->setBindingData(&rbData);
 | 
			
		||||
	shState->setBindingData(&rbData);
 | 
			
		||||
 | 
			
		||||
	mriBindingInit();
 | 
			
		||||
 | 
			
		||||
	QByteArray &customScript = gState->rtData().config.customScript;
 | 
			
		||||
	QByteArray &customScript = shState->rtData().config.customScript;
 | 
			
		||||
	if (!customScript.isEmpty())
 | 
			
		||||
		runCustomScript(customScript.constData());
 | 
			
		||||
	else
 | 
			
		||||
| 
						 | 
				
			
			@ -315,7 +315,7 @@ static void mriBindingExecute()
 | 
			
		|||
 | 
			
		||||
	ruby_cleanup(0);
 | 
			
		||||
 | 
			
		||||
	gState->rtData().rqTermAck = true;
 | 
			
		||||
	shState->rtData().rqTermAck = true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void mriBindingTerminate()
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -21,7 +21,7 @@
 | 
			
		|||
 | 
			
		||||
#include "binding-util.h"
 | 
			
		||||
 | 
			
		||||
#include "globalstate.h"
 | 
			
		||||
#include "sharedstate.h"
 | 
			
		||||
#include "exception.h"
 | 
			
		||||
#include "util.h"
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -44,7 +44,7 @@ void initType(rb_data_type_struct &type,
 | 
			
		|||
 | 
			
		||||
RbData *getRbData()
 | 
			
		||||
{
 | 
			
		||||
	return static_cast<RbData*>(gState->bindingData());
 | 
			
		||||
	return static_cast<RbData*>(shState->bindingData());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
struct
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -21,7 +21,7 @@
 | 
			
		|||
 | 
			
		||||
#include "binding-util.h"
 | 
			
		||||
 | 
			
		||||
#include "globalstate.h"
 | 
			
		||||
#include "sharedstate.h"
 | 
			
		||||
#include "filesystem.h"
 | 
			
		||||
 | 
			
		||||
#include <QDebug>
 | 
			
		||||
| 
						 | 
				
			
			@ -32,7 +32,7 @@ static VALUE
 | 
			
		|||
fileIntForPath(const char *path)
 | 
			
		||||
{
 | 
			
		||||
	SDL_RWops *ops = SDL_AllocRW();
 | 
			
		||||
	gState->fileSystem().openRead(*ops, path);
 | 
			
		||||
	shState->fileSystem().openRead(*ops, path);
 | 
			
		||||
 | 
			
		||||
	VALUE klass = rb_const_get(rb_cObject, rb_intern("FileInt"));
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -20,7 +20,7 @@
 | 
			
		|||
*/
 | 
			
		||||
 | 
			
		||||
#include "graphics.h"
 | 
			
		||||
#include "globalstate.h"
 | 
			
		||||
#include "sharedstate.h"
 | 
			
		||||
#include "binding-util.h"
 | 
			
		||||
#include "exception.h"
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -28,7 +28,7 @@ RB_METHOD(graphicsUpdate)
 | 
			
		|||
{
 | 
			
		||||
	RB_UNUSED_PARAM;
 | 
			
		||||
 | 
			
		||||
	gState->graphics().update();
 | 
			
		||||
	shState->graphics().update();
 | 
			
		||||
 | 
			
		||||
	return Qnil;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -37,7 +37,7 @@ RB_METHOD(graphicsFreeze)
 | 
			
		|||
{
 | 
			
		||||
	RB_UNUSED_PARAM;
 | 
			
		||||
 | 
			
		||||
	gState->graphics().freeze();
 | 
			
		||||
	shState->graphics().freeze();
 | 
			
		||||
 | 
			
		||||
	return Qnil;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -52,7 +52,7 @@ RB_METHOD(graphicsTransition)
 | 
			
		|||
 | 
			
		||||
	rb_get_args(argc, argv, "|izi", &duration, &filename, &vague, RB_ARG_END);
 | 
			
		||||
 | 
			
		||||
	GUARD_EXC( gState->graphics().transition(duration, filename, vague); )
 | 
			
		||||
	GUARD_EXC( shState->graphics().transition(duration, filename, vague); )
 | 
			
		||||
 | 
			
		||||
	return Qnil;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -61,7 +61,7 @@ RB_METHOD(graphicsFrameReset)
 | 
			
		|||
{
 | 
			
		||||
	RB_UNUSED_PARAM;
 | 
			
		||||
 | 
			
		||||
	gState->graphics().frameReset();
 | 
			
		||||
	shState->graphics().frameReset();
 | 
			
		||||
 | 
			
		||||
	return Qnil;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -70,14 +70,14 @@ RB_METHOD(graphicsFrameReset)
 | 
			
		|||
	RB_METHOD(graphics##Get##PropName) \
 | 
			
		||||
	{ \
 | 
			
		||||
		RB_UNUSED_PARAM; \
 | 
			
		||||
		return rb_fix_new(gState->graphics().get##PropName()); \
 | 
			
		||||
		return rb_fix_new(shState->graphics().get##PropName()); \
 | 
			
		||||
	} \
 | 
			
		||||
	RB_METHOD(graphics##Set##PropName) \
 | 
			
		||||
	{ \
 | 
			
		||||
		RB_UNUSED_PARAM; \
 | 
			
		||||
		int value; \
 | 
			
		||||
		rb_get_args(argc, argv, "i", &value, RB_ARG_END); \
 | 
			
		||||
		gState->graphics().set##PropName(value); \
 | 
			
		||||
		shState->graphics().set##PropName(value); \
 | 
			
		||||
		return rb_fix_new(value); \
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -85,14 +85,14 @@ RB_METHOD(graphicsFrameReset)
 | 
			
		|||
	RB_METHOD(graphics##Get##PropName) \
 | 
			
		||||
	{ \
 | 
			
		||||
		RB_UNUSED_PARAM; \
 | 
			
		||||
		return rb_bool_new(gState->graphics().get##PropName()); \
 | 
			
		||||
		return rb_bool_new(shState->graphics().get##PropName()); \
 | 
			
		||||
	} \
 | 
			
		||||
	RB_METHOD(graphics##Set##PropName) \
 | 
			
		||||
	{ \
 | 
			
		||||
		RB_UNUSED_PARAM; \
 | 
			
		||||
		bool value; \
 | 
			
		||||
		rb_get_args(argc, argv, "b", &value, RB_ARG_END); \
 | 
			
		||||
		gState->graphics().set##PropName(value); \
 | 
			
		||||
		shState->graphics().set##PropName(value); \
 | 
			
		||||
		return rb_bool_new(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 @@ RB_METHOD(inputUpdate)
 | 
			
		|||
{
 | 
			
		||||
	RB_UNUSED_PARAM;
 | 
			
		||||
 | 
			
		||||
	gState->input().update();
 | 
			
		||||
	shState->input().update();
 | 
			
		||||
 | 
			
		||||
	return Qnil;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -42,7 +42,7 @@ RB_METHOD(inputPress)
 | 
			
		|||
 | 
			
		||||
	Input::ButtonCode bc = (Input::ButtonCode) num;
 | 
			
		||||
 | 
			
		||||
	return rb_bool_new(gState->input().isPressed(bc));
 | 
			
		||||
	return rb_bool_new(shState->input().isPressed(bc));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
RB_METHOD(inputTrigger)
 | 
			
		||||
| 
						 | 
				
			
			@ -54,7 +54,7 @@ RB_METHOD(inputTrigger)
 | 
			
		|||
 | 
			
		||||
	Input::ButtonCode bc = (Input::ButtonCode) num;
 | 
			
		||||
 | 
			
		||||
	return rb_bool_new(gState->input().isTriggered(bc));
 | 
			
		||||
	return rb_bool_new(shState->input().isTriggered(bc));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
RB_METHOD(inputRepeat)
 | 
			
		||||
| 
						 | 
				
			
			@ -66,21 +66,21 @@ RB_METHOD(inputRepeat)
 | 
			
		|||
 | 
			
		||||
	Input::ButtonCode bc = (Input::ButtonCode) num;
 | 
			
		||||
 | 
			
		||||
	return rb_bool_new(gState->input().isRepeated(bc));
 | 
			
		||||
	return rb_bool_new(shState->input().isRepeated(bc));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
RB_METHOD(inputDir4)
 | 
			
		||||
{
 | 
			
		||||
	RB_UNUSED_PARAM;
 | 
			
		||||
 | 
			
		||||
	return rb_fix_new(gState->input().dir4Value());
 | 
			
		||||
	return rb_fix_new(shState->input().dir4Value());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
RB_METHOD(inputDir8)
 | 
			
		||||
{
 | 
			
		||||
	RB_UNUSED_PARAM;
 | 
			
		||||
 | 
			
		||||
	return rb_fix_new(gState->input().dir8Value());
 | 
			
		||||
	return rb_fix_new(shState->input().dir8Value());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Non-standard extensions */
 | 
			
		||||
| 
						 | 
				
			
			@ -88,14 +88,14 @@ RB_METHOD(inputMouseX)
 | 
			
		|||
{
 | 
			
		||||
	RB_UNUSED_PARAM;
 | 
			
		||||
 | 
			
		||||
	return rb_fix_new(gState->input().mouseX());
 | 
			
		||||
	return rb_fix_new(shState->input().mouseX());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
RB_METHOD(inputMouseY)
 | 
			
		||||
{
 | 
			
		||||
	RB_UNUSED_PARAM;
 | 
			
		||||
 | 
			
		||||
	return rb_fix_new(gState->input().mouseY());
 | 
			
		||||
	return rb_fix_new(shState->input().mouseY());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#define DEF_CONST_I(name, value) \
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue