aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHawkear <Hawkear@b956fd51-792f-4845-bead-9b4dfca2ff2c>2009-01-11 20:36:10 +0000
committerHawkear <Hawkear@b956fd51-792f-4845-bead-9b4dfca2ff2c>2009-01-11 20:36:10 +0000
commit859fcd3f6deff68206c3e26beba60b447042735d (patch)
tree9064c76aa13f168dbe62a219faed96c2a0913cbd
parent5d89432a90a62ec10c5a142f614916120ec1d681 (diff)
downloadusdx-svn/Lua.tar.gz
usdx-svn/Lua.tar.xz
usdx-svn/Lua.zip
Added Script-dirsvn/Luagithub/svn/Lua
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/branches/Lua@1556 b956fd51-792f-4845-bead-9b4dfca2ff2c
-rw-r--r--game/LuaCommands.odtbin17390 -> 17530 bytes
-rw-r--r--game/scripts/main.lua (renamed from game/main.lua)76
-rw-r--r--game/scripts/party/Until5000.lua46
-rw-r--r--src/base/UMain.pas6
4 files changed, 88 insertions, 40 deletions
diff --git a/game/LuaCommands.odt b/game/LuaCommands.odt
index f024b8be..223df235 100644
--- a/game/LuaCommands.odt
+++ b/game/LuaCommands.odt
Binary files differ
diff --git a/game/main.lua b/game/scripts/main.lua
index ed12d8ed..3e035bb9 100644
--- a/game/main.lua
+++ b/game/scripts/main.lua
@@ -1,38 +1,38 @@
--- Calculate FPS
-FPScounter = 1 + (FPScounter or 0) -- increment FPScounter (which is nil, when undefined, therefore "or 0")
-if os.time() > (LastTime or 0) then
- LastTime = os.time()
- print("FPS: " .. FPScounter - (LastFPScounter or 0)) -- print is only displayed, if compiled with DEBUG
- LastFPScounter = FPScounter
- -- Show the first 200 Textures
- TexNum = 1 + (TexNum or 0)
- if TexNum > 200 then TexNum = 1 end
- print("TexNum: " .. (TexNum or 0))
-end
-
--- Draw some rectangles
-gl.Enable("GL_BLEND")
-gl.Color(1, 1, 1, 0.5)
-for i = 1,10 do
- gl.Begin("GL_LINE_loop")
- gl.Vertex(0+4*i, 0+4*i);
- gl.Vertex(0+4*i, 600-4*i);
- gl.Vertex(800-4*i, 600-4*i);
- gl.Vertex(800-4*i, 0+4*i);
- gl.End()
-end
-gl.Disable("GL_BLEND")
-
--- Display a Texture
-gl.Enable("GL_BLEND")
-gl.Enable("GL_TEXTURE_2D")
-gl.Color(1, 1, 1, 1)
-gl.BindTexture("GL_TEXTURE_2D", TexNum or 0)
-gl.Begin("GL_QUADS")
-gl.TexCoord(0, 0); gl.Vertex(10, 10);
-gl.TexCoord(0, 1); gl.Vertex(10, 110);
-gl.TexCoord(1, 1); gl.Vertex(110, 110);
-gl.TexCoord(1, 0); gl.Vertex(110, 10);
-gl.End()
-gl.Disable("GL_TEXTURE_2D")
-gl.Disable("GL_BLEND")
+-- Calculate FPS
+FPScounter = 1 + (FPScounter or 0) -- increment FPScounter (which is nil, when undefined, therefore "or 0")
+if os.time() > (LastTime or 0) then
+ LastTime = os.time()
+ print("FPS: " .. FPScounter - (LastFPScounter or 0)) -- print is only displayed, if compiled with DEBUG
+ LastFPScounter = FPScounter
+ -- Show the first 200 Textures
+ TexNum = 1 + (TexNum or 0)
+ if TexNum > 200 then TexNum = 1 end
+ print("TexNum: " .. (TexNum or 0))
+end
+
+-- Draw some rectangles
+gl.Enable("GL_BLEND")
+gl.Color(1, 1, 1, 0.5)
+for i = 1,10 do
+ gl.Begin("GL_LINE_loop")
+ gl.Vertex(0+4*i, 0+4*i);
+ gl.Vertex(0+4*i, 600-4*i);
+ gl.Vertex(800-4*i, 600-4*i);
+ gl.Vertex(800-4*i, 0+4*i);
+ gl.End()
+end
+gl.Disable("GL_BLEND")
+
+-- Display a Texture
+gl.Enable("GL_BLEND")
+gl.Enable("GL_TEXTURE_2D")
+gl.Color(1, 1, 1, 1)
+gl.BindTexture("GL_TEXTURE_2D", TexNum or 0)
+gl.Begin("GL_QUADS")
+gl.TexCoord(0, 0); gl.Vertex(10, 10);
+gl.TexCoord(0, 1); gl.Vertex(10, 110);
+gl.TexCoord(1, 1); gl.Vertex(110, 110);
+gl.TexCoord(1, 0); gl.Vertex(110, 10);
+gl.End()
+gl.Disable("GL_TEXTURE_2D")
+gl.Disable("GL_BLEND")
diff --git a/game/scripts/party/Until5000.lua b/game/scripts/party/Until5000.lua
new file mode 100644
index 00000000..10d1d070
--- /dev/null
+++ b/game/scripts/party/Until5000.lua
@@ -0,0 +1,46 @@
+function InitPartyMode()
+ -- PartyModi created by users should use tables
+ Party.Mode.Name = {English = "Until 5000",
+ French = "A 5000",
+ German = "Bis 5000"}
+
+ -- PartyModi delivered with USDX should use translateable Strings
+ Party.Mode.Name = "PLUGIN_UNTIL5000_NAME"
+ Party.Mode.Description = "PLUGIN_UNTIL5000_DESC"
+
+ Party.Mode.Author = "Whiteshark & Hawkear"
+ Party.Mode.Homepage = "http://ultrastardx.sourceforge.net/"
+ Party.Mode.Version = "0.9"
+
+ Party.ShowRateBar = true
+ Party.ShowScore = true
+ Party.ShowNotes = true
+ Party.NoDuet = true -- dont sing duets - this would be unfair
+
+ -- all the other settings are at default or loaded from ini
+
+ return true
+end
+
+function Draw()
+ local i
+ for i=0,Party.Teams-1 do
+ Party.Team[i].Bar = math.floor(Party.Team[i].Score / 50)
+ Party.Team[i].Percentage = Party.Team[i].Bar
+ if Party.Team[i].Score >= 5000 then
+ return false -- end the round
+ end
+ end
+ return true -- continue with the round
+end
+
+function Finish()
+ local i
+ local winners={}
+ for i=0,Party.Teams-1 do
+ if Party.Team[i].Score >= 5000 then
+ table.insert(winners,i)
+ end
+ end
+ return winners
+end
diff --git a/src/base/UMain.pas b/src/base/UMain.pas
index 0f9daa6e..2da1ca39 100644
--- a/src/base/UMain.pas
+++ b/src/base/UMain.pas
@@ -106,6 +106,7 @@ var
FontPath: string;
ResourcesPath: string;
PlayListPath: string;
+ ScriptPath: string;
Done: Boolean;
// FIXME: ConversionFileName should not be global
@@ -475,9 +476,9 @@ begin
done := not Display.Draw;
// FIXME remove this when the Partymode works
- if FileExists('main.lua') then
+ if FileExists(ScriptPath + 'main.lua') then
begin
- if 0 <> luaL_dofile(Lua, 'main.lua') then
+ if 0 <> luaL_dofile(Lua, PAnsiChar(ScriptPath + 'main.lua')) then
begin
Log.LogError(lua_tostring(Lua,-1));
end;
@@ -1190,6 +1191,7 @@ begin
FindPath(VisualsPath, Platform.GetGameSharedPath + 'visuals', false);
FindPath(FontPath, Platform.GetGameSharedPath + 'fonts', false);
FindPath(ResourcesPath, Platform.GetGameSharedPath + 'resources', false);
+ FindPath(ScriptPath, Platform.GetGameSharedPath + 'scripts', false);
// Playlists are not shared as we need one directory to write too
FindPath(PlaylistPath, Platform.GetGameUserPath + 'playlists', true);