Advertisement
ywkls

Dynamic Swimming Music

Dec 3rd, 2019
143
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //Old Code- Uses one array slot and thus doesn't really support multiple DMaps
  2. const int SAMBA_MIDI = 79;//Chocobo silver, away!
  3.  
  4. //Check for water to see if you can swim or will drown
  5. void ScriptedSwimming(){
  6. if(ComboT(ComboAt(Link->X+8,Link->Y+8),CT_WATER)){
  7. if(Link->Item[I_FLIPPERS] ){
  8. if(!GetScriptAction(SA_RAFTING))
  9. SetScriptAction(SA_SWIMMING);
  10. }
  11. }
  12. if(GetScriptAction(SA_SWIMMING)
  13. && Game->DMapMIDI[Game->GetCurDMap()]!=SAMBA_MIDI){
  14. AotSVars[SAVED_MIDI]= Game->DMapMIDI[Game->GetCurDMap()];
  15. Game->PlayMIDI(SAMBA_MIDI);
  16. Game->DMapMIDI[Game->GetCurDMap()]=SAMBA_MIDI;
  17. }
  18. if(!ComboT(ComboAt(Link->X+4,Link->Y+4),CT_WATER)
  19. && !ComboT(ComboAt(Link->X+12,Link->Y+12),CT_WATER)
  20. && !ComboT(ComboAt(Link->X+12,Link->Y+4),CT_WATER)
  21. && !ComboT(ComboAt(Link->X+4,Link->Y+12),CT_WATER)
  22. && GetScriptAction(SA_SWIMMING)){
  23. UnSetScriptAction(SA_SWIMMING);
  24. Game->PlayMIDI(AotSVars[SAVED_MIDI]);
  25. Game->DMapMIDI[Game->GetCurDMap()]=AotSVars[SAVED_MIDI];
  26. }
  27. }
  28.  
  29. //Handle drawing while on raft
  30. void Scripted_Rafting(){
  31. if(Link->Action==LA_RAFTING)
  32. SetScriptAction(SA_RAFTING);
  33. else if(Link->Action !=LA_RAFTING && Link->Action!=LA_SCROLLING
  34. && GetScriptAction(SA_RAFTING) && AotSVars[SCROLL_COUNTER]<=0)
  35. UnSetScriptAction(SA_RAFTING);
  36. }
  37.  
  38. //Currently performing scripted action
  39. bool GetScriptAction(int action){
  40. return ((AotSVars[SCRIPT_ACTION]&action)!=0);
  41. }
  42.  
  43. //Set scripted action active
  44. void SetScriptAction(int action){
  45. if((AotSVars[SCRIPT_ACTION]&action)==0)
  46. AotSVars[SCRIPT_ACTION]|=action;
  47. }
  48.  
  49. //Deactivate script action
  50. void UnSetScriptAction(int action){
  51. if((AotSVars[SCRIPT_ACTION]&action)!=0)
  52. AotSVars[SCRIPT_ACTION]&=~action;
  53. }
  54.  
  55. //Script Action Constants
  56.  
  57. const int SA_NONE = 00000000000b;//No special action
  58. const int SA_RAFTING = 00000000100b;//Rafting
  59. const int SA_SWIMMING = 00000001000b;//Swimming
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement