Skip to content

Commit

Permalink
UPDATE 20220505
Browse files Browse the repository at this point in the history
  • Loading branch information
Curilang committed May 6, 2022
1 parent 70ff1e9 commit b83c3e1
Show file tree
Hide file tree
Showing 31 changed files with 884 additions and 520 deletions.
Original file line number Diff line number Diff line change
@@ -1,83 +1,183 @@
--Thank you for using this project.
--Please consider all the effort that has been made, so remember to play fair.
--Enjoy! See you later alligator.
--Author: Enciso0720
--Last Update: 20220126

------- CHARACTER BPM SYNC -------

local function CharaAnimRate(self)
local SPos = GAMESTATE:GetSongPosition()
local mRate = GAMESTATE:GetSongOptionsObject("ModsLevel_Current"):MusicRate()
local bpm = round(GAMESTATE:GetSongBPS() * 60 * mRate, 3)
local spdRate = 1

if bpm <= 130 and GetUserPref("CharacterSync") == "BPM Sync" then
spdRate = (0.00388*bpm)+0.400
end

if _VERSION ~= 5.3 and HasVideo() and VideoStage() then
if not SPos:GetFreeze() and not SPos:GetDelay() then
spdRate = spdRate
else
spdRate = 0.1
end
end

self:SetUpdateRate(spdRate)
end

local t = Def.ActorFrame{};

Character_1 = GAMESTATE:GetCharacter(PLAYER_1):GetDisplayName()
Character_2 = GAMESTATE:GetCharacter(PLAYER_2):GetDisplayName()
------- READ SELECTED CHARACTER -------

