diff options
author | whiteshark0 <whiteshark0@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2010-01-25 19:15:54 +0000 |
---|---|---|
committer | whiteshark0 <whiteshark0@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2010-01-25 19:15:54 +0000 |
commit | c8af7cb20362428d566d41d8bbe3091b40e7346a (patch) | |
tree | 3f1d2d0a4e74bde32f1d31a1088ab0218701af31 /src/base | |
parent | ecf41a3f0e7c5770cea44659b27162cfaad78a37 (diff) | |
download | usdx-c8af7cb20362428d566d41d8bbe3091b40e7346a.tar.gz usdx-c8af7cb20362428d566d41d8bbe3091b40e7346a.tar.xz usdx-c8af7cb20362428d566d41d8bbe3091b40e7346a.zip |
fix execution of default behaviour for party hooks
(caused e.g. song never ending bug)
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2093 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to 'src/base')
-rw-r--r-- | src/base/UParty.pas | 133 |
1 files changed, 87 insertions, 46 deletions
diff --git a/src/base/UParty.pas b/src/base/UParty.pas index 94580241..2f89afd6 100644 --- a/src/base/UParty.pas +++ b/src/base/UParty.pas @@ -797,8 +797,12 @@ end; if plugins function returns true then default is called after plugins function was executed} procedure TPartyGame.CallBeforeSongSelect; + var + ExecuteDefault: boolean; begin - if (CurRound >= 0) then + if not bPartyStarted then + ExecuteDefault := true + else if (CurRound >= 0) then begin // we set screen song to party mode // plugin should not have to do this if it @@ -806,79 +810,116 @@ begin ScreenSong.Mode := smPartyMode; with Modes[Rounds[CurRound].Mode] do - if (CallLua(Parent, Functions.BeforeSongSelect)) then - begin // execute default function: - // display song select screen - Display.FadeTo(@ScreenSong); - end; + ExecuteDefault := (CallLua(Parent, Functions.BeforeSongSelect)); + end + else + ExecuteDefault := true; + + // execute default function: + if ExecuteDefault then + begin + // display song select screen + Display.FadeTo(@ScreenSong); end; end; -procedure TPartyGame.CallAfterSongSelect; +procedure TPartyGame.CallAfterSongSelect; + var + ExecuteDefault: boolean; begin - if (CurRound >= 0) then + if not bPartyStarted then + ExecuteDefault := true + else if (CurRound >= 0) then begin with Modes[Rounds[CurRound].Mode] do - if (CallLua(Parent, Functions.AfterSongSelect)) then - begin // execute default function: + ExecuteDefault := (CallLua(Parent, Functions.AfterSongSelect)); + end + else + ExecuteDefault := true; - // display sing screen - ScreenSong.StartSong; - end; + // execute default function: + if ExecuteDefault then + begin + // display sing screen + ScreenSong.StartSong; end; end; -procedure TPartyGame.CallBeforeSing; +procedure TPartyGame.CallBeforeSing; + var + ExecuteDefault: boolean; begin - if (CurRound >= 0) then + if not bPartyStarted then + ExecuteDefault := true + else if (CurRound >= 0) then begin with Modes[Rounds[CurRound].Mode] do - if (CallLua(Parent, Functions.BeforeSing)) then - begin // execute default function: - - //nothing atm - { to-do : compartmentalize TSingScreen.OnShow into - functions for init of a specific part of - sing screen. - these functions should be called here before - sing screen is shown, or it should be called - by plugin if it wants to define a custom - singscreen start up. } - - //set correct playersplay - if (bPartyGame) then - PlayersPlay := Length(Teams); - end; + ExecuteDefault := (CallLua(Parent, Functions.BeforeSing)); + end + else + ExecuteDefault := true; + + // execute default function: + if ExecuteDefault then + begin + //nothing atm + { to-do : compartmentalize TSingScreen.OnShow into + functions for init of a specific part of + sing screen. + these functions should be called here before + sing screen is shown, or it should be called + by plugin if it wants to define a custom + singscreen start up. } + + //set correct playersplay + if (bPartyGame) then + PlayersPlay := Length(Teams); end; end; procedure TPartyGame.CallOnSing; + var + ExecuteDefault: boolean; begin - if (CurRound >= 0) then + if not bPartyStarted then + ExecuteDefault := true + else if (CurRound >= 0) then begin with Modes[Rounds[CurRound].Mode] do - if (CallLua(Parent, Functions.OnSing)) then - begin // execute default function: + ExecuteDefault := (CallLua(Parent, Functions.OnSing));; + end + else + ExecuteDefault := true; - //nothing atm - end; + // execute default function: + if ExecuteDefault then + begin + //nothing atm end; end; procedure TPartyGame.CallAfterSing; + var + ExecuteDefault: boolean; begin - if (CurRound >= 0) then + if not bPartyStarted then + ExecuteDefault := true + else if (CurRound >= 0) then begin with Modes[Rounds[CurRound].Mode] do - if (CallLua(Parent, Functions.AfterSing)) then - begin // execute default function: - - if (bPartyGame) then - // display party score screen - Display.FadeTo(@ScreenPartyScore) - else //display standard score screen - Display.FadeTo(@ScreenScore); - end; + ExecuteDefault := (CallLua(Parent, Functions.AfterSing)); + end + else + ExecuteDefault := true; + + // execute default function: + if ExecuteDefault then + begin + if (bPartyGame) then + // display party score screen + Display.FadeTo(@ScreenPartyScore) + else //display standard score screen + Display.FadeTo(@ScreenScore); end; end; |