world_settings.lua 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. -- Settings of the world map that are meant to be edited.
  2. local BLOCK = 8182 / 4096 -- units of a mesh block (a map block is 2 of them)
  3. local BASE = BLOCK * 0.45 -- the speed that the game has by default for walking
  4. --- Movement speeds, in world units per second (about 0.9 is the default walking speed).
  5. -- A name that is removed uses the default of the module (walking 0.9, the vehicles twice that).
  6. local speed = {
  7. walk = BASE,
  8. chocobo = BASE * 1.5,
  9. buggy = BASE * 1.2,
  10. tiny_bronco = BASE * 1.2,
  11. -- The Highwind and the submarine (in WM2 and when diving) when they move forward.
  12. highwind = BASE * 2,
  13. submarine = BASE * 1.2,
  14. }
  15. -- The camera that the module had: 2.7 units from the vehicle, 33.7 degrees over the ground (the offset
  16. -- 1.5 up and 2.25 back). It is the distance that was good for the fastest vehicle.
  17. local DISTANCE = 2.0
  18. local PITCH = 33.7
  19. -- A bit more parallel to the ground, for the vehicles that fly.
  20. local FLIGHT_PITCH = 20
  21. WorldMapSettings = {
  22. speed = speed,
  23. --- World units per second for each point of SetActiveEntityMovespeed in the scenes of the Warship
  24. -- (the Warship sails at 10 to 40 in them). From ff7.exe: a mesh is 8192 units and the ship moves
  25. -- speed / 8192 of a mesh each frame, which is this value with 30 frames per second (a unit of 30 / 4096).
  26. scene_speed_unit = 30 / 4096,
  27. --- Frames of the scene scripts for each second. The distance does not depend on it (it is for each frame, in
  28. -- the exe), only how long the waits and the movement take. 15 is what the user remembers of the original.
  29. scene_fps = 15,
  30. --- Camera: distance to the vehicle (world units) and angle over the ground (degrees), by vehicle.
  31. -- submarine_underwater is the submarine in WM2 and submarine the one that floats in WM0.
  32. camera = {
  33. walk = {distance = 1.35, pitch = PITCH},
  34. chocobo = {distance = DISTANCE, pitch = PITCH},
  35. buggy = {distance = DISTANCE, pitch = PITCH},
  36. tiny_bronco = {distance = DISTANCE, pitch = PITCH},
  37. highwind = {distance = DISTANCE, pitch = FLIGHT_PITCH},
  38. submarine = {distance = DISTANCE, pitch = PITCH},
  39. submarine_underwater = {distance = DISTANCE, pitch = FLIGHT_PITCH},
  40. -- The entity of a scripted scene (the Warship).
  41. scene = {distance = 1.25, pitch = 25},
  42. },
  43. --- Music of the world map (the logic is in world_music.lua). Numbers are the tracks of game/audio/music.
  44. -- Written from the description of the game by the user, and from the scripts of the world (wm0.lua);
  45. -- the pieces that are not known yet are marked TODO and are the ones to fix.
  46. music = {
  47. -- On foot (and the vehicles that have no music of their own).
  48. default = 13, -- world_map
  49. -- TODO: the track that replaces the default after some point of disc two (70, world_map_danger),
  50. -- and the value of the story counter (ReadWord(0)) where it starts. nil means it never starts.
  51. danger = 70,
  52. danger_from_story = nil,
  53. -- The Chocobo always has its own track (assumed, not checked).
  54. chocobo = 50, -- chocobo_ride
  55. -- The Highwind (WM0) has its own track, except when the music is an override of the story or
  56. -- when cloud_away() is true.
  57. highwind = 46, -- airship
  58. -- TODO: the Buggy, the Tiny Bronco and the submarine of WM0 have no known music: they use
  59. -- the default one. Put the track here when it is known (nil = the default).
  60. buggy = nil,
  61. tiny_bronco = nil,
  62. submarine = nil,
  63. -- WM2 (underwater) and WM3 (snow): one track that never changes.
  64. -- TODO: 84 and 76 are from memory (84 is the "submarine" track of the installer), check them.
  65. underwater = 84,
  66. snow = 76,
  67. --- Overrides of the story, in order of priority. The first one whose when() is true gives the
  68. -- track, and the vehicles (except the Chocobo) don't change it.
  69. overrides = {
  70. -- While the Diamond Weapon is around. The conditions are the ones of the world script that
  71. -- calls Unknown_AKAO(6) (bit 6803 set, 7212 set, 7209 not set); that 6 is guessed to mean 69.
  72. -- TODO: check that the music ends with the Diamond Weapon (what ends it, when 7209 is set?).
  73. {name = "diamond_weapon", track = 69, when = function()
  74. return ReadBit(6803) ~= 0 and ReadBit(7212) ~= 0 and ReadBit(7209) == 0
  75. end},
  76. -- Before the last visit to Midgar. The script calls Unknown_AKAO(7) when the story counter is
  77. -- exactly 1596; that 7 is guessed to mean 71.
  78. -- TODO: the real range of the story counter (it may last more than that value).
  79. {name = "before_last_midgar", track = 71, when = function()
  80. return ReadWord(0) == 1596
  81. end},
  82. },
  83. --- True while Cloud is not in the party: the Highwind doesn't change the music then.
  84. -- TODO: find out when (the story counter range, or a flag). For now it is never.
  85. cloud_away = function()
  86. return false
  87. end,
  88. },
  89. --- Which vehicles can enter the places of the map (towns, caves...). The numbers are the FIELD.TBL
  90. -- records, the first parameter of EnterFieldScene (1 Midgar, 2 Kalm, 3 the chocobo farm, 7 Junon, 15 North
  91. -- Corel, 18 Costa del Sol, 59 the northern cave...). On foot everything can be entered.
  92. entry = {
  93. --- Records that any vehicle can enter. The scripted events and the submarine station are here
  94. -- so that nothing gets stuck.
  95. -- TODO: check the list (50-52 are the ship fields, 56 the submarine station): add the other
  96. -- records that are story events and not places, if some vehicle must be able to trigger them.
  97. exempt = {[50] = true, [51] = true, [52] = true, [56] = true},
  98. --- Exceptions to "only on foot", by vehicle: records that it can enter.
  99. allowed = {
  100. chocobo = {[3] = true}, -- the chocobo farm
  101. -- Corel, Junon and Costa del Sol.
  102. -- TODO: check the records of Corel: 15 is North Corel (ncorel), 14 Mt. Corel (mtcrl_0) and 16
  103. -- the Corel desert (desert2) could be it too.
  104. buggy = {[7] = true, [15] = true, [18] = true},
  105. },
  106. --- Records that the Highwind enters when it lands on the NORTHERND_CAVE terrain (it cannot enter
  107. -- anything else, and it never enters while it is flying).
  108. highwind_landing = {[59] = true}, -- the northern cave (las0_1)
  109. },
  110. }