diff options
author | whiteshark0 <whiteshark0@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2009-04-27 16:50:49 +0000 |
---|---|---|
committer | whiteshark0 <whiteshark0@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2009-04-27 16:50:49 +0000 |
commit | d2c6680bc0c2354b6c972402951b6118bf6843af (patch) | |
tree | eaebc6af487c3de344ab8af4a0ea8ddf0237b055 /Lua/src/base | |
parent | bb273547540d3ee260456ad01b298bacac00f2ea (diff) | |
download | usdx-d2c6680bc0c2354b6c972402951b6118bf6843af.tar.gz usdx-d2c6680bc0c2354b6c972402951b6118bf6843af.tar.xz usdx-d2c6680bc0c2354b6c972402951b6118bf6843af.zip |
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
Diffstat (limited to 'Lua/src/base')
-rw-r--r-- | Lua/src/base/UMain.pas | 4 | ||||
-rw-r--r-- | Lua/src/base/UParty.pas | 30 |
2 files changed, 9 insertions, 25 deletions
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 |