Advertisement
blurose

GrabTrSlideGfxData

Sep 26th, 2022
884
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.29 KB | None | 0 0
  1. /*
  2.  
  3. - in rom.ld:
  4. TrainerBTrTypeGet = 0x0207280C | 1;
  5.  
  6.  
  7. - in hooks:
  8. arm9 GrabTrSlideGfxData_hook 08070D40 5
  9.  
  10.  
  11. - in an asm/*.s file:
  12. GrabTrSlideGfxData_hook:
  13. ldr r5, =GrabTrSlideGfxData_return_address
  14. mov r6, lr
  15. str r6, [r5]
  16. pop {r5-r6}
  17. bl GrabTrSlideGfxData
  18. ldr r1, =GrabTrSlideGfxData_return_address
  19. ldr r1, [r1]
  20. mov pc, r1
  21.  
  22. .pool
  23.  
  24. GrabTrSlideGfxData_return_address:
  25. .word 0
  26.  
  27.  
  28. - in bytereplacement:
  29. # trainer tone skin slide func setup, GrabTrSlideGfxData
  30. arm9 08070D3C 60 B4 C0 46
  31.  
  32.  
  33. - in a c file:
  34.  
  35. */
  36.  
  37. struct tr_gfx_data
  38. {
  39.     u32 arcID;
  40.     u32 ncgrID;
  41.     u32 nclrID;
  42.     u32 ncerID;
  43.     u32 nanrID;
  44.     u32 ncbrID;
  45. };
  46.  
  47. void GrabTrSlideGfxData(int trtype, int dir, int unsure, struct tr_gfx_data *tcg)
  48. {
  49.     if (dir == 2) // front sprites
  50.     {
  51.         tcg->arcID = 58;
  52.         tcg->ncgrID = 0 + trtype*5;
  53.         tcg->nclrID = 1 + trtype*5;
  54.         tcg->ncerID = 2 + trtype*5;
  55.         tcg->nanrID = 3 + trtype*5;
  56.         tcg->ncbrID = 4 + trtype*5;
  57.     }
  58.     else // back sprites
  59.     {
  60.         tcg->arcID = 6;
  61.         trtype = TrainerBTrTypeGet(trtype, unsure);
  62.         tcg->ncgrID = 0 + trtype*5;
  63.         tcg->nclrID = 1 + trtype*5;
  64.         tcg->ncerID = 2 + trtype*5;
  65.         tcg->nanrID = 3 + trtype*5;
  66.         tcg->ncbrID = 4 + trtype*5;
  67.     }
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement