Advertisement
fig02

F Boots

Jul 6th, 2020
1,040
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.83 KB | None | 0 0
  1. The tunic/boots byte in save context is 8015E6D0 on debug.
  2. The value written here in hundo is 0xFC.
  3. That is, tunic value of 0xF (15) and tunic 0xC (12)
  4.  
  5. Link levitates with F boots because gravity is 0.
  6.  
  7. Links gravity is written to by func_8083D6EC
  8. the whole function is decomped on romans player branch:
  9. https://github.com/Roman971/oot/blob/player/src/overlays/actors/ovl_player_actor/z_player.c#L4772
  10. the important line is:
  11. this->actor.gravity = REG(68) / 100.0f;
  12.  
  13. REG(68) is gGameInfo+0x9C or 80210AAC in ram
  14.  
  15. with kokiri boots, REG(68) is 0xFF9C or -100
  16. -100 / 100 = gravity of -1.0
  17.  
  18. with iron boots, REG(68) is 0xFF60 or -160
  19. -160 / 100 = gravity of -1.6
  20.  
  21. hover boots is the same as kokiri
  22.  
  23. with F boots, REG(68) is 0
  24. 0 / 100 = gravity of 0
  25.  
  26. --------
  27.  
  28. So, where does REG(68)'s value come from?
  29.  
  30. It gets set in a function in z_player_lib: func_8008E750
  31. At a glance it seems like there is an array that contains various parameters related to the current boots.
  32. This function updated game info regs with the correct values based on "currentBoots".
  33. currentBoots is an instance variable at link+0x14F (802246FF)
  34.  
  35. interesting things to note:
  36.  
  37. currentBoots = player->currentBoots;
  38. if ((currentBoots == 0) && (LINK_IS_CHILD)) {
  39. currentBoots = 5;
  40. }
  41.  
  42. If link is child and wearing kokiri boots, the index into the "boot params" array is 5 instead of 0.
  43. My bet is that different values are used related to links walking animation, so they didnt want to use the
  44. same set of parameters as adult.
  45.  
  46. another:
  47.  
  48. } else if (currentBoots == 1) {
  49. if ((s32)(player->stateFlags1 * 0x10) < 0) {
  50. currentBoots = 4;
  51. }
  52.  
  53. If link is wearing iron boots and some state flag is set, use index 4 for boot params
  54. I dont know what that state flag is (it also needs to be rewritten as a bit mask..)
  55. My guess is a different set of params for iron boots when underwater?
  56.  
  57. Anyway,
  58. This array that im calling "boot params" is at 80125B78 on mq debug.
  59. It is an array of s16, and has a size of 0xCC bytes.
  60. Each boot type has 17 params, 0x22 bytes of data per boot index.
  61. Given that, this array has a set of params for boot index 0 - 5.
  62.  
  63. When we have F boots on, currentBoots is 0xE or 14.
  64. currentBoots is always equipped boot value - 1, because the save context variable is not 0 indexed.
  65. 14 is wayyyy out of bounds of this array.
  66.  
  67. BootParams is an array of entries that are 0x22 bytes large. 0xE * 0x22 = an offset of 0x1DC
  68. The boot params entry for F boots starts at 80125B78+0x1DC = 80125D54.
  69.  
  70. This means that the boot params entry for F boots starts in the data symbol D_80125D28 and bleeds into D_80125D68.
  71. D_80125D28 and D_80125D68 both seem to be an array of segment addresses that get indexed by age.
  72. A good guess is animation related or textures or something. Will look into it later when player is decomped.
  73.  
  74. the value used for gravity is assigned as follows:
  75.  
  76. REG(68) = params[10];
  77.  
  78. REG(68) is assigned the short at params entry + 0x14.
  79. 80125D54 + 0x14 = 80125D68
  80.  
  81. in other words, gravity gets assigned to the short at D_80125D68[0]
  82.  
  83. below is an excerpt of the data around this region. its mostly segment addresses with some entries being NULL.
  84. put in brackets [] is the 0 value that gets assigned to REG(68), which gets divided by 100 and set to gravity:
  85.  
  86. 06 02 7F 00 06 01 73 60 06 02 31 60 06 01 4D 68 06 02 7F 00 06 01 6E E8
  87. 06 02 0A 78 06 01 48 A8 06 02 5F B8 06 01 6A 98 06 02 11 B8 06 01 52 48
  88. 06 02 64 F0 06 01 73 60 [00 00] 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  89. 00 00 00 00 06 02 26 88 00 00 00 00 06 02 26 88 06 02 49 D8 06 01 54 08
  90. 06 02 81 50 06 01 75 00 06 02 49 D8 06 01 50 10 06 02 81 50 06 01 71 50
  91.  
  92. So basically, when using F boots a bunch of values in the static context are going to be assigned shorts from this array of segment addresses. Some of them are conveniently null, which allows us to have 0 gravity.
  93.  
  94. To finish off this doc i am going to list each assignment from the boot params array for kokiri boots and F boots
  95.  
  96. Kokiri Boots:
  97. REG(19) = 0x00C8
  98. REG(30) = 0x03E8
  99. REG(32) = 0x012C
  100. REG(34) = 0x0320
  101. REG(35) = 0x01F4
  102. REG(36) = 0x0190
  103. REG(37) = 0x0320
  104. REG(38) = 0x0190
  105. REG(43) = 0x0320
  106. REG(45) = 0x0226
  107. REG(68) = 0xFF9C // gravity factor -100
  108. REG(69) = 0x0258
  109. IREG(66) = 0x021C
  110. IREG(67) = 0x02EE
  111. IREG(68) = 0x007D
  112. IREG(69) = 0x0190
  113. MREG(95) = 0x00C8
  114.  
  115. F Boots:
  116. REG(19) = 0x0601
  117. REG(30) = 0x6A98
  118. REG(32) = 0x0602
  119. REG(34) = 0x11B8
  120. REG(35) = 0x0601
  121. REG(36) = 0x5248
  122. REG(37) = 0x0602
  123. REG(38) = 0x64F0
  124. REG(43) = 0x0601
  125. REG(45) = 0x7360
  126. REG(68) = 0x0000 // gravity factor 0 (also the first null entry in this area lol)
  127. REG(69) = 0x0000
  128. IREG(66) = 0x0000
  129. IREG(67) = 0x0000
  130. IREG(68) = 0x0000
  131. IREG(69) = 0x0000
  132. MREG(95) = 0x0000
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement