Guest User

Untitled

a guest
Apr 25th, 2022
30
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 50.24 KB | None | 0 0
  1. //%MGSO% DECLARATION Tango?
  2. //%MGSO% DECLARATION g
  3. //%MGSO% DECLARATION glob march
  4. //%MGSO% DECLARATION mapglobal
  5. //%MGSO% DECLARATION seeds
  6. //%MGSO% DECLARATION ddd
  7. //%MGSO% DECLARATION spalsh
  8. //%MGSO% DECLARATION old
  9. //%MGSO% DECLARATION power bracelet
  10. //%MGSO% DECLARATION moosh glob
  11. //%MGSO% DECLARATION autoghost
  12. //%MGSO% DECLARATION OG global
  13. //%MGSO% DECLARATION GB SHIELD
  14. //%MGSO% DECLARATION gasha enemy
  15. //%MGSO% DECLARATION link collide
  16. //%MGSO% DECLARATION mooshmap
  17. //%MGSO% DECLARATION platform
  18. //%MGSO% DECLARATION yargcheat
  19. //%MGSO% DECLARATION floor spinner global
  20. //%MGSO% DECLARATION globalcont
  21. //%MGSO% DECLARATION spinneronexit
  22.  
  23. //%MGSO% HEADER_START Tango?
  24.  
  25. //%MGSO% HEADER_END Tango?
  26.  
  27. //%MGSO% HEADER_START g
  28.  
  29. //%MGSO% HEADER_START glob march
  30.  
  31. //%MGSO% HEADER_START seeds
  32.  
  33. //%MGSO% HEADER_END seeds
  34.  
  35.  
  36. //%MGSO% HEADER_START mapglobal
  37.  
  38. //FlounderMAJ Custom Map Global and FFC Scripts
  39.  
  40. //---See the Manual and Quest Example for complete setup instructions---
  41.  
  42. //Import this into the ZQuest buffer along with MapHeader.zh and std.zh
  43.  
  44. //---Global---
  45. //This is the main global script for displaying maps. It sets up all the variables and calls the functions needed.
  46. //Add other code for your global script where indicated.
  47.  
  48.  
  49. //---FFCs---
  50. //The following FFC Scripts are used to create or remove marks on the maps. Place SetMarks on a screen Where you want up to 6 marks to be set.
  51. //Place UnsetMarks on a screen you will enter after obtaining an item that will unset the mark, such as a Triforce fragment.
  52. //Place BossNoReturn on a boss screen if the boss you are using doesn't set the "Enemy No Return" state for some reason.
  53.  
  54.  
  55. //Place this on the screen where you want the marks to be set on the map. The Script uses the D0 screen register of the screen where the mark
  56. //will be set. Up to 6 marks can be set at one time.
  57.  
  58. //Script Variables
  59. //D0: The Dmap where the screens to be marked reside.
  60. //D1-D6: The screens to be marked. If unused, set to -1.
  61. //D7: This is the iteration of this script. If more than 6 marks are needed, or more marks are to be set later, increment this. This prevents an
  62. //iteration of this script from running more than once. Must be at least 1.
  63. ffc script SetMarks
  64. {
  65. void run (int dmap, int s0, int s1, int s2, int s3, int s4, int s5, int setmarks)
  66. {
  67. int Sarray[6]={s0,s1,s2,s3,s4,s5};
  68. int i;
  69. while (setmarksbeenrun<setmarks-1)
  70. {
  71. Waitframe();
  72. }
  73. if (setmarksbeenrun==setmarks-1)
  74. {
  75. for (i=0; i<6; i++)
  76. {
  77. if (Sarray[i]>-1) Game->SetDMapScreenD(dmap, Sarray[i], 0, 1);
  78. Waitframe();
  79. }
  80. setmarksbeenrun++;
  81. Quit();
  82. }
  83. else Quit();
  84. }
  85. }
  86.  
  87. //Place this on a screen where you want a single mark to be unset, such as the screen you warp to after finishing a dungeon.
  88. //Marks can be unset by obtaining a certain item, like a sword, or by obtaining a certain level's specific item.
  89.  
  90. //Script Variables
  91. //D0: The item that unsets the mark. If unused, set to -1.
  92. //D1: The DMap of the marked screen.
  93. //D2: The screen to be unmarked.
  94. //D3: The Level for which the level item specified must be obtained to unset the mark. If unused, set to -1.
  95. //If using Triforce and anything other than the 8 normal triforce pieces, this may work strangely.
  96. //D4: The Level item that must be obtained. Check the LI_ constants in 'std.zh' for values. If unused, set to 0.
  97.  
  98. ffc script UnsetMarks
  99. {
  100. void run (int item0, int dmap0, int screen0, int level0, int LevelItem0)
  101. {
  102. while(Game->GetDMapScreenD(dmap0, screen0, 0)==1)
  103. {
  104. if (item0>=0&&Link->Item[item0]) {Game->SetDMapScreenD(dmap0, screen0, 0, 0); setmarksbeenrun++;}
  105. else if (level0>=0&&GetLevelItem(level0, LevelItem0)) {Game->SetDMapScreenD(dmap0, screen0, 0, 0); setmarksbeenrun++;}
  106. else Quit();
  107. Waitframe();
  108. }
  109. Quit();
  110. }
  111. }
  112.  
  113.  
  114. //---See the Manual and Quest Example for complete setup instructions---
  115. //%MGSO% HEADER_END mapglobal
  116.  
  117.  
  118. //%MGSO% HEADER_START ddd
  119.  
  120. //%MGSO% HEADER_START spalsh
  121.  
  122. //%MGSO% HEADER_END spalsh
  123.  
  124.  
  125. //%MGSO% HEADER_START old
  126.  
  127. //%MGSO% HEADER_START power bracelet
  128.  
  129.  
  130.  
  131. // global constants
  132.  
  133. const int CF_PICK = 101; // SCRIPT1, bracelet
  134.  
  135. const int SCRIPT_POWERBRACELET = 9; // set this to the ffc script slot assigned to PowerBracelet script when compiling
  136.  
  137. const int LTM_CATCHING = 135; // LTM for Link catching a block with the Power Bracelet
  138. const int LTM_PULLING = 136; // LTM for Link pulling a block with the Power Bracelet
  139. const int LTM_HOLDING = 133; // LTM for Link holding a block with the Power Bracelet
  140.  
  141. const int BLOCK_VH=4; //thrown block/bush horizontal initial velocity
  142. const int BLOCK_VV=0; //thrown block/bush vertical initial velocity
  143. const int BLOCK_DMG=8; //damage dealt to enemies by thrown block/bush
  144. const int LW_BLOCK = 31; //id of a lweapon to be used as thrown block
  145. const float BLOCK_FALL = 0.5; //gravity acceleration for block in sideview screens
  146. const int PB_PULL_TIME=15; // num of frames to wait for pickup with PB
  147. const int PB_UNDERCOMBO=0; // combo to set after picking up a block; set a negative value to have a shift of the original combo
  148.  
  149. const int SFX_PICKUP_BLOCK = 99; // sfx played when link picks up the block
  150. const int SFX_THROW_BLOCK = 100; // sfx played when the block is thrown
  151. const int SFX_CRASH_BLOCK = 101; // sfx of a block crashing
  152.  
  153. const int INV_COMBO_ID = 41; // id af an invisible combo
  154. const int INV_TILE_ID = 11661; // id af an invisible tile
  155. const int CRASH_SPR = 98; // sprite for a block crashing at ground
  156. const int BUSH_SPR = 52; // sprite for a bush crashing at ground
  157. const int LAYER_OVER = 3; // an overhead layer
  158.  
  159. const int NPC_ITEMSET = 193; // id of a dummy enemy with type different from "none"
  160.  
  161. // ------------------------------------------
  162.  
  163. // global variables
  164. bool throw_disabled;
  165. int holding_block;
  166. bool holding_bush;
  167. int link_catching;
  168.  
  169.  
  170. void PowerBracelet(){
  171. if(Link->Item[LTM_HOLDING]){
  172. if(CountFFCsRunning(SCRIPT_POWERBRACELET)==0 && holding_block>0){
  173. holding_block = 0;
  174. Link->Item[LTM_HOLDING] = false;
  175. Link->Item[LTM_CATCHING] = false;
  176. Link->Item[LTM_PULLING] = false;
  177. }
  178. }
  179. }
  180. //%MGSO% HEADER_END power bracelet
  181.  
  182.  
  183. //%MGSO% HEADER_START moosh glob
  184.  
  185. //%MGSO% HEADER_START autoghost
  186.  
  187. //%MGSO% HEADER_END autoghost
  188.  
  189.  
  190. //%MGSO% HEADER_START OG global
  191.  
  192. //%MGSO% HEADER_START link collide
  193.  
  194.  
  195. const int HEROPUSHLTM = 145; //Item that has the LTM setting for pushing.
  196. const int REALCLIMBLTM = 146; //Item that has the LTM setting for climing (all directions should be facing up).
  197. const int REALCLIMBCOMBOT = CT_SCRIPT2; //Combo type for ladders.
  198. const int HERODEFAULTSTEP = 150; //Normal step speed (150 is default ZC).
  199.  
  200. int HEROEXTRASTATE = 0;
  201. const int HX_NONE = 0;
  202. const int HX_PUSHING = 1;
  203. const int HX_CLIMBING = 2;
  204. //const int HX_SLEEPING = 3;
  205. int HEROEXTRAPREV = 0;
  206. //int HEROSLEEPTIMER;
  207. //int HEROSLEEPCURRTILE;
  208.  
  209. bool DISABLEPUSH = false;
  210.  
  211. void heroExtraStateInit() {
  212. Hero->Step = HERODEFAULTSTEP;
  213. DISABLEPUSH = false;
  214. }
  215.  
  216. void heroExtraState() {
  217. //Handle sleep on its own - commented out
  218. /*
  219. if (HEROEXTRASTATE == HX_SLEEPING) {
  220. if (HEROSLEEPTIMER == 119) {
  221. HEROEXTRAPREV = HX_SLEEPING;
  222. }
  223. if (HEROEXTRAPREV != HX_SLEEPING) {
  224. HEROSLEEPTIMER = 120;
  225. HEROSLEEPCURRTILE = SLEEPTILE;
  226. }
  227. Hero->ScriptTile = HEROSLEEPCURRTILE;
  228. NoInput();
  229. if (HEROSLEEPTIMER%8 == 0) {
  230. HEROSLEEPCURRTILE++;
  231. if (HEROSLEEPCURRTILE == SLEEPTILE+8) {
  232. HEROSLEEPCURRTILE = SLEEPTILE;
  233. }
  234. }
  235. HEROSLEEPTIMER--;
  236. if ((HEROSLEEPTIMER == 0) or (Hero->Action == LA_GOTHURTLAND)) {
  237. Hero->ScriptTile = -1;
  238. HEROEXTRASTATE = HX_NONE;
  239. HEROEXTRAPREV = HX_NONE;
  240. }
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252. }*/
  253.  
  254. //Check for the extra state conditions
  255. if ((Screen->ComboT[ComboAt(CenterLinkX(),CenterLinkY())] == REALCLIMBCOMBOT) and (Hero->Z==0)) {
  256. HEROEXTRAPREV = HEROEXTRASTATE;
  257. HEROEXTRASTATE = HX_CLIMBING;
  258. }
  259.  
  260. else if ((Hero->Pushing)
  261. and (Hero->Action == LA_WALKING)
  262. and (Hero->Z==0)
  263. and (Screen->MovingBlockX == -1)
  264. and (!DISABLEPUSH)) {
  265. //Extra if check for z4bomb / power bracelet compatibility - commented out
  266. //if ((!Hero->Item[Z4BOMBPICKLTM]) and (!Hero->Item[Z4BOMBHOLDLTM]) and (!Hero->Item[PBRACE_LTM_HOLDING])) {
  267. HEROEXTRAPREV = HEROEXTRASTATE;
  268. HEROEXTRASTATE = HX_PUSHING;
  269. //}
  270. }
  271.  
  272. else {
  273. HEROEXTRAPREV = HEROEXTRASTATE;
  274. HEROEXTRASTATE = HX_NONE;
  275. }
  276.  
  277. //Handle exiting push
  278. if ((HEROEXTRAPREV == HX_PUSHING) and (HEROEXTRASTATE != HX_PUSHING)) {
  279. Hero->Item[HEROPUSHLTM] = false;
  280. Hero->DrawXOffset = 0;
  281. Hero->DrawYOffset = 0;
  282. }
  283.  
  284. //Handle exiting climb
  285. else if ((HEROEXTRAPREV == HX_CLIMBING) and (HEROEXTRASTATE != HX_CLIMBING)) {
  286. Hero->Item[REALCLIMBLTM] = false;
  287. Hero->Step = HERODEFAULTSTEP;
  288. }
  289.  
  290. //Handle push
  291. if (HEROEXTRASTATE == HX_PUSHING) {
  292. Hero->Item[HEROPUSHLTM] = true;
  293. switch (Hero->Dir) {
  294. case DIR_RIGHT: { Hero->DrawXOffset = 3; Hero->DrawYOffset = 0; break;}
  295. case DIR_LEFT: { Hero->DrawXOffset = -3; Hero->DrawYOffset = 0; break;}
  296. case DIR_DOWN: { Hero->DrawXOffset = 0; Hero->DrawYOffset = 2; break;}
  297. }
  298. }
  299.  
  300. //Handle climb
  301. else if (HEROEXTRASTATE == HX_CLIMBING) {
  302. if (Hero->Action == LA_CHARGING) {
  303. Hero->Action = LA_WALKING;
  304. }
  305. Input->Button[CB_A] = false;
  306. Input->Button[CB_B] = false;
  307. Input->Button[CB_EX1] = false;
  308. Input->Button[CB_EX2] = false;
  309. Hero->Item[REALCLIMBLTM] = true;
  310. Hero->Step = HERODEFAULTSTEP / 2;
  311. }
  312. }
  313. //%MGSO% HEADER_END link collide
  314.  
  315. //%MGSO% HEADER_START GB SHIELD
  316.  
  317. const int SFX_GBSHIELD = 98; //Shield active SFX
  318.  
  319. int shieldItem; //Shield item to give (set by item script, reset each frame)
  320. bool shieldButton; //False = B, True = A
  321.  
  322.  
  323. //%MGSO% HEADER_END GB SHIELD
  324.  
  325. //%MGSO% HEADER_START gasha enemy
  326.  
  327. void GB_Gasha_EnemyDying(){
  328. for(int i = 1; i <= Screen->NumNPCs(); i ++){
  329.  
  330. npc nme = Screen->LoadNPC(i); //Loads the NPC
  331. if(GB_Gasha_IsDying(nme)){ //Check to see if the NPC is dying.
  332.  
  333. if(nme->Misc[GASHA_DYINGTIMER] == 14){
  334.  
  335.  
  336. for(int i = 0; i < 98; i++){
  337.  
  338. if(GB_GASHA[i] > -1) GB_GASHA[i] ++;
  339. if(Link->Item[GASHA_Ring_ID] && GASHA_Ring_ID != 0 && GB_GASHA[i] > -1) GB_GASHA[i] ++;
  340.  
  341. }
  342.  
  343.  
  344. }
  345. nme->Misc[GASHA_DYINGTIMER] ++; //Increment the NPC's dying timer
  346. }
  347. }
  348. }
  349. //%MGSO% HEADER_END gasha enemy
  350.  
  351.  
  352. //%MGSO% HEADER_START mooshmap
  353.  
  354.  
  355. //+=======================================+
  356. //| MooshMap Global Script |
  357. //+=======================================+
  358. //Combine this with any other global scripts you may be using.
  359.  
  360.  
  361. //Function to freeze the screen
  362. void MooshMap_ScreenFreeze(){
  363. ffc f1 = Screen->LoadFFC(FFC_SCREENFREEZEA);
  364. f1->Data = CMB_SCREENFREEZEA;
  365. ffc f2 = Screen->LoadFFC(FFC_SCREENFREEZEB);
  366. f2->Data = CMB_SCREENFREEZEB;
  367. }
  368.  
  369. //Function to unfreeze the screen
  370. void MooshMap_ScreenUnfreeze(){
  371. ffc f1 = Screen->LoadFFC(FFC_SCREENFREEZEA);
  372. f1->Data = 0;
  373. ffc f2 = Screen->LoadFFC(FFC_SCREENFREEZEB);
  374. f2->Data = 0;
  375. }
  376.  
  377. //Run in the first frame of the global
  378. void MooshMap_Init(){
  379. MooshMap_ScreenUnfreeze(); //If the screen is somehow frozen when starting, unfreeze
  380. MooshMap[MM_ISOPEN] = 0; //In case of F6
  381.  
  382. MooshMap[MM_LASTDMAP] = Game->GetCurDMap();
  383. MooshMap[MM_LASTSCREEN] = Game->GetCurScreen();
  384. MooshMap[MM_LASTSCREENSTATES] = MooshMap_GetAllScreenStates();
  385. }
  386.  
  387. //Run every frame in the global to run the map script
  388. void MooshMap_Update(){
  389. if(MOOSHMAP_VISITED_CARRYOVER){
  390. MooshMap_UpdateCarryover();
  391. }
  392. if(Game->DMapFlags[Game->GetCurDMap()]&(1<<DMF_ALLOWMAP)){
  393. if(MooshMap[MM_ISOPEN]){ //If the map is open
  394. if(MooshMap[MM_OPENFRAMES]>0){ //Opening animation
  395. if(MooshMap[MM_OPENFRAMES]>9){
  396. Screen->Rectangle(7, 0, 0, 255, 175, C_BLACK, 1, 0, 0, 0, true, 64);
  397. }
  398. else if(MooshMap[MM_OPENFRAMES]>6){
  399. Screen->Rectangle(7, 0, 0, 255, 175, C_BLACK, 1, 0, 0, 0, true, 64);
  400. Screen->Rectangle(7, 0, 0, 255, 175, C_BLACK, 1, 0, 0, 0, true, 64);
  401. }
  402. else if(MooshMap[MM_OPENFRAMES]>3){
  403. MooshMap_DrawAll(MooshMap[MM_SELECTEDFLOOR]);
  404. Screen->Rectangle(7, 0, 0, 255, 175, C_BLACK, 1, 0, 0, 0, true, 64);
  405. Screen->Rectangle(7, 0, 0, 255, 175, C_BLACK, 1, 0, 0, 0, true, 64);
  406. }
  407. else{
  408. MooshMap_DrawAll(MooshMap[MM_SELECTEDFLOOR]);
  409. Screen->Rectangle(7, 0, 0, 255, 175, C_BLACK, 1, 0, 0, 0, true, 64);
  410. }
  411. MooshMap[MM_OPENFRAMES]--;
  412. }
  413. else{
  414. MooshMap_DrawAll(MooshMap[MM_SELECTEDFLOOR]);
  415. if(MooshMap[MM_NUMFLOORS]>1){
  416. if(Link->InputUp||Link->InputDown){
  417. if(Link->InputUp&&!Link->InputDown){
  418. if(MooshMap[MM_FLOORSWITCHFRAMES]>0)
  419. MooshMap[MM_FLOORSWITCHFRAMES]--;
  420. }
  421. else if(Link->InputDown&&!Link->InputUp){
  422. if(MooshMap[MM_FLOORSWITCHFRAMES]>0)
  423. MooshMap[MM_FLOORSWITCHFRAMES]--;
  424. }
  425. else
  426. MooshMap[MM_FLOORSWITCHFRAMES] = 16;
  427. }
  428. if(Link->PressUp||(Link->InputUp&&MooshMap[MM_FLOORSWITCHFRAMES]<=0)){
  429. MooshMap[MM_FLOORSWITCHFRAMES] = 16;
  430. Game->PlaySound(SFX_MAPSUBSCREEN_FLOORCHANGE);
  431. MooshMap[MM_SELECTEDFLOOR]++;
  432. //Wrap selection
  433. if(MooshMap[MM_SELECTEDFLOOR]>MooshMap[MM_NUMFLOORS]-1)
  434. MooshMap[MM_SELECTEDFLOOR] = 0;
  435. MooshMap_UpdateBitmap(MooshMap[MM_SELECTEDFLOOR]); //The floor has changed, so we must update the bitmaps
  436. }
  437. else if(Link->PressDown||(Link->InputDown&&MooshMap[MM_FLOORSWITCHFRAMES]<=0)){
  438. MooshMap[MM_FLOORSWITCHFRAMES] = 16;
  439. Game->PlaySound(SFX_MAPSUBSCREEN_FLOORCHANGE);
  440. MooshMap[MM_SELECTEDFLOOR]--;
  441. //Wrap selection
  442. if(MooshMap[MM_SELECTEDFLOOR]<0)
  443. MooshMap[MM_SELECTEDFLOOR] = MooshMap[MM_NUMFLOORS]-1;
  444. MooshMap_UpdateBitmap(MooshMap[MM_SELECTEDFLOOR]); //The floor has changed, so we must update the bitmaps
  445.  
  446. }
  447. }
  448. if(Link->PressMap){
  449. Game->PlaySound(SFX_MAPSUBSCREEN_CLOSE);
  450. MooshMap[MM_ISOPEN] = 0; //The map is closed now
  451. MooshMap[MM_OPENFRAMES] = 12; //It takes 12 frames to play the full closing animation
  452. }
  453. Link->InputStart = false;
  454. Link->PressStart = false;
  455. NoAction();
  456. }
  457. }
  458. else{ //Otherwise, check if Link is trying to open it
  459. if(MooshMap[MM_OPENFRAMES]>0){ //Closing animation
  460. if(MooshMap[MM_OPENFRAMES]>9){
  461. MooshMap_DrawAll(MooshMap[MM_SELECTEDFLOOR]);
  462. Screen->Rectangle(7, 0, 0, 255, 175, C_BLACK, 1, 0, 0, 0, true, 64);
  463. }
  464. else if(MooshMap[MM_OPENFRAMES]>6){
  465. MooshMap_DrawAll(MooshMap[MM_SELECTEDFLOOR]);
  466. Screen->Rectangle(7, 0, 0, 255, 175, C_BLACK, 1, 0, 0, 0, true, 64);
  467. Screen->Rectangle(7, 0, 0, 255, 175, C_BLACK, 1, 0, 0, 0, true, 64);
  468. }
  469. else if(MooshMap[MM_OPENFRAMES]>3){
  470. Screen->Rectangle(7, 0, 0, 255, 175, C_BLACK, 1, 0, 0, 0, true, 64);
  471. Screen->Rectangle(7, 0, 0, 255, 175, C_BLACK, 1, 0, 0, 0, true, 64);
  472. }
  473. else{
  474. Screen->Rectangle(7, 0, 0, 255, 175, C_BLACK, 1, 0, 0, 0, true, 64);
  475. }
  476. MooshMap[MM_OPENFRAMES]--;
  477. if(MooshMap[MM_OPENFRAMES]<=0) //Unfreeze once the closing animation ends
  478. MooshMap_ScreenUnfreeze();
  479. }
  480. else if(Link->PressMap){
  481. if(MooshMap_LoadLevelMapData()){ //Only continue if we can get the floor data successfully
  482. MooshMap_ScreenFreeze();
  483. MooshMap_UpdateBitmap(MooshMap[MM_SELECTEDFLOOR]); //Update the non animated parts of the map before loading (screens, markers)
  484. Game->PlaySound(SFX_MAPSUBSCREEN_OPEN);
  485. MooshMap[MM_ISOPEN] = 1; //The map is open now
  486. MooshMap[MM_OPENFRAMES] = 12; //It takes 12 frames to play the full opening animation
  487. }
  488. }
  489. }
  490. Link->InputMap = false;
  491. Link->PressMap = false;
  492. }
  493. }
  494.  
  495. //Get a decimal number from a combo on a screen.
  496. //If it's not a decimal marker combo, return -1.
  497. int MooshMap_GetCMBDec(int map, int scrn, int pos){
  498. int cd = Game->GetComboData(map, scrn, pos);
  499. if(cd>=CMB_DEC&&cd<=CMB_DEC+MAX_DEC)
  500. return cd-CMB_DEC;
  501. return -1;
  502. }
  503.  
  504. //Get a hexadecimal number from a combo on a screen.
  505. //If it's not a hex marker combo, return -1.
  506. int MooshMap_GetCMBHex(int map, int scrn, int pos){
  507. int cd = Game->GetComboData(map, scrn, pos);
  508. if(cd>=CMB_HEX&&cd<=CMB_HEX+MAX_HEX)
  509. return cd-CMB_HEX;
  510. return -1;
  511. }
  512.  
  513. //Get map data from a screen based on the current Level
  514. bool MooshMap_LoadLevelMapData(){
  515. if(Game->GetCurScreen()>=0x80)
  516. return false;
  517.  
  518. int num;
  519. int level = Game->GetCurLevel();
  520. num = MooshMap_GetCMBDec(MAP_MOOSHMAP_DATA, level, 3);
  521. MooshMap[MM_BGMAP] = MAP_MOOSHMAP_BG;
  522. MooshMap[MM_BGSCREEN] = SCREEN_MOOSHMAP_BG;
  523. if(num>-1){ //If there's a custom background map set, store that
  524. MooshMap[MM_BGMAP] = num;
  525. num = MooshMap_GetCMBHex(MAP_MOOSHMAP_DATA, level, 4);
  526. if(num>-1) //Same for background screen
  527. MooshMap[MM_BGSCREEN] = num;
  528. }
  529. MooshMap[MM_NUMFLOORS] = 0;
  530. MooshMap[MM_SELECTEDFLOOR] = 0;
  531. MooshMap[MM_LINKFLOOR] = -1;
  532. for(int i=0; i<13; i++){ //Cycle through all valid floor slots
  533. num = MooshMap_GetCMBDec(MAP_MOOSHMAP_DATA, level, 51+i);
  534. if(num==-1) //If there's no valid ref map at this position
  535. break; //Break the loop
  536. else{ //Otherwise, assume this is a valid floor
  537. MooshMap[MM_NUMFLOORS]++;
  538.  
  539. //Combo, CSet
  540. MooshMap[MM_STARTFLOORINDEX+MM_NUMFLOORINDEX*i+MM_F_FLOORCMB] = Game->GetComboData(MAP_MOOSHMAP_DATA, level, 35+i);
  541. MooshMap[MM_STARTFLOORINDEX+MM_NUMFLOORINDEX*i+MM_F_FLOORCS] = Game->GetComboCSet(MAP_MOOSHMAP_DATA, level, 35+i);
  542.  
  543. //Ref Map (Also used earlier to check if it's a valid floor)
  544. MooshMap[MM_STARTFLOORINDEX+MM_NUMFLOORINDEX*i+MM_F_REFMAP] = num;
  545.  
  546. //Ref Screen
  547. num = MooshMap_GetCMBHex(MAP_MOOSHMAP_DATA, level, 67+i);
  548. if(num==-1) //Error
  549. return false;
  550. MooshMap[MM_STARTFLOORINDEX+MM_NUMFLOORINDEX*i+MM_F_REFSCREEN] = num;
  551.  
  552. //Marker Screen
  553. num = MooshMap_GetCMBHex(MAP_MOOSHMAP_DATA, level, 83+i);
  554. if(num==-1) //Error
  555. return false;
  556. MooshMap[MM_STARTFLOORINDEX+MM_NUMFLOORINDEX*i+MM_F_MARKERSCREEN] = num;
  557.  
  558. //Marker Screen 2
  559. num = MooshMap_GetCMBHex(MAP_MOOSHMAP_DATA, level, 99+i);
  560. MooshMap[MM_STARTFLOORINDEX+MM_NUMFLOORINDEX*i+MM_F_MARKERSCREEN2] = num;
  561.  
  562. //Floor DMap 1
  563. num = MooshMap_GetCMBDec(MAP_MOOSHMAP_DATA, level, 115+i);
  564. if(num==-1) //Error
  565. return false;
  566. if(Game->GetCurDMap()==num){ //If Link is on the current DMap, set Link's floor and the current floor
  567. MooshMap[MM_LINKFLOOR] = i;
  568. MooshMap[MM_SELECTEDFLOOR] = i;
  569. }
  570. MooshMap[MM_STARTFLOORINDEX+MM_NUMFLOORINDEX*i+MM_F_FLOORDMAPS] = num;
  571.  
  572. //Floor DMap 2 (Optional)
  573. num = MooshMap_GetCMBDec(MAP_MOOSHMAP_DATA, level, 131+i);
  574. if(Game->GetCurDMap()==num){ //If Link is on the current DMap, set Link's floor and the current floor
  575. MooshMap[MM_LINKFLOOR] = i;
  576. MooshMap[MM_SELECTEDFLOOR] = i;
  577. }
  578. MooshMap[MM_STARTFLOORINDEX+MM_NUMFLOORINDEX*i+MM_F_FLOORDMAPS+1] = num;
  579.  
  580. //Floor DMap 3 (Optional)
  581. num = MooshMap_GetCMBDec(MAP_MOOSHMAP_DATA, level, 147+i);
  582. if(Game->GetCurDMap()==num){ //If Link is on the current DMap, set Link's floor and the current floor
  583. MooshMap[MM_LINKFLOOR] = i;
  584. MooshMap[MM_SELECTEDFLOOR] = i;
  585. }
  586. MooshMap[MM_STARTFLOORINDEX+MM_NUMFLOORINDEX*i+MM_F_FLOORDMAPS+2] = num;
  587.  
  588. //Floor DMap 4 (Optional)
  589. num = MooshMap_GetCMBDec(MAP_MOOSHMAP_DATA, level, 163+i);
  590. if(Game->GetCurDMap()==num){ //If Link is on the current DMap, set Link's floor and the current floor
  591. MooshMap[MM_LINKFLOOR] = i;
  592. MooshMap[MM_SELECTEDFLOOR] = i;
  593. }
  594. MooshMap[MM_STARTFLOORINDEX+MM_NUMFLOORINDEX*i+MM_F_FLOORDMAPS+3] = num;
  595. }
  596. }
  597. if(MooshMap[MM_NUMFLOORS]==0) //Can't have a map with 0 floors
  598. return false;
  599. return true; //Heyyy, we've loaded everything with no issue
  600. }
  601.  
  602. //Draw the map and markers to various parts of the bitmap
  603. void MooshMap_UpdateBitmap(int floor){
  604. int cmb; int cs; int flag;
  605. int cmbMarker; int csMarker; int ctMarker;
  606. int pos;
  607. int i; int j; int k;
  608. bool test1; bool test2;
  609.  
  610. Screen->SetRenderTarget(RT_MOOSHMAP);
  611. Screen->Rectangle(6, 0, 0, 511, 511, 0x00, 1, 0, 0, 0, true, 128); //Clear the bitmap
  612.  
  613. int refMap = MooshMap[MM_STARTFLOORINDEX+MM_NUMFLOORINDEX*floor+MM_F_REFMAP];
  614. int refScreen = MooshMap[MM_STARTFLOORINDEX+MM_NUMFLOORINDEX*floor+MM_F_REFSCREEN];
  615. int markerScreen = MooshMap[MM_STARTFLOORINDEX+MM_NUMFLOORINDEX*floor+MM_F_MARKERSCREEN];
  616.  
  617. //Find the first DMap associated with the current floor
  618. int dmap = MooshMap[MM_STARTFLOORINDEX+MM_NUMFLOORINDEX*floor+MM_F_FLOORDMAPS];
  619. if(MooshMap[MM_LINKFLOOR]==floor)
  620. dmap = Game->GetCurDMap();
  621. int srcMap = Game->DMapMap[dmap];
  622. int offset = Game->DMapOffset[dmap];
  623.  
  624. bool visited[64];
  625. //Cycle through all screens once to find which have been visited
  626. for(i=0; i<64; i++){
  627. pos = i%8+Floor(i/8)*16;
  628. if(Game->GetScreenState(srcMap, pos+offset, ST_VISITED)){
  629. flag = Game->GetComboFlag(refMap, refScreen, pos);
  630. if(flag>0&&!visited[i]){ //If a combo has a flag, it's part of a screen group
  631. for(j=0; j<64; j++){ //Cycle through every screen again to
  632. pos = j%8+Floor(j/8)*16;
  633. if(Game->GetComboFlag(refMap, refScreen, pos)==flag) //All screens that share the flag should be marked as visited
  634. visited[j] = true;
  635. }
  636. }
  637. visited[i] = true;
  638. }
  639. }
  640.  
  641. //Cycle through all the screens again and draw them this time
  642. for(i=0; i<64; i++){
  643. pos = i%8+Floor(i/8)*16;
  644. cmb = Game->GetComboData(refMap, refScreen, pos);
  645. cs = Game->GetComboCSet(refMap, refScreen, pos);
  646.  
  647. if(Game->LItems[Game->GetCurLevel()]&LI_MAP) //If Link has the map, draw unvisited screens
  648. Screen->FastCombo(6, MOOSHMAP_MAP_SQUARE_SCALE*(i%8), MOOSHMAP_MAP_SQUARE_SCALE*Floor(i/8), cmb, cs, 128);
  649. if(visited[i]) //If Link has been to the screen, or one grouped with it, draw it
  650. Screen->FastCombo(6, MOOSHMAP_MAP_SQUARE_SCALE*(i%8)+256, MOOSHMAP_MAP_SQUARE_SCALE*Floor(i/8), cmb+1, cs, 128);
  651. if(Game->LItems[Game->GetCurLevel()]&LI_COMPASS){ //If Link has the compass, show markers
  652. for(k=0; k<2; k++){ //Repeat twice if MarkerScreen2 is set
  653. int markerLayerOffset = 256*k;
  654. markerScreen = MooshMap[MM_STARTFLOORINDEX+MM_NUMFLOORINDEX*floor+MM_F_MARKERSCREEN];
  655. if(MooshMap[MM_STARTFLOORINDEX+MM_NUMFLOORINDEX*floor+MM_F_MARKERSCREEN2]<0) //jesus christ, man, why are you doing it this way
  656. k = 2; //seriously dude, no!
  657. else if(k==1)
  658. markerScreen = MooshMap[MM_STARTFLOORINDEX+MM_NUMFLOORINDEX*floor+MM_F_MARKERSCREEN2];
  659. ctMarker = Game->GetComboType(refMap, markerScreen, pos);
  660. if(ctMarker==CT_CHEST){ //Marker for Screen Item or Special Item (2 states: 0 = Item present, 1 = Item taken)
  661. cmbMarker = Game->GetComboData(refMap, markerScreen, pos);
  662. csMarker = Game->GetComboCSet(refMap, markerScreen, pos);
  663. test1 = Game->GetScreenState(srcMap, pos+offset, ST_ITEM) || Game->GetScreenState(srcMap, pos+offset, ST_SPECIALITEM);
  664. if(test1)
  665. Screen->FastCombo(6, MOOSHMAP_MAP_SQUARE_SCALE*(i%8)+markerLayerOffset, MOOSHMAP_MAP_SQUARE_SCALE*Floor(i/8)+176, cmbMarker+1, csMarker, 128);
  666. else
  667. Screen->FastCombo(6, MOOSHMAP_MAP_SQUARE_SCALE*(i%8)+markerLayerOffset, MOOSHMAP_MAP_SQUARE_SCALE*Floor(i/8)+176, cmbMarker, csMarker, 128);
  668. }
  669. else if(ctMarker==CT_BOSSCHEST){ //Marker for Screen Item and Special Item (4 states: 0 = Both items present, 1 = Screen item present, 2 = Special item present, 3 = Both items taken);
  670. cmbMarker = Game->GetComboData(refMap, markerScreen, pos);
  671. csMarker = Game->GetComboCSet(refMap, markerScreen, pos);
  672. test1 = Game->GetScreenState(srcMap, pos+offset, ST_ITEM);
  673. test2 = Game->GetScreenState(srcMap, pos+offset, ST_SPECIALITEM);
  674. if(test1&&test2)
  675. Screen->FastCombo(6, MOOSHMAP_MAP_SQUARE_SCALE*(i%8)+markerLayerOffset, MOOSHMAP_MAP_SQUARE_SCALE*Floor(i/8)+176, cmbMarker+3, csMarker, 128);
  676. else if(test1)
  677. Screen->FastCombo(6, MOOSHMAP_MAP_SQUARE_SCALE*(i%8)+markerLayerOffset, MOOSHMAP_MAP_SQUARE_SCALE*Floor(i/8)+176, cmbMarker+2, csMarker, 128);
  678. else if(test2)
  679. Screen->FastCombo(6, MOOSHMAP_MAP_SQUARE_SCALE*(i%8)+markerLayerOffset, MOOSHMAP_MAP_SQUARE_SCALE*Floor(i/8)+176, cmbMarker+1, csMarker, 128);
  680. else
  681. Screen->FastCombo(6, MOOSHMAP_MAP_SQUARE_SCALE*(i%8)+markerLayerOffset, MOOSHMAP_MAP_SQUARE_SCALE*Floor(i/8)+176, cmbMarker, csMarker, 128);
  682. }
  683. else if(ctMarker==CT_DAMAGE1){ //Marker for bosses. Removed based on the level's boss flag. (2 states: 0 = Boss alive, 1 = Boss dead)
  684. cmbMarker = Game->GetComboData(refMap, markerScreen, pos);
  685. csMarker = Game->GetComboCSet(refMap, markerScreen, pos);
  686. if(Game->LItems[Game->GetCurLevel()]&LI_BOSS)
  687. Screen->FastCombo(6, MOOSHMAP_MAP_SQUARE_SCALE*(i%8)+markerLayerOffset, MOOSHMAP_MAP_SQUARE_SCALE*Floor(i/8)+176, cmbMarker+1, csMarker, 128);
  688. else
  689. Screen->FastCombo(6, MOOSHMAP_MAP_SQUARE_SCALE*(i%8)+markerLayerOffset, MOOSHMAP_MAP_SQUARE_SCALE*Floor(i/8)+176, cmbMarker, csMarker, 128);
  690. }
  691. else if(ctMarker==CT_STEP){ //Marker for screen secrets. (2 states: 0 = Secret not triggered, 1 = Secret triggered)
  692. cmbMarker = Game->GetComboData(refMap, markerScreen, pos);
  693. csMarker = Game->GetComboCSet(refMap, markerScreen, pos);
  694. test1 = Game->GetScreenState(srcMap, pos+offset, ST_SECRET);
  695. if(test1)
  696. Screen->FastCombo(6, MOOSHMAP_MAP_SQUARE_SCALE*(i%8)+markerLayerOffset, MOOSHMAP_MAP_SQUARE_SCALE*Floor(i/8)+176, cmbMarker+1, csMarker, 128);
  697. else
  698. Screen->FastCombo(6, MOOSHMAP_MAP_SQUARE_SCALE*(i%8)+markerLayerOffset, MOOSHMAP_MAP_SQUARE_SCALE*Floor(i/8)+176, cmbMarker, csMarker, 128);
  699. }
  700. else if(ctMarker==CT_LOCKBLOCK){ //Marker for lock blocks. (2 states: 0 = Locked, 1 = Unlocked)
  701. cmbMarker = Game->GetComboData(refMap, markerScreen, pos);
  702. csMarker = Game->GetComboCSet(refMap, markerScreen, pos);
  703. test1 = Game->GetScreenState(srcMap, pos+offset, ST_LOCKBLOCK);
  704. if(test1)
  705. Screen->FastCombo(6, MOOSHMAP_MAP_SQUARE_SCALE*(i%8)+markerLayerOffset, MOOSHMAP_MAP_SQUARE_SCALE*Floor(i/8)+176, cmbMarker+1, csMarker, 128);
  706. else
  707. Screen->FastCombo(6, MOOSHMAP_MAP_SQUARE_SCALE*(i%8)+markerLayerOffset, MOOSHMAP_MAP_SQUARE_SCALE*Floor(i/8)+176, cmbMarker, csMarker, 128);
  708. }
  709. else if(ctMarker==CT_BOSSLOCKBLOCK){ //Marker for boss lock blocks. (2 states: 0 = Locked, 1 = Unlocked)
  710. cmbMarker = Game->GetComboData(refMap, markerScreen, pos);
  711. csMarker = Game->GetComboCSet(refMap, markerScreen, pos);
  712. test1 = Game->GetScreenState(srcMap, pos+offset, ST_BOSSLOCKBLOCK);
  713. if(test1)
  714. Screen->FastCombo(6, MOOSHMAP_MAP_SQUARE_SCALE*(i%8)+markerLayerOffset, MOOSHMAP_MAP_SQUARE_SCALE*Floor(i/8)+176, cmbMarker+1, csMarker, 128);
  715. else
  716. Screen->FastCombo(6, MOOSHMAP_MAP_SQUARE_SCALE*(i%8)+markerLayerOffset, MOOSHMAP_MAP_SQUARE_SCALE*Floor(i/8)+176, cmbMarker, csMarker, 128);
  717. }
  718. }
  719. }
  720. }
  721. Screen->SetRenderTarget(RT_SCREEN);
  722. }
  723.  
  724. //Draw the entire map
  725. void MooshMap_DrawAll(int floor){
  726. Screen->DrawScreen(7, MooshMap[MM_BGMAP], MooshMap[MM_BGSCREEN], 0, 0, 0);
  727. MooshMap_DrawMap(floor, MOOSHMAP_MAP_X, MOOSHMAP_MAP_Y);
  728. MooshMap_DrawFloors(floor);
  729. if(MOOSHMAP_SHOW_LITEMS)
  730. MooshMap_DrawDungeonItems();
  731. if(MOOSHMAP_SHOW_TITLE)
  732. MooshMap_DrawTitle();
  733. }
  734.  
  735. //Draw just the map block
  736. void MooshMap_DrawMap(int floor, int x, int y){
  737. int refMap = MooshMap[MM_STARTFLOORINDEX+MM_NUMFLOORINDEX*floor+MM_F_REFMAP];
  738. int refScreen = MooshMap[MM_STARTFLOORINDEX+MM_NUMFLOORINDEX*floor+MM_F_REFSCREEN];
  739.  
  740. int cmb; int cs; int flag;
  741. int pos;
  742. int i;
  743. int maxScale = MOOSHMAP_MAP_SQUARE_SCALE*8+1;
  744. //Draw unvisited layer
  745. Screen->DrawBitmap(7, RT_MOOSHMAP, 0, 0, maxScale, maxScale, x, y, maxScale, maxScale, 0, true);
  746. //Draw visited layer
  747. Screen->DrawBitmap(7, RT_MOOSHMAP, 256, 0, maxScale, maxScale, x, y, maxScale, maxScale, 0, true);
  748. //Draw current screen layer
  749. if(floor==MooshMap[MM_LINKFLOOR]&&MOOSHMAP_HIGHLIGHTCURRENTROOM){
  750. pos = Game->GetCurDMapScreen();
  751. flag = Game->GetComboFlag(refMap, refScreen, pos);
  752. if(flag>0){ //Link is in a grouped screen
  753. for(i=0; i<64; i++){
  754. pos = i%8+Floor(i/8)*16;
  755. if(Game->GetComboFlag(refMap, refScreen, pos)==flag){
  756. cmb = Game->GetComboData(refMap, refScreen, pos);
  757. cs = Game->GetComboCSet(refMap, refScreen, pos);
  758. Screen->FastCombo(7, x+MOOSHMAP_MAP_SQUARE_SCALE*(i%8), y+MOOSHMAP_MAP_SQUARE_SCALE*Floor(i/8), cmb+2, cs, 128);
  759. }
  760. }
  761. }
  762. else{
  763. cmb = Game->GetComboData(refMap, refScreen, pos);
  764. cs = Game->GetComboCSet(refMap, refScreen, pos);
  765. Screen->FastCombo(7, x+MOOSHMAP_MAP_SQUARE_SCALE*(pos%16), y+MOOSHMAP_MAP_SQUARE_SCALE*Floor(pos/16), cmb+2, cs, 128);
  766. }
  767. }
  768. //Draw marker layer
  769. Screen->DrawBitmap(7, RT_MOOSHMAP, 0, 176, maxScale, maxScale, x, y, maxScale, maxScale, 0, true);
  770. //Draw second marker layer
  771. Screen->DrawBitmap(7, RT_MOOSHMAP, 256, 176, maxScale, maxScale, x, y, maxScale, maxScale, 0, true);
  772. //If set to draw Link's position, do so
  773. if(MOOSHMAP_DRAWLINKPOSITION&&floor==MooshMap[MM_LINKFLOOR]){
  774. pos = Game->GetCurDMapScreen();
  775. int linkx = x+(pos%16)*MOOSHMAP_MAP_SQUARE_SCALE;
  776. int linky = y+Floor(pos/16)*MOOSHMAP_MAP_SQUARE_SCALE;
  777. if(MOOSHMAP_PRECISELINKPOSITION){
  778. linkx += MOOSHMAP_PRECISELINKPOSITIONBORDER+(Link->X/240)*(MOOSHMAP_MAP_SQUARE_SCALE-MOOSHMAP_PRECISELINKPOSITIONBORDER*2)-8;
  779. linky += MOOSHMAP_PRECISELINKPOSITIONBORDER+(Link->Y/160)*(MOOSHMAP_MAP_SQUARE_SCALE-MOOSHMAP_PRECISELINKPOSITIONBORDER*2)-8;
  780. }
  781. else{
  782. linkx += MOOSHMAP_MAP_SQUARE_SCALE/2-8;
  783. linky += MOOSHMAP_MAP_SQUARE_SCALE/2-8;
  784. }
  785. Screen->FastCombo(7, linkx, linky, CMB_MOOSHMAP_LINKPOSITIONMARKER, CS_MOOSHMAP_LINKPOSITIONMARKER, 128);
  786. }
  787. }
  788.  
  789. //Draw floor numbers next to the map
  790. void MooshMap_DrawFloors(int floor){
  791. int x; int y;
  792. int cmb; int cs;
  793. for(int i=0; i<MooshMap[MM_NUMFLOORS]; i++){
  794. cmb = MooshMap[MM_STARTFLOORINDEX+MM_NUMFLOORINDEX*i+MM_F_FLOORCMB];
  795. cs = MooshMap[MM_STARTFLOORINDEX+MM_NUMFLOORINDEX*i+MM_F_FLOORCS];
  796. x = MOOSHMAP_FLOOR_X;
  797. y = MOOSHMAP_FLOOR_Y+(MOOSHMAP_FLOOR_SPACING*(MooshMap[MM_NUMFLOORS]-1))/2-MOOSHMAP_FLOOR_SPACING*i;
  798. if(i==MooshMap[MM_SELECTEDFLOOR])
  799. Screen->DrawCombo(7, x, y, cmb+1, MOOSHMAP_FLOOR_WIDTH, MOOSHMAP_FLOOR_HEIGHT, cs, -1, -1, 0, 0, 0, -1, 0, true, 128);
  800. else
  801. Screen->DrawCombo(7, x, y, cmb, MOOSHMAP_FLOOR_WIDTH, MOOSHMAP_FLOOR_HEIGHT, cs, -1, -1, 0, 0, 0, -1, 0, true, 128);
  802. if(i==MooshMap[MM_LINKFLOOR])
  803. Screen->FastCombo(7, x-16, y+((MOOSHMAP_FLOOR_HEIGHT-1)*8), CMB_MOOSHMAP_LINKFLOORMARKER, CS_MOOSHMAP_LINKFLOORMARKER, 128);
  804. }
  805. }
  806.  
  807. void MooshMap_DrawTitle(){
  808. int str[21];
  809. Game->GetDMapTitle(Game->GetCurDMap(), str);
  810. for(int i=19; i>=0; i--){
  811. if(str[i]==' ')
  812. str[i] = 0;
  813. else
  814. break;
  815. }
  816. Screen->DrawString(7, MOOSHMAP_TITLE_X, MOOSHMAP_TITLE_Y-1, MOOSHMAP_TITLE_FONT, C_BLACK, -1, TF_CENTERED, str, 128);
  817. Screen->DrawString(7, MOOSHMAP_TITLE_X, MOOSHMAP_TITLE_Y+1, MOOSHMAP_TITLE_FONT, C_BLACK, -1, TF_CENTERED, str, 128);
  818. Screen->DrawString(7, MOOSHMAP_TITLE_X-1, MOOSHMAP_TITLE_Y, MOOSHMAP_TITLE_FONT, C_BLACK, -1, TF_CENTERED, str, 128);
  819. Screen->DrawString(7, MOOSHMAP_TITLE_X+1, MOOSHMAP_TITLE_Y, MOOSHMAP_TITLE_FONT, C_BLACK, -1, TF_CENTERED, str, 128);
  820.  
  821. Screen->DrawString(7, MOOSHMAP_TITLE_X, MOOSHMAP_TITLE_Y, MOOSHMAP_TITLE_FONT, C_WHITE, -1, TF_CENTERED, str, 128);
  822. }
  823.  
  824. void MooshMap_DrawDungeonItems(){
  825. int level = Game->GetCurLevel();
  826. if(Game->LItems[level]&LI_MAP)
  827. Screen->FastCombo(7, MOOSHMAP_MAPICON_X, MOOSHMAP_MAPICON_Y, CMB_MOOSHMAP_MAP, CS_MOOSHMAP_MAP, 128);
  828. if(Game->LItems[level]&LI_COMPASS)
  829. Screen->FastCombo(7, MOOSHMAP_COMPASSICON_X, MOOSHMAP_COMPASSICON_Y, CMB_MOOSHMAP_COMPASS, CS_MOOSHMAP_COMPASS, 128);
  830. if(Game->LItems[level]&LI_BOSSKEY)
  831. Screen->FastCombo(7, MOOSHMAP_BOSSKEYICON_X, MOOSHMAP_BOSSKEYICON_Y, CMB_MOOSHMAP_BOSSKEY, CS_MOOSHMAP_BOSSKEY, 128);
  832. }
  833.  
  834. int MooshMap_GetAllScreenStates(){
  835. int states;
  836. for(int i=0; i<14; i++){
  837. if(Screen->State[i])
  838. states |= 1<<i;
  839. }
  840. return states;
  841. }
  842.  
  843. void MooshMap_UpdateCarryover(){
  844. if(Link->Action!=LA_SCROLLING){
  845. int allStates = MooshMap_GetAllScreenStates();
  846. if(MooshMap[MM_LASTDMAP]!=Game->GetCurDMap()||MooshMap[MM_LASTSCREEN]!=Game->GetCurScreen()||MooshMap[MM_LASTSCREENSTATES]!=allStates){
  847. if(MooshMap[MM_LASTDMAP]!=Game->GetCurDMap()){
  848. MooshMap_LoadLevelMapData(); //If what changed was the DMap, make sure the correct level is loaded
  849. }
  850. MooshMap[MM_LASTDMAP] = Game->GetCurDMap();
  851. MooshMap[MM_LASTSCREEN] = Game->GetCurScreen();
  852. MooshMap[MM_LASTSCREENSTATES] = allStates;
  853. if(Game->DMapFlags[Game->GetCurDMap()]&(1<<DMF_ALLOWMAP)){ //Only bother running carryovers if the allow map flag is set
  854. int i; int j; int k;
  855. int currentFloor = -1;
  856. for(i=0; i<13; i++){ //Cycle through all floors until we find which one Link is on
  857. for(j=0; j<4; j++){
  858. k = MooshMap[MM_STARTFLOORINDEX+MM_NUMFLOORINDEX*i+MM_F_FLOORDMAPS+j];
  859. if(Game->GetCurDMap()==k){
  860. currentFloor = i;
  861. break;
  862. }
  863. }
  864. }
  865. if(currentFloor>0){
  866. int map; int offset;
  867. for(i=0; i<4; i++){ //Cycle through all DMaps on the current floor and set their states
  868. k = MooshMap[MM_STARTFLOORINDEX+MM_NUMFLOORINDEX*currentFloor+MM_F_FLOORDMAPS+i];
  869. if(k>-1&&k!=Game->GetCurDMap()){ //Don't bother for the current DMap or invalid ones
  870. map = Game->DMapMap[k];
  871. offset = Game->DMapOffset[k];
  872.  
  873. //Start with carrying over the visited state
  874. Game->SetScreenState(map, Game->GetCurDMapScreen()+offset, ST_VISITED, true);
  875. //If set to do so, carry over the other 13
  876. if(MOOSHMAP_ALL_CARRYOVER){
  877. for(j=0; j<14; j++){
  878. Game->SetScreenState(map, Game->GetCurDMapScreen()+offset, j, Screen->State[j]);
  879. }
  880. }
  881. //Carry over Screen->D if set
  882. if(MOOSHMAP_D_CARRYOVER){
  883. for(j=0; j<8; j++){
  884. Game->SetDMapScreenD(k, Game->GetCurDMapScreen(), j, Screen->D[j]);
  885. }
  886. }
  887. }
  888. }
  889. }
  890. }
  891. }
  892. }
  893. }
  894. //%MGSO% HEADER_END mooshmap
  895.  
  896. //%MGSO% HEADER_START platform
  897.  
  898. ///Constants and Variables used by platform script;
  899. const int DIAGONAL_MOVEMENT = 1; //Enable the option and change this to 0 for nes movement.
  900. int onplatform; //Global variable use this to check if Link is on a platform for other scripts.
  901.  
  902.  
  903. void NesMovementFix()
  904. {
  905. if(DIAGONAL_MOVEMENT==0 && (Link->InputUp || Link->InputDown))
  906. {
  907. Link->InputLeft = false;
  908. Link->InputRight = false;
  909. }
  910. }
  911.  
  912. void MovingPlatforms()
  913. {
  914. onplatform = 0;
  915. if(Link->Z == 0)
  916. {
  917. int buffer[] = "movingplatform";
  918. for(int i = 1; i <= 32; i++)
  919. {
  920. ffc f = Screen->LoadFFC(i);
  921. if(f->Script != Game->GetFFCScript(buffer)) continue;
  922. if(Abs(Link->X + 8 - CenterX(f)) >= f->TileWidth*8) continue;
  923. if(Abs(Link->Y + 12 - CenterY(f)) >= f->TileHeight*8) continue;
  924. onplatform = FFCNum(f);
  925. break;
  926. }
  927. }
  928. }
  929.  
  930. //%MGSO% HEADER_END platform
  931.  
  932. //%MGSO% HEADER_START yargcheat
  933.  
  934. //%MGSO% HEADER_END yargcheat
  935.  
  936. //%MGSO% HEADER_START floor spinner global
  937.  
  938. //Global Variables
  939.  
  940. int TimesContinued;//Tracks how many times you've continued.
  941.  
  942.  
  943. //%MGSO% HEADER_END floor spinner global
  944.  
  945. //%MGSO% HEADER_START globalcont
  946.  
  947.  
  948.  
  949. //%MGSO% HEADER_END globalcont
  950.  
  951. //%MGSO% HEADER_START spinneronexit
  952.  
  953.  
  954.  
  955. //Test if one location is between two others.
  956. //D0- Location to test
  957. //D1- Lower bound
  958. //D2- Higher bound
  959.  
  960. bool Between(int loc,int greaterthan, int lessthan){
  961. if(loc>=greaterthan && loc<=lessthan)return true;
  962. return false;
  963. }
  964. //%MGSO% HEADER_END spinneronexit
  965.  
  966. global script MGSO_Combined
  967. {
  968. void run()
  969. {
  970. //%MGSO% INIT_START Tango?
  971.  
  972. TangoInit();
  973.  
  974. //%MGSO% INIT_END Tango?
  975.  
  976. //%MGSO% INIT_START g
  977.  
  978. //%MGSO% INIT_START glob march
  979.  
  980. //%MGSO% INIT_START seeds
  981.  
  982. LinkMovement_Init();
  983. //%MGSO% INIT_END seeds
  984.  
  985.  
  986. //%MGSO% INIT_START mapglobal
  987.  
  988. int CurrentDMap;
  989. int CurrentLevel;
  990. int CurrentDMapScreen;
  991. int CurrentScreen;
  992. bool LMap;
  993. bool LCompass;
  994. bool BKey;
  995.  
  996. if(Game->HasPlayed == false)
  997. //If this is the first time the game is run, the functions below in brackets are called.
  998. {
  999. InitializeSList();
  1000. }
  1001.  
  1002. //%MGSO% INIT_END mapglobal
  1003.  
  1004.  
  1005. //%MGSO% INIT_START ddd
  1006.  
  1007. //%MGSO% INIT_START spalsh
  1008.  
  1009. int splashTimer = splashFreq;
  1010. //%MGSO% INIT_END spalsh
  1011.  
  1012.  
  1013. //%MGSO% INIT_START old
  1014.  
  1015. //%MGSO% INIT_START power bracelet
  1016.  
  1017. PowerBracelet();
  1018.  
  1019. //%MGSO% INIT_END power bracelet
  1020.  
  1021.  
  1022. //%MGSO% INIT_START moosh glob
  1023.  
  1024. //%MGSO% INIT_START autoghost
  1025.  
  1026. StartGhostZH();
  1027.  
  1028. //%MGSO% INIT_END autoghost
  1029.  
  1030.  
  1031. //%MGSO% INIT_START OG global
  1032.  
  1033. //%MGSO% INIT_START link collide
  1034.  
  1035. heroExtraStateInit();
  1036.  
  1037. //%MGSO% INIT_END link collide
  1038.  
  1039. //%MGSO% INIT_START GB SHIELD
  1040.  
  1041. //Initializations
  1042. bool shieldOn;
  1043.  
  1044. //%MGSO% INIT_END GB SHIELD
  1045.  
  1046. //%MGSO% INIT_START gasha enemy
  1047.  
  1048. GB_Gasha_EnemyDying();
  1049.  
  1050. //%MGSO% INIT_END gasha enemy
  1051.  
  1052.  
  1053. //%MGSO% INIT_START mooshmap
  1054.  
  1055. MooshMap_Init();
  1056. //%MGSO% INIT_END mooshmap
  1057.  
  1058. //%MGSO% INIT_START platform
  1059.  
  1060. //%MGSO% INIT_END platform
  1061.  
  1062. //%MGSO% INIT_START yargcheat
  1063.  
  1064. int saveName[9];
  1065. int yarg[] = "yarg";
  1066.  
  1067. Game->GetSaveName(saveName);
  1068. UpperToLower(saveName); // Convert to lower-case so it will match the lower-case string
  1069.  
  1070. if(strcmp(saveName, yarg) == 0)
  1071. {
  1072. Game->Cheat = 4;
  1073. }
  1074. //%MGSO% INIT_END yargcheat
  1075.  
  1076. //%MGSO% INIT_START floor spinner global
  1077.  
  1078. //Increases variable when you F6.
  1079. //Used to prevent cheating past spinners.
  1080. TimesContinued++;
  1081. //%MGSO% INIT_END floor spinner global
  1082.  
  1083. //%MGSO% INIT_START globalcont
  1084.  
  1085. //Increases variable when you load the game after saving.
  1086. //Used to prevent cheating past spinners.
  1087. TimesContinued++;
  1088. //%MGSO% INIT_END globalcont
  1089.  
  1090. //%MGSO% INIT_START spinneronexit
  1091.  
  1092. TimesContinued++;
  1093. //%MGSO% INIT_END spinneronexit
  1094.  
  1095. while(true)
  1096. {
  1097. //%MGSO% UPDATE1_START Tango?
  1098.  
  1099. Tango_Update1();
  1100. //%MGSO% UPDATE1_END Tango?
  1101.  
  1102. //%MGSO% UPDATE1_START g
  1103.  
  1104. //%MGSO% UPDATE1_START glob march
  1105.  
  1106. //%MGSO% UPDATE1_START seeds
  1107.  
  1108. LinkMovement_Update1();
  1109. SeedShooter_Update();
  1110. //%MGSO% UPDATE1_END seeds
  1111.  
  1112.  
  1113. //%MGSO% UPDATE1_START mapglobal
  1114.  
  1115. if (Link->PressMap)
  1116. {
  1117. CurrentLevel=Game->GetCurLevel(); //Calculate variables for custom map
  1118. CurrentDMap=Game->GetCurDMap();
  1119. CurrentDMapScreen=Game->GetCurDMapScreen();
  1120. CurrentScreen=Game->GetCurScreen();
  1121. BKey=GetLevelItem(CurrentLevel, LI_BOSSKEY);
  1122. LMap=GetLevelItem(CurrentLevel, LI_MAP);
  1123. LCompass=GetLevelItem(CurrentLevel, LI_COMPASS);
  1124.  
  1125. StateList(CurrentLevel); //Build Lookup Tables
  1126.  
  1127. Map(CurrentLevel, CurrentDMap, CurrentDMapScreen, CurrentScreen, LMap, LCompass, BKey); //Displays custom map
  1128.  
  1129. }
  1130.  
  1131. if(Game->GetCurScreen()<128)
  1132. {
  1133. if(Screen->State[ST_VISITED]==false){ Screen->State[ST_VISITED]=true; //Set visited state and door configuration on every screen entered
  1134. DoorsList(Game->GetCurLevel(), Game->GetCurDMap(), Game->GetCurScreen());}
  1135. }
  1136.  
  1137. //----Add other code here----
  1138.  
  1139. //%MGSO% UPDATE1_END mapglobal
  1140.  
  1141.  
  1142. //%MGSO% UPDATE1_START ddd
  1143.  
  1144. //%MGSO% UPDATE1_START spalsh
  1145.  
  1146. //Shallow water SFX
  1147. if( Screen->ComboT[ComboAt(Link->X+7,Link->Y+15)] == CT_SHALLOWWATER
  1148. && Link->Action==LA_WALKING
  1149. && Link->Z == 0 )
  1150. {
  1151. if( splashTimer >= splashFreq ){
  1152. Game->PlaySound(SFX_SPLASH);
  1153. splashTimer = 0;
  1154. }
  1155. splashTimer++;
  1156. }
  1157. else splashTimer = splashFreq;
  1158. //End water SFX code
  1159. //%MGSO% UPDATE1_END spalsh
  1160.  
  1161.  
  1162. //%MGSO% UPDATE1_START old
  1163.  
  1164. //%MGSO% UPDATE1_START power bracelet
  1165.  
  1166.  
  1167.  
  1168. //%MGSO% UPDATE1_END power bracelet
  1169.  
  1170.  
  1171. //%MGSO% UPDATE1_START moosh glob
  1172.  
  1173. //%MGSO% UPDATE1_START autoghost
  1174.  
  1175. UpdateGhostZH1();
  1176. //%MGSO% UPDATE1_END autoghost
  1177.  
  1178.  
  1179. //%MGSO% UPDATE1_START OG global
  1180.  
  1181. //%MGSO% UPDATE1_START link collide
  1182.  
  1183. heroExtraState();
  1184.  
  1185. //%MGSO% UPDATE1_END link collide
  1186.  
  1187. //%MGSO% UPDATE1_START GB SHIELD
  1188.  
  1189. if( !shieldOn && shieldItem ){ //Enable shield when using dummy
  1190. shieldOn=true; //Set shield state to on
  1191. Link->Item[shieldItem]=true; //Give the shield
  1192. Game->PlaySound(SFX_GBSHIELD); //Play the sound
  1193. }
  1194. else if( ( (shieldButton && !Link->InputA)||(!shieldButton && !Link->InputB)) //When button is released
  1195. && shieldOn){ //And shield is still on
  1196. Link->Item[shieldItem]=false; //Remove shield
  1197. shieldItem = 0; //Reset shield item variable
  1198. shieldOn = false; //Set shield state to off
  1199. }
  1200.  
  1201. //%MGSO% UPDATE1_END GB SHIELD
  1202.  
  1203. //%MGSO% UPDATE1_START gasha enemy
  1204.  
  1205.  
  1206.  
  1207. //%MGSO% UPDATE1_END gasha enemy
  1208.  
  1209.  
  1210. //%MGSO% UPDATE1_START mooshmap
  1211.  
  1212. MooshMap_Update();
  1213. //%MGSO% UPDATE1_END mooshmap
  1214.  
  1215. //%MGSO% UPDATE1_START platform
  1216.  
  1217. NesMovementFix();
  1218. //%MGSO% UPDATE1_END platform
  1219.  
  1220. //%MGSO% UPDATE1_START yargcheat
  1221.  
  1222. //%MGSO% UPDATE1_END yargcheat
  1223.  
  1224. //%MGSO% UPDATE1_START floor spinner global
  1225.  
  1226. //%MGSO% UPDATE1_END floor spinner global
  1227.  
  1228. //%MGSO% UPDATE1_START globalcont
  1229.  
  1230. //%MGSO% UPDATE1_END globalcont
  1231.  
  1232. //%MGSO% UPDATE1_START spinneronexit
  1233.  
  1234. //%MGSO% UPDATE1_END spinneronexit
  1235.  
  1236. Waitdraw();
  1237. //%MGSO% UPDATE2_START Tango?
  1238.  
  1239. Tango_Update2();
  1240. //%MGSO% UPDATE2_END Tango?
  1241.  
  1242. //%MGSO% UPDATE2_START g
  1243.  
  1244. //%MGSO% UPDATE2_START glob march
  1245.  
  1246. //%MGSO% UPDATE2_START seeds
  1247.  
  1248. LinkMovement_Update2();
  1249. //%MGSO% UPDATE2_END seeds
  1250.  
  1251.  
  1252. //%MGSO% UPDATE2_START mapglobal
  1253.  
  1254. //%MGSO% UPDATE2_END mapglobal
  1255.  
  1256.  
  1257. //%MGSO% UPDATE2_START ddd
  1258.  
  1259. //%MGSO% UPDATE2_START spalsh
  1260.  
  1261. //%MGSO% UPDATE2_END spalsh
  1262.  
  1263.  
  1264. //%MGSO% UPDATE2_START old
  1265.  
  1266. //%MGSO% UPDATE2_START power bracelet
  1267.  
  1268.  
  1269.  
  1270. //%MGSO% UPDATE2_END power bracelet
  1271.  
  1272.  
  1273. //%MGSO% UPDATE2_START moosh glob
  1274.  
  1275. //%MGSO% UPDATE2_START autoghost
  1276.  
  1277. UpdateGhostZH2();
  1278. //%MGSO% UPDATE2_END autoghost
  1279.  
  1280.  
  1281. //%MGSO% UPDATE2_START OG global
  1282.  
  1283. //%MGSO% UPDATE2_START link collide
  1284.  
  1285.  
  1286.  
  1287. //%MGSO% UPDATE2_END link collide
  1288.  
  1289. //%MGSO% UPDATE2_START GB SHIELD
  1290.  
  1291. //%MGSO% UPDATE2_END GB SHIELD
  1292.  
  1293. //%MGSO% UPDATE2_START gasha enemy
  1294.  
  1295.  
  1296.  
  1297. //%MGSO% UPDATE2_END gasha enemy
  1298.  
  1299.  
  1300. //%MGSO% UPDATE2_START mooshmap
  1301.  
  1302. //%MGSO% UPDATE2_END mooshmap
  1303.  
  1304. //%MGSO% UPDATE2_START platform
  1305.  
  1306. MovingPlatforms();
  1307. //%MGSO% UPDATE2_END platform
  1308.  
  1309. //%MGSO% UPDATE2_START yargcheat
  1310.  
  1311. //%MGSO% UPDATE2_END yargcheat
  1312.  
  1313. //%MGSO% UPDATE2_START floor spinner global
  1314.  
  1315. //%MGSO% UPDATE2_END floor spinner global
  1316.  
  1317. //%MGSO% UPDATE2_START globalcont
  1318.  
  1319. //%MGSO% UPDATE2_END globalcont
  1320.  
  1321. //%MGSO% UPDATE2_START spinneronexit
  1322.  
  1323. //%MGSO% UPDATE2_END spinneronexit
  1324.  
  1325. Waitframe();
  1326. }
  1327.  
  1328. //%MGSO% FUNCTIONS_START g
  1329.  
  1330. //%MGSO% FUNCTIONS_END g
  1331.  
  1332.  
  1333.  
  1334.  
  1335.  
  1336.  
  1337.  
  1338.  
  1339.  
  1340.  
  1341.  
  1342.  
  1343. //%MGSO% FUNCTIONS_START gasha enemy
  1344.  
  1345. //%MGSO% FUNCTIONS_END gasha enemy
  1346.  
  1347.  
  1348.  
  1349.  
  1350.  
  1351.  
  1352.  
  1353.  
  1354. }
  1355. }
  1356.  
Add Comment
Please, Sign In to add comment