From d2c6680bc0c2354b6c972402951b6118bf6843af Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Mon, 27 Apr 2009 16:50:49 +0000 Subject: first attempt to implement the lua wrapper for party game git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/branches/experimental@1702 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Lua/src/base/UMain.pas | 4 ++++ Lua/src/base/UParty.pas | 30 +++++------------------------- 2 files changed, 9 insertions(+), 25 deletions(-) (limited to 'Lua/src/base') diff --git a/Lua/src/base/UMain.pas b/Lua/src/base/UMain.pas index 1bd96d41..57ad01a1 100644 --- a/Lua/src/base/UMain.pas +++ b/Lua/src/base/UMain.pas @@ -189,6 +189,7 @@ uses ULuaLog, ULuaTexture, ULuaTextGL, + ULuaParty, UThemes; @@ -419,10 +420,13 @@ begin chr(0)) ); } + Party := TPartyGame.Create; + LuaCore := TLuaCore.Create; LuaCore.RegisterModule('Log', ULuaLog_Lib_f); LuaCore.RegisterModule('Gl', ULuaGl_Lib_f); + LuaCore.RegisterModule('Party', ULuaParty_Lib_f); LuaCore.BrowseDir(PluginPath); LuaCore.DumpPlugins; diff --git a/Lua/src/base/UParty.pas b/Lua/src/base/UParty.pas index b2e31171..2002b861 100644 --- a/Lua/src/base/UParty.pas +++ b/Lua/src/base/UParty.pas @@ -105,7 +105,6 @@ type bPartyStarted: Boolean; Modes: array of TParty_ModeInfo; //< holds info of registred party modes - Teams: array of TParty_TeamInfo; //< holds info of teams playing in current round TimesPlayed: array of Integer; //< times every mode was played in current party game (for random mode calculation) @@ -117,7 +116,8 @@ type function CallLua(Parent: Integer; Func: String):Boolean; public //Teams: TTeamInfo; - Rounds: array of TParty_Round; + Rounds: array of TParty_Round; //< holds info which modes are played in this party game (if started) + Teams: array of TParty_TeamInfo; //< holds info of teams playing in current round (private for easy manipulation of lua functions) constructor Create; @@ -202,6 +202,9 @@ const StandardModus = 0; //Modus Id that will be played in non-party mode +var + Party: TPartyGame; + implementation uses @@ -338,29 +341,6 @@ begin end; end; -//---------- -// NextRound - Increases CurRound by 1; Returns num of round or -1 if last round is already played -//---------- -{function TPartyGame.NextRound(wParam: TwParam; lParam: TlParam): integer; -var - I: integer; -begin - if ((CurRound < high(Rounds)) or (CurRound = high(CurRound))) then - begin //everythings OK! -> Start the Round, maaaaan - Inc(CurRound); - - //Set Players to play this Round - for I := 0 to Teams.NumTeams-1 do - Teams.Teaminfo[I].CurPlayer := GetRandomPlayer(I); - - // FIXME: return a valid result - Result := 0; - end - else - Result := -1; -end; } - - { private: returns true if the players bit is set in the winner int } function TPartyGame.IsWinner(Player, Winner: Integer): boolean; var -- cgit v1.2.3