diff --git a/Docs/Changelog_sm5.txt b/Docs/Changelog_sm5.txt index 240277c0f6..f4c14e1518 100644 --- a/Docs/Changelog_sm5.txt +++ b/Docs/Changelog_sm5.txt @@ -4,6 +4,12 @@ The StepMania 5 Changelog covers all post-sm-ssc changes. For a list of changes from StepMania 4 alpha 5 to sm-ssc v1.2.5, see Changelog_sm-ssc.txt. ________________________________________________________________________________ +2014/12/01 +---------- +* [Everything] Actor and singleton functions that formerly returned nothing now + return the actor or singleton. Example (set zoom, x, y, and diffuse in one): + self:zoom(.5):xy(_screen.cx, _screen.h-60):diffuse(color("#dc322f")) + 2014/11/22 ---------- * [Preferences] MinTNSToHideNotes preference added. [kyzentun] diff --git a/Themes/_fallback/Scripts/02 Actor.lua b/Themes/_fallback/Scripts/02 Actor.lua index 0ab7ea29ea..ac16aaf106 100644 --- a/Themes/_fallback/Scripts/02 Actor.lua +++ b/Themes/_fallback/Scripts/02 Actor.lua @@ -11,19 +11,19 @@ function Actor:ease(t, fEase) -- fEase = -100 is equivalent to TweenType_Accelerate. if fEase == -100 then self:accelerate(t) - return + return self end -- fEase = 0 is equivalent to TweenType_Linear. if fEase == 0 then self:linear(t) - return + return self end -- fEase = +100 is equivalent to TweenType_Decelerate. if fEase == 100 then self:decelerate(t) - return + return self end self:tween( t, "TweenType_Bezier", @@ -34,6 +34,7 @@ function Actor:ease(t, fEase) 1 } ) + return self end -- Notes On Beziers -- -- They can be 1D ( Quadratic ) or 2D ( Bezier ) @@ -52,6 +53,7 @@ local BounceBeginBezier = } function Actor:bouncebegin(t) self:tween( t, "TweenType_Bezier", BounceBeginBezier ) + return self end local BounceEndBezier = @@ -63,6 +65,7 @@ local BounceEndBezier = } function Actor:bounceend(t) self:tween( t, "TweenType_Bezier", BounceEndBezier ) + return self end local SmoothBezier = @@ -71,6 +74,7 @@ local SmoothBezier = } function Actor:smooth(t) self:tween( t, "TweenType_Bezier", SmoothBezier ) + return self end -- SSC Additions local DropBezier = @@ -82,6 +86,7 @@ local DropBezier = } function Actor:drop(t) self:tween( t, "TweenType_Bezier", DropBezier ) + return self end -- compound tweens "combine multiple interpolators to allow generating more @@ -119,6 +124,7 @@ function Actor:compound(length,...) -- todo: handle using tween and 'TweenType_Bezier' end end + return self end -- Hide if b is true, but don't unhide if b is false. @@ -126,16 +132,19 @@ function Actor:hide_if(b) if b then self:visible(false) end + return self end function Actor:player(p) self:visible( GAMESTATE:IsHumanPlayer(p) ) + return self end function ActorFrame:propagatecommand(...) self:propagate(1) self:playcommand(...) self:propagate(0) + return self end -- Shortcut for alignment. @@ -145,10 +154,12 @@ end function Actor:align(h, v) self:halign( h ) self:valign( v ) + return self end function Actor:FullScreen() self:stretchto( 0,0,SCREEN_WIDTH,SCREEN_HEIGHT ) + return self end bg_fit_functions= { @@ -185,16 +196,18 @@ function Actor:scale_or_crop_background_no_move() else self:scaletocover(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT) end + return self end function Actor:scale_or_crop_background() self:scale_or_crop_background_no_move() self:xy(SCREEN_CENTER_X, SCREEN_CENTER_Y) + return self end -function Actor:CenterX() self:x(SCREEN_CENTER_X) end -function Actor:CenterY() self:y(SCREEN_CENTER_Y) end -function Actor:Center() self:xy(SCREEN_CENTER_X,SCREEN_CENTER_Y) end +function Actor:CenterX() self:x(SCREEN_CENTER_X) return self end +function Actor:CenterY() self:y(SCREEN_CENTER_Y) return self end +function Actor:Center() self:xy(SCREEN_CENTER_X,SCREEN_CENTER_Y) return self end function Actor:bezier(...) local a = {...} @@ -205,6 +218,7 @@ function Actor:bezier(...) b[#b+1] = a[i] end self:tween(a[2], "TweenMode_Bezier", b) + return self end function Actor:Real() @@ -212,6 +226,7 @@ function Actor:Real() self:basezoom(GetReal()) -- don't make this ugly self:SetTextureFiltering(false) + return self end -- Scale things back up after they have already been scaled down. @@ -219,6 +234,7 @@ function Actor:RealInverse() -- scale back up to theme resolution self:basezoom(GetRealInverse()) self:SetTextureFiltering(true) + return self end -- MaskSource([clearzbuffer]) @@ -229,12 +245,14 @@ function Actor:MaskSource(noclear) end self:zwrite(true) self:blend('BlendMode_NoEffect') + return self end -- MaskDest() -- Sets an actor up to be masked by anything with MaskSource(). function Actor:MaskDest() self:ztest(true) + return self end -- Thump() @@ -249,6 +267,7 @@ function Actor:thump(fEffectPeriod) end -- The default effectmagnitude will make this effect look very bad. self:effectmagnitude(1,1.125,1) + return self end -- Heartbeat() @@ -262,6 +281,7 @@ function Actor:heartbeat(fEffectPeriod) self:effecttiming(0,0.125,0.125,0.75); end self:effecmagnitude(1,1.125,1) + return self end --[[ BitmapText commands ]] @@ -271,24 +291,28 @@ end -- Named because it works best with pixel fonts. function BitmapText:PixelFont() self:SetTextureFiltering(false) + return self end -- Stroke(color) -- Sets the text's stroke color. function BitmapText:Stroke(c) self:strokecolor( c ) + return self end -- NoStroke() -- Removes any stroke. function BitmapText:NoStroke() self:strokecolor( color("0,0,0,0") ) + return self end -- Set Text With Format (contributed by Daisuke Master) -- this function is my hero - shake function BitmapText:settextf(...) self:settext(string.format(...)) + return self end -- DiffuseAndStroke(diffuse,stroke) @@ -296,6 +320,7 @@ end function BitmapText:DiffuseAndStroke(diffuseC,strokeC) self:diffuse(diffuseC) self:strokecolor(strokeC) + return self end; --[[ end BitmapText commands ]] @@ -345,6 +370,7 @@ function Actor:LyricCommand(side) self:sleep( Var "LyricDuration" * 0.25 ) self:linear(0.2) self:diffusealpha(0) + return self end -- formerly in 02 HelpDisplay.lua, although nothing uses it: @@ -362,6 +388,7 @@ function HelpDisplay:setfromsongorcourse() end self:settips( Artists, AltArtists ) + return self end -- Play the sound on the given player's side. Must set SupportPan = true @@ -370,6 +397,7 @@ function ActorSound:playforplayer(pn) local fBalance = SOUND:GetPlayerBalance(pn) self:get():SetProperty("Pan", fBalance) self:play() + return self end function PositionPerPlayer(player, p1X, p2X) @@ -392,7 +420,7 @@ function GetRealInverse() end -- command aliases: -function Actor:SetSize(w,h) self:setsize(w,h) end +function Actor:SetSize(w,h) self:setsize(w,h) return self end -- Simple draworder mappings DrawOrder = { diff --git a/Themes/_fallback/Scripts/02 Sprite.lua b/Themes/_fallback/Scripts/02 Sprite.lua index 905f05dbad..e1f22ea054 100644 --- a/Themes/_fallback/Scripts/02 Sprite.lua +++ b/Themes/_fallback/Scripts/02 Sprite.lua @@ -9,6 +9,7 @@ function Sprite:LoadFromSongBanner(song) else self:LoadBanner( THEME:GetPathG("Common","fallback banner") ) end + return self end function Sprite:LoadFromSongBackground(song) @@ -18,6 +19,7 @@ function Sprite:LoadFromSongBackground(song) end self:LoadBackground( Path ) + return self end function LoadSongBackground() @@ -37,21 +39,25 @@ function Sprite:LoadFromCurrentSongBackground() end end - if not song then return end + if not song then return self end self:LoadFromSongBackground(song) + return self end function Sprite:position( f ) self:GetTexture():position( f ) + return self end function Sprite:loop( f ) self:GetTexture():loop( f ) + return self end function Sprite:rate( f ) self:GetTexture():rate( f ) + return self end function Sprite.LinearFrames(NumFrames, Seconds) @@ -66,7 +72,7 @@ function Sprite.LinearFrames(NumFrames, Seconds) end -- command aliases: -function Sprite:cropto(w,h) self:CropTo(w,h) end +function Sprite:cropto(w,h) self:CropTo(w,h) return self end -- (c) 2005 Glenn Maynard -- All rights reserved. diff --git a/Themes/_fallback/Scripts/02 StageMods.lua b/Themes/_fallback/Scripts/02 StageMods.lua index 3ed4f978de..2ae36e8f4a 100644 --- a/Themes/_fallback/Scripts/02 StageMods.lua +++ b/Themes/_fallback/Scripts/02 StageMods.lua @@ -52,6 +52,7 @@ function ScreenSelectMusic:setupmusicstagemods() GAMESTATE:SetSongOptions( "ModsLevel_Stage", so ) MESSAGEMAN:Broadcast( "SongOptionsChanged" ) end + return self end function ScreenSelectMusic:setupcoursestagemods() @@ -72,6 +73,7 @@ function ScreenSelectMusic:setupcoursestagemods() GAMESTATE:SetSongOptions( "ModsLevel_Stage", so ) MESSAGEMAN:Broadcast( "SongOptionsChanged" ) end + return self end -- (c) 2006-2007 Steve Checkoway diff --git a/src/Actor.cpp b/src/Actor.cpp index 15eab5f0b5..402899c411 100644 --- a/src/Actor.cpp +++ b/src/Actor.cpp @@ -1402,17 +1402,17 @@ Actor::TweenInfo &Actor::TweenInfo::operator=( const TweenInfo &rhs ) class LunaActor : public Luna { public: - static int name( T* p, lua_State *L ) { p->SetName(SArg(1)); return 0; } + static int name( T* p, lua_State *L ) { p->SetName(SArg(1)); COMMON_RETURN_SELF; } static int sleep( T* p, lua_State *L ) { float fTime = FArg(1); if (fTime < 0) { LuaHelpers::ReportScriptErrorFmt("Lua: sleep(%f): time must not be negative", fTime); - return 0; + COMMON_RETURN_SELF; } p->Sleep(fTime); - return 0; + COMMON_RETURN_SELF; } static int linear( T* p, lua_State *L ) { @@ -1420,10 +1420,10 @@ public: if (fTime < 0) { LuaHelpers::ReportScriptErrorFmt("Lua: linear(%f): tween time must not be negative", fTime); - return 0; + COMMON_RETURN_SELF; } p->BeginTweening(fTime, TWEEN_LINEAR); - return 0; + COMMON_RETURN_SELF; } static int accelerate( T* p, lua_State *L ) { @@ -1431,10 +1431,10 @@ public: if (fTime < 0) { LuaHelpers::ReportScriptErrorFmt("Lua: accelerate(%f): tween time must not be negative", fTime); - return 0; + COMMON_RETURN_SELF; } p->BeginTweening(fTime, TWEEN_ACCELERATE); - return 0; + COMMON_RETURN_SELF; } static int decelerate( T* p, lua_State *L ) { @@ -1442,10 +1442,10 @@ public: if (fTime < 0) { LuaHelpers::ReportScriptErrorFmt("Lua: decelerate(%f): tween time must not be negative", fTime); - return 0; + COMMON_RETURN_SELF; } p->BeginTweening(fTime, TWEEN_DECELERATE); - return 0; + COMMON_RETURN_SELF; } static int spring( T* p, lua_State *L ) { @@ -1453,10 +1453,10 @@ public: if (fTime < 0) { LuaHelpers::ReportScriptErrorFmt("Lua: spring(%f): tween time must not be negative", fTime); - return 0; + COMMON_RETURN_SELF; } p->BeginTweening(fTime, TWEEN_SPRING); - return 0; + COMMON_RETURN_SELF; } static int tween( T* p, lua_State *L ) { @@ -1464,113 +1464,113 @@ public: if (fTime < 0) { LuaHelpers::ReportScriptErrorFmt("Lua: tween(%f): tween time must not be negative", fTime); - return 0; + COMMON_RETURN_SELF; } ITween *pTween = ITween::CreateFromStack( L, 2 ); if(pTween != NULL) { p->BeginTweening(fTime, pTween); } - return 0; + COMMON_RETURN_SELF; } - static int stoptweening( T* p, lua_State * ) { p->StopTweening(); return 0; } - static int finishtweening( T* p, lua_State * ) { p->FinishTweening(); return 0; } - static int hurrytweening( T* p, lua_State *L ) { p->HurryTweening(FArg(1)); return 0; } + static int stoptweening( T* p, lua_State *L ) { p->StopTweening(); COMMON_RETURN_SELF; } + static int finishtweening( T* p, lua_State *L ) { p->FinishTweening(); COMMON_RETURN_SELF; } + static int hurrytweening( T* p, lua_State *L ) { p->HurryTweening(FArg(1)); COMMON_RETURN_SELF; } static int GetTweenTimeLeft( T* p, lua_State *L ) { lua_pushnumber( L, p->GetTweenTimeLeft() ); return 1; } - static int x( T* p, lua_State *L ) { p->SetX(FArg(1)); return 0; } - static int y( T* p, lua_State *L ) { p->SetY(FArg(1)); return 0; } - static int z( T* p, lua_State *L ) { p->SetZ(FArg(1)); return 0; } - static int xy( T* p, lua_State *L ) { p->SetXY(FArg(1),FArg(2)); return 0; } - static int addx( T* p, lua_State *L ) { p->AddX(FArg(1)); return 0; } - static int addy( T* p, lua_State *L ) { p->AddY(FArg(1)); return 0; } - static int addz( T* p, lua_State *L ) { p->AddZ(FArg(1)); return 0; } - static int zoom( T* p, lua_State *L ) { p->SetZoom(FArg(1)); return 0; } - static int zoomx( T* p, lua_State *L ) { p->SetZoomX(FArg(1)); return 0; } - static int zoomy( T* p, lua_State *L ) { p->SetZoomY(FArg(1)); return 0; } - static int zoomz( T* p, lua_State *L ) { p->SetZoomZ(FArg(1)); return 0; } - static int zoomto( T* p, lua_State *L ) { p->ZoomTo(FArg(1), FArg(2)); return 0; } - static int zoomtowidth( T* p, lua_State *L ) { p->ZoomToWidth(FArg(1)); return 0; } - static int zoomtoheight( T* p, lua_State *L ) { p->ZoomToHeight(FArg(1)); return 0; } - static int setsize( T* p, lua_State *L ) { p->SetWidth(FArg(1)); p->SetHeight(FArg(2)); return 0; } - static int SetWidth( T* p, lua_State *L ) { p->SetWidth(FArg(1)); return 0; } - static int SetHeight( T* p, lua_State *L ) { p->SetHeight(FArg(1)); return 0; } - static int basealpha( T* p, lua_State *L ) { p->SetBaseAlpha(FArg(1)); return 0; } - static int basezoom( T* p, lua_State *L ) { p->SetBaseZoom(FArg(1)); return 0; } - static int basezoomx( T* p, lua_State *L ) { p->SetBaseZoomX(FArg(1)); return 0; } - static int basezoomy( T* p, lua_State *L ) { p->SetBaseZoomY(FArg(1)); return 0; } - static int basezoomz( T* p, lua_State *L ) { p->SetBaseZoomZ(FArg(1)); return 0; } - static int stretchto( T* p, lua_State *L ) { p->StretchTo( RectF(FArg(1),FArg(2),FArg(3),FArg(4)) ); return 0; } - static int cropleft( T* p, lua_State *L ) { p->SetCropLeft(FArg(1)); return 0; } - static int croptop( T* p, lua_State *L ) { p->SetCropTop(FArg(1)); return 0; } - static int cropright( T* p, lua_State *L ) { p->SetCropRight(FArg(1)); return 0; } - static int cropbottom( T* p, lua_State *L ) { p->SetCropBottom(FArg(1)); return 0; } - static int fadeleft( T* p, lua_State *L ) { p->SetFadeLeft(FArg(1)); return 0; } - static int fadetop( T* p, lua_State *L ) { p->SetFadeTop(FArg(1)); return 0; } - static int faderight( T* p, lua_State *L ) { p->SetFadeRight(FArg(1)); return 0; } - static int fadebottom( T* p, lua_State *L ) { p->SetFadeBottom(FArg(1)); return 0; } - static int diffuse( T* p, lua_State *L ) { RageColor c; c.FromStackCompat( L, 1 ); p->SetDiffuse( c ); return 0; } - static int diffuseupperleft( T* p, lua_State *L ) { RageColor c; c.FromStackCompat( L, 1 ); p->SetDiffuseUpperLeft( c ); return 0; } - static int diffuseupperright( T* p, lua_State *L ) { RageColor c; c.FromStackCompat( L, 1 ); p->SetDiffuseUpperRight( c ); return 0; } - static int diffuselowerleft( T* p, lua_State *L ) { RageColor c; c.FromStackCompat( L, 1 ); p->SetDiffuseLowerLeft( c ); return 0; } - static int diffuselowerright( T* p, lua_State *L ) { RageColor c; c.FromStackCompat( L, 1 ); p->SetDiffuseLowerRight( c ); return 0; } - static int diffuseleftedge( T* p, lua_State *L ) { RageColor c; c.FromStackCompat( L, 1 ); p->SetDiffuseLeftEdge( c ); return 0; } - static int diffuserightedge( T* p, lua_State *L ) { RageColor c; c.FromStackCompat( L, 1 ); p->SetDiffuseRightEdge( c ); return 0; } - static int diffusetopedge( T* p, lua_State *L ) { RageColor c; c.FromStackCompat( L, 1 ); p->SetDiffuseTopEdge( c ); return 0; } - static int diffusebottomedge( T* p, lua_State *L ) { RageColor c; c.FromStackCompat( L, 1 ); p->SetDiffuseBottomEdge( c ); return 0; } - static int diffusealpha( T* p, lua_State *L ) { p->SetDiffuseAlpha(FArg(1)); return 0; } - static int diffusecolor( T* p, lua_State *L ) { RageColor c; c.FromStackCompat( L, 1 ); p->SetDiffuseColor( c ); return 0; } - static int glow( T* p, lua_State *L ) { RageColor c; c.FromStackCompat( L, 1 ); p->SetGlow( c ); return 0; } - static int aux( T* p, lua_State *L ) { p->SetAux( FArg(1) ); return 0; } + static int x( T* p, lua_State *L ) { p->SetX(FArg(1)); COMMON_RETURN_SELF; } + static int y( T* p, lua_State *L ) { p->SetY(FArg(1)); COMMON_RETURN_SELF; } + static int z( T* p, lua_State *L ) { p->SetZ(FArg(1)); COMMON_RETURN_SELF; } + static int xy( T* p, lua_State *L ) { p->SetXY(FArg(1),FArg(2)); COMMON_RETURN_SELF; } + static int addx( T* p, lua_State *L ) { p->AddX(FArg(1)); COMMON_RETURN_SELF; } + static int addy( T* p, lua_State *L ) { p->AddY(FArg(1)); COMMON_RETURN_SELF; } + static int addz( T* p, lua_State *L ) { p->AddZ(FArg(1)); COMMON_RETURN_SELF; } + static int zoom( T* p, lua_State *L ) { p->SetZoom(FArg(1)); COMMON_RETURN_SELF; } + static int zoomx( T* p, lua_State *L ) { p->SetZoomX(FArg(1)); COMMON_RETURN_SELF; } + static int zoomy( T* p, lua_State *L ) { p->SetZoomY(FArg(1)); COMMON_RETURN_SELF; } + static int zoomz( T* p, lua_State *L ) { p->SetZoomZ(FArg(1)); COMMON_RETURN_SELF; } + static int zoomto( T* p, lua_State *L ) { p->ZoomTo(FArg(1), FArg(2)); COMMON_RETURN_SELF; } + static int zoomtowidth( T* p, lua_State *L ) { p->ZoomToWidth(FArg(1)); COMMON_RETURN_SELF; } + static int zoomtoheight( T* p, lua_State *L ) { p->ZoomToHeight(FArg(1)); COMMON_RETURN_SELF; } + static int setsize( T* p, lua_State *L ) { p->SetWidth(FArg(1)); p->SetHeight(FArg(2)); COMMON_RETURN_SELF; } + static int SetWidth( T* p, lua_State *L ) { p->SetWidth(FArg(1)); COMMON_RETURN_SELF; } + static int SetHeight( T* p, lua_State *L ) { p->SetHeight(FArg(1)); COMMON_RETURN_SELF; } + static int basealpha( T* p, lua_State *L ) { p->SetBaseAlpha(FArg(1)); COMMON_RETURN_SELF; } + static int basezoom( T* p, lua_State *L ) { p->SetBaseZoom(FArg(1)); COMMON_RETURN_SELF; } + static int basezoomx( T* p, lua_State *L ) { p->SetBaseZoomX(FArg(1)); COMMON_RETURN_SELF; } + static int basezoomy( T* p, lua_State *L ) { p->SetBaseZoomY(FArg(1)); COMMON_RETURN_SELF; } + static int basezoomz( T* p, lua_State *L ) { p->SetBaseZoomZ(FArg(1)); COMMON_RETURN_SELF; } + static int stretchto( T* p, lua_State *L ) { p->StretchTo( RectF(FArg(1),FArg(2),FArg(3),FArg(4)) ); COMMON_RETURN_SELF; } + static int cropleft( T* p, lua_State *L ) { p->SetCropLeft(FArg(1)); COMMON_RETURN_SELF; } + static int croptop( T* p, lua_State *L ) { p->SetCropTop(FArg(1)); COMMON_RETURN_SELF; } + static int cropright( T* p, lua_State *L ) { p->SetCropRight(FArg(1)); COMMON_RETURN_SELF; } + static int cropbottom( T* p, lua_State *L ) { p->SetCropBottom(FArg(1)); COMMON_RETURN_SELF; } + static int fadeleft( T* p, lua_State *L ) { p->SetFadeLeft(FArg(1)); COMMON_RETURN_SELF; } + static int fadetop( T* p, lua_State *L ) { p->SetFadeTop(FArg(1)); COMMON_RETURN_SELF; } + static int faderight( T* p, lua_State *L ) { p->SetFadeRight(FArg(1)); COMMON_RETURN_SELF; } + static int fadebottom( T* p, lua_State *L ) { p->SetFadeBottom(FArg(1)); COMMON_RETURN_SELF; } + static int diffuse( T* p, lua_State *L ) { RageColor c; c.FromStackCompat( L, 1 ); p->SetDiffuse( c ); COMMON_RETURN_SELF; } + static int diffuseupperleft( T* p, lua_State *L ) { RageColor c; c.FromStackCompat( L, 1 ); p->SetDiffuseUpperLeft( c ); COMMON_RETURN_SELF; } + static int diffuseupperright( T* p, lua_State *L ) { RageColor c; c.FromStackCompat( L, 1 ); p->SetDiffuseUpperRight( c ); COMMON_RETURN_SELF; } + static int diffuselowerleft( T* p, lua_State *L ) { RageColor c; c.FromStackCompat( L, 1 ); p->SetDiffuseLowerLeft( c ); COMMON_RETURN_SELF; } + static int diffuselowerright( T* p, lua_State *L ) { RageColor c; c.FromStackCompat( L, 1 ); p->SetDiffuseLowerRight( c ); COMMON_RETURN_SELF; } + static int diffuseleftedge( T* p, lua_State *L ) { RageColor c; c.FromStackCompat( L, 1 ); p->SetDiffuseLeftEdge( c ); COMMON_RETURN_SELF; } + static int diffuserightedge( T* p, lua_State *L ) { RageColor c; c.FromStackCompat( L, 1 ); p->SetDiffuseRightEdge( c ); COMMON_RETURN_SELF; } + static int diffusetopedge( T* p, lua_State *L ) { RageColor c; c.FromStackCompat( L, 1 ); p->SetDiffuseTopEdge( c ); COMMON_RETURN_SELF; } + static int diffusebottomedge( T* p, lua_State *L ) { RageColor c; c.FromStackCompat( L, 1 ); p->SetDiffuseBottomEdge( c ); COMMON_RETURN_SELF; } + static int diffusealpha( T* p, lua_State *L ) { p->SetDiffuseAlpha(FArg(1)); COMMON_RETURN_SELF; } + static int diffusecolor( T* p, lua_State *L ) { RageColor c; c.FromStackCompat( L, 1 ); p->SetDiffuseColor( c ); COMMON_RETURN_SELF; } + static int glow( T* p, lua_State *L ) { RageColor c; c.FromStackCompat( L, 1 ); p->SetGlow( c ); COMMON_RETURN_SELF; } + static int aux( T* p, lua_State *L ) { p->SetAux( FArg(1) ); COMMON_RETURN_SELF; } static int getaux( T* p, lua_State *L ) { lua_pushnumber( L, p->GetAux() ); return 1; } - static int rotationx( T* p, lua_State *L ) { p->SetRotationX(FArg(1)); return 0; } - static int rotationy( T* p, lua_State *L ) { p->SetRotationY(FArg(1)); return 0; } - static int rotationz( T* p, lua_State *L ) { p->SetRotationZ(FArg(1)); return 0; } - static int addrotationx( T* p, lua_State *L ) { p->AddRotationX(FArg(1)); return 0; } - static int addrotationy( T* p, lua_State *L ) { p->AddRotationY(FArg(1)); return 0; } - static int addrotationz( T* p, lua_State *L ) { p->AddRotationZ(FArg(1)); return 0; } + static int rotationx( T* p, lua_State *L ) { p->SetRotationX(FArg(1)); COMMON_RETURN_SELF; } + static int rotationy( T* p, lua_State *L ) { p->SetRotationY(FArg(1)); COMMON_RETURN_SELF; } + static int rotationz( T* p, lua_State *L ) { p->SetRotationZ(FArg(1)); COMMON_RETURN_SELF; } + static int addrotationx( T* p, lua_State *L ) { p->AddRotationX(FArg(1)); COMMON_RETURN_SELF; } + static int addrotationy( T* p, lua_State *L ) { p->AddRotationY(FArg(1)); COMMON_RETURN_SELF; } + static int addrotationz( T* p, lua_State *L ) { p->AddRotationZ(FArg(1)); COMMON_RETURN_SELF; } static int getrotation( T* p, lua_State *L ) { lua_pushnumber(L, p->GetRotationX()); lua_pushnumber(L, p->GetRotationY()); lua_pushnumber(L, p->GetRotationZ()); return 3; } - static int baserotationx( T* p, lua_State *L ) { p->SetBaseRotationX(FArg(1)); return 0; } - static int baserotationy( T* p, lua_State *L ) { p->SetBaseRotationY(FArg(1)); return 0; } - static int baserotationz( T* p, lua_State *L ) { p->SetBaseRotationZ(FArg(1)); return 0; } - static int skewx( T* p, lua_State *L ) { p->SetSkewX(FArg(1)); return 0; } - static int skewy( T* p, lua_State *L ) { p->SetSkewY(FArg(1)); return 0; } - static int heading( T* p, lua_State *L ) { p->AddRotationH(FArg(1)); return 0; } - static int pitch( T* p, lua_State *L ) { p->AddRotationP(FArg(1)); return 0; } - static int roll( T* p, lua_State *L ) { p->AddRotationR(FArg(1)); return 0; } - static int shadowlength( T* p, lua_State *L ) { p->SetShadowLength(FArg(1)); return 0; } - static int shadowlengthx( T* p, lua_State *L ) { p->SetShadowLengthX(FArg(1)); return 0; } - static int shadowlengthy( T* p, lua_State *L ) { p->SetShadowLengthY(FArg(1)); return 0; } - static int shadowcolor( T* p, lua_State *L ) { RageColor c; c.FromStackCompat( L, 1 ); p->SetShadowColor( c ); return 0; } - static int horizalign( T* p, lua_State *L ) { p->SetHorizAlign(Enum::Check(L, 1)); return 0; } - static int vertalign( T* p, lua_State *L ) { p->SetVertAlign(Enum::Check(L, 1)); return 0; } - static int halign( T* p, lua_State *L ) { p->SetHorizAlign(FArg(1)); return 0; } - static int valign( T* p, lua_State *L ) { p->SetVertAlign(FArg(1)); return 0; } - static int diffuseblink( T* p, lua_State * ) { p->SetEffectDiffuseBlink(1.0f, RageColor(0.5f,0.5f,0.5f,0.5f), RageColor(1,1,1,1)); return 0; } - static int diffuseshift( T* p, lua_State * ) { p->SetEffectDiffuseShift(1.0f, RageColor(0,0,0,1), RageColor(1,1,1,1)); return 0; } - static int diffuseramp( T* p, lua_State * ) { p->SetEffectDiffuseRamp(1.0f, RageColor(0,0,0,1), RageColor(1,1,1,1)); return 0; } - static int glowblink( T* p, lua_State * ) { p->SetEffectGlowBlink(1.0f, RageColor(1,1,1,0.2f), RageColor(1,1,1,0.8f)); return 0; } - static int glowshift( T* p, lua_State * ) { p->SetEffectGlowShift(1.0f, RageColor(1,1,1,0.2f), RageColor(1,1,1,0.8f)); return 0; } - static int glowramp( T* p, lua_State * ) { p->SetEffectGlowRamp(1.0f, RageColor(1,1,1,0.2f), RageColor(1,1,1,0.8f)); return 0; } - static int rainbow( T* p, lua_State * ) { p->SetEffectRainbow(2.0f); return 0; } - static int wag( T* p, lua_State * ) { p->SetEffectWag(2.0f, RageVector3(0,0,20)); return 0; } - static int bounce( T* p, lua_State * ) { p->SetEffectBounce(2.0f, RageVector3(0,20,0)); return 0; } - static int bob( T* p, lua_State * ) { p->SetEffectBob(2.0f, RageVector3(0,20,0)); return 0; } - static int pulse( T* p, lua_State * ) { p->SetEffectPulse(2.0f, 0.5f, 1.0f); return 0; } - static int spin( T* p, lua_State * ) { p->SetEffectSpin(RageVector3(0,0,180)); return 0; } - static int vibrate( T* p, lua_State * ) { p->SetEffectVibrate(RageVector3(10,10,10)); return 0; } - static int stopeffect( T* p, lua_State * ) { p->StopEffect(); return 0; } - static int effectcolor1( T* p, lua_State *L ) { RageColor c; c.FromStackCompat( L, 1 ); p->SetEffectColor1( c ); return 0; } - static int effectcolor2( T* p, lua_State *L ) { RageColor c; c.FromStackCompat( L, 1 ); p->SetEffectColor2( c ); return 0; } + static int baserotationx( T* p, lua_State *L ) { p->SetBaseRotationX(FArg(1)); COMMON_RETURN_SELF; } + static int baserotationy( T* p, lua_State *L ) { p->SetBaseRotationY(FArg(1)); COMMON_RETURN_SELF; } + static int baserotationz( T* p, lua_State *L ) { p->SetBaseRotationZ(FArg(1)); COMMON_RETURN_SELF; } + static int skewx( T* p, lua_State *L ) { p->SetSkewX(FArg(1)); COMMON_RETURN_SELF; } + static int skewy( T* p, lua_State *L ) { p->SetSkewY(FArg(1)); COMMON_RETURN_SELF; } + static int heading( T* p, lua_State *L ) { p->AddRotationH(FArg(1)); COMMON_RETURN_SELF; } + static int pitch( T* p, lua_State *L ) { p->AddRotationP(FArg(1)); COMMON_RETURN_SELF; } + static int roll( T* p, lua_State *L ) { p->AddRotationR(FArg(1)); COMMON_RETURN_SELF; } + static int shadowlength( T* p, lua_State *L ) { p->SetShadowLength(FArg(1)); COMMON_RETURN_SELF; } + static int shadowlengthx( T* p, lua_State *L ) { p->SetShadowLengthX(FArg(1)); COMMON_RETURN_SELF; } + static int shadowlengthy( T* p, lua_State *L ) { p->SetShadowLengthY(FArg(1)); COMMON_RETURN_SELF; } + static int shadowcolor( T* p, lua_State *L ) { RageColor c; c.FromStackCompat( L, 1 ); p->SetShadowColor( c ); COMMON_RETURN_SELF; } + static int horizalign( T* p, lua_State *L ) { p->SetHorizAlign(Enum::Check(L, 1)); COMMON_RETURN_SELF; } + static int vertalign( T* p, lua_State *L ) { p->SetVertAlign(Enum::Check(L, 1)); COMMON_RETURN_SELF; } + static int halign( T* p, lua_State *L ) { p->SetHorizAlign(FArg(1)); COMMON_RETURN_SELF; } + static int valign( T* p, lua_State *L ) { p->SetVertAlign(FArg(1)); COMMON_RETURN_SELF; } + static int diffuseblink( T* p, lua_State *L ) { p->SetEffectDiffuseBlink(1.0f, RageColor(0.5f,0.5f,0.5f,0.5f), RageColor(1,1,1,1)); COMMON_RETURN_SELF; } + static int diffuseshift( T* p, lua_State *L ) { p->SetEffectDiffuseShift(1.0f, RageColor(0,0,0,1), RageColor(1,1,1,1)); COMMON_RETURN_SELF; } + static int diffuseramp( T* p, lua_State *L ) { p->SetEffectDiffuseRamp(1.0f, RageColor(0,0,0,1), RageColor(1,1,1,1)); COMMON_RETURN_SELF; } + static int glowblink( T* p, lua_State *L ) { p->SetEffectGlowBlink(1.0f, RageColor(1,1,1,0.2f), RageColor(1,1,1,0.8f)); COMMON_RETURN_SELF; } + static int glowshift( T* p, lua_State *L ) { p->SetEffectGlowShift(1.0f, RageColor(1,1,1,0.2f), RageColor(1,1,1,0.8f)); COMMON_RETURN_SELF; } + static int glowramp( T* p, lua_State *L ) { p->SetEffectGlowRamp(1.0f, RageColor(1,1,1,0.2f), RageColor(1,1,1,0.8f)); COMMON_RETURN_SELF; } + static int rainbow( T* p, lua_State *L ) { p->SetEffectRainbow(2.0f); COMMON_RETURN_SELF; } + static int wag( T* p, lua_State *L ) { p->SetEffectWag(2.0f, RageVector3(0,0,20)); COMMON_RETURN_SELF; } + static int bounce( T* p, lua_State *L ) { p->SetEffectBounce(2.0f, RageVector3(0,20,0)); COMMON_RETURN_SELF; } + static int bob( T* p, lua_State *L ) { p->SetEffectBob(2.0f, RageVector3(0,20,0)); COMMON_RETURN_SELF; } + static int pulse( T* p, lua_State *L ) { p->SetEffectPulse(2.0f, 0.5f, 1.0f); COMMON_RETURN_SELF; } + static int spin( T* p, lua_State *L ) { p->SetEffectSpin(RageVector3(0,0,180)); COMMON_RETURN_SELF; } + static int vibrate( T* p, lua_State *L ) { p->SetEffectVibrate(RageVector3(10,10,10)); COMMON_RETURN_SELF; } + static int stopeffect( T* p, lua_State *L ) { p->StopEffect(); COMMON_RETURN_SELF; } + static int effectcolor1( T* p, lua_State *L ) { RageColor c; c.FromStackCompat( L, 1 ); p->SetEffectColor1( c ); COMMON_RETURN_SELF; } + static int effectcolor2( T* p, lua_State *L ) { RageColor c; c.FromStackCompat( L, 1 ); p->SetEffectColor2( c ); COMMON_RETURN_SELF; } static int effectperiod( T* p, lua_State *L ) { float fPeriod = FArg(1); if (fPeriod <= 0) { LuaHelpers::ReportScriptErrorFmt("Effect period (%f) must be positive; ignoring", fPeriod); - return 0; + COMMON_RETURN_SELF; } p->SetEffectPeriod(FArg(1)); - return 0; + COMMON_RETURN_SELF; } static int effecttiming( T* p, lua_State *L ) { @@ -1579,42 +1579,42 @@ public: { LuaHelpers::ReportScriptErrorFmt("Effect timings (%f,%f,%f,%f) must not be negative; ignoring", f1, f2, f3, f4); - return 0; + COMMON_RETURN_SELF; } if (f1 == 0 && f2 == 0 && f3 == 0 && f4 == 0) { LuaHelpers::ReportScriptErrorFmt("Effect timings (0,0,0,0) must not all be zero; ignoring"); - return 0; + COMMON_RETURN_SELF; } p->SetEffectTiming(FArg(1), FArg(2), FArg(3), FArg(4)); - return 0; + COMMON_RETURN_SELF; } - static int effectoffset( T* p, lua_State *L ) { p->SetEffectOffset(FArg(1)); return 0; } - static int effectclock( T* p, lua_State *L ) { p->SetEffectClockString(SArg(1)); return 0; } - static int effectmagnitude( T* p, lua_State *L ) { p->SetEffectMagnitude( RageVector3(FArg(1),FArg(2),FArg(3)) ); return 0; } + static int effectoffset( T* p, lua_State *L ) { p->SetEffectOffset(FArg(1)); COMMON_RETURN_SELF; } + static int effectclock( T* p, lua_State *L ) { p->SetEffectClockString(SArg(1)); COMMON_RETURN_SELF; } + static int effectmagnitude( T* p, lua_State *L ) { p->SetEffectMagnitude( RageVector3(FArg(1),FArg(2),FArg(3)) ); COMMON_RETURN_SELF; } static int geteffectmagnitude( T* p, lua_State *L ) { RageVector3 v = p->GetEffectMagnitude(); lua_pushnumber(L, v[0]); lua_pushnumber(L, v[1]); lua_pushnumber(L, v[2]); return 3; } - static int scaletocover( T* p, lua_State *L ) { p->ScaleToCover( RectF(FArg(1), FArg(2), FArg(3), FArg(4)) ); return 0; } - static int scaletofit( T* p, lua_State *L ) { p->ScaleToFitInside( RectF(FArg(1), FArg(2), FArg(3), FArg(4)) ); return 0; } - static int animate( T* p, lua_State *L ) { p->EnableAnimation(BIArg(1)); return 0; } - static int play( T* p, lua_State * ) { p->EnableAnimation(true); return 0; } - static int pause( T* p, lua_State * ) { p->EnableAnimation(false); return 0; } - static int setstate( T* p, lua_State *L ) { p->SetState(IArg(1)); return 0; } + static int scaletocover( T* p, lua_State *L ) { p->ScaleToCover( RectF(FArg(1), FArg(2), FArg(3), FArg(4)) ); COMMON_RETURN_SELF; } + static int scaletofit( T* p, lua_State *L ) { p->ScaleToFitInside( RectF(FArg(1), FArg(2), FArg(3), FArg(4)) ); COMMON_RETURN_SELF; } + static int animate( T* p, lua_State *L ) { p->EnableAnimation(BIArg(1)); COMMON_RETURN_SELF; } + static int play( T* p, lua_State *L ) { p->EnableAnimation(true); COMMON_RETURN_SELF; } + static int pause( T* p, lua_State *L ) { p->EnableAnimation(false); COMMON_RETURN_SELF; } + static int setstate( T* p, lua_State *L ) { p->SetState(IArg(1)); COMMON_RETURN_SELF; } static int GetNumStates( T* p, lua_State *L ) { LuaHelpers::Push( L, p->GetNumStates() ); return 1; } - static int texturetranslate( T* p, lua_State *L ) { p->SetTextureTranslate(FArg(1),FArg(2)); return 0; } - static int texturewrapping( T* p, lua_State *L ) { p->SetTextureWrapping(BIArg(1)); return 0; } - static int SetTextureFiltering( T* p, lua_State *L ) { p->SetTextureFiltering(BArg(1)); return 0; } - static int blend( T* p, lua_State *L ) { p->SetBlendMode( Enum::Check(L, 1) ); return 0; } - static int zbuffer( T* p, lua_State *L ) { p->SetUseZBuffer(BIArg(1)); return 0; } - static int ztest( T* p, lua_State *L ) { p->SetZTestMode((BIArg(1))?ZTEST_WRITE_ON_PASS:ZTEST_OFF); return 0; } - static int ztestmode( T* p, lua_State *L ) { p->SetZTestMode( Enum::Check(L, 1) ); return 0; } - static int zwrite( T* p, lua_State *L ) { p->SetZWrite(BIArg(1)); return 0; } - static int zbias( T* p, lua_State *L ) { p->SetZBias(FArg(1)); return 0; } - static int clearzbuffer( T* p, lua_State *L ) { p->SetClearZBuffer(BIArg(1)); return 0; } - static int backfacecull( T* p, lua_State *L ) { p->SetCullMode((BIArg(1)) ? CULL_BACK : CULL_NONE); return 0; } - static int cullmode( T* p, lua_State *L ) { p->SetCullMode( Enum::Check(L, 1)); return 0; } - static int visible( T* p, lua_State *L ) { p->SetVisible(BIArg(1)); return 0; } - static int hibernate( T* p, lua_State *L ) { p->SetHibernate(FArg(1)); return 0; } - static int draworder( T* p, lua_State *L ) { p->SetDrawOrder(IArg(1)); return 0; } + static int texturetranslate( T* p, lua_State *L ) { p->SetTextureTranslate(FArg(1),FArg(2)); COMMON_RETURN_SELF; } + static int texturewrapping( T* p, lua_State *L ) { p->SetTextureWrapping(BIArg(1)); COMMON_RETURN_SELF; } + static int SetTextureFiltering( T* p, lua_State *L ) { p->SetTextureFiltering(BArg(1)); COMMON_RETURN_SELF; } + static int blend( T* p, lua_State *L ) { p->SetBlendMode( Enum::Check(L, 1) ); COMMON_RETURN_SELF; } + static int zbuffer( T* p, lua_State *L ) { p->SetUseZBuffer(BIArg(1)); COMMON_RETURN_SELF; } + static int ztest( T* p, lua_State *L ) { p->SetZTestMode((BIArg(1))?ZTEST_WRITE_ON_PASS:ZTEST_OFF); COMMON_RETURN_SELF; } + static int ztestmode( T* p, lua_State *L ) { p->SetZTestMode( Enum::Check(L, 1) ); COMMON_RETURN_SELF; } + static int zwrite( T* p, lua_State *L ) { p->SetZWrite(BIArg(1)); COMMON_RETURN_SELF; } + static int zbias( T* p, lua_State *L ) { p->SetZBias(FArg(1)); COMMON_RETURN_SELF; } + static int clearzbuffer( T* p, lua_State *L ) { p->SetClearZBuffer(BIArg(1)); COMMON_RETURN_SELF; } + static int backfacecull( T* p, lua_State *L ) { p->SetCullMode((BIArg(1)) ? CULL_BACK : CULL_NONE); COMMON_RETURN_SELF; } + static int cullmode( T* p, lua_State *L ) { p->SetCullMode( Enum::Check(L, 1)); COMMON_RETURN_SELF; } + static int visible( T* p, lua_State *L ) { p->SetVisible(BIArg(1)); COMMON_RETURN_SELF; } + static int hibernate( T* p, lua_State *L ) { p->SetHibernate(FArg(1)); COMMON_RETURN_SELF; } + static int draworder( T* p, lua_State *L ) { p->SetDrawOrder(IArg(1)); COMMON_RETURN_SELF; } static int playcommand( T* p, lua_State *L ) { if( !lua_istable(L, 2) && !lua_isnoneornil(L, 2) ) @@ -1627,16 +1627,16 @@ public: Message msg( SArg(1), ParamTable ); p->HandleMessage( msg ); - return 0; + COMMON_RETURN_SELF; } - static int queuecommand( T* p, lua_State *L ) { p->QueueCommand(SArg(1)); return 0; } - static int queuemessage( T* p, lua_State *L ) { p->QueueMessage(SArg(1)); return 0; } + static int queuecommand( T* p, lua_State *L ) { p->QueueCommand(SArg(1)); COMMON_RETURN_SELF; } + static int queuemessage( T* p, lua_State *L ) { p->QueueMessage(SArg(1)); COMMON_RETURN_SELF; } static int addcommand( T* p, lua_State *L ) { LuaReference *pRef = new LuaReference; pRef->SetFromStack( L ); p->AddCommand( SArg(1), apActorCommands(pRef) ); - return 0; + COMMON_RETURN_SELF; } static int GetCommand( T* p, lua_State *L ) { @@ -1663,7 +1663,7 @@ public: ParamTable.SetFromStack( L ); p->RunCommandsRecursively( ref, &ParamTable ); - return 0; + COMMON_RETURN_SELF; } static int GetX( T* p, lua_State *L ) { lua_pushnumber( L, p->GetX() ); return 1; } @@ -1710,7 +1710,7 @@ public: LUA->YieldLua(); p->Draw(); LUA->UnyieldLua(); - return 0; + COMMON_RETURN_SELF; } LunaActor() diff --git a/src/ActorFrame.cpp b/src/ActorFrame.cpp index a747ef73e4..48b6aeaa71 100644 --- a/src/ActorFrame.cpp +++ b/src/ActorFrame.cpp @@ -591,8 +591,8 @@ void ActorFrame::SetDrawByZPosition( bool b ) class LunaActorFrame : public Luna { public: - static int playcommandonchildren( T* p, lua_State *L ) { p->PlayCommandOnChildren(SArg(1)); return 0; } - static int playcommandonleaves( T* p, lua_State *L ) { p->PlayCommandOnLeaves(SArg(1)); return 0; } + static int playcommandonchildren( T* p, lua_State *L ) { p->PlayCommandOnChildren(SArg(1)); COMMON_RETURN_SELF; } + static int playcommandonleaves( T* p, lua_State *L ) { p->PlayCommandOnLeaves(SArg(1)); COMMON_RETURN_SELF; } static int runcommandsonleaves( T* p, lua_State *L ) { luaL_checktype( L, 1, LUA_TFUNCTION ); @@ -600,7 +600,7 @@ public: cmds.SetFromStack( L ); p->RunCommandsOnLeaves( cmds ); - return 0; + COMMON_RETURN_SELF; } static int RunCommandsOnChildren( T* p, lua_State *L ) { @@ -614,13 +614,13 @@ public: cmds.SetFromStack( L ); p->RunCommandsOnChildren( cmds, &ParamTable ); - return 0; + COMMON_RETURN_SELF; } - static int propagate( T* p, lua_State *L ) { p->SetPropagateCommands( BIArg(1) ); return 0; } - static int fov( T* p, lua_State *L ) { p->SetFOV( FArg(1) ); return 0; } - static int SetUpdateRate( T* p, lua_State *L ) { p->SetUpdateRate( FArg(1) ); return 0; } - static int SetFOV( T* p, lua_State *L ) { p->SetFOV( FArg(1) ); return 0; } - static int vanishpoint( T* p, lua_State *L ) { p->SetVanishPoint( FArg(1), FArg(2) ); return 0; } + static int propagate( T* p, lua_State *L ) { p->SetPropagateCommands( BIArg(1) ); COMMON_RETURN_SELF; } + static int fov( T* p, lua_State *L ) { p->SetFOV( FArg(1) ); COMMON_RETURN_SELF; } + static int SetUpdateRate( T* p, lua_State *L ) { p->SetUpdateRate( FArg(1) ); COMMON_RETURN_SELF; } + static int SetFOV( T* p, lua_State *L ) { p->SetFOV( FArg(1) ); COMMON_RETURN_SELF; } + static int vanishpoint( T* p, lua_State *L ) { p->SetVanishPoint( FArg(1), FArg(2) ); COMMON_RETURN_SELF; } static int GetChild( T* p, lua_State *L ) { p->PushChildTable(L, SArg(1)); @@ -641,7 +641,7 @@ public: lua_pushnil( L ); ref.SetFromStack( L ); p->SetDrawFunction( ref ); - return 0; + COMMON_RETURN_SELF; } luaL_checktype( L, 1, LUA_TFUNCTION ); @@ -650,7 +650,7 @@ public: lua_pushvalue( L, 1 ); ref.SetFromStack( L ); p->SetDrawFunction( ref ); - return 0; + COMMON_RETURN_SELF; } static int GetDrawFunction( T* p, lua_State *L ) { @@ -665,7 +665,7 @@ public: lua_pushnil( L ); ref.SetFromStack( L ); p->SetUpdateFunction( ref ); - return 0; + COMMON_RETURN_SELF; } luaL_checktype( L, 1, LUA_TFUNCTION ); @@ -674,14 +674,14 @@ public: lua_pushvalue( L, 1 ); ref.SetFromStack( L ); p->SetUpdateFunction( ref ); - return 0; + COMMON_RETURN_SELF; } - static int SortByDrawOrder( T* p, lua_State *L ) { p->SortByDrawOrder(); return 0; } + static int SortByDrawOrder( T* p, lua_State *L ) { p->SortByDrawOrder(); COMMON_RETURN_SELF; } - //static int CustomLighting( T* p, lua_State *L ) { p->SetCustomLighting(BArg(1)); return 0; } - static int SetAmbientLightColor( T* p, lua_State *L ) { RageColor c; c.FromStackCompat( L, 1 ); p->SetAmbientLightColor( c ); return 0; } - static int SetDiffuseLightColor( T* p, lua_State *L ) { RageColor c; c.FromStackCompat( L, 1 ); p->SetDiffuseLightColor( c ); return 0; } - static int SetSpecularLightColor( T* p, lua_State *L ) { RageColor c; c.FromStackCompat( L, 1 ); p->SetSpecularLightColor( c ); return 0; } + //static int CustomLighting( T* p, lua_State *L ) { p->SetCustomLighting(BArg(1)); COMMON_RETURN_SELF; } + static int SetAmbientLightColor( T* p, lua_State *L ) { RageColor c; c.FromStackCompat( L, 1 ); p->SetAmbientLightColor( c ); COMMON_RETURN_SELF; } + static int SetDiffuseLightColor( T* p, lua_State *L ) { RageColor c; c.FromStackCompat( L, 1 ); p->SetDiffuseLightColor( c ); COMMON_RETURN_SELF; } + static int SetSpecularLightColor( T* p, lua_State *L ) { RageColor c; c.FromStackCompat( L, 1 ); p->SetSpecularLightColor( c ); COMMON_RETURN_SELF; } static int SetLightDirection( T* p, lua_State *L ) { luaL_checktype( L, 1, LUA_TTABLE ); @@ -695,7 +695,7 @@ public: } RageVector3 vTmp = RageVector3( coords[0], coords[1], coords[2] ); p->SetLightDirection( vTmp ); - return 0; + COMMON_RETURN_SELF; } static int AddChildFromPath( T* p, lua_State *L ) @@ -721,7 +721,7 @@ public: lua_pushnil( L ); return 1; } - static int RemoveAllChildren( T* p, lua_State *L ) { p->RemoveAllChildren( ); return 0; } + static int RemoveAllChildren( T* p, lua_State *L ) { p->RemoveAllChildren( ); COMMON_RETURN_SELF; } LunaActorFrame() { diff --git a/src/ActorFrameTexture.cpp b/src/ActorFrameTexture.cpp index 599422114b..cbaf39c498 100644 --- a/src/ActorFrameTexture.cpp +++ b/src/ActorFrameTexture.cpp @@ -77,18 +77,23 @@ void ActorFrameTexture::DrawPrimitives() class LunaActorFrameTexture : public Luna { public: - static int Create( T* p, lua_State * ) { p->Create(); return 0; } - static int EnableDepthBuffer( T* p, lua_State *L ) { p->EnableDepthBuffer(BArg(1)); return 0; } - static int EnableAlphaBuffer( T* p, lua_State *L ) { p->EnableAlphaBuffer(BArg(1)); return 0; } - static int EnableFloat( T* p, lua_State *L ) { p->EnableFloat(BArg(1)); return 0; } - static int EnablePreserveTexture( T* p, lua_State *L ) { p->EnablePreserveTexture(BArg(1)); return 0; } - static int SetTextureName( T* p, lua_State *L ) { p->SetTextureName(SArg(1)); return 0; } + static int Create( T* p, lua_State *L ) { p->Create(); COMMON_RETURN_SELF; } + static int EnableDepthBuffer( T* p, lua_State *L ) { p->EnableDepthBuffer(BArg(1)); COMMON_RETURN_SELF; } + static int EnableAlphaBuffer( T* p, lua_State *L ) { p->EnableAlphaBuffer(BArg(1)); COMMON_RETURN_SELF; } + static int EnableFloat( T* p, lua_State *L ) { p->EnableFloat(BArg(1)); COMMON_RETURN_SELF; } + static int EnablePreserveTexture( T* p, lua_State *L ) { p->EnablePreserveTexture(BArg(1)); COMMON_RETURN_SELF; } + static int SetTextureName( T* p, lua_State *L ) { p->SetTextureName(SArg(1)); COMMON_RETURN_SELF; } static int GetTexture( T* p, lua_State *L ) { RageTexture *pTexture = p->GetTexture(); if( pTexture == NULL ) - return 0; - pTexture->PushSelf(L); + { + lua_pushnil(L); + } + else + { + pTexture->PushSelf(L); + } return 1; } diff --git a/src/ActorMultiTexture.cpp b/src/ActorMultiTexture.cpp index d441a48f9c..01e4e2d958 100644 --- a/src/ActorMultiTexture.cpp +++ b/src/ActorMultiTexture.cpp @@ -149,7 +149,7 @@ public: static int ClearTextures( T* p, lua_State *L ) { p->ClearTextures(); - return 0; + COMMON_RETURN_SELF; } static int AddTexture( T* p, lua_State *L ) { @@ -163,24 +163,24 @@ public: int iIndex = IArg(1); TextureMode tm = Enum::Check(L, 2); p->SetTextureMode( iIndex, tm ); - return 0; + COMMON_RETURN_SELF; } static int SetTextureCoords( T* p, lua_State *L ) { p->SetTextureCoords( RectF(FArg(1), FArg(2), FArg(3), FArg(4)) ); - return 0; + COMMON_RETURN_SELF; } static int SetSizeFromTexture( T* p, lua_State *L ) { RageTexture *pTexture = Luna::check(L, 1); p->SetSizeFromTexture( pTexture ); - return 0; + COMMON_RETURN_SELF; } static int SetEffectMode( T* p, lua_State *L ) { EffectMode em = Enum::Check(L, 1); p->SetEffectMode( em ); - return 0; + COMMON_RETURN_SELF; } LunaActorMultiTexture() diff --git a/src/ActorMultiVertex.cpp b/src/ActorMultiVertex.cpp index 0470c5ba25..c569eb3d7a 100644 --- a/src/ActorMultiVertex.cpp +++ b/src/ActorMultiVertex.cpp @@ -407,7 +407,7 @@ public: static int SetNumVertices( T* p, lua_State *L ) { p->SetNumVertices( IArg(1) ); - return 0; + COMMON_RETURN_SELF; } static int GetNumVertices( T* p, lua_State *L ) { lua_pushnumber( L, p->GetNumVertices() ); return 1; } @@ -478,7 +478,7 @@ public: if( Index < 0 ) { LuaHelpers::ReportScriptErrorFmt( "ActorMultiVertex::SetVertex: index %d provided, cannot set Index < 1", Index+1 ); - return 0; + COMMON_RETURN_SELF; } else if( Index == (int) p->GetNumVertices() ) { @@ -487,10 +487,10 @@ public: else if( Index > (int) p->GetNumVertices() ) { LuaHelpers::ReportScriptErrorFmt( "ActorMultiVertex::SetVertex: Cannot set vertex %d if there is no vertex %d, only %u vertices.", Index+1 , Index, (unsigned int)p->GetNumVertices() ); - return 0; + COMMON_RETURN_SELF; } SetVertexFromStack(p, L, Index, lua_gettop(L)); - return 0; + COMMON_RETURN_SELF; } static int SetVertices(T* p, lua_State* L) @@ -505,7 +505,7 @@ public: if( First < 0 ) { LuaHelpers::ReportScriptErrorFmt( "ActorMultiVertex::SetVertices: index %d provided, cannot set Index < 1", First+1 ); - return 0; + COMMON_RETURN_SELF; } } int Last = First + lua_objlen(L, StackIndex ); @@ -520,21 +520,21 @@ public: SetVertexFromStack(p, L, n, lua_gettop(L)); lua_pop(L, 1); } - return 0; + COMMON_RETURN_SELF; } static int SetEffectMode( T* p, lua_State *L ) { EffectMode em = Enum::Check(L, 1); p->SetEffectMode( em ); - return 0; + COMMON_RETURN_SELF; } static int SetTextureMode( T* p, lua_State *L ) { TextureMode tm = Enum::Check(L, 1); p->SetTextureMode( tm ); - return 0; + COMMON_RETURN_SELF; } static int SetLineWidth( T* p, lua_State *L ) @@ -543,10 +543,10 @@ public: if( Width < 0 ) { LuaHelpers::ReportScriptErrorFmt( "ActorMultiVertex::SetLineWidth: cannot set negative width." ); - return 0; + COMMON_RETURN_SELF; } p->SetLineWidth(Width); - return 0; + COMMON_RETURN_SELF; } static int SetDrawState( T* p, lua_State* L ) @@ -558,7 +558,7 @@ public: if( !lua_istable(L, ArgsIndex) ) { LuaHelpers::ReportScriptErrorFmt( "ActorMultiVertex:SetDrawState: Table expected, something else recieved. Doing nothing."); - return 0; + COMMON_RETURN_SELF; } // Fetch the draw mode, if provided. lua_getfield(L, ArgsIndex, "Mode"); @@ -583,7 +583,7 @@ public: } lua_pop(L, 1); p->SetDrawState(dm, first, num); - return 0; + COMMON_RETURN_SELF; } static int GetDestDrawMode( T* p, lua_State* L ) @@ -635,7 +635,7 @@ public: RageTextureID ID( SArg(1) ); p->LoadFromTexture( ID ); } - return 0; + COMMON_RETURN_SELF; } static int SetTexture( T* p, lua_State *L ) @@ -643,7 +643,7 @@ public: RageTexture *Texture = Luna::check(L, 1); Texture = TEXTUREMAN->CopyTexture( Texture ); p->SetTexture( Texture ); - return 0; + COMMON_RETURN_SELF; } static int GetTexture(T* p, lua_State *L) { diff --git a/src/ActorProxy.cpp b/src/ActorProxy.cpp index 92f721f9b9..1b23e7e912 100644 --- a/src/ActorProxy.cpp +++ b/src/ActorProxy.cpp @@ -41,7 +41,7 @@ public: { Actor *pTarget = Luna::check( L, 1 ); p->SetTarget( pTarget ); - return 0; + COMMON_RETURN_SELF; } static int GetTarget( T* p, lua_State *L ) diff --git a/src/ActorScroller.cpp b/src/ActorScroller.cpp index 94919040e4..87730ed89d 100644 --- a/src/ActorScroller.cpp +++ b/src/ActorScroller.cpp @@ -324,32 +324,32 @@ void ActorScroller::PositionItemsAndDrawPrimitives( bool bDrawPrimitives ) class LunaActorScroller: public Luna { public: - static int PositionItems( T* p, lua_State *L ) { p->PositionItems(); return 0; } + static int PositionItems( T* p, lua_State *L ) { p->PositionItems(); COMMON_RETURN_SELF; } static int SetTransformFromFunction( T* p, lua_State *L ) { LuaReference ref; LuaHelpers::FromStack( L, ref, 1 ); p->SetTransformFromReference( ref ); - return 0; + COMMON_RETURN_SELF; } - static int SetTransformFromHeight( T* p, lua_State *L ) { p->SetTransformFromHeight(FArg(1)); return 0; } - static int SetTransformFromWidth( T* p, lua_State *L ) { p->SetTransformFromWidth(FArg(1)); return 0; } - static int SetCurrentAndDestinationItem( T* p, lua_State *L ) { p->SetCurrentAndDestinationItem( FArg(1) ); return 0; } - static int SetDestinationItem( T* p, lua_State *L ) { p->SetDestinationItem( FArg(1) ); return 0; } + static int SetTransformFromHeight( T* p, lua_State *L ) { p->SetTransformFromHeight(FArg(1)); COMMON_RETURN_SELF; } + static int SetTransformFromWidth( T* p, lua_State *L ) { p->SetTransformFromWidth(FArg(1)); COMMON_RETURN_SELF; } + static int SetCurrentAndDestinationItem( T* p, lua_State *L ) { p->SetCurrentAndDestinationItem( FArg(1) ); COMMON_RETURN_SELF; } + static int SetDestinationItem( T* p, lua_State *L ) { p->SetDestinationItem( FArg(1) ); COMMON_RETURN_SELF; } static int GetSecondsToDestination( T* p, lua_State *L ) { lua_pushnumber( L, p->GetSecondsToDestination() ); return 1; } - static int SetSecondsPerItem( T* p, lua_State *L ) { p->SetSecondsPerItem(FArg(1)); return 0; } + static int SetSecondsPerItem( T* p, lua_State *L ) { p->SetSecondsPerItem(FArg(1)); COMMON_RETURN_SELF; } static int GetSecondsPauseBetweenItems( T* p, lua_State *L ) { lua_pushnumber( L, p->GetSecondsPauseBetweenItems() ); return 1; } - static int SetSecondsPauseBetweenItems( T* p, lua_State *L ) { p->SetSecondsPauseBetweenItems(FArg(1)); return 0; } - static int SetPauseCountdownSeconds( T* p, lua_State *L ) { p->SetPauseCountdownSeconds(FArg(1)); return 0; } - static int SetNumSubdivisions( T* p, lua_State *L ) { p->SetNumSubdivisions(IArg(1)); return 0; } - static int ScrollThroughAllItems( T* p, lua_State *L ) { p->ScrollThroughAllItems(); return 0; } - static int ScrollWithPadding( T* p, lua_State *L ) { p->ScrollWithPadding(FArg(1),FArg(2)); return 0; } - static int SetFastCatchup( T* p, lua_State *L ) { p->SetFastCatchup(BArg(1)); return 0; } - static int SetLoop( T* p, lua_State *L ) { p->SetLoop(BArg(1)); return 0; } - static int SetWrap( T* p, lua_State *L ) { p->SetWrap(BArg(1)); return 0; } - static int SetMask( T* p, lua_State *L ) { p->EnableMask(FArg(1), FArg(2)); return 0; } + static int SetSecondsPauseBetweenItems( T* p, lua_State *L ) { p->SetSecondsPauseBetweenItems(FArg(1)); COMMON_RETURN_SELF; } + static int SetPauseCountdownSeconds( T* p, lua_State *L ) { p->SetPauseCountdownSeconds(FArg(1)); COMMON_RETURN_SELF; } + static int SetNumSubdivisions( T* p, lua_State *L ) { p->SetNumSubdivisions(IArg(1)); COMMON_RETURN_SELF; } + static int ScrollThroughAllItems( T* p, lua_State *L ) { p->ScrollThroughAllItems(); COMMON_RETURN_SELF; } + static int ScrollWithPadding( T* p, lua_State *L ) { p->ScrollWithPadding(FArg(1),FArg(2)); COMMON_RETURN_SELF; } + static int SetFastCatchup( T* p, lua_State *L ) { p->SetFastCatchup(BArg(1)); COMMON_RETURN_SELF; } + static int SetLoop( T* p, lua_State *L ) { p->SetLoop(BArg(1)); COMMON_RETURN_SELF; } + static int SetWrap( T* p, lua_State *L ) { p->SetWrap(BArg(1)); COMMON_RETURN_SELF; } + static int SetMask( T* p, lua_State *L ) { p->EnableMask(FArg(1), FArg(2)); COMMON_RETURN_SELF; } - static int SetNumItemsToDraw( T* p, lua_State *L ) { p->SetNumItemsToDraw(FArg(1)); return 0; } + static int SetNumItemsToDraw( T* p, lua_State *L ) { p->SetNumItemsToDraw(FArg(1)); COMMON_RETURN_SELF; } static int GetFullScrollLengthSeconds( T* p, lua_State *L ) { lua_pushnumber( L, p->GetSecondsForCompleteScrollThrough() ); return 1; } static int GetCurrentItem( T* p, lua_State *L ) { lua_pushnumber( L, p->GetCurrentItem() ); return 1; } static int GetDestinationItem( T* p, lua_State *L ) { lua_pushnumber( L, p->GetDestinationItem() ); return 1; } diff --git a/src/ActorSound.cpp b/src/ActorSound.cpp index ab9c09cb05..c83605e1a9 100644 --- a/src/ActorSound.cpp +++ b/src/ActorSound.cpp @@ -50,10 +50,10 @@ void ActorSound::LoadFromNode( const XNode* pNode ) class LunaActorSound: public Luna { public: - static int load( T* p, lua_State *L ) { p->Load(SArg(1)); return 0; } - static int play( T* p, lua_State *L ) { p->Play(); return 0; } - static int pause( T* p, lua_State *L ) { p->Pause(BArg(1)); return 0; } - static int stop( T* p, lua_State *L ) { p->Stop(); return 0; } + static int load( T* p, lua_State *L ) { p->Load(SArg(1)); COMMON_RETURN_SELF; } + static int play( T* p, lua_State *L ) { p->Play(); COMMON_RETURN_SELF; } + static int pause( T* p, lua_State *L ) { p->Pause(BArg(1)); COMMON_RETURN_SELF; } + static int stop( T* p, lua_State *L ) { p->Stop(); COMMON_RETURN_SELF; } static int get( T* p, lua_State *L ) { p->PushSound( L ); return 1; } LunaActorSound() diff --git a/src/AnnouncerManager.cpp b/src/AnnouncerManager.cpp index 1c815f79eb..ab6e9ff17b 100644 --- a/src/AnnouncerManager.cpp +++ b/src/AnnouncerManager.cpp @@ -195,8 +195,13 @@ public: { RString s = p->GetCurAnnouncerName(); if( s.empty() ) - return 0; - lua_pushstring(L, s ); + { + lua_pushnil(L); + } + else + { + lua_pushstring(L, s ); + } return 1; } static int SetCurrentAnnouncer( T* p, lua_State *L ) @@ -205,7 +210,7 @@ public: // only bother switching if the announcer exists. -aj if(p->DoesAnnouncerExist(s)) p->SwitchAnnouncer(s); - return 0; + COMMON_RETURN_SELF; } LunaAnnouncerManager() diff --git a/src/BPMDisplay.cpp b/src/BPMDisplay.cpp index c2e29c99d8..3e138d9155 100644 --- a/src/BPMDisplay.cpp +++ b/src/BPMDisplay.cpp @@ -307,7 +307,7 @@ REGISTER_ACTOR_CLASS( SongBPMDisplay ); class LunaBPMDisplay: public Luna { public: - static int SetFromGameState( T* p, lua_State *L ) { p->SetFromGameState(); return 0; } + static int SetFromGameState( T* p, lua_State *L ) { p->SetFromGameState(); COMMON_RETURN_SELF; } static int SetFromSong( T* p, lua_State *L ) { if( lua_isnil(L,1) ) { p->NoBPM(); } @@ -316,7 +316,7 @@ public: const Song* pSong = Luna::check( L, 1, true ); p->SetBpmFromSong(pSong); } - return 0; + COMMON_RETURN_SELF; } static int SetFromSteps( T* p, lua_State *L ) { @@ -326,7 +326,7 @@ public: const Steps* pSteps = Luna::check( L, 1, true ); p->SetBpmFromSteps(pSteps); } - return 0; + COMMON_RETURN_SELF; } static int SetFromCourse( T* p, lua_State *L ) { @@ -336,7 +336,7 @@ public: const Course* pCourse = Luna::check( L, 1, true ); p->SetBpmFromCourse(pCourse); } - return 0; + COMMON_RETURN_SELF; } static int GetText( T* p, lua_State *L ) { lua_pushstring( L, p->GetText() ); return 1; } diff --git a/src/Banner.cpp b/src/Banner.cpp index 1695d27455..0e7ff1b8de 100644 --- a/src/Banner.cpp +++ b/src/Banner.cpp @@ -244,53 +244,53 @@ void Banner::LoadFromSortOrder( SortOrder so ) class LunaBanner: public Luna { public: - static int scaletoclipped( T* p, lua_State *L ) { p->ScaleToClipped(FArg(1),FArg(2)); return 0; } - static int ScaleToClipped( T* p, lua_State *L ) { p->ScaleToClipped(FArg(1),FArg(2)); return 0; } + static int scaletoclipped( T* p, lua_State *L ) { p->ScaleToClipped(FArg(1),FArg(2)); COMMON_RETURN_SELF; } + static int ScaleToClipped( T* p, lua_State *L ) { p->ScaleToClipped(FArg(1),FArg(2)); COMMON_RETURN_SELF; } static int LoadFromSong( T* p, lua_State *L ) { if( lua_isnil(L,1) ) { p->LoadFromSong( NULL ); } else { Song *pS = Luna::check(L,1); p->LoadFromSong( pS ); } - return 0; + COMMON_RETURN_SELF; } static int LoadFromCourse( T* p, lua_State *L ) { if( lua_isnil(L,1) ) { p->LoadFromCourse( NULL ); } else { Course *pC = Luna::check(L,1); p->LoadFromCourse( pC ); } - return 0; + COMMON_RETURN_SELF; } static int LoadFromCachedBanner( T* p, lua_State *L ) { p->LoadFromCachedBanner( SArg(1) ); - return 0; + COMMON_RETURN_SELF; } static int LoadIconFromCharacter( T* p, lua_State *L ) { if( lua_isnil(L,1) ) { p->LoadIconFromCharacter( NULL ); } else { Character *pC = Luna::check(L,1); p->LoadIconFromCharacter( pC ); } - return 0; + COMMON_RETURN_SELF; } static int LoadCardFromCharacter( T* p, lua_State *L ) { if( lua_isnil(L,1) ) { p->LoadIconFromCharacter( NULL ); } else { Character *pC = Luna::check(L,1); p->LoadIconFromCharacter( pC ); } - return 0; + COMMON_RETURN_SELF; } static int LoadBannerFromUnlockEntry( T* p, lua_State *L ) { if( lua_isnil(L,1) ) { p->LoadBannerFromUnlockEntry( NULL ); } else { UnlockEntry *pUE = Luna::check(L,1); p->LoadBannerFromUnlockEntry( pUE ); } - return 0; + COMMON_RETURN_SELF; } static int LoadBackgroundFromUnlockEntry( T* p, lua_State *L ) { if( lua_isnil(L,1) ) { p->LoadBackgroundFromUnlockEntry( NULL ); } else { UnlockEntry *pUE = Luna::check(L,1); p->LoadBackgroundFromUnlockEntry( pUE ); } - return 0; + COMMON_RETURN_SELF; } static int LoadFromSongGroup( T* p, lua_State *L ) { p->LoadFromSongGroup( SArg(1) ); - return 0; + COMMON_RETURN_SELF; } static int LoadFromSortOrder( T* p, lua_State *L ) { @@ -300,10 +300,10 @@ public: SortOrder so = Enum::Check(L, 1); p->LoadFromSortOrder( so ); } - return 0; + COMMON_RETURN_SELF; } static int GetScrolling( T* p, lua_State *L ){ lua_pushboolean( L, p->GetScrolling() ); return 1; } - static int SetScrolling( T* p, lua_State *L ){ p->SetScrolling( BArg(1), FArg(2) ); return 0; } + static int SetScrolling( T* p, lua_State *L ){ p->SetScrolling( BArg(1), FArg(2) ); COMMON_RETURN_SELF; } static int GetPercentScrolling( T* p, lua_State *L ){ lua_pushnumber( L, p->ScrollingPercent() ); return 1; } LunaBanner() diff --git a/src/BitmapText.cpp b/src/BitmapText.cpp index 823c730bda..318fb5f7b6 100644 --- a/src/BitmapText.cpp +++ b/src/BitmapText.cpp @@ -916,19 +916,19 @@ void BitmapText::Attribute::FromStack( lua_State *L, int iPos ) class LunaBitmapText: public Luna { public: - static int wrapwidthpixels( T* p, lua_State *L ) { p->SetWrapWidthPixels( IArg(1) ); return 0; } + static int wrapwidthpixels( T* p, lua_State *L ) { p->SetWrapWidthPixels( IArg(1) ); COMMON_RETURN_SELF; } #define MAX_DIMENSION(maxdimension, SetMaxDimension) \ static int maxdimension( T* p, lua_State *L ) \ - { p->SetMaxDimension(FArg(1)); return 0; } + { p->SetMaxDimension(FArg(1)); COMMON_RETURN_SELF; } MAX_DIMENSION(maxwidth, SetMaxWidth); MAX_DIMENSION(maxheight, SetMaxHeight); #undef MAX_DIMENSION static int max_dimension_use_zoom(T* p, lua_State* L) { p->SetMaxDimUseZoom(lua_toboolean(L, 1)); - return 0; + COMMON_RETURN_SELF; } - static int vertspacing( T* p, lua_State *L ) { p->SetVertSpacing( IArg(1) ); return 0; } + static int vertspacing( T* p, lua_State *L ) { p->SetVertSpacing( IArg(1) ); COMMON_RETURN_SELF; } static int settext( T* p, lua_State *L ) { RString s = SArg(1); @@ -949,12 +949,12 @@ public: } p->SetText( s, sAlt ); - return 0; + COMMON_RETURN_SELF; } - static int rainbowscroll( T* p, lua_State *L ) { p->SetRainbowScroll( BArg(1) ); return 0; } - static int jitter( T* p, lua_State *L ) { p->SetJitter( BArg(1) ); return 0; } - static int distort( T* p, lua_State *L) { p->SetDistortion( FArg(1) ); return 0; } - static int undistort( T* p, lua_State *L) { p->UnSetDistortion(); return 0; } + static int rainbowscroll( T* p, lua_State *L ) { p->SetRainbowScroll( BArg(1) ); COMMON_RETURN_SELF; } + static int jitter( T* p, lua_State *L ) { p->SetJitter( BArg(1) ); COMMON_RETURN_SELF; } + static int distort( T* p, lua_State *L) { p->SetDistortion( FArg(1) ); COMMON_RETURN_SELF; } + static int undistort( T* p, lua_State *L) { p->UnSetDistortion(); COMMON_RETURN_SELF; } static int GetText( T* p, lua_State *L ) { lua_pushstring( L, p->GetText() ); return 1; } static int AddAttribute( T* p, lua_State *L ) { @@ -963,13 +963,13 @@ public: attr.FromStack( L, 2 ); p->AddAttribute( iPos, attr ); - return 0; + COMMON_RETURN_SELF; } - static int ClearAttributes( T* p, lua_State * ) { p->ClearAttributes(); return 0; } - static int strokecolor( T* p, lua_State *L ) { RageColor c; c.FromStackCompat( L, 1 ); p->SetStrokeColor( c ); return 0; } + static int ClearAttributes( T* p, lua_State *L ) { p->ClearAttributes(); COMMON_RETURN_SELF; } + static int strokecolor( T* p, lua_State *L ) { RageColor c; c.FromStackCompat( L, 1 ); p->SetStrokeColor( c ); COMMON_RETURN_SELF; } DEFINE_METHOD(getstrokecolor, GetStrokeColor()); - static int uppercase( T* p, lua_State *L ) { p->SetUppercase( BArg(1) ); return 0; } - static int textglowmode( T* p, lua_State *L ) { p->SetTextGlowMode( Enum::Check(L, 1) ); return 0; } + static int uppercase( T* p, lua_State *L ) { p->SetUppercase( BArg(1) ); COMMON_RETURN_SELF; } + static int textglowmode( T* p, lua_State *L ) { p->SetTextGlowMode( Enum::Check(L, 1) ); COMMON_RETURN_SELF; } LunaBitmapText() { diff --git a/src/ComboGraph.cpp b/src/ComboGraph.cpp index e562d269b0..df441e716a 100644 --- a/src/ComboGraph.cpp +++ b/src/ComboGraph.cpp @@ -140,14 +140,14 @@ public: static int Load( T* p, lua_State *L ) { p->Load( SArg(1) ); - return 0; + COMMON_RETURN_SELF; } static int Set( T* p, lua_State *L ) { StageStats *pStageStats = Luna::check( L, 1 ); PlayerStageStats *pPlayerStageStats = Luna::check( L, 2 ); p->Set( *pStageStats, *pPlayerStageStats ); - return 0; + COMMON_RETURN_SELF; } LunaComboGraph() diff --git a/src/ControllerStateDisplay.cpp b/src/ControllerStateDisplay.cpp index ebeb68b38f..bbd23e7fb9 100644 --- a/src/ControllerStateDisplay.cpp +++ b/src/ControllerStateDisplay.cpp @@ -100,8 +100,8 @@ void ControllerStateDisplay::Update( float fDelta ) class LunaControllerStateDisplay: public Luna { public: - static int LoadGameController( T* p, lua_State *L ) { p->LoadGameController( SArg(1), Enum::Check(L, 2) ); return 0; } - static int LoadMultiPlayer( T* p, lua_State *L ) { p->LoadMultiPlayer( SArg(1), Enum::Check(L, 2) ); return 0; } + static int LoadGameController( T* p, lua_State *L ) { p->LoadGameController( SArg(1), Enum::Check(L, 2) ); COMMON_RETURN_SELF; } + static int LoadMultiPlayer( T* p, lua_State *L ) { p->LoadMultiPlayer( SArg(1), Enum::Check(L, 2) ); COMMON_RETURN_SELF; } LunaControllerStateDisplay() { diff --git a/src/CourseContentsList.cpp b/src/CourseContentsList.cpp index 43e76e1526..b320f1f282 100644 --- a/src/CourseContentsList.cpp +++ b/src/CourseContentsList.cpp @@ -154,7 +154,7 @@ void CourseContentsList::SetItemFromGameState( Actor *pActor, int iCourseEntryIn class LunaCourseContentsList: public Luna { public: - static int SetFromGameState( T* p, lua_State *L ) { p->SetFromGameState(); return 0; } + static int SetFromGameState( T* p, lua_State *L ) { p->SetFromGameState(); COMMON_RETURN_SELF; } LunaCourseContentsList() { diff --git a/src/DifficultyIcon.cpp b/src/DifficultyIcon.cpp index b19b9cce50..58eead5f75 100644 --- a/src/DifficultyIcon.cpp +++ b/src/DifficultyIcon.cpp @@ -111,7 +111,7 @@ public: Steps *pS = Luna::check(L,1); p->SetFromSteps( PLAYER_1, pS ); } - return 0; + COMMON_RETURN_SELF; } static int SetFromTrail( T* p, lua_State *L ) { @@ -124,11 +124,11 @@ public: Trail *pT = Luna::check(L,1); p->SetFromTrail( PLAYER_1, pT ); } - return 0; + COMMON_RETURN_SELF; } - static int Unset( T* p, lua_State *L ) { p->Unset(); return 0; } - static int SetPlayer( T* p, lua_State *L ) { p->SetPlayer( Enum::Check(L, 1) ); return 0; } - static int SetFromDifficulty( T* p, lua_State *L ) { p->SetFromDifficulty( Enum::Check(L, 1) ); return 0; } + static int Unset( T* p, lua_State *L ) { p->Unset(); COMMON_RETURN_SELF; } + static int SetPlayer( T* p, lua_State *L ) { p->SetPlayer( Enum::Check(L, 1) ); COMMON_RETURN_SELF; } + static int SetFromDifficulty( T* p, lua_State *L ) { p->SetFromDifficulty( Enum::Check(L, 1) ); COMMON_RETURN_SELF; } LunaDifficultyIcon() { diff --git a/src/DifficultyList.cpp b/src/DifficultyList.cpp index d24fadd9f4..a3ce25a8a9 100644 --- a/src/DifficultyList.cpp +++ b/src/DifficultyList.cpp @@ -389,7 +389,7 @@ void StepsDisplayList::HandleMessage( const Message &msg ) class LunaStepsDisplayList: public Luna { public: - static int setfromgamestate( T* p, lua_State *L ) { p->SetFromGameState(); return 0; } + static int setfromgamestate( T* p, lua_State *L ) { p->SetFromGameState(); COMMON_RETURN_SELF; } LunaStepsDisplayList() { diff --git a/src/FadingBanner.cpp b/src/FadingBanner.cpp index 33883063f9..1efe9a567e 100644 --- a/src/FadingBanner.cpp +++ b/src/FadingBanner.cpp @@ -268,37 +268,37 @@ void FadingBanner::LoadCustom( RString sBanner ) class LunaFadingBanner: public Luna { public: - static int scaletoclipped( T* p, lua_State *L ) { p->ScaleToClipped(FArg(1),FArg(2)); return 0; } - static int ScaleToClipped( T* p, lua_State *L ) { p->ScaleToClipped(FArg(1),FArg(2)); return 0; } + static int scaletoclipped( T* p, lua_State *L ) { p->ScaleToClipped(FArg(1),FArg(2)); COMMON_RETURN_SELF; } + static int ScaleToClipped( T* p, lua_State *L ) { p->ScaleToClipped(FArg(1),FArg(2)); COMMON_RETURN_SELF; } static int LoadFromSong( T* p, lua_State *L ) { if( lua_isnil(L,1) ) { p->LoadFromSong( NULL ); } else { Song *pS = Luna::check(L,1); p->LoadFromSong( pS ); } - return 0; + COMMON_RETURN_SELF; } static int LoadFromCourse( T* p, lua_State *L ) { if( lua_isnil(L,1) ) { p->LoadFromCourse( NULL ); } else { Course *pC = Luna::check(L,1); p->LoadFromCourse( pC ); } - return 0; + COMMON_RETURN_SELF; } static int LoadIconFromCharacter( T* p, lua_State *L ) { if( lua_isnil(L,1) ) { p->LoadIconFromCharacter( NULL ); } else { Character *pC = Luna::check(L,1); p->LoadIconFromCharacter( pC ); } - return 0; + COMMON_RETURN_SELF; } static int LoadCardFromCharacter( T* p, lua_State *L ) { if( lua_isnil(L,1) ) { p->LoadIconFromCharacter( NULL ); } else { Character *pC = Luna::check(L,1); p->LoadIconFromCharacter( pC ); } - return 0; + COMMON_RETURN_SELF; } - static int LoadFromSongGroup( T* p, lua_State *L ) { p->LoadFromSongGroup( SArg(1) ); return 0; } - static int LoadRandom( T* p, lua_State *L ) { p->LoadRandom(); return 0; } - static int LoadRoulette( T* p, lua_State *L ) { p->LoadRoulette(); return 0; } - static int LoadCourseFallback( T* p, lua_State *L ) { p->LoadCourseFallback(); return 0; } - static int LoadFallback( T* p, lua_State *L ) { p->LoadFallback(); return 0; } + static int LoadFromSongGroup( T* p, lua_State *L ) { p->LoadFromSongGroup( SArg(1) ); COMMON_RETURN_SELF; } + static int LoadRandom( T* p, lua_State *L ) { p->LoadRandom(); COMMON_RETURN_SELF; } + static int LoadRoulette( T* p, lua_State *L ) { p->LoadRoulette(); COMMON_RETURN_SELF; } + static int LoadCourseFallback( T* p, lua_State *L ) { p->LoadCourseFallback(); COMMON_RETURN_SELF; } + static int LoadFallback( T* p, lua_State *L ) { p->LoadFallback(); COMMON_RETURN_SELF; } static int LoadFromSortOrder( T* p, lua_State *L ) { if( lua_isnil(L,1) ) { p->LoadFromSortOrder( SortOrder_Invalid ); } @@ -307,7 +307,7 @@ public: SortOrder so = Enum::Check(L, 1); p->LoadFromSortOrder( so ); } - return 0; + COMMON_RETURN_SELF; } static int GetLatestIndex( T* p, lua_State *L ){ lua_pushnumber( L, p->GetLatestIndex() ); return 1; } diff --git a/src/GameSoundManager.cpp b/src/GameSoundManager.cpp index 9b90b5cf4d..4a39336570 100644 --- a/src/GameSoundManager.cpp +++ b/src/GameSoundManager.cpp @@ -795,19 +795,19 @@ public: float fVolume = FArg(1); float fDurationSeconds = FArg(2); p->DimMusic( fVolume, fDurationSeconds ); - return 0; + COMMON_RETURN_SELF; } static int PlayOnce( T* p, lua_State *L ) { RString sPath = SArg(1); p->PlayOnce( sPath ); - return 0; + COMMON_RETURN_SELF; } static int PlayAnnouncer( T* p, lua_State *L ) { RString sPath = SArg(1); p->PlayOnceFromAnnouncer( sPath ); - return 0; + COMMON_RETURN_SELF; } static int GetPlayerBalance( T* p, lua_State *L ) { @@ -847,10 +847,10 @@ public: } p->PlayMusic(musicPath, NULL, loop, musicStart, musicLength, fadeIn, fadeOut, alignBeat, applyRate); - return 0; + COMMON_RETURN_SELF; } - static int StopMusic( T* p, lua_State *L ) { p->StopMusic(); return 0; } + static int StopMusic( T* p, lua_State *L ) { p->StopMusic(); COMMON_RETURN_SELF; } static int IsTimingDelayed( T* p, lua_State *L ) { lua_pushboolean( L, g_Playing->m_bTimingDelayed ); return 1; } LunaGameSoundManager() diff --git a/src/GameState.cpp b/src/GameState.cpp index d16009ff5b..02c7707747 100644 --- a/src/GameState.cpp +++ b/src/GameState.cpp @@ -2272,7 +2272,7 @@ public: static int SetMultiplayer( T* p, lua_State *L ) { p->m_bMultiplayer = BArg(1); - return 0; + COMMON_RETURN_SELF; } DEFINE_METHOD( InStepEditor, m_bInStepEditor ); DEFINE_METHOD( GetNumMultiplayerNoteFields, m_iNumMultiplayerNoteFields ) @@ -2281,7 +2281,7 @@ public: static int SetNumMultiplayerNoteFields( T* p, lua_State *L ) { p->m_iNumMultiplayerNoteFields = IArg(1); - return 0; + COMMON_RETURN_SELF; } static int GetPlayerState( T* p, lua_State *L ) { @@ -2310,14 +2310,14 @@ public: pn = Enum::Check(L, 2); } p->ApplyGameCommand(SArg(1),pn); - return 0; + COMMON_RETURN_SELF; } static int GetCurrentSong( T* p, lua_State *L ) { if(p->m_pCurSong) p->m_pCurSong->PushSelf(L); else lua_pushnil(L); return 1; } static int SetCurrentSong( T* p, lua_State *L ) { if( lua_isnil(L,1) ) { p->m_pCurSong.Set( NULL ); } else { Song *pS = Luna::check( L, 1, true ); p->m_pCurSong.Set( pS ); } - return 0; + COMMON_RETURN_SELF; } static void SetCompatibleStyleOrError(T* p, lua_State* L, StepsType stype) { @@ -2351,14 +2351,14 @@ public: SetCompatibleStyleOrError(p, L, pS->m_StepsType); p->m_pCurSteps[pn].Set(pS); } - return 0; + COMMON_RETURN_SELF; } static int GetCurrentCourse( T* p, lua_State *L ) { if(p->m_pCurCourse) p->m_pCurCourse->PushSelf(L); else lua_pushnil(L); return 1; } static int SetCurrentCourse( T* p, lua_State *L ) { if( lua_isnil(L,1) ) { p->m_pCurCourse.Set( NULL ); } else { Course *pC = Luna::check(L,1); p->m_pCurCourse.Set( pC ); } - return 0; + COMMON_RETURN_SELF; } static int GetCurrentTrail( T* p, lua_State *L ) { @@ -2381,16 +2381,16 @@ public: SetCompatibleStyleOrError(p, L, pS->m_StepsType); p->m_pCurTrail[pn].Set(pS); } - return 0; + COMMON_RETURN_SELF; } static int GetPreferredSong( T* p, lua_State *L ) { if(p->m_pPreferredSong) p->m_pPreferredSong->PushSelf(L); else lua_pushnil(L); return 1; } static int SetPreferredSong( T* p, lua_State *L ) { if( lua_isnil(L,1) ) { p->m_pPreferredSong = NULL; } else { Song *pS = Luna::check(L,1); p->m_pPreferredSong = pS; } - return 0; + COMMON_RETURN_SELF; } - static int SetTemporaryEventMode( T* p, lua_State *L ) { p->m_bTemporaryEventMode = BArg(1); return 0; } + static int SetTemporaryEventMode( T* p, lua_State *L ) { p->m_bTemporaryEventMode = BArg(1); COMMON_RETURN_SELF; } static int Env( T* p, lua_State *L ) { p->m_Environment->PushSelf(L); return 1; } static int GetEditSourceSteps( T* p, lua_State *L ) { @@ -2404,7 +2404,7 @@ public: PlayerNumber pn = Enum::Check( L, 1 ); Difficulty dc = Enum::Check( L, 2 ); p->m_PreferredDifficulty[pn].Set( dc ); - return 0; + COMMON_RETURN_SELF; } DEFINE_METHOD( GetPreferredDifficulty, m_PreferredDifficulty[Enum::Check(L, 1)] ) DEFINE_METHOD( AnyPlayerHasRankingFeats, AnyPlayerHasRankingFeats() ) @@ -2473,17 +2473,17 @@ public: static int ApplyStageModifiers( T* p, lua_State *L ) { p->ApplyStageModifiers( Enum::Check(L, 1), SArg(2) ); - return 0; + COMMON_RETURN_SELF; } static int ApplyPreferredModifiers( T* p, lua_State *L ) { p->ApplyPreferredModifiers( Enum::Check(L, 1), SArg(2) ); - return 0; + COMMON_RETURN_SELF; } static int ClearStageModifiersIllegalForCourse( T* p, lua_State *L ) { p->ClearStageModifiersIllegalForCourse(); - return 0; + COMMON_RETURN_SELF; } static int SetSongOptions( T* p, lua_State *L ) { @@ -2493,7 +2493,7 @@ public: so.FromString( SArg(2) ); p->m_SongOptions.Assign( m, so ); - return 0; + COMMON_RETURN_SELF; } static int GetStageResult( T* p, lua_State *L ) { @@ -2511,7 +2511,6 @@ public: lua_pushboolean(L, p->GetStageResult(PLAYER_1)==RESULT_DRAW); return 1; } static int GetCurrentGame( T* p, lua_State *L ) { const_cast(p->GetCurrentGame())->PushSelf( L ); return 1; } - //static int SetCurrentGame( T* p, lua_State *L ) { p->SetCurrentGame( GAMEMAN->StringToGame( SArg(1) ) ); return 0; } DEFINE_METHOD( GetEditCourseEntryIndex, m_iEditCourseEntryIndex ) DEFINE_METHOD( GetEditLocalProfileID, m_sEditLocalProfileID.Get() ) static int GetEditLocalProfile( T* p, lua_State *L ) @@ -2554,7 +2553,7 @@ public: return vpStepsToShow.size()*2; } - static int SetPreferredSongGroup( T* p, lua_State *L ) { p->m_sPreferredSongGroup.Set( SArg(1) ); return 0; } + static int SetPreferredSongGroup( T* p, lua_State *L ) { p->m_sPreferredSongGroup.Set( SArg(1) ); COMMON_RETURN_SELF; } DEFINE_METHOD( GetPreferredSongGroup, m_sPreferredSongGroup.Get() ); static int GetHumanPlayers( T* p, lua_State *L ) { @@ -2602,15 +2601,15 @@ public: } static int GetGameSeed( T* p, lua_State *L ) { LuaHelpers::Push( L, p->m_iGameSeed ); return 1; } static int GetStageSeed( T* p, lua_State *L ) { LuaHelpers::Push( L, p->m_iStageSeed ); return 1; } - static int SaveLocalData( T* p, lua_State *L ) { p->SaveLocalData(); return 0; } + static int SaveLocalData( T* p, lua_State *L ) { p->SaveLocalData(); COMMON_RETURN_SELF; } static int SetJukeboxUsesModifiers( T* p, lua_State *L ) { - p->m_bJukeboxUsesModifiers = BArg(1); return 0; + p->m_bJukeboxUsesModifiers = BArg(1); COMMON_RETURN_SELF; } - static int Reset( T* p, lua_State *L ) { p->Reset(); return 0; } - static int JoinPlayer( T* p, lua_State *L ) { p->JoinPlayer(Enum::Check(L, 1)); return 0; } - static int UnjoinPlayer( T* p, lua_State *L ) { p->UnjoinPlayer(Enum::Check(L, 1)); return 0; } + static int Reset( T* p, lua_State *L ) { p->Reset(); COMMON_RETURN_SELF; } + static int JoinPlayer( T* p, lua_State *L ) { p->JoinPlayer(Enum::Check(L, 1)); COMMON_RETURN_SELF; } + static int UnjoinPlayer( T* p, lua_State *L ) { p->UnjoinPlayer(Enum::Check(L, 1)); COMMON_RETURN_SELF; } static int JoinInput( T* p, lua_State *L ) { lua_pushboolean(L, p->JoinInput(Enum::Check(L, 1))); @@ -2625,10 +2624,10 @@ public: Character* c = CHARMAN->GetCharacterFromID(SArg(2)); if (c) p->m_pCurCharacters[Enum::Check(L, 1)] = c; - return 0; + COMMON_RETURN_SELF; } static int GetExpandedSectionName( T* p, lua_State *L ) { lua_pushstring(L, p->sExpandedSectionName); return 1; } - static int AddStageToPlayer( T* p, lua_State *L ) { p->AddStageToPlayer(Enum::Check(L, 1)); return 0; } + static int AddStageToPlayer( T* p, lua_State *L ) { p->AddStageToPlayer(Enum::Check(L, 1)); COMMON_RETURN_SELF; } static int InsertCoin( T* p, lua_State *L ) { int numCoins = IArg(1); @@ -2639,25 +2638,25 @@ public: // Warn themers if they attempt to set credits to a negative value. luaL_error( L, "Credits may not be negative." ); } - return 0; + COMMON_RETURN_SELF; } static int InsertCredit( T* p, lua_State *L ) { StepMania::InsertCredit(); - return 0; + COMMON_RETURN_SELF; } static int CurrentOptionsDisqualifyPlayer( T* p, lua_State *L ) { lua_pushboolean(L, p->CurrentOptionsDisqualifyPlayer(Enum::Check(L, 1))); return 1; } static int ResetPlayerOptions( T* p, lua_State *L ) { p->ResetPlayerOptions(Enum::Check(L, 1)); - return 0; + COMMON_RETURN_SELF; } static int RefreshNoteSkinData( T* p, lua_State *L ) { NOTESKIN->RefreshNoteSkinData(p->m_pCurGame); - return 0; + COMMON_RETURN_SELF; } static int Dopefish( T* p, lua_State *L ) @@ -2675,26 +2674,26 @@ public: } p->LoadProfiles( LoadEdits ); SCREENMAN->ZeroNextUpdate(); - return 0; + COMMON_RETURN_SELF; } static int SaveProfiles( T* p, lua_State *L ) { p->SavePlayerProfiles(); SCREENMAN->ZeroNextUpdate(); - return 0; + COMMON_RETURN_SELF; } static int SetFailTypeExplicitlySet(T* p, lua_State* L) { p->m_bFailTypeWasExplicitlySet= true; - return 0; + COMMON_RETURN_SELF; } static int StoreRankingName( T* p, lua_State *L ) { p->StoreRankingName(Enum::Check(L, 1), SArg(2)); - return 0; + COMMON_RETURN_SELF; } DEFINE_METHOD( HaveProfileToLoad, HaveProfileToLoad() ) @@ -2772,13 +2771,13 @@ public: if( !AreStyleAndPlayModeCompatible( p, L, pStyle, p->m_PlayMode ) ) { - return 0; + COMMON_RETURN_SELF; } p->SetCurrentStyle( pStyle ); ClearIncompatibleStepsAndTrails( p, L ); - return 0; + COMMON_RETURN_SELF; } static int SetCurrentPlayMode( T* p, lua_State *L ) @@ -2788,7 +2787,7 @@ public: { p->m_PlayMode.Set( pm ); } - return 0; + COMMON_RETURN_SELF; } LunaGameState() diff --git a/src/GradeDisplay.cpp b/src/GradeDisplay.cpp index b1e371e0ff..658146cc0e 100644 --- a/src/GradeDisplay.cpp +++ b/src/GradeDisplay.cpp @@ -50,13 +50,13 @@ public: static int Load( T* p, lua_State *L ) { p->Load( SArg(1) ); - return 0; + COMMON_RETURN_SELF; } static int SetGrade( T* p, lua_State *L ) { Grade g = Enum::Check(L, 1); p->SetGrade( g ); - return 0; + COMMON_RETURN_SELF; } LunaGradeDisplay() diff --git a/src/GraphDisplay.cpp b/src/GraphDisplay.cpp index e5891b2397..116ae9fc3a 100644 --- a/src/GraphDisplay.cpp +++ b/src/GraphDisplay.cpp @@ -282,14 +282,14 @@ public: static int Load( T* p, lua_State *L ) { p->Load( SArg(1) ); - return 0; + COMMON_RETURN_SELF; } static int Set( T* p, lua_State *L ) { StageStats *pStageStats = Luna::check( L, 1 ); PlayerStageStats *pPlayerStageStats = Luna::check( L, 2 ); p->Set( *pStageStats, *pPlayerStageStats ); - return 0; + COMMON_RETURN_SELF; } LunaGraphDisplay() diff --git a/src/GrooveRadar.cpp b/src/GrooveRadar.cpp index 1331e56242..5aafb9873c 100644 --- a/src/GrooveRadar.cpp +++ b/src/GrooveRadar.cpp @@ -224,7 +224,7 @@ public: RadarValues *pRV = Luna::check(L,2); p->SetFromRadarValues( pn, *pRV ); } - return 0; + COMMON_RETURN_SELF; } static int SetFromValues( T* p, lua_State *L ) { @@ -239,9 +239,9 @@ public: LuaHelpers::ReadArrayFromTable( vals, L ); p->SetFromValues(pn, vals); } - return 0; + COMMON_RETURN_SELF; } - static int SetEmpty( T* p, lua_State *L ) { p->SetEmpty( Enum::Check(L, 1) ); return 0; } + static int SetEmpty( T* p, lua_State *L ) { p->SetEmpty( Enum::Check(L, 1) ); COMMON_RETURN_SELF; } LunaGrooveRadar() { diff --git a/src/HelpDisplay.cpp b/src/HelpDisplay.cpp index bab75ec577..07c035eb01 100644 --- a/src/HelpDisplay.cpp +++ b/src/HelpDisplay.cpp @@ -91,14 +91,14 @@ public: else p->SetTips( arrayTips ); - return 0; + COMMON_RETURN_SELF; } static int SetTipsColonSeparated( T* p, lua_State *L ) { vector vs; split( SArg(1), "::", vs ); p->SetTips( vs ); - return 0; + COMMON_RETURN_SELF; } static int gettips( T* p, lua_State *L ) @@ -111,7 +111,7 @@ public: return 2; } - static int SetSecsBetweenSwitches( T* p, lua_State *L ) { p->SetSecsBetweenSwitches( FArg(1) ); return 0; } + static int SetSecsBetweenSwitches( T* p, lua_State *L ) { p->SetSecsBetweenSwitches( FArg(1) ); COMMON_RETURN_SELF; } LunaHelpDisplay() { diff --git a/src/HoldJudgment.cpp b/src/HoldJudgment.cpp index 26656d8120..abc546fd45 100644 --- a/src/HoldJudgment.cpp +++ b/src/HoldJudgment.cpp @@ -108,7 +108,7 @@ void HoldJudgment::HandleMessage( const Message &msg ) class LunaHoldJudgment: public Luna { public: - static int LoadFromMultiPlayer( T* p, lua_State *L ) { p->LoadFromMultiPlayer( Enum::Check(L, 1) ); return 0; } + static int LoadFromMultiPlayer( T* p, lua_State *L ) { p->LoadFromMultiPlayer( Enum::Check(L, 1) ); COMMON_RETURN_SELF; } LunaHoldJudgment() { diff --git a/src/LifeMeterBattery.cpp b/src/LifeMeterBattery.cpp index d95b1f52bb..883b855afa 100644 --- a/src/LifeMeterBattery.cpp +++ b/src/LifeMeterBattery.cpp @@ -268,7 +268,7 @@ class LunaLifeMeterBattery: public Luna public: static int GetLivesLeft( T* p, lua_State *L ) { lua_pushnumber( L, p->GetLivesLeft() ); return 1; } static int GetTotalLives( T* p, lua_State *L ) { lua_pushnumber(L, p->GetTotalLives()); return 1; } - static int ChangeLives( T* p, lua_State *L ) { p->ChangeLives(IArg(1)); return 0; } + static int ChangeLives( T* p, lua_State *L ) { p->ChangeLives(IArg(1)); COMMON_RETURN_SELF; } LunaLifeMeterBattery() { diff --git a/src/LuaBinding.h b/src/LuaBinding.h index 91c27c6dec..04a345c202 100644 --- a/src/LuaBinding.h +++ b/src/LuaBinding.h @@ -161,6 +161,8 @@ public: #define DEFINE_METHOD( method_name, expr ) \ static int method_name( T* p, lua_State *L ) { LuaHelpers::Push( L, p->expr ); return 1; } +#define COMMON_RETURN_SELF p->PushSelf(L); return 1; + #define ADD_METHOD( method_name ) \ AddMethod( #method_name, method_name ) diff --git a/src/MenuTimer.cpp b/src/MenuTimer.cpp index 5115544399..7f8b4b24f0 100644 --- a/src/MenuTimer.cpp +++ b/src/MenuTimer.cpp @@ -203,14 +203,14 @@ void MenuTimer::SetText( float fSeconds ) class LunaMenuTimer: public Luna { public: - static int SetSeconds( T* p, lua_State *L ) { p->SetSeconds(FArg(1)); return 0; } + static int SetSeconds( T* p, lua_State *L ) { p->SetSeconds(FArg(1)); COMMON_RETURN_SELF; } static int GetSeconds( T* p, lua_State *L ) { lua_pushnumber( L, p->GetSeconds() ); return 1; } - static int start( T* p, lua_State *L ) { p->Start(); return 0; } - static int pause( T* p, lua_State *L ) { p->Pause(); return 0; } - static int stop( T* p, lua_State *L ) { p->Stop(); return 0; } - static int disable( T* p, lua_State *L ) { p->Disable(); return 0; } - static int silent( T* p, lua_State *L ) { p->EnableSilent(BArg(1)); return 0; } - static int stealth( T* p, lua_State *L ) { p->EnableStealth(BArg(1)); return 0; } + static int start( T* p, lua_State *L ) { p->Start(); COMMON_RETURN_SELF; } + static int pause( T* p, lua_State *L ) { p->Pause(); COMMON_RETURN_SELF; } + static int stop( T* p, lua_State *L ) { p->Stop(); COMMON_RETURN_SELF; } + static int disable( T* p, lua_State *L ) { p->Disable(); COMMON_RETURN_SELF; } + static int silent( T* p, lua_State *L ) { p->EnableSilent(BArg(1)); COMMON_RETURN_SELF; } + static int stealth( T* p, lua_State *L ) { p->EnableStealth(BArg(1)); COMMON_RETURN_SELF; } LunaMenuTimer() { diff --git a/src/MessageManager.cpp b/src/MessageManager.cpp index 83eb4d47dd..671871fba2 100644 --- a/src/MessageManager.cpp +++ b/src/MessageManager.cpp @@ -307,12 +307,12 @@ public: Message msg( SArg(1), ParamTable ); p->Broadcast( msg ); - return 0; + COMMON_RETURN_SELF; } static int SetLogging(T* p, lua_State *L) { p->SetLogging(lua_toboolean(L, -1)); - return 0; + COMMON_RETURN_SELF; } LunaMessageManager() diff --git a/src/MeterDisplay.cpp b/src/MeterDisplay.cpp index 9fa6e19c4c..fc485e9014 100644 --- a/src/MeterDisplay.cpp +++ b/src/MeterDisplay.cpp @@ -97,7 +97,7 @@ void SongMeterDisplay::Update( float fDeltaTime ) class LunaMeterDisplay: public Luna { public: - static int SetStreamWidth( T* p, lua_State *L ) { p->SetStreamWidth(FArg(1)); return 0; } + static int SetStreamWidth( T* p, lua_State *L ) { p->SetStreamWidth(FArg(1)); COMMON_RETURN_SELF; } LunaMeterDisplay() { diff --git a/src/ModIconRow.cpp b/src/ModIconRow.cpp index 4a2e05fa90..0bf97c456e 100644 --- a/src/ModIconRow.cpp +++ b/src/ModIconRow.cpp @@ -184,7 +184,7 @@ void ModIconRow::SetFromGameState() class LunaModIconRow: public Luna { public: - static int Load( T* p, lua_State *L ) { p->Load( SArg(1), Enum::Check(L, 2) ); return 0; } + static int Load( T* p, lua_State *L ) { p->Load( SArg(1), Enum::Check(L, 2) ); COMMON_RETURN_SELF; } LunaModIconRow() { diff --git a/src/Model.cpp b/src/Model.cpp index af1da0d951..968d16229e 100644 --- a/src/Model.cpp +++ b/src/Model.cpp @@ -775,14 +775,14 @@ bool Model::MaterialsNeedNormals() const class LunaModel: public Luna { public: - static int position( T* p, lua_State *L ) { p->SetPosition( FArg(1) ); return 0; } - static int playanimation( T* p, lua_State *L ) { p->PlayAnimation(SArg(1),FArg(2)); return 0; } - static int SetDefaultAnimation( T* p, lua_State *L ) { p->SetDefaultAnimation(SArg(1),FArg(2)); return 0; } + static int position( T* p, lua_State *L ) { p->SetPosition( FArg(1) ); COMMON_RETURN_SELF; } + static int playanimation( T* p, lua_State *L ) { p->PlayAnimation(SArg(1),FArg(2)); COMMON_RETURN_SELF; } + static int SetDefaultAnimation( T* p, lua_State *L ) { p->SetDefaultAnimation(SArg(1),FArg(2)); COMMON_RETURN_SELF; } static int GetDefaultAnimation( T* p, lua_State *L ) { lua_pushstring( L, p->GetDefaultAnimation() ); return 1; } - static int loop( T* p, lua_State *L ) { p->SetLoop(BArg(1)); return 0; } - static int rate( T* p, lua_State *L ) { p->SetRate(FArg(1)); return 0; } + static int loop( T* p, lua_State *L ) { p->SetLoop(BArg(1)); COMMON_RETURN_SELF; } + static int rate( T* p, lua_State *L ) { p->SetRate(FArg(1)); COMMON_RETURN_SELF; } static int GetNumStates( T* p, lua_State *L ) { lua_pushnumber( L, p->GetNumStates() ); return 1; } - //static int CelShading( T* p, lua_State *L ) { p->SetCelShading(BArg(1)); return 0; } + //static int CelShading( T* p, lua_State *L ) { p->SetCelShading(BArg(1)); COMMON_RETURN_SELF; } LunaModel() { diff --git a/src/PaneDisplay.cpp b/src/PaneDisplay.cpp index 7b91953552..ac979bcfe0 100644 --- a/src/PaneDisplay.cpp +++ b/src/PaneDisplay.cpp @@ -294,7 +294,7 @@ void PaneDisplay::SetFromGameState() class LunaPaneDisplay: public Luna { public: - static int SetFromGameState( T* pc, lua_State *L ) { pc->SetFromGameState(); return 0; } + static int SetFromGameState( T* p, lua_State *L ) { p->SetFromGameState(); COMMON_RETURN_SELF; } LunaPaneDisplay() { diff --git a/src/PercentageDisplay.cpp b/src/PercentageDisplay.cpp index 99cc9971e4..6bf9d23975 100644 --- a/src/PercentageDisplay.cpp +++ b/src/PercentageDisplay.cpp @@ -219,7 +219,7 @@ public: const PlayerState *pStageStats = Luna::check( L, 1 ); const PlayerStageStats *pPlayerStageStats = Luna::check( L, 2 ); p->Load( pStageStats, pPlayerStageStats ); - return 0; + COMMON_RETURN_SELF; } LunaPercentageDisplay() diff --git a/src/Player.cpp b/src/Player.cpp index fc242c83f5..dbc5dbc1ec 100644 --- a/src/Player.cpp +++ b/src/Player.cpp @@ -3492,13 +3492,13 @@ public: { Actor *pActor = Luna::check(L, 1); p->SetActorWithJudgmentPosition(pActor); - return 0; + COMMON_RETURN_SELF; } static int SetActorWithComboPosition( T* p, lua_State *L ) { Actor *pActor = Luna::check(L, 1); p->SetActorWithComboPosition(pActor); - return 0; + COMMON_RETURN_SELF; } static int GetPlayerTimingData( T* p, lua_State *L ) { diff --git a/src/PlayerStageStats.cpp b/src/PlayerStageStats.cpp index c04968c1ce..a2deb7c845 100644 --- a/src/PlayerStageStats.cpp +++ b/src/PlayerStageStats.cpp @@ -834,7 +834,7 @@ public: p->m_iScore = IArg(1); return 1; } - return 0; + COMMON_RETURN_SELF; } static int SetCurMaxScore( T* p, lua_State *L ) { @@ -843,13 +843,13 @@ public: p->m_iCurMaxScore = IArg(1); return 1; } - return 0; + COMMON_RETURN_SELF; } - static int FailPlayer( T* p, lua_State * ) + static int FailPlayer( T* p, lua_State *L ) { p->m_bFailed = true; - return 0; + COMMON_RETURN_SELF; } LunaPlayerStageStats() diff --git a/src/PrefsManager.cpp b/src/PrefsManager.cpp index c22ba08d81..9931f3a027 100644 --- a/src/PrefsManager.cpp +++ b/src/PrefsManager.cpp @@ -567,12 +567,12 @@ public: if( pPref == NULL ) { LuaHelpers::ReportScriptErrorFmt( "SetPreference: unknown preference \"%s\"", sName.c_str() ); - return 0; + COMMON_RETURN_SELF; } lua_pushvalue( L, 2 ); pPref->SetFromStack( L ); - return 0; + COMMON_RETURN_SELF; } static int SetPreferenceToDefault( T* p, lua_State *L ) { @@ -582,12 +582,12 @@ public: if( pPref == NULL ) { LuaHelpers::ReportScriptErrorFmt( "SetPreferenceToDefault: unknown preference \"%s\"", sName.c_str() ); - return 0; + COMMON_RETURN_SELF; } pPref->LoadDefault(); LOG->Trace( "Restored preference \"%s\" to default \"%s\"", sName.c_str(), pPref->ToString().c_str() ); - return 0; + COMMON_RETURN_SELF; } static int PreferenceExists( T* p, lua_State *L ) { @@ -603,7 +603,7 @@ public: return 1; } - static int SavePreferences( T* p, lua_State *L ) { p->SavePrefsToDisk(); return 0; } + static int SavePreferences( T* p, lua_State *L ) { p->SavePrefsToDisk(); COMMON_RETURN_SELF; } LunaPrefsManager() { diff --git a/src/Profile.cpp b/src/Profile.cpp index de2c10f9c2..79976dbf47 100644 --- a/src/Profile.cpp +++ b/src/Profile.cpp @@ -2147,20 +2147,20 @@ public: screenshot.sMD5= BinaryToHex(CRYPTMAN->GetMD5ForFile(filename)); screenshot.highScore= *hs; p->AddScreenshot(screenshot); - return 0; + COMMON_RETURN_SELF; } static int GetDisplayName( T* p, lua_State *L ) { lua_pushstring(L, p->m_sDisplayName ); return 1; } static int SetDisplayName( T* p, lua_State *L ) { p->m_sDisplayName= SArg(1); - return 0; + COMMON_RETURN_SELF; } static int GetLastUsedHighScoreName( T* p, lua_State *L ) { lua_pushstring(L, p->m_sLastUsedHighScoreName ); return 1; } static int SetLastUsedHighScoreName( T* p, lua_State *L ) { p->m_sLastUsedHighScoreName= SArg(1); - return 0; + COMMON_RETURN_SELF; } static int GetHighScoreList( T* p, lua_State *L ) { @@ -2182,7 +2182,7 @@ public: } luaL_typerror( L, 1, "Song or Course" ); - return 0; + COMMON_RETURN_SELF; } static int GetCategoryHighScoreList( T* p, lua_State *L ) { @@ -2249,9 +2249,9 @@ public: } static int GetCharacter( T* p, lua_State *L ) { p->GetCharacter()->PushSelf(L); return 1; } - static int SetCharacter( T* p, lua_State *L ) { p->SetCharacter(SArg(1)); return 0; } + static int SetCharacter( T* p, lua_State *L ) { p->SetCharacter(SArg(1)); COMMON_RETURN_SELF; } static int GetWeightPounds( T* p, lua_State *L ) { lua_pushnumber(L, p->m_iWeightPounds ); return 1; } - static int SetWeightPounds( T* p, lua_State *L ) { p->m_iWeightPounds = IArg(1); return 0; } + static int SetWeightPounds( T* p, lua_State *L ) { p->m_iWeightPounds = IArg(1); COMMON_RETURN_SELF; } DEFINE_METHOD(GetVoomax, m_Voomax); DEFINE_METHOD(GetAge, GetAge()); DEFINE_METHOD(GetBirthYear, m_BirthYear); @@ -2260,35 +2260,35 @@ public: static int SetVoomax( T* p, lua_State *L ) { p->m_Voomax= FArg(1); - return 0; + COMMON_RETURN_SELF; } static int SetBirthYear( T* p, lua_State *L ) { p->m_BirthYear= IArg(1); - return 0; + COMMON_RETURN_SELF; } static int SetIgnoreStepCountCalories( T* p, lua_State *L ) { p->m_IgnoreStepCountCalories= BArg(1); - return 0; + COMMON_RETURN_SELF; } static int SetIsMale( T* p, lua_State *L ) { p->m_IsMale= BArg(1); - return 0; + COMMON_RETURN_SELF; } static int AddCaloriesToDailyTotal( T* p, lua_State *L ) { p->AddCaloriesToDailyTotal(FArg(1)); - return 0; + COMMON_RETURN_SELF; } DEFINE_METHOD(CalculateCaloriesFromHeartRate, CalculateCaloriesFromHeartRate(FArg(1), FArg(2))); static int GetGoalType( T* p, lua_State *L ) { lua_pushnumber(L, p->m_GoalType ); return 1; } - static int SetGoalType( T* p, lua_State *L ) { p->m_GoalType = Enum::Check(L, 1); return 0; } + static int SetGoalType( T* p, lua_State *L ) { p->m_GoalType = Enum::Check(L, 1); COMMON_RETURN_SELF; } static int GetGoalCalories( T* p, lua_State *L ) { lua_pushnumber(L, p->m_iGoalCalories ); return 1; } - static int SetGoalCalories( T* p, lua_State *L ) { p->m_iGoalCalories = IArg(1); return 0; } + static int SetGoalCalories( T* p, lua_State *L ) { p->m_iGoalCalories = IArg(1); COMMON_RETURN_SELF; } static int GetGoalSeconds( T* p, lua_State *L ) { lua_pushnumber(L, p->m_iGoalSeconds ); return 1; } - static int SetGoalSeconds( T* p, lua_State *L ) { p->m_iGoalSeconds = IArg(1); return 0; } + static int SetGoalSeconds( T* p, lua_State *L ) { p->m_iGoalSeconds = IArg(1); COMMON_RETURN_SELF; } static int GetCaloriesBurnedToday( T* p, lua_State *L ) { lua_pushnumber(L, p->GetCaloriesBurnedToday() ); return 1; } static int GetTotalNumSongsPlayed( T* p, lua_State *L ) { lua_pushnumber(L, p->m_iNumTotalSongsPlayed ); return 1; } static int IsCodeUnlocked( T* p, lua_State *L ) { lua_pushboolean(L, p->IsCodeUnlocked(SArg(1)) ); return 1; } diff --git a/src/RageSound.cpp b/src/RageSound.cpp index 462be50b15..0a0ee3df09 100644 --- a/src/RageSound.cpp +++ b/src/RageSound.cpp @@ -642,7 +642,7 @@ public: RageSoundParams params( p->GetParams() ); params.m_fPitch = FArg(1); p->SetParams( params ); - return 0; + COMMON_RETURN_SELF; } static int speed( T* p, lua_State *L ) @@ -650,7 +650,7 @@ public: RageSoundParams params( p->GetParams() ); params.m_fSpeed = FArg(1); p->SetParams( params ); - return 0; + COMMON_RETURN_SELF; } static int volume( T* p, lua_State *L ) @@ -658,7 +658,7 @@ public: RageSoundParams params( p->GetParams() ); params.m_Volume = FArg(1); p->SetParams( params ); - return 0; + COMMON_RETURN_SELF; } static int SetProperty( T* p, lua_State *L ) @@ -682,7 +682,7 @@ public: else if( val == "Volume" ) params.m_Volume = FArg(2); p->SetParams( params ); - return 0; + COMMON_RETURN_SELF; } /* diff --git a/src/RageTexture.cpp b/src/RageTexture.cpp index f0d35a3203..210ee7997a 100644 --- a/src/RageTexture.cpp +++ b/src/RageTexture.cpp @@ -86,9 +86,9 @@ const RectF *RageTexture::GetTextureCoordRect( int iFrameNo ) const class LunaRageTexture: public Luna { public: - static int position( T* p, lua_State *L ) { p->SetPosition( FArg(1) ); return 0; } - static int loop( T* p, lua_State *L ) { p->SetLooping( BIArg(1) ); return 0; } - static int rate( T* p, lua_State *L ) { p->SetPlaybackRate( FArg(1) ); return 0; } + static int position( T* p, lua_State *L ) { p->SetPosition( FArg(1) ); COMMON_RETURN_SELF; } + static int loop( T* p, lua_State *L ) { p->SetLooping( BIArg(1) ); COMMON_RETURN_SELF; } + static int rate( T* p, lua_State *L ) { p->SetPlaybackRate( FArg(1) ); COMMON_RETURN_SELF; } static int GetTextureCoordRect( T* p, lua_State *L ) { const RectF *pRect = p->GetTextureCoordRect( IArg(1) ); @@ -106,7 +106,7 @@ public: static int Reload(T* p, lua_State* L) { p->Reload(); - return 0; + COMMON_RETURN_SELF; } LunaRageTexture() diff --git a/src/RageTextureRenderTarget.cpp b/src/RageTextureRenderTarget.cpp index 9bb8efdfeb..33df34c887 100644 --- a/src/RageTextureRenderTarget.cpp +++ b/src/RageTextureRenderTarget.cpp @@ -83,9 +83,9 @@ public: { bool bPreserveTexture = !!luaL_opt( L, lua_toboolean, 1, false ); p->BeginRenderingTo( bPreserveTexture ); - return 0; + COMMON_RETURN_SELF; } - static int FinishRenderingTo( T* p, lua_State *L ) { p->FinishRenderingTo(); return 0; } + static int FinishRenderingTo( T* p, lua_State *L ) { p->FinishRenderingTo(); COMMON_RETURN_SELF; } LunaRageTextureRenderTarget() { diff --git a/src/RollingNumbers.cpp b/src/RollingNumbers.cpp index db20620013..22ae87f144 100644 --- a/src/RollingNumbers.cpp +++ b/src/RollingNumbers.cpp @@ -122,8 +122,8 @@ void RollingNumbers::UpdateText() class LunaRollingNumbers: public Luna { public: - static int Load( T* p, lua_State *L ) { p->Load(SArg(1)); return 0; } - static int targetnumber( T* p, lua_State *L ) { p->SetTargetNumber( FArg(1) ); return 0; } + static int Load( T* p, lua_State *L ) { p->Load(SArg(1)); COMMON_RETURN_SELF; } + static int targetnumber( T* p, lua_State *L ) { p->SetTargetNumber( FArg(1) ); COMMON_RETURN_SELF; } LunaRollingNumbers() { diff --git a/src/Screen.cpp b/src/Screen.cpp index 1100cdb350..c1c491ff9d 100644 --- a/src/Screen.cpp +++ b/src/Screen.cpp @@ -408,9 +408,9 @@ class LunaScreen: public Luna { public: static int GetNextScreenName( T* p, lua_State *L ) { lua_pushstring(L, p->GetNextScreenName() ); return 1; } - static int SetNextScreenName( T* p, lua_State *L ) { p->SetNextScreenName(SArg(1)); return 0; } + static int SetNextScreenName( T* p, lua_State *L ) { p->SetNextScreenName(SArg(1)); COMMON_RETURN_SELF; } static int GetPrevScreenName( T* p, lua_State *L ) { lua_pushstring(L, p->GetPrevScreen() ); return 1; } - static int lockinput( T* p, lua_State *L ) { p->SetLockInputSecs(FArg(1)); return 0; } + static int lockinput( T* p, lua_State *L ) { p->SetLockInputSecs(FArg(1)); COMMON_RETURN_SELF; } DEFINE_METHOD( GetScreenType, GetScreenType() ) static int PostScreenMessage( T* p, lua_State *L ) @@ -418,7 +418,7 @@ public: RString sMessage = SArg(1); ScreenMessage SM = ScreenMessageHelpers::ToScreenMessage( sMessage ); p->PostScreenMessage( SM, IArg(2) ); - return 0; + COMMON_RETURN_SELF; } static int AddInputCallback(T* p, lua_State* L) @@ -428,7 +428,7 @@ public: luaL_error(L, "Input callback must be a function."); } p->AddInputCallbackFromStack(L); - return 0; + COMMON_RETURN_SELF; } static int RemoveInputCallback(T* p, lua_State* L) @@ -438,7 +438,7 @@ public: luaL_error(L, "Input callback must be a function."); } p->RemoveInputCallback(L); - return 0; + COMMON_RETURN_SELF; } LunaScreen() diff --git a/src/ScreenManager.cpp b/src/ScreenManager.cpp index 3421f9689b..230b6a186f 100644 --- a/src/ScreenManager.cpp +++ b/src/ScreenManager.cpp @@ -909,7 +909,7 @@ public: RString screen= SArg(1); ValidateScreenName(L, screen); p->SetNewScreen(screen); - return 0; + COMMON_RETURN_SELF; } static int GetTopScreen( T* p, lua_State *L ) { @@ -920,7 +920,7 @@ public: lua_pushnil( L ); return 1; } - static int SystemMessage( T* p, lua_State *L ) { p->SystemMessage( SArg(1) ); return 0; } + static int SystemMessage( T* p, lua_State *L ) { p->SystemMessage( SArg(1) ); COMMON_RETURN_SELF; } static int ScreenIsPrepped( T* p, lua_State *L ) { lua_pushboolean( L, ScreenManagerUtil::ScreenIsPrepped( SArg(1) ) ); return 1; } static int ScreenClassExists( T* p, lua_State *L ) { lua_pushboolean( L, g_pmapRegistrees->find( SArg(1) ) != g_pmapRegistrees->end() ); return 1; } static int AddNewScreenToTop( T* p, lua_State *L ) @@ -935,10 +935,10 @@ public: } p->AddNewScreenToTop( screen, SM ); - return 0; + COMMON_RETURN_SELF; } //static int GetScreenStackSize( T* p, lua_State *L ) { lua_pushnumber( L, ScreenManagerUtil::g_ScreenStack.size() ); return 1; } - static int ReloadOverlayScreens( T* p, lua_State *L ) { p->ReloadOverlayScreens(); return 0; } + static int ReloadOverlayScreens( T* p, lua_State *L ) { p->ReloadOverlayScreens(); COMMON_RETURN_SELF; } LunaScreenManager() { diff --git a/src/ScreenProfileLoad.cpp b/src/ScreenProfileLoad.cpp index a960ebf657..8a91ea4314 100644 --- a/src/ScreenProfileLoad.cpp +++ b/src/ScreenProfileLoad.cpp @@ -47,7 +47,7 @@ public: LUA->YieldLua(); p->Continue(); LUA->UnyieldLua(); - return 0; + COMMON_RETURN_SELF; } static int HaveProfileToLoad( T* p, lua_State *L ) { diff --git a/src/ScreenProfileSave.cpp b/src/ScreenProfileSave.cpp index 15705aa443..3b5d03f583 100644 --- a/src/ScreenProfileSave.cpp +++ b/src/ScreenProfileSave.cpp @@ -35,7 +35,7 @@ public: LUA->YieldLua(); p->Continue(); LUA->UnyieldLua(); - return 0; + COMMON_RETURN_SELF; } static int HaveProfileToSave( T* p, lua_State *L ) { diff --git a/src/ScreenSelectMusic.cpp b/src/ScreenSelectMusic.cpp index 92da13a25b..94ed76a8e1 100644 --- a/src/ScreenSelectMusic.cpp +++ b/src/ScreenSelectMusic.cpp @@ -1937,7 +1937,7 @@ public: p->GetMusicWheel()->PushSelf(L); return 1; } - static int OpenOptionsList( T* p, lua_State *L ) { PlayerNumber pn = Enum::Check(L, 1); p->OpenOptionsList(pn); return 0; } + static int OpenOptionsList( T* p, lua_State *L ) { PlayerNumber pn = Enum::Check(L, 1); p->OpenOptionsList(pn); COMMON_RETURN_SELF; } LunaScreenSelectMusic() { diff --git a/src/ScreenWithMenuElements.cpp b/src/ScreenWithMenuElements.cpp index c54f6adef5..e935cd31ef 100644 --- a/src/ScreenWithMenuElements.cpp +++ b/src/ScreenWithMenuElements.cpp @@ -373,12 +373,12 @@ bool ScreenWithMenuElementsSimple::MenuBack( const InputEventPlus &input ) class LunaScreenWithMenuElements: public Luna { public: - static int Cancel( T* p, lua_State *L ) { p->Cancel( SM_GoToPrevScreen ); return 0; } + static int Cancel( T* p, lua_State *L ) { p->Cancel( SM_GoToPrevScreen ); COMMON_RETURN_SELF; } static int IsTransitioning( T* p, lua_State *L ) { lua_pushboolean( L, p->IsTransitioning() ); return 1; } static int SetAllowLateJoin( T* p, lua_State *L ) { p->m_bShouldAllowLateJoin= BArg(1); - return 0; + COMMON_RETURN_SELF; } static int StartTransitioningScreen( T* p, lua_State *L ) @@ -386,7 +386,7 @@ public: RString sMessage = SArg(1); ScreenMessage SM = ScreenMessageHelpers::ToScreenMessage( sMessage ); p->StartTransitioningScreen( SM ); - return 0; + COMMON_RETURN_SELF; } LunaScreenWithMenuElements() diff --git a/src/SongManager.cpp b/src/SongManager.cpp index 7a9840ad28..7cc2efab73 100644 --- a/src/SongManager.cpp +++ b/src/SongManager.cpp @@ -1920,13 +1920,13 @@ public: static int SetPreferredSongs( T* p, lua_State *L ) { p->UpdatePreferredSort( SArg(1), "PreferredCourses.txt" ); - return 0; + COMMON_RETURN_SELF; } static int SetPreferredCourses( T* p, lua_State *L ) { p->UpdatePreferredSort( "PreferredSongs.txt", SArg(1) ); - return 0; + COMMON_RETURN_SELF; } static int GetAllSongs( T* p, lua_State *L ) { diff --git a/src/Sprite.cpp b/src/Sprite.cpp index f9350e7e4b..3d5b9a3ab6 100644 --- a/src/Sprite.cpp +++ b/src/Sprite.cpp @@ -1048,7 +1048,7 @@ public: RageTextureID ID( SArg(1) ); p->Load( ID ); } - return 0; + COMMON_RETURN_SELF; } static int LoadBackground( T* p, lua_State *L ) { @@ -1069,8 +1069,8 @@ public: /* Commands that go in the tweening queue: * Commands that take effect immediately (ignoring the tweening queue): */ - static int customtexturerect( T* p, lua_State *L ) { p->SetCustomTextureRect( RectF(FArg(1),FArg(2),FArg(3),FArg(4)) ); return 0; } - static int SetCustomImageRect( T* p, lua_State *L ) { p->SetCustomImageRect( RectF(FArg(1),FArg(2),FArg(3),FArg(4)) ); return 0; } + static int customtexturerect( T* p, lua_State *L ) { p->SetCustomTextureRect( RectF(FArg(1),FArg(2),FArg(3),FArg(4)) ); COMMON_RETURN_SELF; } + static int SetCustomImageRect( T* p, lua_State *L ) { p->SetCustomImageRect( RectF(FArg(1),FArg(2),FArg(3),FArg(4)) ); COMMON_RETURN_SELF; } static int SetCustomPosCoords( T* p, lua_State *L ) { float coords[8]; @@ -1083,24 +1083,24 @@ public: } } p->SetCustomPosCoords(coords); - return 0; + COMMON_RETURN_SELF; } - static int StopUsingCustomPosCoords( T* p, lua_State *L ) { p->StopUsingCustomPosCoords(); return 0; } - static int texcoordvelocity( T* p, lua_State *L ) { p->SetTexCoordVelocity( FArg(1),FArg(2) ); return 0; } - static int scaletoclipped( T* p, lua_State *L ) { p->ScaleToClipped( FArg(1),FArg(2) ); return 0; } - static int CropTo( T* p, lua_State *L ) { p->CropTo( FArg(1),FArg(2) ); return 0; } - static int stretchtexcoords( T* p, lua_State *L ) { p->StretchTexCoords( FArg(1),FArg(2) ); return 0; } - static int addimagecoords( T* p, lua_State *L ) { p->AddImageCoords( FArg(1),FArg(2) ); return 0; } - static int setstate( T* p, lua_State *L ) { p->SetState( IArg(1) ); return 0; } + static int StopUsingCustomPosCoords( T* p, lua_State *L ) { p->StopUsingCustomPosCoords(); COMMON_RETURN_SELF; } + static int texcoordvelocity( T* p, lua_State *L ) { p->SetTexCoordVelocity( FArg(1),FArg(2) ); COMMON_RETURN_SELF; } + static int scaletoclipped( T* p, lua_State *L ) { p->ScaleToClipped( FArg(1),FArg(2) ); COMMON_RETURN_SELF; } + static int CropTo( T* p, lua_State *L ) { p->CropTo( FArg(1),FArg(2) ); COMMON_RETURN_SELF; } + static int stretchtexcoords( T* p, lua_State *L ) { p->StretchTexCoords( FArg(1),FArg(2) ); COMMON_RETURN_SELF; } + static int addimagecoords( T* p, lua_State *L ) { p->AddImageCoords( FArg(1),FArg(2) ); COMMON_RETURN_SELF; } + static int setstate( T* p, lua_State *L ) { p->SetState( IArg(1) ); COMMON_RETURN_SELF; } static int GetState( T* p, lua_State *L ) { lua_pushnumber( L, p->GetState() ); return 1; } static int GetAnimationLengthSeconds( T* p, lua_State *L ) { lua_pushnumber( L, p->GetAnimationLengthSeconds() ); return 1; } - static int SetSecondsIntoAnimation( T* p, lua_State *L ) { p->SetSecondsIntoAnimation(FArg(0)); return 0; } + static int SetSecondsIntoAnimation( T* p, lua_State *L ) { p->SetSecondsIntoAnimation(FArg(0)); COMMON_RETURN_SELF; } static int SetTexture( T* p, lua_State *L ) { RageTexture *pTexture = Luna::check(L, 1); pTexture = TEXTUREMAN->CopyTexture( pTexture ); p->SetTexture( pTexture ); - return 0; + COMMON_RETURN_SELF; } static int GetTexture( T* p, lua_State *L ) { @@ -1115,10 +1115,10 @@ public: { EffectMode em = Enum::Check(L, 1); p->SetEffectMode( em ); - return 0; + COMMON_RETURN_SELF; } static int GetNumStates( T* p, lua_State *L ) { lua_pushnumber( L, p->GetNumStates() ); return 1; } - static int SetAllStateDelays( T* p, lua_State *L ) { p->SetAllStateDelays(FArg(1)); return 0; } + static int SetAllStateDelays( T* p, lua_State *L ) { p->SetAllStateDelays(FArg(1)); COMMON_RETURN_SELF; } LunaSprite() { diff --git a/src/StepsDisplay.cpp b/src/StepsDisplay.cpp index 7df5e6b930..6996e7f0e5 100644 --- a/src/StepsDisplay.cpp +++ b/src/StepsDisplay.cpp @@ -288,7 +288,7 @@ void StepsDisplay::SetInternal( const SetParams ¶ms ) class LunaStepsDisplay: public Luna { public: - static int Load( T* p, lua_State *L ) { p->Load( SArg(1), NULL ); return 0; } + static int Load( T* p, lua_State *L ) { p->Load( SArg(1), NULL ); COMMON_RETURN_SELF; } static int SetFromSteps( T* p, lua_State *L ) { if( lua_isnil(L,1) ) @@ -300,7 +300,7 @@ public: Steps *pS = Luna::check(L,1); p->SetFromSteps( pS ); } - return 0; + COMMON_RETURN_SELF; } static int SetFromTrail( T* p, lua_State *L ) { @@ -313,13 +313,13 @@ public: Trail *pT = Luna::check(L,1); p->SetFromTrail( pT ); } - return 0; + COMMON_RETURN_SELF; } static int SetFromGameState( T* p, lua_State *L ) { PlayerNumber pn = Enum::Check(L, 1); p->SetFromGameState( pn ); - return 0; + COMMON_RETURN_SELF; } LunaStepsDisplay() diff --git a/src/TextBanner.cpp b/src/TextBanner.cpp index f504f2712d..5fa8fbc32f 100644 --- a/src/TextBanner.cpp +++ b/src/TextBanner.cpp @@ -90,12 +90,12 @@ void TextBanner::SetFromSong( const Song *pSong ) class LunaTextBanner: public Luna { public: - static int Load( T* p, lua_State *L ) { p->Load( SArg(1) ); return 0; } + static int Load( T* p, lua_State *L ) { p->Load( SArg(1) ); COMMON_RETURN_SELF; } static int SetFromSong( T* p, lua_State *L ) { Song *pSong = Luna::check(L,1); p->SetFromSong( pSong ); - return 0; + COMMON_RETURN_SELF; } static int SetFromString( T* p, lua_State *L ) { @@ -106,7 +106,7 @@ public: RString sDisplayArtist = SArg(5); RString sTranslitArtist = SArg(6); p->SetFromString( sDisplayTitle, sTranslitTitle, sDisplaySubTitle, sTranslitSubTitle, sDisplayArtist, sTranslitArtist ); - return 0; + COMMON_RETURN_SELF; } LunaTextBanner() diff --git a/src/UnlockManager.cpp b/src/UnlockManager.cpp index 3d88380775..fca32edc61 100644 --- a/src/UnlockManager.cpp +++ b/src/UnlockManager.cpp @@ -926,21 +926,21 @@ public: return 1; } static int FindEntryID( T* p, lua_State *L ) { RString sName = SArg(1); RString s = p->FindEntryID(sName); if( s.empty() ) lua_pushnil(L); else lua_pushstring(L, s); return 1; } - static int UnlockEntryID( T* p, lua_State *L ) { RString sUnlockEntryID = SArg(1); p->UnlockEntryID(sUnlockEntryID); return 0; } - static int UnlockEntryIndex( T* p, lua_State *L ) { int iUnlockEntryID = IArg(1); p->UnlockEntryIndex(iUnlockEntryID); return 0; } + static int UnlockEntryID( T* p, lua_State *L ) { RString sUnlockEntryID = SArg(1); p->UnlockEntryID(sUnlockEntryID); COMMON_RETURN_SELF; } + static int UnlockEntryIndex( T* p, lua_State *L ) { int iUnlockEntryID = IArg(1); p->UnlockEntryIndex(iUnlockEntryID); COMMON_RETURN_SELF; } static int LockEntryID( T * p, lua_State * L) { RString entryID = SArg(1); p->LockEntryID( entryID ); - return 0; + COMMON_RETURN_SELF; } static int LockEntryIndex( T * p, lua_State * L) { int entryIndex = IArg(1); p->LockEntryIndex( entryIndex ); - return 0; + COMMON_RETURN_SELF; } - static int PreferUnlockEntryID( T* p, lua_State *L ) { RString sUnlockEntryID = SArg(1); p->PreferUnlockEntryID(sUnlockEntryID); return 0; } + static int PreferUnlockEntryID( T* p, lua_State *L ) { RString sUnlockEntryID = SArg(1); p->PreferUnlockEntryID(sUnlockEntryID); COMMON_RETURN_SELF; } static int GetNumUnlocks( T* p, lua_State *L ) { lua_pushnumber( L, p->GetNumUnlocks() ); return 1; } static int GetNumUnlocked( T* p, lua_State *L ) { lua_pushnumber( L, p->GetNumUnlocked() ); return 1; } static int GetUnlockEntryIndexToCelebrate( T* p, lua_State *L ) { lua_pushnumber( L, p->GetUnlockEntryIndexToCelebrate() ); return 1; } diff --git a/src/WheelBase.cpp b/src/WheelBase.cpp index 6775d87445..99142ec4e1 100644 --- a/src/WheelBase.cpp +++ b/src/WheelBase.cpp @@ -526,7 +526,7 @@ int WheelBase::FirstVisibleIndex() class LunaWheelBase: public Luna { public: - static int Move( T* p, lua_State *L ){ p->Move( IArg(1) ); return 0; } + static int Move( T* p, lua_State *L ){ p->Move( IArg(1) ); COMMON_RETURN_SELF; } static int GetWheelItem( T* p, lua_State *L ) { int iItem = IArg(1); @@ -539,11 +539,10 @@ public: return 1; } static int IsSettled( T* p, lua_State *L ){ lua_pushboolean( L, p->IsSettled() ); return 1; } - static int SetOpenSection( T* p, lua_State *L ){ p->SetOpenSection( SArg(1) ); return 0; } + static int SetOpenSection( T* p, lua_State *L ){ p->SetOpenSection( SArg(1) ); COMMON_RETURN_SELF; } static int GetCurrentIndex( T* p, lua_State *L ){ lua_pushnumber( L, p->GetCurrentIndex() ); return 1; } static int GetNumItems( T* p, lua_State *L ){ lua_pushnumber( L, p->GetNumItems() ); return 1; } // evil shit - //static int Move( T* p, lua_State *L ){ p->Move( IArg(1) ); return 0; } //static int ChangeMusic( T* p, lua_State *L ){ p->ChangeMusicUnlessLocked( IArg(1) ); return 0; } DEFINE_METHOD( GetSelectedType, GetSelectedType() ) diff --git a/src/WorkoutGraph.cpp b/src/WorkoutGraph.cpp index 7865b05780..0d00555a35 100644 --- a/src/WorkoutGraph.cpp +++ b/src/WorkoutGraph.cpp @@ -122,8 +122,8 @@ void WorkoutGraph::SetFromGameStateAndHighlightSong( int iSongIndex ) class LunaWorkoutGraph: public Luna { public: - static int SetFromCurrentWorkout( T* p, lua_State *L ) { p->SetFromCurrentWorkout(); return 0; } - static int SetFromGameStateAndHighlightSong( T* p, lua_State *L ) { p->SetFromGameStateAndHighlightSong(IArg(1)); return 0; } + static int SetFromCurrentWorkout( T* p, lua_State *L ) { p->SetFromCurrentWorkout(); COMMON_RETURN_SELF; } + static int SetFromGameStateAndHighlightSong( T* p, lua_State *L ) { p->SetFromGameStateAndHighlightSong(IArg(1)); COMMON_RETURN_SELF; } LunaWorkoutGraph() {