diff --git a/README.md b/README.md index 1f6de2c..93020d0 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,12 @@ Questions about the mod or development can be asked on our [Discord Server](http ## Settings ### Randomisations +#### Random character animations +Off by default +This will randomise each characters animation set. +#### Random pickup stars +On by default +This will randomise the colour of each items pickup star #### Random couch character On by default. If this is checked, you will get a random character sitting on the couch in the main menu. diff --git a/Randomiser/CustomFiles.ini b/Randomiser/CustomFiles.ini index 49b1f4f..f6fb301 100644 --- a/Randomiser/CustomFiles.ini +++ b/Randomiser/CustomFiles.ini @@ -12,6 +12,7 @@ */gr?i.mfk=Resources/MissionScripts/HandleMissionInit.lua */sr?l.mfk=Resources/MissionScripts/HandleMissionLoad.lua */sr?i.mfk=Resources/MissionScripts/HandleMissionInit.lua +scripts/missions/rewards.mfk=Resources/HandleRewards.lua art/l1z4.p3d=Resources/HandleLevelTERRA.lua ;art/l1r4a.p3d=Resources/HandleLevelTERRA.lua @@ -21,6 +22,7 @@ art/missions/*_doors.p3d=Resources/HandleLevelDoors.lua *CustomT.p3d=Resources/HandleLevelTERRA.lua *TERRA.p3d=Resources/HandleLevelTERRA.lua *.cho=Resources/HandleChar.lua +*_a.p3d=Resources/Handle_a.lua *.rms=Resources/HandleRMS.lua art/cars/*.p3d=Resources/HandleCarModel.lua art/frontend/scrooby/frontend.p3d=Resources/HandleFrontend.lua @@ -30,7 +32,8 @@ art/l*i*.p3d=Resources/HandleLevelInterior.lua art/chars/*_m.p3d=Resources/HandleCharModel.lua art/frontend/scrooby/resource/txtbible/srr2.p3d=Resources/CustomText.lua art/frontend/scrooby/resource/pure3d/homer*.p3d=Resources/RandomCouch.lua -art/missions/level0?/m?.p3d=Resources/HandleMissionP3D.lua +art/missions/level0?/*.p3d=Resources/HandleMissionP3D.lua +art/wrench0.p3d=Resources/HandleWrenches.lua art/missions/level0?/level.p3d=Resources/HandleLevelP3D.lua sound/scripts/car_tune.spt=Resources/HandleCarTune.lua sound/scripts/carsound.spt=Resources/HandleCarSound.lua diff --git a/Randomiser/CustomFiles.lua b/Randomiser/CustomFiles.lua index 17c1baf..c9e48d6 100644 --- a/Randomiser/CustomFiles.lua +++ b/Randomiser/CustomFiles.lua @@ -108,10 +108,15 @@ if Settings.CustomChars then end dofile(Paths.Resources .. "RandomCarTune.lua") + if Settings.RandomDialogue then dofile(Paths.Resources .. "RandomDialogue.lua") end +if Settings.RandoPickupStars then + dofile(Paths.Resources .. "InitStars.lua") +end + DebugPrint("Loaded " .. #RandomCarPoolPlayer .. " cars for the random Player pool") DebugPrint("Loaded " .. #RandomCarPoolTraffic .. " cars for the random Traffic pool") DebugPrint("Loaded " .. #RandomCarPoolMission .. " cars for the random Mission pool") diff --git a/Randomiser/CustomFiles/art/chars/choreo.cho b/Randomiser/CustomFiles/art/chars/choreo.cho new file mode 100644 index 0000000..9917a10 --- /dev/null +++ b/Randomiser/CustomFiles/art/chars/choreo.cho @@ -0,0 +1,515 @@ +//--------------------------------------------------------------------------- +// Made with Steves Animation Pick and Mix +//--------------------------------------------------------------------------- + +// skeleton rig +rig "CHARACTER_NAME" +{ + skeleton "CHARACTER_NAME"; + + // roots + jointIndex_AIRoot 0; + jointIndex_OrientationRoot 0; + joint_MotionRoot "Motion_Root"; + joint_BalanceRoot "Balance_Root"; + joint_CharacterRoot "Character_Root"; + + // balance root + maxBalanceRootCompress 0.25; + + // legs + leg "left" + { + jointIndex_FootPlant 1; + footPlantChannelIndex 1; + + joint_FKMin "Hip_L"; + joint_FKMax "Ball_L"; + + joint_Thigh "Hip_L"; + joint_Knee "Knee_L"; + joint_Ankle "Ankle_L"; + + //joint_Effector "Left_Foot"; + //joint_PoleVector "Left_Knee"; + //joint_OrientOffset "L_Foot_O_Off"; + + isIKRigged 0; + }; + + leg "right" + { + jointIndex_FootPlant 1; + footPlantChannelIndex 0; + + joint_FKMin "Hip_R"; + joint_FKMax "Ball_R"; + + joint_Thigh "Hip_R"; + joint_Knee "Knee_R"; + joint_Ankle "Ankle_R"; + + //joint_Effector "Right_Foot"; + //joint_PoleVector "Right_Knee"; + //joint_OrientOffset "R_Foot_O_Off"; + + isIKRigged 0; + }; +}; + +// bank +bank "CHARACTER_NAME" +{ + // reference to skeleton configuration + rig "CHARACTER_NAME"; + + default animation.blendOutTime 0.1; + default animation.blendInTime 0.1; + +// SURF ANIMATIONS + + animation "surf_in" + { + animation "SURF_IN"; + }; + + animation "surf_cycle" + { + animation "SURF_CYCLE"; + }; + + animation "surf_out" + { + animation "SURF_OUT"; + }; + + animation "get_into_car" + { + animation "GET_INTO_CAR"; + }; + animation "get_into_car_open_door" + { + animation "GET_INTO_CAR_OPEN_DOOR"; + }; + animation "get_into_car_close_door" + { + animation "GET_INTO_CAR_CLOSE_DOOR"; + }; + animation "get_out_of_car" + { + animation "GET_OUT_OF_CAR"; + }; + animation "get_out_of_car_open_door" + { + animation "GET_OUT_OF_CAR_OPEN_DOOR"; + }; + animation "get_out_of_car_close_door" + { + animation "GET_OUT_OF_CAR_CLOSE_DOOR"; + }; + animation "get_into_car_close_door_high" + { + animation "GET_INTO_CAR_CLOSE_DOOR_HIGH"; + }; + animation "get_into_car_open_door_high" + { + animation "GET_INTO_CAR_OPEN_DOOR_HIGH"; + }; + animation "get_into_car_high" + { + animation "GET_INTO_CAR_HIGH"; + }; + animation "get_out_of_car_close_door_high" + { + animation "GET_OUT_OF_CAR_CLOSE_DOOR_HIGH"; + }; + animation "get_out_of_car_open_door_high" + { + animation "GET_OUT_OF_CAR_OPEN_DOOR_HIGH"; + }; + animation "get_out_of_car_high" + { + animation "GET_OUT_OF_CAR_HIGH"; + }; + + + + + + + animation "jump_idle_launch" + { + animation "JUMP_IDLE_TAKE_OFF"; + blendInTime 0.01; + + }; + animation "jump_idle" + { + animation "JUMP_IDLE_IN_AIR"; + blendInTime 0.05; + blendOutTime 0.1; + }; + animation "jump_idle_land" + { + animation "JUMP_IDLE_LAND"; + blendInTime 0.01; + }; + + + + + +animation "stomp_antic" + { + animation "STOMP_ANTIC"; + }; + +animation "stomp_in_air" + { + animation "STOMP_IN_AIR"; + }; + + + +animation "stomp_land" + { + animation "STOMP_LAND"; + }; + + +animation "jump_kick" + { + animation "JUMP_KICK"; + }; + +animation "victory_small" + { + animation "VICTORY_SMALL"; + }; + +animation "victory_large" + { + animation "VICTORY_LARGE"; + }; + + + + animation "dash" + { + animation "LOCO_DASH"; + }; + + animation "hit_switch" + { + animation "HIT_SWITCH"; + }; + animation "hit_switch_quick" + { + animation "HIT_SWITCH"; +// startFrame 3.0; +// endFrame 15.0; + blendInTime 0.05; + }; + + animation "jump_dash_in_air" + { + animation "JUMP_DASH_IN_AIR"; + blendInTime 0.5; + blendOutTime 0.05; + }; + + + animation "break" + { + animation "BREAK"; + }; + + animation "break_quick" + { + animation "BREAK"; +// startFrame 2.0; + endFrame 12.0; + blendInTime 0.08; + }; + + animation "dialogue_thinking" + { + animation "DIALOGUE_THINKING"; + }; + + animation "dialogue_hands_on_hips" + { + animation "DIALOGUE_HANDS_ON_HIPS"; + }; + + animation "dialogue_hands_in_air" + { + animation "DIALOGUE_HANDS_IN_AIR"; + }; + + animation "dialogue_shaking_fist" + { + animation "DIALOGUE_SHAKING_FIST"; + }; + + animation "dialogue_scratch_head" + { + animation "DIALOGUE_SCRATCH_HEAD"; + }; + + animation "dialogue_yes" + { + animation "DIALOGUE_YES"; + }; + + animation "dialogue_no" + { + animation "DIALOGUE_NO"; + }; + + animation "dialogue_cross_arms" + { + animation "DIALOGUE_CROSS_ARMS"; + }; + + animation "dialogue_open_arm_hand_gesture" + { + animation "DIALOGUE_OPEN_ARM_HAND_GESTURE"; + }; + + animation "dialogue_shake_hand_in_air" + { + animation "DIALOGUE_SHAKE_HAND_IN_AIR"; + }; + + animation "get_into_car_driver" + { + animation "GET_INTO_CAR_DRIVER"; + }; + animation "get_into_car_open_door_driver" + { + animation "GET_INTO_CAR_OPEN_DOOR_DRIVER"; + }; + animation "get_into_car_close_door_driver" + { + animation "GET_INTO_CAR_CLOSE_DOOR_DRIVER"; + blendInTime .1; + blendOutTime .1; + }; + animation "get_out_of_car_driver" + { + animation "GET_OUT_OF_CAR_DRIVER"; + }; + animation "get_out_of_car_open_door_driver" + { + animation "GET_OUT_OF_CAR_OPEN_DOOR_DRIVER"; + blendInTime .1; + blendOutTime .1; + }; + animation "get_out_of_car_close_door_driver" + { + animation "GET_OUT_OF_CAR_CLOSE_DOOR_DRIVER"; + }; + animation "get_into_car_close_door_high_driver" + { + animation "GET_INTO_CAR_CLOSE_DOOR_HIGH_DRIVER"; + }; + animation "get_into_car_open_door_high_driver" + { + animation "GET_INTO_CAR_OPEN_DOOR_HIGH_DRIVER"; + }; + animation "get_into_car_high_driver" + { + animation "GET_INTO_CAR_HIGH_DRIVER"; + }; + animation "get_out_of_car_close_door_high_driver" + { + animation "GET_OUT_OF_CAR_CLOSE_DOOR_HIGH_DRIVER"; + }; + animation "get_out_of_car_open_door_high_driver" + { + animation "GET_OUT_OF_CAR_OPEN_DOOR_HIGH_DRIVER"; + }; + animation "get_out_of_car_high_driver" + { + animation "GET_OUT_OF_CAR_HIGH_DRIVER"; + }; + + animation "dodge" + { + animation "npd_dodge"; + }; + + animation "flail" + { + animation "FLAIL"; + }; + + animation "get_up" + { + animation "GET_UP"; + }; + + // in car animations borrowed from ndr and nps anim sets + + animation "in_car_idle_driver" + { + animation "ndr_in_car_idle"; + blendInTime 0; + blendOutTime 0; + }; + + animation "in_car_idle" + { + animation "npd_in_car_idle"; + blendInTime 0; + blendOutTime 0; + }; + + animation "turn_left_driver" + { + animation "ndr_turn_left"; + }; + + animation "turn_right_driver" + { + animation "ndr_turn_right"; + }; + + animation "accelerate_driver" + { + animation "ndr_accelerate"; + }; + + animation "crash_driver" + { + animation "ndr_crash"; + }; + + animation "decelerate_driver" + { + animation "ndr_decelerate"; + }; + + animation "look_back_driver" + { + animation "ndr_look_back"; + }; + + animation "sway_left_driver" + { + animation "ndr_sway_left"; + }; + + animation "sway_right_driver" + { + animation "ndr_sway_right"; + }; + + animation "wave_driver" + { + animation "ndr_wave"; + }; + + animation "wave_goodbye_driver" + { + animation "ndr_wave_goodbye"; + }; + + animation "point_left" + { + animation "nps_point_left"; + }; + + animation "point_right" + { + animation "nps_point_right"; + }; + + animation "point_straight_ahead" + { + animation "nps_point_straight_ahead"; + }; + + animation "look_back" + { + animation "nps_look_back"; + }; + + animation "look_left" + { + animation "nps_look_left"; + }; + + animation "look_right" + { + animation "nps_look_right"; + }; + + animation "sway_right" + { + animation "nps_sway_right"; + }; + + animation "sway_left" + { + animation "nps_sway_left"; + }; + + animation "in_car_victory_large_driver" + { + animation "ndr_in_car_victory_large"; + }; + + animation "in_car_victory_small_driver" + { + animation "ndr_in_car_victory_small"; + }; + + animation "in_car_victory_large" + { + animation "nps_victory_large"; + }; + + animation "in_car_victory_small" + { + animation "nps_victory_small"; + }; + + animation "seatmove" + { + animation "npd_seatmove"; + blendInTime 0; + blendOutTime 0; + }; + + locomotion "walkerLoco" + { + velocityCount 4; // includes idle. + directionCount 1; + idle "LOCO_IDLE_REST"; + + blendInTime 0.1; + blendOutTime 0.1; + + priority 1; + + acceleration 50; + //turningAcceleration 1440; + //turningVelocity 720; + //turningAngleThreshold 360; + //turningTimeThreshold 0.01; + + animation "LOCO_WALK"; + + animation "LOCO_RUN"; + + animation "LOCO_DASH"; + }; + +}; + + + + +// End of file. \ No newline at end of file diff --git a/Randomiser/CustomFiles/art/chars/out.p3d b/Randomiser/CustomFiles/art/chars/out.p3d new file mode 100644 index 0000000..fb3d66b Binary files /dev/null and b/Randomiser/CustomFiles/art/chars/out.p3d differ diff --git a/Randomiser/CustomFiles/art/global0.p3d b/Randomiser/CustomFiles/art/global0.p3d new file mode 100644 index 0000000..50fa52d Binary files /dev/null and b/Randomiser/CustomFiles/art/global0.p3d differ diff --git a/Randomiser/CustomFiles/art/wrench.p3d b/Randomiser/CustomFiles/art/wrench.p3d new file mode 100644 index 0000000..c9ab44c Binary files /dev/null and b/Randomiser/CustomFiles/art/wrench.p3d differ diff --git a/Randomiser/CustomFiles/art/wrench0.p3d b/Randomiser/CustomFiles/art/wrench0.p3d new file mode 100644 index 0000000..1148dcb Binary files /dev/null and b/Randomiser/CustomFiles/art/wrench0.p3d differ diff --git a/Randomiser/Meta.ini b/Randomiser/Meta.ini index 46fb9fb..b97528a 100644 --- a/Randomiser/Meta.ini +++ b/Randomiser/Meta.ini @@ -84,6 +84,23 @@ Name=Steve Credits=1 Group=Testing + +[Setting] +Name=RandomAnims +Title=Random character animatinos +Type=TickBox +Default=0 +Tooltip=Randomise the character animation +Page=Randomisations + +[Setting] +Name=RandoPickupStars +Title=Random pickup stars +Type=TickBox +Default=1 +Tooltip=Randomise the pickup stars +Page=Randomisations + [Setting] Name=RandomCouch Title=Random couch character diff --git a/Randomiser/Resources/HandleChar.lua b/Randomiser/Resources/HandleChar.lua index ecfee99..d404812 100644 --- a/Randomiser/Resources/HandleChar.lua +++ b/Randomiser/Resources/HandleChar.lua @@ -1,7 +1,96 @@ local Path = "/GameData/" .. GetPath(); -if Settings.RandomCharacter and OrigChar and RandomChar and string.match(Path, OrigChar .. "%.cho") then +if Settings.RandomCharacter and OrigChar and RandomChar and string.match(Path, OrigChar .. "%.cho") and (not Settings.RandomAnims)then local NewFile = ReadFile(Path); NewFile = string.gsub(NewFile, "skeleton%s\"" .. OrigChar .. "\"", "skeleton \"" .. RandomChar .. "\"") Output(NewFile) +end + + +--Random Animations +function string.split(str,knife) + local t,index = {},1 + for i = 1,#str do + if str:sub(i,i) == knife then + table.insert(t,str:sub(index,i)) + index = i + elseif i == #str then + table.insert(t,str:sub(index,i)) + end + end + for k,v in pairs(t) do t[k] = v:gsub(knife,"") end + return t,#t +end + +if Settings.RandomAnims then + local CharName, l = string.split("/GameData/" .. GetPath(),"/") + CharName = CharName[l]:gsub(".cho","") + + anims = { + {"surf_in surf_cycle surf_out", "surfing"}, + {"get_into_car_close_door get_into_car_close_door get_out_of_car_open_door_high get_out_of_car_open_door get_out_of_car get_into_car_close_door get_into_car_close_door get_into_car_close_door get_into_car get_into_car_open_door get_into_car_close_door get_out_of_car" .. + "get_out_of_car_open_door get_out_of_car_close_door get_into_car_close_door_high " .. + "get_into_car_open_door_high get_into_car_high get_out_of_car_close_door_high " .. + "get_out_of_car_open_door_high get_out_of_car_high","entering and leaving vehicle passanger"}, + {"jump_idle_take_off","jump take off" }, + {"jump_idle_in_air", "jump"}, + {"jump_idle_land", "jump landing"}, + {"jump_dash_in_air", "double jump"}, + {"stomp_antic stomp_in_air stomp_land", "ground pound"}, + {"jump_kick","jump kick"}, + {"victory_small","small celebration"}, + {"victory_large", "big celebration" }, + {"loco_dash", "dash" }, + {"loco_run", "run" }, + {"loco_walk", "walk" }, + {"loco_idle_rest", "rest" }, + {"break", "kick" }, + {"hit_switch" ,"hit switch" }, + {"hit_switch_quick" ,"hit switch quickly" }, + {"jump_dash_in_air", "jump dash in air" }, + {"break","break" }, + {"dialogue_thinking", "thinking"}, + {"dialogue_hands_on_hips", "hand on hip"}, + {"dialogue_shaking_fist", "shaking fist" }, + {"dialogue_scratch_head", "scrath head" }, + {"dialogue_yes", "dialogue yes" }, + {"dialogue_no", "dialogue no" }, + {"dialogue_cross_arms", "cross arms" }, + {"dialogue_open_arm_hand_gesture", "open arm gesture" }, + {"dialogue_hands_in_air", "hands in air" }, + {"dialogue_shake_hand_in_air", "hand in air" }, + {"get_into_car_driver get_into_car_open_door_driver get_into_car_close_door_driver " .. + "get_out_of_car_driver get_out_of_car_open_door_driver get_out_of_car_close_door_driver " .. + "get_into_car_close_door_high_driver get_into_car_open_door_high_driver get_into_car_high_driver " .. + "get_out_of_car_close_door_high_driver get_out_of_car_open_door_high_driver hom_get_out_of_car_open_door_high_driver " .. + "get_out_of_car_high_driver","entering and leaving vehicle driver" }, + {"flail", "flail" }, + {"get_up", "get up" } + } + + file = ChoreoFile + if Path:sub(21,21) ~= "n" then + file = ReadFile("/GameData/art/chars/choreo.cho") + if Settings.RandomCharacter and OrigChar and RandomChar and string.match(Path, OrigChar .. "%.cho") then + file = file:gsub("CHARACTER_NAME",RandomChar) + else + file = file:gsub("CHARACTER_NAME",CharName) + end + for i = 1, #anims do + code = ({"hom_","brt_","lsa_","mrg_","apu_"})[math.random(1,5)] + if string.find(anims[i][1], " ") then + moreanims = string.split(anims[i][1]," ") + for j = 1, #moreanims do + print(moreanims[j]) + file = file:gsub("\""..moreanims[j]:upper().."\"", "\""..code..moreanims[j].."\"") + end + else + file = file:gsub("\""..anims[i][1]:upper().."\"", "\""..code..anims[i][1].."\"") + end + end + else + file = ReadFile(Path) + end + + Output(file) end \ No newline at end of file diff --git a/Randomiser/Resources/HandleMissionP3D.lua b/Randomiser/Resources/HandleMissionP3D.lua index 1a20e95..bec1129 100644 --- a/Randomiser/Resources/HandleMissionP3D.lua +++ b/Randomiser/Resources/HandleMissionP3D.lua @@ -1,55 +1,82 @@ -if not Waypoints then return end local filePath = "/GameData/" .. GetPath() -local level = filePath:lower():match("art/l(%d)") or filePath:lower():match("level0(%d)") -if RoadPositions["L" .. level] == nil then return false, nil end -local modified = false -local tbl = RoadPositions["L" .. level] local P3DFile = P3D.P3DChunk:new{Raw = ReadFile(filePath)} -for idx in P3DFile:GetChunkIndexes(P3D.Identifiers.Locator) do - local LocatorChunk = P3D.LocatorP3DChunk:new{Raw = P3DFile:GetChunkAtIndex(idx)} - if Waypoints[P3D.CleanP3DString(LocatorChunk.Name)] then - local RoadLength = math.random() * RoadPositions["L" .. level .. "Total"] - local Road = nil - for i=1,#tbl do - RoadLength = RoadLength - tbl[i].Length - Road = tbl[i] - if RoadLength <= 0 then break end - end - local RandX = math.random() - local RandY = math.random() - - local x1 = Road.BottomRight.X * RandX - local y1 = Road.BottomRight.Y * RandX - local z1 = Road.BottomRight.Z * RandX - - local x2 = Road.TopLeft.X + (Road.TopRight.X - Road.TopLeft.X) * RandX - local y2 = Road.TopLeft.Y + (Road.TopRight.Y - Road.TopLeft.Y) * RandX - local z2 = Road.TopLeft.Z + (Road.TopRight.Z - Road.TopLeft.Z) * RandX - - local x = Road.BottomLeft.X + x1 + (x2 - x1) * RandY - local y = Road.BottomLeft.Y + y1 + (y2 - y1) * RandY - local z = Road.BottomLeft.Z + z1 + (z2 - z1) * RandY - - local pos = {X = x, Y = y, Z = z} - LocatorChunk.Position = pos - local TriggerVolumeIDX = LocatorChunk:GetChunkIndex(P3D.Identifiers.Trigger_Volume) - if TriggerVolumeIDX then - local TriggerVolumeChunk = P3D.TriggerVolumeP3DChunk:new{Raw = LocatorChunk:GetChunkAtIndex(TriggerVolumeIDX)} - TriggerVolumeChunk.HalfExtents.Y = TriggerVolumeChunk.HalfExtents.Y + 3.5 - if TriggerVolumeChunk.IsRect == 0 then - TriggerVolumeChunk.HalfExtents.X = TriggerVolumeChunk.HalfExtents.X + 3.5 - TriggerVolumeChunk.HalfExtents.Z = TriggerVolumeChunk.HalfExtents.Z + 3.5 + +local function DoWayPoints () + if not Waypoints then return end + + local level = filePath:lower():match("art/l(%d)") or filePath:lower():match("level0(%d)") + if RoadPositions["L" .. level] == nil then return false, nil end + local modified = false + local tbl = RoadPositions["L" .. level] + + for idx in P3DFile:GetChunkIndexes(P3D.Identifiers.Locator) do + local LocatorChunk = P3D.LocatorP3DChunk:new{Raw = P3DFile:GetChunkAtIndex(idx)} + if Waypoints[P3D.CleanP3DString(LocatorChunk.Name)] then + local RoadLength = math.random() * RoadPositions["L" .. level .. "Total"] + local Road = nil + for i=1,#tbl do + RoadLength = RoadLength - tbl[i].Length + Road = tbl[i] + if RoadLength <= 0 then break end + end + local RandX = math.random() + local RandY = math.random() + + local x1 = Road.BottomRight.X * RandX + local y1 = Road.BottomRight.Y * RandX + local z1 = Road.BottomRight.Z * RandX + + local x2 = Road.TopLeft.X + (Road.TopRight.X - Road.TopLeft.X) * RandX + local y2 = Road.TopLeft.Y + (Road.TopRight.Y - Road.TopLeft.Y) * RandX + local z2 = Road.TopLeft.Z + (Road.TopRight.Z - Road.TopLeft.Z) * RandX + + local x = Road.BottomLeft.X + x1 + (x2 - x1) * RandY + local y = Road.BottomLeft.Y + y1 + (y2 - y1) * RandY + local z = Road.BottomLeft.Z + z1 + (z2 - z1) * RandY + + local pos = {X = x, Y = y, Z = z} + LocatorChunk.Position = pos + local TriggerVolumeIDX = LocatorChunk:GetChunkIndex(P3D.Identifiers.Trigger_Volume) + if TriggerVolumeIDX then + local TriggerVolumeChunk = P3D.TriggerVolumeP3DChunk:new{Raw = LocatorChunk:GetChunkAtIndex(TriggerVolumeIDX)} + TriggerVolumeChunk.HalfExtents.Y = TriggerVolumeChunk.HalfExtents.Y + 3.5 + if TriggerVolumeChunk.IsRect == 0 then + TriggerVolumeChunk.HalfExtents.X = TriggerVolumeChunk.HalfExtents.X + 3.5 + TriggerVolumeChunk.HalfExtents.Z = TriggerVolumeChunk.HalfExtents.Z + 3.5 + end + TriggerVolumeChunk.Matrix.M41 = pos.X + TriggerVolumeChunk.Matrix.M42 = pos.Y + TriggerVolumeChunk.Matrix.M43 = pos.Z + LocatorChunk:SetChunkAtIndex(TriggerVolumeIDX, TriggerVolumeChunk:Output()) end - TriggerVolumeChunk.Matrix.M41 = pos.X - TriggerVolumeChunk.Matrix.M42 = pos.Y - TriggerVolumeChunk.Matrix.M43 = pos.Z - LocatorChunk:SetChunkAtIndex(TriggerVolumeIDX, TriggerVolumeChunk:Output()) + P3DFile:SetChunkAtIndex(idx, LocatorChunk:Output()) + modified = true end - P3DFile:SetChunkAtIndex(idx, LocatorChunk:Output()) - modified = true end end + +if string.find(filePath, "art/missions/level0%d/m%d.p3d") then + DoWayPoints() -- I have just put this in a function because I have no idea whats going on there +end +if Settings.RandoPickupStars then + + for idx in P3DFile:GetChunkIndexes(P3D.Identifiers.Old_Billboard_Quad_Group) do + local Chunk = P3D.OldBillboardQuadGroupP3DChunk:new{Raw = P3DFile:GetChunkAtIndex(idx)} + for k,v in pairs(DefaultStars) do + local tmp = P3D.CleanP3DString(Chunk.Shader) + if string.find(tmp, v) then + local tmp_0 = math.random(1,#RandomPickupStarColours) + print("P3D",filePath.." : "..tmp.." --> "..tmp_0) + Chunk.Shader = RandomPickupStarColours[tmp_0] + P3DFile:SetChunkAtIndex(idx, Chunk:Output()) + modified = true + end + end + end +end + if modified then Output(P3DFile:Output()) end + Waypoints = nil \ No newline at end of file diff --git a/Randomiser/Resources/HandleRewards.lua b/Randomiser/Resources/HandleRewards.lua new file mode 100644 index 0000000..fb1cde4 --- /dev/null +++ b/Randomiser/Resources/HandleRewards.lua @@ -0,0 +1,3 @@ +--LoadP3DFile("art\\global0.p3d", "GMA_DEFAULT", "Global"); +Path = "/GameData/" .. GetPath(); +Output(ReadFile(Path)..'\nLoadP3DFile("art\\global0.p3d", "GMA_DEFAULT", "Global");') \ No newline at end of file diff --git a/Randomiser/Resources/HandleWrenches.lua b/Randomiser/Resources/HandleWrenches.lua new file mode 100644 index 0000000..7165939 --- /dev/null +++ b/Randomiser/Resources/HandleWrenches.lua @@ -0,0 +1,22 @@ +local filePath = "/GameData/" .. GetPath() +local P3DFile = P3D.P3DChunk:new{Raw = ReadFile(filePath)} +local modified = false + +if Settings.RandoPickupStars then + local tmp_0 = math.random(1,#RandomPickupStarColours) + for idx in P3DFile:GetChunkIndexes(P3D.Identifiers.Old_Billboard_Quad_Group) do + local Chunk = P3D.OldBillboardQuadGroupP3DChunk:new{Raw = P3DFile:GetChunkAtIndex(idx)} + local v = "wrench_pickupstar" + local tmp = P3D.CleanP3DString(Chunk.Shader) + if string.match(tmp, v) then + print("P3D",filePath.." : "..tmp.." --> "..tmp_0) + Chunk.Shader = RandomPickupStarColours[tmp_0] + P3DFile:SetChunkAtIndex(idx, Chunk:Output()) + modified = true + end + end + end + +if modified then + Output(P3DFile:Output()) +end \ No newline at end of file diff --git a/Randomiser/Resources/Handle_a.lua b/Randomiser/Resources/Handle_a.lua new file mode 100644 index 0000000..041e7c3 --- /dev/null +++ b/Randomiser/Resources/Handle_a.lua @@ -0,0 +1,8 @@ +local Path = "/GameData/" .. GetPath() + + +if Path:sub(21,21) ~= "n" then + Path = "/GameData/art/chars/out.p3d" +end + +Output(ReadFile(Path)) diff --git a/Randomiser/Resources/InitStars.lua b/Randomiser/Resources/InitStars.lua new file mode 100644 index 0000000..188c3bb --- /dev/null +++ b/Randomiser/Resources/InitStars.lua @@ -0,0 +1,21 @@ +RandomPickupStarColours = { +"pickup_particle", +"pickup_star_inner", +"pickup_star_outer_yellow", +"pickup_star_outer_lightyellow", +"pickup_star_outer_darkyellow", +"pickup_star_outer_lightbrown", +"pickup_star_outer_white", +"pickup_star_outer_gray", +"pickup_star_outer_darkgray", +"pickup_star_outer_magenta", +"pickup_star_outer_red", +"pickup_star_outer_green", +"pickup_star_outer_orange", +"pickup_star_outer_blue", +"pickup_star_outer_darkblue", +"pickup_star_outer_rainbow"} + +DefaultStars = {"yellowstar_full_m"} + +if false then table.insert(DefaultStars, "doorstar") end \ No newline at end of file diff --git a/Randomiser/Resources/MissionScripts/HandleLevelLoad.lua b/Randomiser/Resources/MissionScripts/HandleLevelLoad.lua index cc2fae1..94cf2bd 100644 --- a/Randomiser/Resources/MissionScripts/HandleLevelLoad.lua +++ b/Randomiser/Resources/MissionScripts/HandleLevelLoad.lua @@ -18,5 +18,5 @@ if MissionModules.Level then DebugPrint("Level Load File:\r\n" .. LoadFile) DebugPrint("Level Init File:\r\n" .. InitFile) end - Output(LoadFile) + Output(LoadFile.."\n"..'LoadP3DFile("art\\wrench0.p3d");') end \ No newline at end of file