Advertisement
fggkyle

Untitled

Aug 18th, 2020
243
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.91 KB | None | 0 0
  1. /*
  2. * File: z_en_weather_tag.c
  3. * Overlay: ovl_En_Weather_Tag
  4. * Description: Proximity Rain/Weather Effects
  5. */
  6.  
  7. #include "z_en_weather_tag.h"
  8. #include "vt.h"
  9.  
  10. #define FLAGS 0x00000010
  11.  
  12. #define THIS ((EnWeatherTag*)thisx)
  13.  
  14. void EnWeatherTag_Init(Actor* thisx, GlobalContext* globalCtx);
  15. void EnWeatherTag_Destroy(Actor* thisx, GlobalContext* globalCtx);
  16. void EnWeatherTag_Update(Actor* thisx, GlobalContext* globalCtx);
  17.  
  18. void func_80B31658(EnWeatherTag* this, GlobalContext* globalCtx);
  19. void func_80B31700(EnWeatherTag* this, GlobalContext* globalCtx);
  20. void func_80B31850(EnWeatherTag* this, GlobalContext* globalCtx);
  21. void func_80B31924(EnWeatherTag* this, GlobalContext* globalCtx);
  22. void func_80B317A8(EnWeatherTag* this, GlobalContext* globalCtx);
  23. void func_80B31A10(EnWeatherTag* this, GlobalContext* globalCtx);
  24. void func_80B31B24(EnWeatherTag* this, GlobalContext* globalCtx);
  25. void func_80B31C20(EnWeatherTag* this, GlobalContext* globalCtx);
  26. void func_80B316B0(EnWeatherTag* this, GlobalContext* globalCtx);
  27. void func_80B31758(EnWeatherTag* this, GlobalContext* globalCtx);
  28. void func_80B31800(EnWeatherTag* this, GlobalContext* globalCtx);
  29. void func_80B318C0(EnWeatherTag* this, GlobalContext* globalCtx);
  30. void func_80B319A0(EnWeatherTag* this, GlobalContext* globalCtx);
  31. void func_80B31AA0(EnWeatherTag* this, GlobalContext* globalCtx);
  32. void func_80B31CC0(EnWeatherTag* this, GlobalContext* globalCtx);
  33.  
  34. const ActorInit En_Weather_Tag_InitVars = {
  35. ACTOR_EN_WEATHER_TAG,
  36. ACTORTYPE_PROP,
  37. FLAGS,
  38. OBJECT_GAMEPLAY_KEEP,
  39. sizeof(EnWeatherTag),
  40. (ActorFunc)EnWeatherTag_Init,
  41. (ActorFunc)EnWeatherTag_Destroy,
  42. (ActorFunc)EnWeatherTag_Update,
  43. NULL,
  44. };
  45.  
  46. void func_80B31020(EnWeatherTag* this, EnWeatherTagActionFunc actionfunc) {
  47. this->actionfunc = actionfunc;
  48. }
  49.  
  50. void EnWeatherTag_Destroy(Actor* thisx, GlobalContext* globalCtx) {
  51. }
  52.  
  53. void EnWeatherTag_Init(Actor* thisx, GlobalContext* globalCtx) {
  54. EnWeatherTag* this = THIS;
  55. u32 temp_v0;
  56.  
  57. this->actor.flags &= ~1;
  58.  
  59. switch (this->actor.params & 0xF) {
  60. case 0:
  61. osSyncPrintf("\n\n");
  62. //"☆☆☆☆☆ (;o;) About ☆☆☆☆☆☆"
  63. osSyncPrintf(VT_FGCOL(YELLOW) "☆☆☆☆☆ (;o;) くらいよー ☆☆☆☆☆ \n" VT_RST);
  64. func_80B31020(this, func_80B31658);
  65. break;
  66. case 1:
  67. osSyncPrintf("\n\n");
  68. //"☆☆☆☆☆ Cloudy (._.) Ah Melancholy ☆☆☆☆☆"
  69. osSyncPrintf(VT_FGCOL(YELLOW) "☆☆☆☆☆ くもり (._.) あーあ 憂鬱 ☆☆☆☆☆ \n" VT_RST);
  70. if (Flags_GetEventChkInf(0x18)) {
  71. Actor_Kill(&this->actor);
  72. }
  73. func_80B31020(this, func_80B31700);
  74. break;
  75. case 2:
  76. osSyncPrintf("\n\n");
  77. //"☆☆☆☆☆ Yukigafuru You won't come (._.) ☆☆☆☆☆"
  78. osSyncPrintf(VT_FGCOL(YELLOW) "☆☆☆☆☆ ゆきがふるー あなたはこないー (._.) ☆☆☆☆☆ \n" VT_RST);
  79.  
  80. if (gSaveContext.eventChkInf[4] & 0x400) {
  81. Actor_Kill(&this->actor);
  82. }
  83. func_80B31020(this, func_80B31850);
  84. break;
  85. case 3:
  86. osSyncPrintf("\n\n");
  87. //"☆☆☆☆☆ Wow wa wa na wa saa ki ha (^o^) ☆☆☆☆☆"
  88. osSyncPrintf(VT_FGCOL(YELLOW) "☆☆☆☆☆ わわわわー なーがーさーきーはー (^o^) ☆☆☆☆☆ \n" VT_RST);
  89.  
  90. if (gSaveContext.eventChkInf[4] & 0x400) {
  91. Actor_Kill(&this->actor);
  92. }
  93. func_80B31020(this, func_80B31924);
  94. break;
  95. case 4:
  96. osSyncPrintf("\n\n");
  97. //"☆☆☆☆☆ Cloudy (._.) Ah Melancholy ☆☆☆☆☆"
  98. osSyncPrintf(VT_FGCOL(YELLOW) "☆☆☆☆☆ くもり (._.) あーあ 憂鬱 ☆☆☆☆☆ \n" VT_RST);
  99. if (gSaveContext.eventChkInf[4] & 0x200) {
  100. Actor_Kill(&this->actor);
  101. }
  102. func_80B31020(this, func_80B317A8);
  103. break;
  104. case 5:
  105. osSyncPrintf("\n\n");
  106. //"☆☆☆☆☆ Cloudy Rain Thunder (;O;) Uo Melancholy ☆☆☆☆☆"
  107. osSyncPrintf(VT_FGCOL(YELLOW) "☆☆☆☆☆ くもり雨雷 (;O;) うおお 憂鬱 ☆☆☆☆☆ \n" VT_RST);
  108.  
  109. temp_v0 = gSaveContext.eventChkInf[4];
  110. if (((((temp_v0 & 0x100) == 0) || ((temp_v0 & 0x200) == 0)) || ((temp_v0 & 0x400) == 0)) ||
  111. CHECK_QUEST_ITEM(QUEST_MEDALLION_SHADOW)) {
  112. Actor_Kill(&this->actor);
  113. }
  114. func_80B31020(this, func_80B31A10);
  115. break;
  116. case 6:
  117. osSyncPrintf("\n\n");
  118. //"☆☆☆☆☆ The desert becomes thicker ☆☆☆☆☆"
  119. osSyncPrintf(VT_FGCOL(YELLOW) "☆☆☆☆☆ 砂漠が濃くなります ☆☆☆☆☆ \n" VT_RST);
  120. func_80B31020(this, func_80B31B24);
  121. break;
  122. case 7:
  123. osSyncPrintf("\n\n");
  124. //"☆☆☆☆☆ Wow wa wa na wa saa ki ha (^o^) ☆☆☆☆☆"
  125. osSyncPrintf(VT_FGCOL(YELLOW) "☆☆☆☆☆ わわわわー なーがーさーきーはー (^o^) ☆☆☆☆☆ \n" VT_RST);
  126.  
  127. func_80B31020(this, func_80B31C20);
  128. break;
  129. }
  130. }
  131.  
  132. u8 func_80B312C8(EnWeatherTag* this, GlobalContext* globalCtx, u8 arg2, u8 arg3, u8 arg4, u8 arg5, u16 arg6, u8 arg7) {
  133. s32 pad;
  134. u8 ret = 0;
  135.  
  136. Player* player = PLAYER;
  137.  
  138. if (func_8002DB8C(&player->actor, &this->actor) < (this->actor.params >> 8) * 100.0f) {
  139. if ((globalCtx->envCtx.unk_1E != 0) ||
  140. (!D_8011FB3C || !(globalCtx->skyboxId == 1 || globalCtx->envCtx.unk_1F != globalCtx->envCtx.unk_20))) {
  141. D_8011FB38 = 1;
  142. if (globalCtx->envCtx.gloomySkyEvent == 0 &&
  143. ((globalCtx->envCtx.unk_1E != 0) ||
  144. (!(globalCtx->envCtx.unk_1F == 1 || globalCtx->envCtx.unk_21 != 0)))) {
  145. D_8011FB38 = 0;
  146. if (D_8011FB30 != arg7) {
  147. D_8011FB30 = arg7;
  148. if (globalCtx->envCtx.gloomySkyEvent == 0) {
  149. globalCtx->envCtx.unk_19 = 1;
  150. globalCtx->envCtx.gloomySky = arg2;
  151. globalCtx->envCtx.unk_18 = arg3;
  152. globalCtx->envCtx.unk_1A = arg6;
  153. globalCtx->envCtx.unk_21 = 1;
  154. globalCtx->envCtx.unk_1F = arg4;
  155. globalCtx->envCtx.unk_20 = arg5;
  156. D_8011FB34 = arg5;
  157. globalCtx->envCtx.unk_24 = arg6;
  158. globalCtx->envCtx.unk_22 = globalCtx->envCtx.unk_24;
  159. }
  160. }
  161.  
  162. ret = 1;
  163. }
  164. } else {
  165. if (D_8011FB40 != 0) {
  166. gSaveContext.dayTime += 0x14;
  167. }
  168. }
  169. }
  170.  
  171. return ret;
  172. }
  173.  
  174. u8 func_80B3149C(EnWeatherTag* this, GlobalContext* globalCtx, u8 arg2, u8 arg3, u8 arg4, u8 arg5, u16 arg6) {
  175. s32 pad;
  176. u8 ret = 0;
  177. Player* player = PLAYER;
  178.  
  179. if (((((this->actor.params >> 8) * 100.0f) + 100.0f) < func_8002DB8C(&player->actor, &this->actor))) {
  180. if ((globalCtx->envCtx.unk_1E != 0) ||
  181. (!D_8011FB3C || !(globalCtx->skyboxId == 1 || globalCtx->envCtx.unk_1F != globalCtx->envCtx.unk_20))) {
  182. if ((D_8011FB38 = 1, globalCtx->envCtx.gloomySkyEvent == 0) &&
  183. ((globalCtx->envCtx.unk_1E != 0) ||
  184. (!(globalCtx->envCtx.unk_1F == 1 || globalCtx->envCtx.unk_21 != 0)))) {
  185. D_8011FB38 = 0;
  186. D_8011FB30 = 0;
  187. globalCtx->envCtx.unk_19 = 1;
  188. globalCtx->envCtx.gloomySky = arg2;
  189. globalCtx->envCtx.unk_18 = arg3;
  190. globalCtx->envCtx.unk_1A = arg6;
  191. globalCtx->envCtx.unk_21 = 1;
  192. globalCtx->envCtx.unk_1F = arg4;
  193. globalCtx->envCtx.unk_20 = arg5;
  194. D_8011FB34 = arg5;
  195. globalCtx->envCtx.unk_24 = arg6;
  196. globalCtx->envCtx.unk_22 = globalCtx->envCtx.unk_24;
  197.  
  198. ret = 1;
  199. }
  200. } else {
  201. if (D_8011FB40 != 0) {
  202. gSaveContext.dayTime += 0x14;
  203. }
  204. }
  205. }
  206. return ret;
  207. }
  208.  
  209. void func_80B31658(EnWeatherTag* this, GlobalContext* globalCtx) {
  210. if (func_80B312C8(this, globalCtx, 0, 1, 0, 3, 0x3C, 1) != 0) {
  211. func_80B31020(this, func_80B316B0);
  212. }
  213. }
  214.  
  215. void func_80B316B0(EnWeatherTag* this, GlobalContext* globalCtx) {
  216. if (func_80B3149C(this, globalCtx, 1, 0, 3, 0, 0x3C) != 0) {
  217. func_80B31020(this, func_80B31658);
  218. }
  219. }
  220.  
  221. void func_80B31700(EnWeatherTag* this, GlobalContext* globalCtx) {
  222. if (func_80B312C8(this, globalCtx, 0, 1, 0, 2, 0x64, 2) != 0) {
  223. func_80B31020(this, func_80B31758);
  224. }
  225. }
  226.  
  227. void func_80B31758(EnWeatherTag* this, GlobalContext* globalCtx) {
  228. if (func_80B3149C(this, globalCtx, 1, 0, 2, 0, 0x64) != 0) {
  229. func_80B31020(this, func_80B31700);
  230. }
  231. }
  232.  
  233. void func_80B317A8(EnWeatherTag* this, GlobalContext* globalCtx) {
  234. if (func_80B312C8(this, globalCtx, 0, 1, 0, 2, 0x3C, 2) != 0) {
  235. func_80B31020(this, func_80B31800);
  236. }
  237. }
  238.  
  239. void func_80B31800(EnWeatherTag* this, GlobalContext* globalCtx) {
  240. if (func_80B3149C(this, globalCtx, 1, 0, 2, 0, 0x3C) != 0) {
  241. func_80B31020(this, func_80B31700);
  242. }
  243. }
  244.  
  245. void func_80B31850(EnWeatherTag* this, GlobalContext* globalCtx) {
  246. if (func_80B312C8(this, globalCtx, 0, 1, 0, 2, 0x3C, 3) != 0) {
  247. globalCtx->envCtx.unk_EE[3] = 0x40;
  248. func_80B31020(this, func_80B318C0);
  249. }
  250. }
  251.  
  252. void func_80B318C0(EnWeatherTag* this, GlobalContext* globalCtx) {
  253. if (func_80B3149C(this, globalCtx, 1, 0, 2, 0, 0x3C) != 0) {
  254. globalCtx->envCtx.unk_EE[3] = 0;
  255. func_80B31020(this, func_80B31850);
  256. }
  257. }
  258.  
  259. void func_80B31924(EnWeatherTag* this, GlobalContext* globalCtx) {
  260. if (func_80B312C8(this, globalCtx, 0, 1, 0, 2, 0x64, 4) != 0) {
  261. func_80077624(globalCtx);
  262. globalCtx->envCtx.unk_EE[0] = 0x19;
  263. func_80B31020(this, func_80B319A0);
  264. }
  265. }
  266.  
  267. void func_80B319A0(EnWeatherTag* this, GlobalContext* globalCtx) {
  268. if (func_80B3149C(this, globalCtx, 1, 0, 2, 0, 0x64) != 0) {
  269. func_80077684(globalCtx);
  270. globalCtx->envCtx.unk_EE[0] = 0;
  271. func_80B31020(this, func_80B31924);
  272. }
  273. }
  274.  
  275. void func_80B31A10(EnWeatherTag* this, GlobalContext* globalCtx) {
  276. if (func_80B312C8(this, globalCtx, 0, 1, 0, 4, 0x64, 5) != 0) {
  277. func_80077624(globalCtx);
  278. globalCtx->envCtx.lightning = 1;
  279. globalCtx->envCtx.unk_EE[0] = 0x1E;
  280. func_80B31020(this, func_80B31AA0);
  281. }
  282. }
  283.  
  284. void func_80B31AA0(EnWeatherTag* this, GlobalContext* globalCtx) {
  285. if (func_80B3149C(this, globalCtx, 1, 0, 4, 0, 0x64) != 0) {
  286. func_80077684(globalCtx);
  287. globalCtx->envCtx.lightning = 2;
  288. globalCtx->envCtx.unk_EE[0] = 0;
  289. func_80B31020(this, func_80B31A10);
  290. }
  291. }
  292.  
  293. void func_80B31B24(EnWeatherTag* this, GlobalContext* globalCtx) {
  294. Player* player = PLAYER;
  295.  
  296. if (func_8002DB8C(&player->actor, &this->actor) < ((this->actor.params >> 8) * 100.0f)) {
  297. Math_SmoothScaleMaxMinS(&globalCtx->envCtx.unk_9E, -0x50, 1, 2, 1);
  298. Math_SmoothScaleMaxMinS(&globalCtx->envCtx.unk_A0, -0x7D0, 1, 0x32, 1);
  299. return;
  300. }
  301. Math_SmoothScaleMaxMinS(&globalCtx->envCtx.unk_9E, 0, 1, 1, 1);
  302. Math_SmoothScaleMaxMinS(&globalCtx->envCtx.unk_A0, 0, 1, 0x19, 1);
  303. }
  304.  
  305. void func_80B31C20(EnWeatherTag* this, GlobalContext* globalCtx) {
  306. Player* player = PLAYER;
  307.  
  308. if (func_8002DB8C(&player->actor, &this->actor) < ((this->actor.params >> 8) * 100.0f)) {
  309. func_80077624(globalCtx);
  310. globalCtx->envCtx.lightning = 1;
  311. globalCtx->envCtx.unk_EE[0] = 0x19;
  312. func_80B31020(this, func_80B31CC0);
  313. }
  314. }
  315.  
  316. void func_80B31CC0(EnWeatherTag* this, GlobalContext* globalCtx) {
  317. Player* player = PLAYER;
  318.  
  319. if ((((this->actor.params >> 8) * 100.0f) + 10.0f) < func_8002DB8C(&player->actor, &this->actor)) {
  320. func_80077684(globalCtx);
  321. globalCtx->envCtx.lightning = 2;
  322. globalCtx->envCtx.unk_EE[0] = 0;
  323. globalCtx->envCtx.unk_EE[1] = 0xA;
  324. func_80B31020(this, func_80B31C20);
  325. }
  326. }
  327.  
  328. void EnWeatherTag_Update(Actor* thisx, GlobalContext* globalCtx) {
  329. EnWeatherTag* this = THIS;
  330.  
  331. this->actionfunc(this, globalCtx);
  332. if (BASE_REG(0x19, 0) != 0) {
  333. DebugDisplay_AddObject(this->actor.posRot.pos.x, this->actor.posRot.pos.y, this->actor.posRot.pos.z,
  334. this->actor.posRot.rot.x, this->actor.posRot.rot.y, this->actor.posRot.rot.z, 1.0f, 1.0f,
  335. 1.0f, 0xFF, 0, 0xFF, 0xFF, 4, globalCtx->state.gfxCtx);
  336. }
  337. }
  338.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement