Function chaining for PlayerOptions and SongOptions APIs.
This commit is contained in:
@@ -3002,6 +3002,13 @@ save yourself some time, copy this for undocumented things:
|
|||||||
</Class>
|
</Class>
|
||||||
<Class name='PlayerOptions'>
|
<Class name='PlayerOptions'>
|
||||||
<Description>
|
<Description>
|
||||||
|
All these functions have an optional last argument: If the last argument is the boolean value true, then instead of returning the previous settings as normal, they will instead return the PlayerOptions object.<br />
|
||||||
|
This allows you to chain them like this:<br />
|
||||||
|
player_options:Twirl(5, 1, true):Roll(5, true):Dizzy(true):Twirl()<br />
|
||||||
|
<br />
|
||||||
|
Special note: Functions that take a bool as their arg must have true as the second arg to be used with chaining.<br />
|
||||||
|
"player_options:Backwards(true, true):Beat(5)" will chain, "player_options:Backwards(true):Beat(5)" will not chain.<br />
|
||||||
|
<br />
|
||||||
Most options fall into one of four types: float, int, bool, or enum.<br />
|
Most options fall into one of four types: float, int, bool, or enum.<br />
|
||||||
Float type options have this interface:<br />
|
Float type options have this interface:<br />
|
||||||
Option(value, approach_speed)<br />
|
Option(value, approach_speed)<br />
|
||||||
@@ -3121,7 +3128,7 @@ save yourself some time, copy this for undocumented things:
|
|||||||
Changing the noteskin during a song is not supported.<br />
|
Changing the noteskin during a song is not supported.<br />
|
||||||
Example:<br />
|
Example:<br />
|
||||||
note_name= options:NoteSkin() -- Sets note_name to the player's current noteskin.<br />
|
note_name= options:NoteSkin() -- Sets note_name to the player's current noteskin.<br />
|
||||||
prev_note_name, succeeded= options:NoteSkin("cel") -- Sets prev_note_name to the noteskin the player had set, changes the current noteskin to "cel", sets succeeded to true if the the "cel" noteskin exists.<br />
|
prev_note_name, succeeded= options:NoteSkin("cel") -- Sets prev_note_name to the noteskin the player had set, changes the current noteskin to "cel", sets succeeded to true if the "cel" noteskin exists.<br />
|
||||||
</Function>
|
</Function>
|
||||||
<Function name='Overhead' return='bool' arguments='bool'>
|
<Function name='Overhead' return='bool' arguments='bool'>
|
||||||
If the player is using Overhead (0 tilt, 0 skew), returns true.<br />
|
If the player is using Overhead (0 tilt, 0 skew), returns true.<br />
|
||||||
|
|||||||
+33
-17
@@ -8,13 +8,21 @@
|
|||||||
// Functions are designed to combine Get and Set into one, to be less clumsy to use. -Kyz
|
// Functions are designed to combine Get and Set into one, to be less clumsy to use. -Kyz
|
||||||
// If a valid arg is passed, the value is set.
|
// If a valid arg is passed, the value is set.
|
||||||
// The previous value is returned.
|
// The previous value is returned.
|
||||||
|
// OPTIONAL_RETURN_SELF exists to provide optional chaining support.
|
||||||
|
// Example: local a= player_options:Twirl(5, 1, true):Roll(5, true):Dizzy(true):Twirl()
|
||||||
|
#define OPTIONAL_RETURN_SELF(option_index) \
|
||||||
|
if(lua_isboolean(L, option_index) && lua_toboolean(L, option_index)) \
|
||||||
|
{ \
|
||||||
|
p->PushSelf(L); \
|
||||||
|
return 1; \
|
||||||
|
}
|
||||||
#define FLOAT_INTERFACE(func_name, member, valid) \
|
#define FLOAT_INTERFACE(func_name, member, valid) \
|
||||||
static int func_name(T* p, lua_State* L) \
|
static int func_name(T* p, lua_State* L) \
|
||||||
{ \
|
{ \
|
||||||
DefaultNilArgs(L, 2); \
|
int original_top= lua_gettop(L); \
|
||||||
lua_pushnumber(L, p->m_f ## member); \
|
lua_pushnumber(L, p->m_f ## member); \
|
||||||
lua_pushnumber(L, p->m_Speedf ## member); \
|
lua_pushnumber(L, p->m_Speedf ## member); \
|
||||||
if(lua_isnumber(L, 1)) \
|
if(lua_isnumber(L, 1) && original_top >= 1) \
|
||||||
{ \
|
{ \
|
||||||
float v= FArg(1); \
|
float v= FArg(1); \
|
||||||
if(!valid) \
|
if(!valid) \
|
||||||
@@ -22,23 +30,20 @@
|
|||||||
luaL_error(L, "Invalid value %f", v); \
|
luaL_error(L, "Invalid value %f", v); \
|
||||||
} \
|
} \
|
||||||
p->m_f ## member = v; \
|
p->m_f ## member = v; \
|
||||||
if(p->m_Speedf ## member <= 0.0f) \
|
|
||||||
{ \
|
|
||||||
p->m_Speedf ## member = 1.0f; \
|
|
||||||
} \
|
|
||||||
} \
|
} \
|
||||||
if(lua_isnumber(L, 2)) \
|
if(original_top >= 2 && lua_isnumber(L, 2)) \
|
||||||
{ \
|
{ \
|
||||||
p->m_Speedf ## member = FArgGTEZero(L, 2); \
|
p->m_Speedf ## member = FArgGTEZero(L, 2); \
|
||||||
} \
|
} \
|
||||||
|
OPTIONAL_RETURN_SELF(original_top); \
|
||||||
return 2; \
|
return 2; \
|
||||||
}
|
}
|
||||||
#define FLOAT_NO_SPEED_INTERFACE(func_name, member, valid) \
|
#define FLOAT_NO_SPEED_INTERFACE(func_name, member, valid) \
|
||||||
static int func_name(T* p, lua_State* L) \
|
static int func_name(T* p, lua_State* L) \
|
||||||
{ \
|
{ \
|
||||||
DefaultNilArgs(L, 1); \
|
int original_top= lua_gettop(L); \
|
||||||
lua_pushnumber(L, p->m_f ## member); \
|
lua_pushnumber(L, p->m_f ## member); \
|
||||||
if(lua_isnumber(L, 1)) \
|
if(lua_isnumber(L, 1) && original_top >= 1) \
|
||||||
{ \
|
{ \
|
||||||
float v= FArg(1); \
|
float v= FArg(1); \
|
||||||
if(!valid) \
|
if(!valid) \
|
||||||
@@ -47,53 +52,63 @@
|
|||||||
} \
|
} \
|
||||||
p->m_f ## member = v; \
|
p->m_f ## member = v; \
|
||||||
} \
|
} \
|
||||||
|
OPTIONAL_RETURN_SELF(original_top); \
|
||||||
return 1; \
|
return 1; \
|
||||||
}
|
}
|
||||||
#define INT_INTERFACE(func_name, member) \
|
#define INT_INTERFACE(func_name, member) \
|
||||||
static int func_name(T* p, lua_State* L) \
|
static int func_name(T* p, lua_State* L) \
|
||||||
{ \
|
{ \
|
||||||
DefaultNilArgs(L, 1); \
|
int original_top= lua_gettop(L); \
|
||||||
lua_pushnumber(L, p->m_ ## member); \
|
lua_pushnumber(L, p->m_ ## member); \
|
||||||
if(lua_isnumber(L, 1)) \
|
if(lua_isnumber(L, 1) && original_top >= 1) \
|
||||||
{ \
|
{ \
|
||||||
p->m_ ## member = IArg(1); \
|
p->m_ ## member = IArg(1); \
|
||||||
} \
|
} \
|
||||||
|
OPTIONAL_RETURN_SELF(original_top); \
|
||||||
return 1; \
|
return 1; \
|
||||||
}
|
}
|
||||||
|
// BOOL_INTERFACE can't use OPTIONAL_RETURN_SELF because it pushes a bool.
|
||||||
|
// If it did original_top, then "foo(true)" would chain when it shouldn't.
|
||||||
#define BOOL_INTERFACE(func_name, member) \
|
#define BOOL_INTERFACE(func_name, member) \
|
||||||
static int func_name(T* p, lua_State* L) \
|
static int func_name(T* p, lua_State* L) \
|
||||||
{ \
|
{ \
|
||||||
DefaultNilArgs(L, 1); \
|
int original_top= lua_gettop(L); \
|
||||||
lua_pushboolean(L, p->m_b ## member); \
|
lua_pushboolean(L, p->m_b ## member); \
|
||||||
if(lua_isboolean(L, 1)) \
|
if(lua_isboolean(L, 1) && original_top >= 1) \
|
||||||
{ \
|
{ \
|
||||||
p->m_b ## member = BArg(1); \
|
p->m_b ## member = BArg(1); \
|
||||||
} \
|
} \
|
||||||
|
if(original_top >= 2 && lua_isboolean(L, 2)) \
|
||||||
|
{ \
|
||||||
|
p->PushSelf(L); \
|
||||||
|
return 1; \
|
||||||
|
} \
|
||||||
return 1; \
|
return 1; \
|
||||||
}
|
}
|
||||||
#define ENUM_INTERFACE(func_name, member, enum_name) \
|
#define ENUM_INTERFACE(func_name, member, enum_name) \
|
||||||
static int func_name(T* p, lua_State* L) \
|
static int func_name(T* p, lua_State* L) \
|
||||||
{ \
|
{ \
|
||||||
DefaultNilArgs(L, 1); \
|
int original_top= lua_gettop(L); \
|
||||||
Enum::Push(L, p->m_ ## member); \
|
Enum::Push(L, p->m_ ## member); \
|
||||||
if(!lua_isnil(L, 1)) \
|
if(!lua_isnil(L, 1) && original_top >= 1) \
|
||||||
{ \
|
{ \
|
||||||
p->m_ ## member= Enum::Check<enum_name>(L, 1); \
|
p->m_ ## member= Enum::Check<enum_name>(L, 1); \
|
||||||
} \
|
} \
|
||||||
|
OPTIONAL_RETURN_SELF(original_top); \
|
||||||
return 1; \
|
return 1; \
|
||||||
}
|
}
|
||||||
// Walk the table to make sure all entries are valid before setting.
|
// Walk the table to make sure all entries are valid before setting.
|
||||||
#define FLOAT_TABLE_INTERFACE(func_name, member, valid) \
|
#define FLOAT_TABLE_INTERFACE(func_name, member, valid) \
|
||||||
static int func_name(T* p, lua_State* L) \
|
static int func_name(T* p, lua_State* L) \
|
||||||
{ \
|
{ \
|
||||||
DefaultNilArgs(L, 1); \
|
int original_top= lua_gettop(L); \
|
||||||
lua_createtable(L, p->m_ ## member.size(), 0); \
|
lua_createtable(L, p->m_ ## member.size(), 0); \
|
||||||
for(size_t n= 0; n < p->m_ ## member.size(); ++n) \
|
for(size_t n= 0; n < p->m_ ## member.size(); ++n) \
|
||||||
{ \
|
{ \
|
||||||
lua_pushnumber(L, p->m_ ## member[n]); \
|
lua_pushnumber(L, p->m_ ## member[n]); \
|
||||||
lua_rawseti(L, -2, n+1); \
|
lua_rawseti(L, -2, n+1); \
|
||||||
} \
|
} \
|
||||||
if(lua_istable(L, 1)) \
|
if(lua_istable(L, 1) && original_top >= 1) \
|
||||||
{ \
|
{ \
|
||||||
size_t size= lua_objlen(L, 1); \
|
size_t size= lua_objlen(L, 1); \
|
||||||
if(valid(L, 1)) \
|
if(valid(L, 1)) \
|
||||||
@@ -110,6 +125,7 @@
|
|||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
|
OPTIONAL_RETURN_SELF(original_top); \
|
||||||
return 1; \
|
return 1; \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+37
-27
@@ -1086,7 +1086,7 @@ public:
|
|||||||
// NoteSkins
|
// NoteSkins
|
||||||
static int NoteSkin(T* p, lua_State* L)
|
static int NoteSkin(T* p, lua_State* L)
|
||||||
{
|
{
|
||||||
DefaultNilArgs(L, 2);
|
int original_top= lua_gettop(L);
|
||||||
if( p->m_sNoteSkin.empty() )
|
if( p->m_sNoteSkin.empty() )
|
||||||
{
|
{
|
||||||
lua_pushstring( L, CommonMetrics::DEFAULT_NOTESKIN_NAME.GetValue() );
|
lua_pushstring( L, CommonMetrics::DEFAULT_NOTESKIN_NAME.GetValue() );
|
||||||
@@ -1095,11 +1095,12 @@ public:
|
|||||||
{
|
{
|
||||||
lua_pushstring( L, p->m_sNoteSkin );
|
lua_pushstring( L, p->m_sNoteSkin );
|
||||||
}
|
}
|
||||||
if(lua_isstring(L, 1))
|
if(original_top >= 1 && lua_isstring(L, 1))
|
||||||
{
|
{
|
||||||
if(NOTESKIN->DoesNoteSkinExist(SArg(1)))
|
RString skin= SArg(1);
|
||||||
|
if(NOTESKIN->DoesNoteSkinExist(skin))
|
||||||
{
|
{
|
||||||
p->m_sNoteSkin = SArg(1);
|
p->m_sNoteSkin = skin;
|
||||||
lua_pushboolean(L, true);
|
lua_pushboolean(L, true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -1111,6 +1112,7 @@ public:
|
|||||||
{
|
{
|
||||||
lua_pushnil(L);
|
lua_pushnil(L);
|
||||||
}
|
}
|
||||||
|
OPTIONAL_RETURN_SELF(original_top);
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1127,7 +1129,7 @@ public:
|
|||||||
// engine's enforcement of sane separation between speed mod types.
|
// engine's enforcement of sane separation between speed mod types.
|
||||||
static int CMod(T* p, lua_State* L)
|
static int CMod(T* p, lua_State* L)
|
||||||
{
|
{
|
||||||
DefaultNilArgs(L, 2);
|
int original_top= lua_gettop(L);
|
||||||
if(p->m_fTimeSpacing)
|
if(p->m_fTimeSpacing)
|
||||||
{
|
{
|
||||||
lua_pushnumber(L, p->m_fScrollBPM);
|
lua_pushnumber(L, p->m_fScrollBPM);
|
||||||
@@ -1138,7 +1140,7 @@ public:
|
|||||||
lua_pushnil(L);
|
lua_pushnil(L);
|
||||||
lua_pushnil(L);
|
lua_pushnil(L);
|
||||||
}
|
}
|
||||||
if(lua_isnumber(L, 1))
|
if(original_top >= 1 && lua_isnumber(L, 1))
|
||||||
{
|
{
|
||||||
float speed= FArg(1);
|
float speed= FArg(1);
|
||||||
if(!isfinite(speed) || speed <= 0.0f)
|
if(!isfinite(speed) || speed <= 0.0f)
|
||||||
@@ -1150,16 +1152,17 @@ public:
|
|||||||
p->m_fScrollSpeed = 1;
|
p->m_fScrollSpeed = 1;
|
||||||
p->m_fMaxScrollBPM = 0;
|
p->m_fMaxScrollBPM = 0;
|
||||||
}
|
}
|
||||||
if(lua_isnumber(L, 2))
|
if(original_top >= 2 && lua_isnumber(L, 2))
|
||||||
{
|
{
|
||||||
SetSpeedModApproaches(p, FArgGTEZero(L, 2));
|
SetSpeedModApproaches(p, FArgGTEZero(L, 2));
|
||||||
}
|
}
|
||||||
|
OPTIONAL_RETURN_SELF(original_top);
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int XMod(T* p, lua_State* L)
|
static int XMod(T* p, lua_State* L)
|
||||||
{
|
{
|
||||||
DefaultNilArgs(L, 2);
|
int original_top= lua_gettop(L);
|
||||||
if(!p->m_fTimeSpacing)
|
if(!p->m_fTimeSpacing)
|
||||||
{
|
{
|
||||||
lua_pushnumber(L, p->m_fScrollSpeed);
|
lua_pushnumber(L, p->m_fScrollSpeed);
|
||||||
@@ -1170,23 +1173,24 @@ public:
|
|||||||
lua_pushnil(L);
|
lua_pushnil(L);
|
||||||
lua_pushnil(L);
|
lua_pushnil(L);
|
||||||
}
|
}
|
||||||
if(lua_isnumber(L, 1))
|
if(lua_isnumber(L, 1) && original_top >= 1)
|
||||||
{
|
{
|
||||||
p->m_fScrollSpeed = FArg(1);
|
p->m_fScrollSpeed = FArg(1);
|
||||||
p->m_fTimeSpacing = 0;
|
p->m_fTimeSpacing = 0;
|
||||||
p->m_fScrollBPM= CMOD_DEFAULT;
|
p->m_fScrollBPM= CMOD_DEFAULT;
|
||||||
p->m_fMaxScrollBPM = 0;
|
p->m_fMaxScrollBPM = 0;
|
||||||
}
|
}
|
||||||
if(lua_isnumber(L, 2))
|
if(lua_isnumber(L, 2) && original_top >= 2)
|
||||||
{
|
{
|
||||||
SetSpeedModApproaches(p, FArgGTEZero(L, 2));
|
SetSpeedModApproaches(p, FArgGTEZero(L, 2));
|
||||||
}
|
}
|
||||||
|
OPTIONAL_RETURN_SELF(original_top);
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int MMod(T* p, lua_State* L)
|
static int MMod(T* p, lua_State* L)
|
||||||
{
|
{
|
||||||
DefaultNilArgs(L, 2);
|
int original_top= lua_gettop(L);
|
||||||
if(!p->m_fTimeSpacing && p->m_fMaxScrollBPM)
|
if(!p->m_fTimeSpacing && p->m_fMaxScrollBPM)
|
||||||
{
|
{
|
||||||
lua_pushnumber(L, p->m_fMaxScrollBPM);
|
lua_pushnumber(L, p->m_fMaxScrollBPM);
|
||||||
@@ -1197,7 +1201,7 @@ public:
|
|||||||
lua_pushnil(L);
|
lua_pushnil(L);
|
||||||
lua_pushnil(L);
|
lua_pushnil(L);
|
||||||
}
|
}
|
||||||
if(lua_isnumber(L, 1))
|
if(lua_isnumber(L, 1) && original_top >= 1)
|
||||||
{
|
{
|
||||||
float speed= FArg(1);
|
float speed= FArg(1);
|
||||||
if(!isfinite(speed) || speed <= 0.0f)
|
if(!isfinite(speed) || speed <= 0.0f)
|
||||||
@@ -1209,10 +1213,11 @@ public:
|
|||||||
p->m_fScrollSpeed= 1;
|
p->m_fScrollSpeed= 1;
|
||||||
p->m_fMaxScrollBPM = speed;
|
p->m_fMaxScrollBPM = speed;
|
||||||
}
|
}
|
||||||
if(lua_isnumber(L, 2))
|
if(lua_isnumber(L, 2) && original_top >= 2)
|
||||||
{
|
{
|
||||||
SetSpeedModApproaches(p, FArgGTEZero(L, 2));
|
SetSpeedModApproaches(p, FArgGTEZero(L, 2));
|
||||||
}
|
}
|
||||||
|
OPTIONAL_RETURN_SELF(original_top);
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1224,23 +1229,24 @@ public:
|
|||||||
|
|
||||||
static int Overhead(T* p, lua_State* L)
|
static int Overhead(T* p, lua_State* L)
|
||||||
{
|
{
|
||||||
DefaultNilArgs(L, 2);
|
int original_top= lua_gettop(L);
|
||||||
lua_pushboolean(L, (p->m_fPerspectiveTilt == 0.0f && p->m_fSkew == 0.0f));
|
lua_pushboolean(L, (p->m_fPerspectiveTilt == 0.0f && p->m_fSkew == 0.0f));
|
||||||
if(lua_toboolean(L, 1))
|
if(lua_toboolean(L, 1))
|
||||||
{
|
{
|
||||||
p->m_fPerspectiveTilt= 0;
|
p->m_fPerspectiveTilt= 0;
|
||||||
p->m_fSkew= 0;
|
p->m_fSkew= 0;
|
||||||
}
|
}
|
||||||
if(lua_isnumber(L, 2))
|
if(lua_isnumber(L, 2) && original_top >= 2)
|
||||||
{
|
{
|
||||||
SetPerspectiveApproach(p, L, FArgGTEZero(L, 2));
|
SetPerspectiveApproach(p, L, FArgGTEZero(L, 2));
|
||||||
}
|
}
|
||||||
|
OPTIONAL_RETURN_SELF(original_top);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int Incoming(T* p, lua_State* L)
|
static int Incoming(T* p, lua_State* L)
|
||||||
{
|
{
|
||||||
DefaultNilArgs(L, 2);
|
int original_top= lua_gettop(L);
|
||||||
if((p->m_fSkew > 0.0f && p->m_fPerspectiveTilt < 0.0f) ||
|
if((p->m_fSkew > 0.0f && p->m_fPerspectiveTilt < 0.0f) ||
|
||||||
(p->m_fSkew < 0.0f && p->m_fPerspectiveTilt > 0.0f))
|
(p->m_fSkew < 0.0f && p->m_fPerspectiveTilt > 0.0f))
|
||||||
{
|
{
|
||||||
@@ -1252,22 +1258,23 @@ public:
|
|||||||
lua_pushnil(L);
|
lua_pushnil(L);
|
||||||
lua_pushnil(L);
|
lua_pushnil(L);
|
||||||
}
|
}
|
||||||
if(lua_isnumber(L, 1))
|
if(lua_isnumber(L, 1) && original_top >= 1)
|
||||||
{
|
{
|
||||||
float value= FArg(1);
|
float value= FArg(1);
|
||||||
p->m_fPerspectiveTilt= -value;
|
p->m_fPerspectiveTilt= -value;
|
||||||
p->m_fSkew= value;
|
p->m_fSkew= value;
|
||||||
}
|
}
|
||||||
if(lua_isnumber(L, 2))
|
if(lua_isnumber(L, 2) && original_top >= 2)
|
||||||
{
|
{
|
||||||
SetPerspectiveApproach(p, L, FArgGTEZero(L, 2));
|
SetPerspectiveApproach(p, L, FArgGTEZero(L, 2));
|
||||||
}
|
}
|
||||||
|
OPTIONAL_RETURN_SELF(original_top);
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int Space(T* p, lua_State* L)
|
static int Space(T* p, lua_State* L)
|
||||||
{
|
{
|
||||||
DefaultNilArgs(L, 2);
|
int original_top= lua_gettop(L);
|
||||||
if((p->m_fSkew > 0.0f && p->m_fPerspectiveTilt > 0.0f) ||
|
if((p->m_fSkew > 0.0f && p->m_fPerspectiveTilt > 0.0f) ||
|
||||||
(p->m_fSkew < 0.0f && p->m_fPerspectiveTilt < 0.0f))
|
(p->m_fSkew < 0.0f && p->m_fPerspectiveTilt < 0.0f))
|
||||||
{
|
{
|
||||||
@@ -1279,22 +1286,23 @@ public:
|
|||||||
lua_pushnil(L);
|
lua_pushnil(L);
|
||||||
lua_pushnil(L);
|
lua_pushnil(L);
|
||||||
}
|
}
|
||||||
if(lua_isnumber(L, 1))
|
if(lua_isnumber(L, 1) && original_top >= 1)
|
||||||
{
|
{
|
||||||
float value= FArg(1);
|
float value= FArg(1);
|
||||||
p->m_fPerspectiveTilt= value;
|
p->m_fPerspectiveTilt= value;
|
||||||
p->m_fSkew= value;
|
p->m_fSkew= value;
|
||||||
}
|
}
|
||||||
if(lua_isnumber(L, 2))
|
if(lua_isnumber(L, 2) && original_top >= 2)
|
||||||
{
|
{
|
||||||
SetPerspectiveApproach(p, L, FArgGTEZero(L, 2));
|
SetPerspectiveApproach(p, L, FArgGTEZero(L, 2));
|
||||||
}
|
}
|
||||||
|
OPTIONAL_RETURN_SELF(original_top);
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int Hallway(T* p, lua_State* L)
|
static int Hallway(T* p, lua_State* L)
|
||||||
{
|
{
|
||||||
DefaultNilArgs(L, 2);
|
int original_top= lua_gettop(L);
|
||||||
if(p->m_fSkew == 0.0f && p->m_fPerspectiveTilt < 0.0f)
|
if(p->m_fSkew == 0.0f && p->m_fPerspectiveTilt < 0.0f)
|
||||||
{
|
{
|
||||||
lua_pushnumber(L, -p->m_fPerspectiveTilt);
|
lua_pushnumber(L, -p->m_fPerspectiveTilt);
|
||||||
@@ -1305,21 +1313,22 @@ public:
|
|||||||
lua_pushnil(L);
|
lua_pushnil(L);
|
||||||
lua_pushnil(L);
|
lua_pushnil(L);
|
||||||
}
|
}
|
||||||
if(lua_isnumber(L, 1))
|
if(lua_isnumber(L, 1) && original_top >= 1)
|
||||||
{
|
{
|
||||||
p->m_fPerspectiveTilt= -FArg(1);
|
p->m_fPerspectiveTilt= -FArg(1);
|
||||||
p->m_fSkew= 0;
|
p->m_fSkew= 0;
|
||||||
}
|
}
|
||||||
if(lua_isnumber(L, 2))
|
if(lua_isnumber(L, 2) && original_top >= 2)
|
||||||
{
|
{
|
||||||
SetPerspectiveApproach(p, L, FArgGTEZero(L, 2));
|
SetPerspectiveApproach(p, L, FArgGTEZero(L, 2));
|
||||||
}
|
}
|
||||||
|
OPTIONAL_RETURN_SELF(original_top);
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int Distant(T* p, lua_State* L)
|
static int Distant(T* p, lua_State* L)
|
||||||
{
|
{
|
||||||
DefaultNilArgs(L, 2);
|
int original_top= lua_gettop(L);
|
||||||
if(p->m_fSkew == 0.0f && p->m_fPerspectiveTilt > 0.0f)
|
if(p->m_fSkew == 0.0f && p->m_fPerspectiveTilt > 0.0f)
|
||||||
{
|
{
|
||||||
lua_pushnumber(L, p->m_fPerspectiveTilt);
|
lua_pushnumber(L, p->m_fPerspectiveTilt);
|
||||||
@@ -1330,15 +1339,16 @@ public:
|
|||||||
lua_pushnil(L);
|
lua_pushnil(L);
|
||||||
lua_pushnil(L);
|
lua_pushnil(L);
|
||||||
}
|
}
|
||||||
if(lua_isnumber(L, 1))
|
if(lua_isnumber(L, 1) && original_top >= 1)
|
||||||
{
|
{
|
||||||
p->m_fPerspectiveTilt= FArg(1);
|
p->m_fPerspectiveTilt= FArg(1);
|
||||||
p->m_fSkew= 0;
|
p->m_fSkew= 0;
|
||||||
}
|
}
|
||||||
if(lua_isnumber(L, 2))
|
if(lua_isnumber(L, 2) && original_top >= 2)
|
||||||
{
|
{
|
||||||
SetPerspectiveApproach(p, L, FArgGTEZero(L, 2));
|
SetPerspectiveApproach(p, L, FArgGTEZero(L, 2));
|
||||||
}
|
}
|
||||||
|
OPTIONAL_RETURN_SELF(original_top);
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user