for pn in ivalues(GAMESTATE:GetEnabledPlayers()) do
if not GAMESTATE:IsDemonstration() then
if GetUserPref("SelectCharacter"..pn) == "Random" then
GAMESTATE:SetCharacter(pn,GetUserPref("CharaRandom"..pn))
else
GAMESTATE:SetCharacter(pn,GetUserPref("SelectCharacter"..pn))
end
else
local DemoChara = GetAllCharacterNames()
table.remove(DemoChara,IndexKey(DemoChara,"Random"))
table.remove(DemoChara,IndexKey(DemoChara,"None"))
GAMESTATE:SetCharacter(pn,DemoChara[math.random(#DemoChara)])
end
end

------- CHARACTER ORDER -------

Listed = {
GAMESTATE:GetCharacter(PLAYER_1):GetDisplayName(),
GAMESTATE:GetCharacter(PLAYER_2):GetDisplayName(),
GetUserPref("Mate1"),
GetUserPref("Mate2"),
GetUserPref("Mate3"),
}

if (GAMESTATE:IsPlayerEnabled(PLAYER_1)) and (not BothPlayersEnabled()) then
table.remove(Listed,2)
elseif (GAMESTATE:IsPlayerEnabled(PLAYER_2)) and (not BothPlayersEnabled()) then
table.remove(Listed,1)
end

for i=1,#Listed do
for i=1,#Listed do
if Listed[i] == "None" then
table.remove(Listed,IndexKey(Listed,"None"))
end
if Listed[i] == "Random" then
local CharaRandom = GetAllCharacterNames()
table.remove(CharaRandom,IndexKey(CharaRandom,"Random"))
table.remove(CharaRandom,IndexKey(CharaRandom,"None"))
Listed[i]=CharaRandom[math.random(#CharaRandom)]
end
end
end

------- GENDER AND SIZE CHECK -------

function CharacterInfo(Read,pn)
local CharaCfg = GAMESTATE:GetCharacter(pn):GetCharacterDir().."CharacterInfo.cfg";
function CharacterInfoo(Chara,Read)
local CharaCfg = "/Characters/"..Chara.."/character.ini";
local Info = Config.Load(Read,CharaCfg)
return Info
end


function CharaCfg(player)
if FILEMAN:DoesFileExist(GAMESTATE:GetCharacter(player):GetCharacterDir().."CharacterInfo.cfg") then
function NewChara(Chara)
if CharacterInfoo("Size",Chara) ~= nil then
return true
else
return false
end
end

Gender = {}
Size = {}

------- CHARACTER SIZE & GENRE-------

for i=1,#Listed do
Gender[i]=CharacterInfoo(Listed[i],"Genre")
Size[i]=CharacterInfoo(Listed[i],"Size")
end

if CharaCfg(PLAYER_1) then
CharacterSize1=tonumber(CharacterInfo("Size",PLAYER_1))
Char1_Gen=CharacterInfo("Genre",PLAYER_1)
else
CharacterSize1=0.81
------- DANCEROUTINES-------

t[#t+1] = LoadActor("/Characters/DanceRepo/DRoutines.lua")

------- CHARACTER POSITION -------

if #Listed == 1 then
PositionX={0}
PositionZ={0}
elseif #Listed == 2 then
PositionX={7,-7}
PositionZ={0,0}
elseif #Listed == 3 and BothPlayersEnabled() then
PositionX={10,-10,0}
PositionZ={-2,-2,6}
elseif #Listed == 3 and not BothPlayersEnabled() then
PositionX={0,10,-10}
PositionZ={-2,6,6}
elseif #Listed == 4 then
PositionX={7,-7,15,-15}
PositionZ={-2,-2,9,9}
elseif #Listed == 5 then
PositionX={8,-8,17,0,-17}
PositionZ={-2,-2,9,9,9}
end


if CharaCfg(PLAYER_2) then
CharacterSize2=tonumber(CharacterInfo("Size",PLAYER_2))
Char2_Gen=CharacterInfo("Genre",PLAYER_2)
------- ... JUST BECAUSE XD -------

local SongLength = GAMESTATE:GetCurrentSong():MusicLengthSeconds()
local MotionLength = MotionsLenght[IndexKey(MotionsLenght,Motion)+1]
if MotionLength ~= nil and (MotionLength-2) > SongLength then
Delta = MotionLength - SongLength
Position=(math.random(0,Delta)/math.random(1,3))
else
CharacterSize2=0.81
Position = 0
end

------- DANCEROUTINE LOADER -------
------- MODEL LOAD -------

t[#t+1] = LoadActor("/Characters/DanceRepo/DanceRoutines.lua")
for i=1,#Listed do

------- CHARACTER LOAD -------

if AnyoneHasChar() then
for player in ivalues(PlayerNumber) do
if CharaCfg(PLAYER_1) and CharaCfg(PLAYER_2)
then
BonesToLoad1=GAMESTATE:GetCharacter(player):GetCharacterDir().."Dance/"..Char1_Gen.." "..Choreo..".redir"
BonesToLoad2=GAMESTATE:GetCharacter(player):GetCharacterDir().."Dance/"..Char2_Gen.." "..Choreo..".redir"
else
BonesToLoad1=GAMESTATE:GetCharacter(player):GetDanceAnimationPath()
BonesToLoad2=GAMESTATE:GetCharacter(player):GetDanceAnimationPath()
end

------- MODEL LOAD -------

if GAMESTATE:IsPlayerEnabled(player) and GAMESTATE:GetCharacter(player):GetDisplayName() ~= "default" then
t[#t+1] = Def.Model {
Meshes=GAMESTATE:GetCharacter(player):GetModelPath(),
Materials=GAMESTATE:GetCharacter(player):GetModelPath(),
Bones=(player == PLAYER_1 and BonesToLoad1) or BonesToLoad2,
OnCommand=function(self)
self:cullmode("CullMode_None")
if BothPlayersEnabled() then
self:x( (player == PLAYER_1 and 7) or -7 )
:zoom( (player == PLAYER_1 and CharacterSize1) or CharacterSize2)
:queuecommand("UpdateRate")
else
self:x(0):zoom( (player == PLAYER_1 and CharacterSize1) or CharacterSize2)
self:queuecommand("UpdateRate")
end
end,
};
end
if tonumber(CharacterInfoo(Listed[i],"Size")) <= 0.5 then
ShadowModel = "Model_Small.txt"
else
ShadowModel = "Model.txt"
end
end

t[#t + 1] = Def.ActorFrame {
OnCommand = function(self)
self:queuecommand('Animate')
end,
AnimateCommand = function(self)
self:SetUpdateFunction(CharaAnimRate)
end,
Def.Model {
Meshes="/Characters/"..Listed[i].."/model.txt",
Materials="/Characters/"..Listed[i].."/model.txt",
Bones="/Characters/DanceRepo/"..Gender[i].." "..Motion..".txt",
OnCommand=function(self)
self:cullmode("CullMode_None")
:zoom(Size[i])
:x(PositionX[i]):z(PositionZ[i])
:position(Position)
end,
};
Def.Model {
Meshes="/Characters/DanceRepo/Shadow/"..ShadowModel,
Materials="/Characters/DanceRepo/Shadow/Model.txt",
Bones="/Characters/DanceRepo/Shadow/Dance/"..Gender[i].." "..Motion..".txt",
OnCommand=function(self)
self:cullmode("CullMode_None")
:zoom(Size[i])
:x(PositionX[i]):z(PositionZ[i])
:position(Position)
end,
};
}

end

return t;
Original file line number Diff line number Diff line change
@@ -1,43 +1,31 @@
--Thank you for using this project.
--Please consider all the effort that has been made, so remember to play fair.
--Enjoy! See you later alligator.
--Author: Enciso0720
--Last Update: 20220126

local StagesFolder="/DanceStages/"
local HasVideo = FILEMAN:DoesFileExist(GAMESTATE:GetCurrentSong():GetMusicPath():sub(1, -4).."avi") == false and FILEMAN:DoesFileExist(GAMESTATE:GetCurrentSong():GetMusicPath():sub(1, -4).."mp4") == false

local t = Def.ActorFrame{
SPos = GAMESTATE:GetSongPosition();

OnCommand=function(self)
self:Center():fov(gFOV());
Camera = self
Camera:SetUpdateFunction(SlowMotion)
if not (HasVideo() and _VERSION ~= "Lua 5.3") then Camera:SetUpdateFunction(SlowMotion) end
end;
};

if HasVideo then


------- DANCESTAGE LOADER -------
------- DANCESTAGE DEMO -------

local DanceStagesDir = FILEMAN:GetDirListing("/DanceStages/", true, false)
local DanceStageSelectedNumber = tonumber(GetUserPref("OptionRowStage"))

DanceStage = DanceStageSong()
if ReadPrefFromFile("OptionRowStage") ~= nil then
if DanceStageSelectedNumber == 1 then
DanceStage = DanceStageSong()
elseif DanceStageSelectedNumber == 2 then
DanceStage = DanceStagesDir[math.random(#DanceStagesDir)]
else
DanceStage = DanceStagesDir[tonumber(GetUserPref("OptionRowStage"))-2]
end;
end;
------- DANCESTAGE CONFIGURATOR -------

function CheckStageConfigurationNumber(def,conf)
local result = def or 0
local filetoload = StagesFolder..DanceStage.."/MapCfg.cfg";
local content = Config.Load(conf,filetoload)
if content then result = tonumber(content) end
return result
if GAMESTATE:IsDemonstration() then
DanceStage = DanceStageSong()
end

------- DANCESTAGE LOADER -------

if (VideoStage() and GAMESTATE:GetCurrentSong():HasBGChanges()) or (not GAMESTATE:GetCurrentSong():HasBGChanges()) then

------- DANCESTAGE LOADER 1 -------

t[#t+1] = LoadActor(StagesFolder..DanceStage.."/LoaderA.lua" )
Expand All @@ -54,42 +42,41 @@ end

------- CAMERA -------

t[#t+1] = LoadActor(StagesFolder..DanceStage.."/Cameras.lua" )
t[#t+1] = LoadActor(StagesFolder..DanceStage.."/Cameras.lua" )


CamRan=1
local CameraRandomList = {}
CamRan=1
local CameraRandomList = {}

for i = 1, NumCameras do
CameraRandomList[i] = i
end
for i = 1, NumCameras do
CameraRandomList[i] = i
end

for i = 1, NumCameras do
local CamRandNumber = math.random(1,NumCameras)
local TempRand = CameraRandomList[i]
CameraRandomList[i] = CameraRandomList[CamRandNumber]
CameraRandomList[CamRandNumber] = TempRand
end


t[#t+1] = Def.Quad{
OnCommand=function(self)
self:visible(false)
:queuemessage("Camera"..CameraRandomList[6]):sleep(WaitTime[CameraRandomList[6]]):queuecommand("TrackTime");
end;
TrackTimeCommand=function(self)
for i = 1, NumCameras do
local CamRandNumber = math.random(1,NumCameras)
local TempRand = CameraRandomList[i]
CameraRandomList[i] = CameraRandomList[CamRandNumber]
CameraRandomList[CamRandNumber] = TempRand
end


t[#t+1] = Def.Quad{
OnCommand=function(self)
self:visible(false)
:queuemessage("Camera"..CameraRandomList[6]):sleep(WaitTime[CameraRandomList[6]]):queuecommand("TrackTime");
end;
TrackTimeCommand=function(self)
DEDICHAR:SetTimingData()
self:sleep(1/60)
self:queuemessage("Camera"..CameraRandomList[CamRan]):sleep(WaitTime[CameraRandomList[CamRan]])
CurrentStageCamera = CurrentStageCamera
CamRan=CamRan+1
if CamRan==NumCameras then
CamRan = 1
end
self:queuecommand("TrackTime")
end,
};

CurrentStageCamera = CurrentStageCamera
CamRan=CamRan+1
if CamRan==NumCameras then
CamRan = 1
end
self:queuecommand("TrackTime")
end,
};
end;

return t;
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@ maskfile = maskfile[short_pn]

local versus_y = {
P1 = -130,
P2 = 220
P2 = 230
}
versus_y = versus_y[short_pn]

local t = Def.ActorFrame{};

local charComboA = "/Characters/"..GAMESTATE:GetCharacter(pn):GetDisplayName().."/Cut-In/comboA.png";
local charComboB = "/Characters/"..GAMESTATE:GetCharacter(pn):GetDisplayName().."/Cut-In/comboB.png";
local charCombo100 = "/Characters/"..GAMESTATE:GetCharacter(pn):GetDisplayName().."/Cut-In/combo100.png";
local charCircles = "/Characters/"..GAMESTATE:GetCharacter(pn):GetDisplayName().."/Cut-In/Tex_0035.png";
local charColor = "/Characters/"..GAMESTATE:GetCharacter(pn):GetDisplayName().."/Cut-In/Tex_0036.png";
local charLight = "/Characters/"..GAMESTATE:GetCharacter(pn):GetDisplayName().."/Cut-In/Tex_0037.png";
local charComboA = "/Characters/"..WhichRead(pn).."/Cut-In/comboA.png";
local charComboB = "/Characters/"..WhichRead(pn).."/Cut-In/comboB.png";
local charCombo100 = "/Characters/"..WhichRead(pn).."/Cut-In/combo100.png";
local charCircles = "/Characters/"..WhichRead(pn).."/Cut-In/Tex_0035.png";
local charColor = "/Characters/"..WhichRead(pn).."/Cut-In/Tex_0036.png";
local charLight = "/Characters/"..WhichRead(pn).."/Cut-In/Tex_0037.png";

t[#t+1] = Def.ActorFrame{
ComboChangedMessageCommand=function(self, params)
Expand Down
Loading

0 comments on commit b83c3e1

Please sign in to comment.