-
Notifications
You must be signed in to change notification settings - Fork 2.7k
/
Copy pathmetatile_behavior.c
1402 lines (1250 loc) · 38.2 KB
/
metatile_behavior.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#include "global.h"
#include "metatile_behavior.h"
#include "constants/metatile_behaviors.h"
#define TILE_FLAG_HAS_ENCOUNTERS (1 << 0)
#define TILE_FLAG_SURFABLE (1 << 1)
#define TILE_FLAG_UNUSED (1 << 2) // Roughly all of the traversable metatiles. Set but never read
static const u8 sTileBitAttributes[NUM_METATILE_BEHAVIORS] =
{
[MB_NORMAL] = TILE_FLAG_UNUSED,
[MB_TALL_GRASS] = TILE_FLAG_UNUSED | TILE_FLAG_HAS_ENCOUNTERS,
[MB_LONG_GRASS] = TILE_FLAG_UNUSED | TILE_FLAG_HAS_ENCOUNTERS,
[MB_UNUSED_05] = TILE_FLAG_HAS_ENCOUNTERS,
[MB_DEEP_SAND] = TILE_FLAG_UNUSED | TILE_FLAG_HAS_ENCOUNTERS,
[MB_SHORT_GRASS] = TILE_FLAG_UNUSED,
[MB_CAVE] = TILE_FLAG_UNUSED | TILE_FLAG_HAS_ENCOUNTERS,
[MB_LONG_GRASS_SOUTH_EDGE] = TILE_FLAG_UNUSED,
[MB_NO_RUNNING] = TILE_FLAG_UNUSED,
[MB_INDOOR_ENCOUNTER] = TILE_FLAG_UNUSED | TILE_FLAG_HAS_ENCOUNTERS,
[MB_MOUNTAIN_TOP] = TILE_FLAG_UNUSED,
[MB_BATTLE_PYRAMID_WARP] = TILE_FLAG_UNUSED,
[MB_MOSSDEEP_GYM_WARP] = TILE_FLAG_UNUSED,
[MB_MT_PYRE_HOLE] = TILE_FLAG_UNUSED,
[MB_POND_WATER] = TILE_FLAG_UNUSED | TILE_FLAG_SURFABLE | TILE_FLAG_HAS_ENCOUNTERS,
[MB_INTERIOR_DEEP_WATER] = TILE_FLAG_UNUSED | TILE_FLAG_SURFABLE | TILE_FLAG_HAS_ENCOUNTERS,
[MB_DEEP_WATER] = TILE_FLAG_UNUSED | TILE_FLAG_SURFABLE | TILE_FLAG_HAS_ENCOUNTERS,
[MB_WATERFALL] = TILE_FLAG_UNUSED | TILE_FLAG_SURFABLE,
[MB_SOOTOPOLIS_DEEP_WATER] = TILE_FLAG_UNUSED | TILE_FLAG_SURFABLE,
[MB_OCEAN_WATER] = TILE_FLAG_UNUSED | TILE_FLAG_SURFABLE | TILE_FLAG_HAS_ENCOUNTERS,
[MB_PUDDLE] = TILE_FLAG_UNUSED,
[MB_SHALLOW_WATER] = TILE_FLAG_UNUSED,
[MB_NO_SURFACING] = TILE_FLAG_UNUSED | TILE_FLAG_SURFABLE,
[MB_STAIRS_OUTSIDE_ABANDONED_SHIP] = TILE_FLAG_UNUSED,
[MB_SHOAL_CAVE_ENTRANCE] = TILE_FLAG_UNUSED,
[MB_ICE] = TILE_FLAG_UNUSED,
[MB_SAND] = TILE_FLAG_UNUSED,
[MB_SEAWEED] = TILE_FLAG_UNUSED | TILE_FLAG_SURFABLE | TILE_FLAG_HAS_ENCOUNTERS,
[MB_UNUSED_23] = TILE_FLAG_UNUSED,
[MB_ASHGRASS] = TILE_FLAG_UNUSED | TILE_FLAG_HAS_ENCOUNTERS,
[MB_FOOTPRINTS] = TILE_FLAG_UNUSED | TILE_FLAG_HAS_ENCOUNTERS,
[MB_THIN_ICE] = TILE_FLAG_UNUSED,
[MB_CRACKED_ICE] = TILE_FLAG_UNUSED,
[MB_HOT_SPRINGS] = TILE_FLAG_UNUSED,
[MB_LAVARIDGE_GYM_B1F_WARP] = TILE_FLAG_UNUSED,
[MB_SEAWEED_NO_SURFACING] = TILE_FLAG_UNUSED | TILE_FLAG_SURFABLE | TILE_FLAG_HAS_ENCOUNTERS,
[MB_REFLECTION_UNDER_BRIDGE] = TILE_FLAG_UNUSED,
[MB_IMPASSABLE_EAST] = TILE_FLAG_UNUSED,
[MB_IMPASSABLE_WEST] = TILE_FLAG_UNUSED,
[MB_IMPASSABLE_NORTH] = TILE_FLAG_UNUSED,
[MB_IMPASSABLE_SOUTH] = TILE_FLAG_UNUSED,
[MB_IMPASSABLE_NORTHEAST] = TILE_FLAG_UNUSED,
[MB_IMPASSABLE_NORTHWEST] = TILE_FLAG_UNUSED,
[MB_IMPASSABLE_SOUTHEAST] = TILE_FLAG_UNUSED,
[MB_IMPASSABLE_SOUTHWEST] = TILE_FLAG_UNUSED,
[MB_JUMP_NORTHEAST] = TILE_FLAG_UNUSED,
[MB_JUMP_NORTHWEST] = TILE_FLAG_UNUSED,
[MB_JUMP_SOUTHEAST] = TILE_FLAG_UNUSED,
[MB_JUMP_SOUTHWEST] = TILE_FLAG_UNUSED,
[MB_WALK_EAST] = TILE_FLAG_UNUSED,
[MB_WALK_WEST] = TILE_FLAG_UNUSED,
[MB_WALK_NORTH] = TILE_FLAG_UNUSED,
[MB_WALK_SOUTH] = TILE_FLAG_UNUSED,
[MB_SLIDE_EAST] = TILE_FLAG_UNUSED,
[MB_SLIDE_WEST] = TILE_FLAG_UNUSED,
[MB_SLIDE_NORTH] = TILE_FLAG_UNUSED,
[MB_SLIDE_SOUTH] = TILE_FLAG_UNUSED,
[MB_TRICK_HOUSE_PUZZLE_8_FLOOR] = TILE_FLAG_UNUSED,
[MB_UNUSED_49] = TILE_FLAG_UNUSED,
[MB_UNUSED_4A] = TILE_FLAG_UNUSED,
[MB_EASTWARD_CURRENT] = TILE_FLAG_UNUSED | TILE_FLAG_SURFABLE,
[MB_WESTWARD_CURRENT] = TILE_FLAG_UNUSED | TILE_FLAG_SURFABLE,
[MB_NORTHWARD_CURRENT] = TILE_FLAG_UNUSED | TILE_FLAG_SURFABLE,
[MB_SOUTHWARD_CURRENT] = TILE_FLAG_UNUSED | TILE_FLAG_SURFABLE,
[MB_NON_ANIMATED_DOOR] = TILE_FLAG_UNUSED,
[MB_LADDER] = TILE_FLAG_UNUSED,
[MB_EAST_ARROW_WARP] = TILE_FLAG_UNUSED,
[MB_WEST_ARROW_WARP] = TILE_FLAG_UNUSED,
[MB_NORTH_ARROW_WARP] = TILE_FLAG_UNUSED,
[MB_SOUTH_ARROW_WARP] = TILE_FLAG_UNUSED,
[MB_CRACKED_FLOOR_HOLE] = TILE_FLAG_UNUSED,
[MB_AQUA_HIDEOUT_WARP] = TILE_FLAG_UNUSED,
[MB_LAVARIDGE_GYM_1F_WARP] = TILE_FLAG_UNUSED,
[MB_ANIMATED_DOOR] = TILE_FLAG_UNUSED,
[MB_UP_ESCALATOR] = TILE_FLAG_UNUSED,
[MB_DOWN_ESCALATOR] = TILE_FLAG_UNUSED,
[MB_WATER_DOOR] = TILE_FLAG_UNUSED | TILE_FLAG_SURFABLE,
[MB_WATER_SOUTH_ARROW_WARP] = TILE_FLAG_UNUSED | TILE_FLAG_SURFABLE,
[MB_DEEP_SOUTH_WARP] = TILE_FLAG_UNUSED,
[MB_UNUSED_6F] = TILE_FLAG_UNUSED | TILE_FLAG_SURFABLE,
[MB_BRIDGE_OVER_POND_LOW] = TILE_FLAG_UNUSED,
[MB_BRIDGE_OVER_POND_MED] = TILE_FLAG_UNUSED,
[MB_BRIDGE_OVER_POND_HIGH] = TILE_FLAG_UNUSED,
[MB_PACIFIDLOG_VERTICAL_LOG_TOP] = TILE_FLAG_UNUSED,
[MB_PACIFIDLOG_VERTICAL_LOG_BOTTOM] = TILE_FLAG_UNUSED,
[MB_PACIFIDLOG_HORIZONTAL_LOG_LEFT] = TILE_FLAG_UNUSED,
[MB_PACIFIDLOG_HORIZONTAL_LOG_RIGHT] = TILE_FLAG_UNUSED,
[MB_FORTREE_BRIDGE] = TILE_FLAG_UNUSED,
[MB_BRIDGE_OVER_POND_MED_EDGE_1] = TILE_FLAG_UNUSED,
[MB_BRIDGE_OVER_POND_MED_EDGE_2] = TILE_FLAG_UNUSED,
[MB_BRIDGE_OVER_POND_HIGH_EDGE_1] = TILE_FLAG_UNUSED,
[MB_BRIDGE_OVER_POND_HIGH_EDGE_2] = TILE_FLAG_UNUSED,
[MB_UNUSED_BRIDGE] = TILE_FLAG_UNUSED,
[MB_BIKE_BRIDGE_OVER_BARRIER] = TILE_FLAG_UNUSED,
[MB_SECRET_BASE_SCENERY] = TILE_FLAG_UNUSED,
[MB_SECRET_BASE_TRAINER_SPOT] = TILE_FLAG_UNUSED,
[MB_HOLDS_SMALL_DECORATION] = TILE_FLAG_UNUSED,
[MB_SECRET_BASE_BALLOON] = TILE_FLAG_UNUSED,
[MB_SECRET_BASE_IMPASSABLE] = TILE_FLAG_UNUSED,
[MB_SECRET_BASE_GLITTER_MAT] = TILE_FLAG_UNUSED,
[MB_SECRET_BASE_JUMP_MAT] = TILE_FLAG_UNUSED,
[MB_SECRET_BASE_SPIN_MAT] = TILE_FLAG_UNUSED,
[MB_SECRET_BASE_SOUND_MAT] = TILE_FLAG_UNUSED,
[MB_SECRET_BASE_BREAKABLE_DOOR] = TILE_FLAG_UNUSED,
[MB_IMPASSABLE_SOUTH_AND_NORTH] = TILE_FLAG_UNUSED,
[MB_IMPASSABLE_WEST_AND_EAST] = TILE_FLAG_UNUSED,
[MB_SECRET_BASE_HOLE] = TILE_FLAG_UNUSED,
[MB_HOLDS_LARGE_DECORATION] = TILE_FLAG_UNUSED,
[MB_SECRET_BASE_TV_SHIELD] = TILE_FLAG_UNUSED,
[MB_PLAYER_ROOM_PC_ON] = TILE_FLAG_UNUSED,
[MB_MUDDY_SLOPE] = TILE_FLAG_UNUSED,
[MB_BUMPY_SLOPE] = TILE_FLAG_UNUSED,
[MB_CRACKED_FLOOR] = TILE_FLAG_UNUSED,
[MB_ISOLATED_VERTICAL_RAIL] = TILE_FLAG_UNUSED,
[MB_ISOLATED_HORIZONTAL_RAIL] = TILE_FLAG_UNUSED,
[MB_VERTICAL_RAIL] = TILE_FLAG_UNUSED,
[MB_HORIZONTAL_RAIL] = TILE_FLAG_UNUSED,
};
bool8 MetatileBehavior_IsATile(u8 metatileBehavior)
{
return TRUE;
}
bool8 MetatileBehavior_IsEncounterTile(u8 metatileBehavior)
{
if ((sTileBitAttributes[metatileBehavior] & TILE_FLAG_HAS_ENCOUNTERS))
return TRUE;
else
return FALSE;
}
bool8 MetatileBehavior_IsJumpEast(u8 metatileBehavior)
{
if (metatileBehavior == MB_JUMP_EAST)
return TRUE;
else
return FALSE;
}
bool8 MetatileBehavior_IsJumpWest(u8 metatileBehavior)
{
if (metatileBehavior == MB_JUMP_WEST)
return TRUE;
else
return FALSE;
}
bool8 MetatileBehavior_IsJumpNorth(u8 metatileBehavior)
{
if (metatileBehavior == MB_JUMP_NORTH)
return TRUE;
else
return FALSE;
}
bool8 MetatileBehavior_IsJumpSouth(u8 metatileBehavior)
{
if (metatileBehavior == MB_JUMP_SOUTH)
return TRUE;
else
return FALSE;
}
bool8 MetatileBehavior_IsPokeGrass(u8 metatileBehavior)
{
if (metatileBehavior == MB_TALL_GRASS || metatileBehavior == MB_LONG_GRASS)
return TRUE;
else
return FALSE;
}
bool8 MetatileBehavior_IsSandOrDeepSand(u8 metatileBehavior)
{
if (metatileBehavior == MB_SAND || metatileBehavior == MB_DEEP_SAND)
return TRUE;
else
return FALSE;
}
bool8 MetatileBehavior_IsDeepSand(u8 metatileBehavior)
{
if (metatileBehavior == MB_DEEP_SAND)
return TRUE;
else
return FALSE;
}
bool8 MetatileBehavior_IsReflective(u8 metatileBehavior)
{
if (metatileBehavior == MB_POND_WATER
|| metatileBehavior == MB_PUDDLE
|| metatileBehavior == MB_UNUSED_SOOTOPOLIS_DEEP_WATER_2
|| metatileBehavior == MB_ICE
|| metatileBehavior == MB_SOOTOPOLIS_DEEP_WATER
|| metatileBehavior == MB_REFLECTION_UNDER_BRIDGE)
return TRUE;
else
return FALSE;
}
bool8 MetatileBehavior_IsIce(u8 metatileBehavior)
{
if (metatileBehavior == MB_ICE)
return TRUE;
else
return FALSE;
}
bool8 MetatileBehavior_IsWarpDoor(u8 metatileBehavior)
{
if (metatileBehavior == MB_ANIMATED_DOOR)
return TRUE;
else
return FALSE;
}
bool8 MetatileBehavior_IsDoor(u8 metatileBehavior)
{
if (metatileBehavior == MB_PETALBURG_GYM_DOOR
|| metatileBehavior == MB_ANIMATED_DOOR)
return TRUE;
else
return FALSE;
}
bool8 MetatileBehavior_IsEscalator(u8 metatileBehavior)
{
if (metatileBehavior == MB_UP_ESCALATOR
|| metatileBehavior == MB_DOWN_ESCALATOR)
return TRUE;
else
return FALSE;
}
bool8 Unref_MetatileBehavior_IsUnused04(u8 metatileBehavior)
{
if (metatileBehavior == MB_UNUSED_04)
return TRUE;
else
return FALSE;
}
bool8 MetatileBehavior_IsLadder(u8 metatileBehavior)
{
if (metatileBehavior == MB_LADDER)
return TRUE;
else
return FALSE;
}
bool8 MetatileBehavior_IsNonAnimDoor(u8 metatileBehavior)
{
if (metatileBehavior == MB_NON_ANIMATED_DOOR
|| metatileBehavior == MB_WATER_DOOR
|| metatileBehavior == MB_DEEP_SOUTH_WARP)
return TRUE;
else
return FALSE;
}
bool8 MetatileBehavior_IsDeepSouthWarp(u8 metatileBehavior)
{
if (metatileBehavior == MB_DEEP_SOUTH_WARP)
return TRUE;
else
return FALSE;
}
bool8 MetatileBehavior_IsSurfableWaterOrUnderwater(u8 metatileBehavior)
{
if ((sTileBitAttributes[metatileBehavior] & TILE_FLAG_SURFABLE))
return TRUE;
else
return FALSE;
}
bool8 MetatileBehavior_IsEastArrowWarp(u8 metatileBehavior)
{
if (metatileBehavior == MB_EAST_ARROW_WARP)
return TRUE;
else
return FALSE;
}
bool8 MetatileBehavior_IsWestArrowWarp(u8 metatileBehavior)
{
if (metatileBehavior == MB_WEST_ARROW_WARP)
return TRUE;
else
return FALSE;
}
bool8 MetatileBehavior_IsNorthArrowWarp(u8 metatileBehavior)
{
if (metatileBehavior == MB_NORTH_ARROW_WARP
|| metatileBehavior == MB_STAIRS_OUTSIDE_ABANDONED_SHIP)
return TRUE;
else
return FALSE;
}
bool8 MetatileBehavior_IsSouthArrowWarp(u8 metatileBehavior)
{
if (metatileBehavior == MB_SOUTH_ARROW_WARP
|| metatileBehavior == MB_WATER_SOUTH_ARROW_WARP
|| metatileBehavior == MB_SHOAL_CAVE_ENTRANCE)
return TRUE;
else
return FALSE;
}
bool8 Unref_MetatileBehavior_IsArrowWarp(u8 metatileBehavior)
{
u8 isArrowWarp = FALSE;
if (MetatileBehavior_IsEastArrowWarp(metatileBehavior)
|| MetatileBehavior_IsWestArrowWarp(metatileBehavior)
|| MetatileBehavior_IsNorthArrowWarp(metatileBehavior)
|| MetatileBehavior_IsSouthArrowWarp(metatileBehavior))
{
isArrowWarp = TRUE;
}
return isArrowWarp;
}
bool8 MetatileBehavior_IsForcedMovementTile(u8 metatileBehavior)
{
if ((metatileBehavior >= MB_WALK_EAST && metatileBehavior <= MB_TRICK_HOUSE_PUZZLE_8_FLOOR)
|| (metatileBehavior >= MB_EASTWARD_CURRENT && metatileBehavior <= MB_SOUTHWARD_CURRENT)
|| metatileBehavior == MB_MUDDY_SLOPE
|| metatileBehavior == MB_CRACKED_FLOOR
|| metatileBehavior == MB_WATERFALL
|| metatileBehavior == MB_ICE
|| metatileBehavior == MB_SECRET_BASE_JUMP_MAT
|| metatileBehavior == MB_SECRET_BASE_SPIN_MAT)
return TRUE;
else
return FALSE;
}
bool8 MetatileBehavior_IsIce_2(u8 metatileBehavior)
{
if (metatileBehavior == MB_ICE)
return TRUE;
else
return FALSE;
}
bool8 MetatileBehavior_IsTrickHouseSlipperyFloor(u8 metatileBehavior)
{
if (metatileBehavior == MB_TRICK_HOUSE_PUZZLE_8_FLOOR)
return TRUE;
else
return FALSE;
}
bool8 Unref_MetatileBehavior_IsUnused05(u8 metatileBehavior)
{
if (metatileBehavior == MB_UNUSED_05)
return TRUE;
else
return FALSE;
}
bool8 MetatileBehavior_IsWalkNorth(u8 metatileBehavior)
{
if (metatileBehavior == MB_WALK_NORTH)
return TRUE;
else
return FALSE;
}
bool8 MetatileBehavior_IsWalkSouth(u8 metatileBehavior)
{
if (metatileBehavior == MB_WALK_SOUTH)
return TRUE;
else
return FALSE;
}
bool8 MetatileBehavior_IsWalkWest(u8 metatileBehavior)
{
if (metatileBehavior == MB_WALK_WEST)
return TRUE;
else
return FALSE;
}
bool8 MetatileBehavior_IsWalkEast(u8 metatileBehavior)
{
if (metatileBehavior == MB_WALK_EAST)
return TRUE;
else
return FALSE;
}
bool8 MetatileBehavior_IsNorthwardCurrent(u8 metatileBehavior)
{
if (metatileBehavior == MB_NORTHWARD_CURRENT)
return TRUE;
else
return FALSE;
}
bool8 MetatileBehavior_IsSouthwardCurrent(u8 metatileBehavior)
{
if (metatileBehavior == MB_SOUTHWARD_CURRENT)
return TRUE;
else
return FALSE;
}
bool8 MetatileBehavior_IsWestwardCurrent(u8 metatileBehavior)
{
if (metatileBehavior == MB_WESTWARD_CURRENT)
return TRUE;
else
return FALSE;
}
bool8 MetatileBehavior_IsEastwardCurrent(u8 metatileBehavior)
{
if (metatileBehavior == MB_EASTWARD_CURRENT)
return TRUE;
else
return FALSE;
}
bool8 MetatileBehavior_IsSlideNorth(u8 metatileBehavior)
{
if (metatileBehavior == MB_SLIDE_NORTH)
return TRUE;
else
return FALSE;
}
bool8 MetatileBehavior_IsSlideSouth(u8 metatileBehavior)
{
if (metatileBehavior == MB_SLIDE_SOUTH)
return TRUE;
else
return FALSE;
}
bool8 MetatileBehavior_IsSlideWest(u8 metatileBehavior)
{
if (metatileBehavior == MB_SLIDE_WEST)
return TRUE;
else
return FALSE;
}
bool8 MetatileBehavior_IsSlideEast(u8 metatileBehavior)
{
if (metatileBehavior == MB_SLIDE_EAST)
return TRUE;
else
return FALSE;
}
bool8 MetatileBehavior_IsCounter(u8 metatileBehavior)
{
if (metatileBehavior == MB_COUNTER)
return TRUE;
else
return FALSE;
}
bool8 MetatileBehavior_IsPlayerFacingTVScreen(u8 metatileBehavior, u8 playerDir)
{
if (playerDir != DIR_NORTH)
return FALSE;
else if (metatileBehavior == MB_TELEVISION)
return TRUE;
else
return FALSE;
}
bool8 MetatileBehavior_IsPC(u8 metatileBehavior)
{
if (metatileBehavior == MB_PC)
return TRUE;
else
return FALSE;
}
bool8 MetatileBehavior_IsCableBoxResults1(u8 metatileBehavior)
{
if (metatileBehavior == MB_CABLE_BOX_RESULTS_1)
return TRUE;
else
return FALSE;
}
bool8 MetatileBehavior_IsOpenSecretBaseDoor(u8 metatileBehavior)
{
if (metatileBehavior == MB_SECRET_BASE_SPOT_RED_CAVE_OPEN
|| metatileBehavior == MB_SECRET_BASE_SPOT_BROWN_CAVE_OPEN
|| metatileBehavior == MB_SECRET_BASE_SPOT_YELLOW_CAVE_OPEN
|| metatileBehavior == MB_SECRET_BASE_SPOT_TREE_LEFT_OPEN
|| metatileBehavior == MB_SECRET_BASE_SPOT_SHRUB_OPEN
|| metatileBehavior == MB_SECRET_BASE_SPOT_BLUE_CAVE_OPEN
|| metatileBehavior == MB_SECRET_BASE_SPOT_TREE_RIGHT_OPEN)
return TRUE;
else
return FALSE;
}
bool8 MetatileBehavior_IsSecretBaseCave(u8 metatileBehavior)
{
if (metatileBehavior == MB_SECRET_BASE_SPOT_RED_CAVE
|| metatileBehavior == MB_SECRET_BASE_SPOT_BROWN_CAVE
|| metatileBehavior == MB_SECRET_BASE_SPOT_YELLOW_CAVE
|| metatileBehavior == MB_SECRET_BASE_SPOT_BLUE_CAVE)
return TRUE;
else
return FALSE;
}
bool8 MetatileBehavior_IsSecretBaseTree(u8 metatileBehavior)
{
if (metatileBehavior == MB_SECRET_BASE_SPOT_TREE_LEFT
|| metatileBehavior == MB_SECRET_BASE_SPOT_TREE_RIGHT)
return TRUE;
else
return FALSE;
}
bool8 MetatileBehavior_IsSecretBaseShrub(u8 metatileBehavior)
{
if (metatileBehavior == MB_SECRET_BASE_SPOT_SHRUB)
return TRUE;
else
return FALSE;
}
bool8 MetatileBehavior_IsSecretBasePC(u8 metatileBehavior)
{
if (metatileBehavior == MB_SECRET_BASE_PC)
return TRUE;
else
return FALSE;
}
bool8 MetatileBehavior_IsRecordMixingSecretBasePC(u8 metatileBehavior)
{
if (metatileBehavior == MB_SECRET_BASE_REGISTER_PC)
return TRUE;
else
return FALSE;
}
// Used by the rock/grass floor spaces that the secret base trainer is not standing on
bool8 MetatileBehavior_IsSecretBaseScenery1(u8 metatileBehavior)
{
if (metatileBehavior == MB_SECRET_BASE_SCENERY)
return TRUE;
else
return FALSE;
}
// Used by the rock/grass floor space that the secret base trainer stands on
bool8 MetatileBehavior_IsSecretBaseTrainerSpot(u8 metatileBehavior)
{
if (metatileBehavior == MB_SECRET_BASE_TRAINER_SPOT)
return TRUE;
else
return FALSE;
}
bool8 MetatileBehavior_IsSecretBaseImpassable(u8 metatileBehavior)
{
if (metatileBehavior == MB_SECRET_BASE_IMPASSABLE)
return TRUE;
else
return FALSE;
}
bool8 MetatileBehavior_IsSecretBaseDecorationBase(u8 metatileBehavior)
{
if (metatileBehavior == MB_SECRET_BASE_DECORATION_BASE)
return TRUE;
else
return FALSE;
}
bool8 MetatileBehavior_IsSecretBasePoster(u8 metatileBehavior)
{
if (metatileBehavior == MB_SECRET_BASE_POSTER)
return TRUE;
else
return FALSE;
}
bool8 MetatileBehavior_IsNormal(u8 metatileBehavior)
{
if (metatileBehavior == MB_NORMAL)
return TRUE;
else
return FALSE;
}
bool8 MetatileBehavior_IsSecretBaseNorthWall(u8 metatileBehavior)
{
if (metatileBehavior == MB_SECRET_BASE_NORTH_WALL)
return TRUE;
else
return FALSE;
}
bool8 MetatileBehavior_IsSecretBaseScenery2(u8 metatileBehavior)
{
if (metatileBehavior == MB_SECRET_BASE_SCENERY)
return TRUE;
else
return FALSE;
}
bool8 MetatileBehavior_HoldsSmallDecoration(u8 metatileBehavior)
{
if (metatileBehavior == MB_HOLDS_SMALL_DECORATION)
return TRUE;
else
return FALSE;
}
bool8 MetatileBehavior_HoldsLargeDecoration(u8 metatileBehavior)
{
if (metatileBehavior == MB_HOLDS_LARGE_DECORATION)
return TRUE;
else
return FALSE;
}
bool8 MetatileBehavior_IsSecretBaseHole(u8 metatileBehavior)
{
if (metatileBehavior == MB_SECRET_BASE_HOLE)
return TRUE;
else
return FALSE;
}
bool8 MetatileBehavior_IsSecretBaseBalloon(u8 metatileBehavior)
{
if (metatileBehavior == MB_SECRET_BASE_BALLOON)
return TRUE;
else
return FALSE;
}
bool8 MetatileBehavior_IsSecretBaseBreakableDoor(u8 metatileBehavior)
{
if (metatileBehavior == MB_SECRET_BASE_BREAKABLE_DOOR)
return TRUE;
else
return FALSE;
}
bool8 MetatileBehavior_IsSecretBaseSoundMat(u8 metatileBehavior)
{
if (metatileBehavior == MB_SECRET_BASE_SOUND_MAT)
return TRUE;
else
return FALSE;
}
bool8 MetatileBehavior_IsSecretBaseGlitterMat(u8 metatileBehavior)
{
if (metatileBehavior == MB_SECRET_BASE_GLITTER_MAT)
return TRUE;
else
return FALSE;
}
bool8 MetatileBehavior_IsSecretBaseSandOrnament(u8 metatileBehavior)
{
if (metatileBehavior == MB_SECRET_BASE_SAND_ORNAMENT)
return TRUE;
else
return FALSE;
}
bool8 MetatileBehavior_IsSecretBaseShieldOrToyTV(u8 metatileBehavior)
{
if (metatileBehavior == MB_SECRET_BASE_TV_SHIELD)
return TRUE;
else
return FALSE;
}
bool8 MetatileBehavior_IsPlayerRoomPCOn(u8 metatileBehavior)
{
if (metatileBehavior == MB_PLAYER_ROOM_PC_ON)
return TRUE;
else
return FALSE;
}
bool8 MetatileBehavior_HasRipples(u8 metatileBehavior)
{
if (metatileBehavior == MB_POND_WATER
|| metatileBehavior == MB_PUDDLE
|| metatileBehavior == MB_SOOTOPOLIS_DEEP_WATER)
return TRUE;
else
return FALSE;
}
bool8 MetatileBehavior_IsPuddle(u8 metatileBehavior)
{
if (metatileBehavior == MB_PUDDLE)
return TRUE;
else
return FALSE;
}
bool8 MetatileBehavior_IsTallGrass(u8 metatileBehavior)
{
if (metatileBehavior == MB_TALL_GRASS)
return TRUE;
else
return FALSE;
}
bool8 MetatileBehavior_IsLongGrass(u8 metatileBehavior)
{
if (metatileBehavior == MB_LONG_GRASS)
return TRUE;
else
return FALSE;
}
bool8 MetatileBehavior_IsBerryTreeSoil(u8 metatileBehavior)
{
if (metatileBehavior == MB_BERRY_TREE_SOIL)
return TRUE;
else
return FALSE;
}
bool8 MetatileBehavior_IsAshGrass(u8 metatileBehavior)
{
if (metatileBehavior == MB_ASHGRASS)
return TRUE;
else
return FALSE;
}
bool8 MetatileBehavior_IsFootprints(u8 metatileBehavior)
{
// MB_FOOTPRINTS is not used by any metatiles.
if (metatileBehavior == MB_FOOTPRINTS)
return TRUE;
else
return FALSE;
}
// For the sections of log bridges that span water / water's edge.
// Note that the rest of the metatiles for these bridges use MB_NORMAL.
// This is used to allow encounters on the water below the bridge.
bool8 MetatileBehavior_IsBridgeOverWater(u8 metatileBehavior)
{
if ((metatileBehavior == MB_BRIDGE_OVER_OCEAN
|| metatileBehavior == MB_BRIDGE_OVER_POND_LOW
|| metatileBehavior == MB_BRIDGE_OVER_POND_MED
|| metatileBehavior == MB_BRIDGE_OVER_POND_HIGH)
|| (metatileBehavior == MB_BRIDGE_OVER_POND_HIGH_EDGE_1
|| metatileBehavior == MB_BRIDGE_OVER_POND_HIGH_EDGE_2
|| metatileBehavior == MB_UNUSED_BRIDGE
|| metatileBehavior == MB_BIKE_BRIDGE_OVER_BARRIER))
return TRUE;
else
return FALSE;
}
u8 MetatileBehavior_GetBridgeType(u8 metatileBehavior)
{
// MB_BRIDGE_OVER_OCEAN --> BRIDGE_TYPE_OCEAN (Routes 110/119)
// MB_BRIDGE_OVER_POND_LOW --> BRIDGE_TYPE_POND_LOW (Unused)
// MB_BRIDGE_OVER_POND_MED --> BRIDGE_TYPE_POND_MED (Route 120, south)
// MB_BRIDGE_OVER_POND_HIGH --> BRIDGE_TYPE_POND_HIGH (Route 120, north)
if (metatileBehavior >= MB_BRIDGE_OVER_OCEAN
&& metatileBehavior <= MB_BRIDGE_OVER_POND_HIGH)
return metatileBehavior - MB_BRIDGE_OVER_OCEAN;
if (metatileBehavior >= MB_BRIDGE_OVER_POND_MED_EDGE_1
&& metatileBehavior <= MB_BRIDGE_OVER_POND_MED_EDGE_2)
return BRIDGE_TYPE_POND_MED;
if (metatileBehavior >= MB_BRIDGE_OVER_POND_HIGH_EDGE_1
&& metatileBehavior <= MB_BRIDGE_OVER_POND_HIGH_EDGE_2)
return BRIDGE_TYPE_POND_HIGH;
return BRIDGE_TYPE_OCEAN;
}
// Used to allow fishing below the bridge metatiles.
bool8 MetatileBehavior_IsBridgeOverWaterNoEdge(u8 metatileBehavior)
{
if (metatileBehavior >= MB_BRIDGE_OVER_OCEAN
&& metatileBehavior <= MB_BRIDGE_OVER_POND_HIGH)
return TRUE;
else
return FALSE;
}
bool8 MetatileBehavior_IsLandWildEncounter(u8 metatileBehavior)
{
if (MetatileBehavior_IsSurfableWaterOrUnderwater(metatileBehavior) == FALSE
&& MetatileBehavior_IsEncounterTile(metatileBehavior) == TRUE)
return TRUE;
else
return FALSE;
}
bool8 MetatileBehavior_IsWaterWildEncounter(u8 metatileBehavior)
{
if (MetatileBehavior_IsSurfableWaterOrUnderwater(metatileBehavior) == TRUE
&& MetatileBehavior_IsEncounterTile(metatileBehavior) == TRUE)
return TRUE;
else
return FALSE;
}
bool8 MetatileBehavior_IsIndoorEncounter(u8 metatileBehavior)
{
if (metatileBehavior == MB_INDOOR_ENCOUNTER)
return TRUE;
else
return FALSE;
}
bool8 MetatileBehavior_IsMountain(u8 metatileBehavior)
{
if (metatileBehavior == MB_MOUNTAIN_TOP)
return TRUE;
else
return FALSE;
}
bool8 MetatileBehavior_IsDiveable(u8 metatileBehavior)
{
if (metatileBehavior == MB_INTERIOR_DEEP_WATER
|| metatileBehavior == MB_DEEP_WATER
|| metatileBehavior == MB_SOOTOPOLIS_DEEP_WATER)
return TRUE;
else
return FALSE;
}
bool8 MetatileBehavior_IsUnableToEmerge(u8 metatileBehavior)
{
// BUG: The player is unintentionally able to emerge on water doors.
// Also the narrower underwater door in the underwater tileset has the wrong metatile behavior. This causes the dive glitch.
// To fix change the metatile behavior of the narrower water door with porymap's tileset editor.
if (metatileBehavior == MB_NO_SURFACING
|| metatileBehavior == MB_SEAWEED_NO_SURFACING
#ifdef BUGFIX
|| metatileBehavior == MB_WATER_DOOR
#endif
)
return TRUE;
else
return FALSE;
}
bool8 MetatileBehavior_IsShallowFlowingWater(u8 metatileBehavior)
{
if (metatileBehavior == MB_SHALLOW_WATER
|| metatileBehavior == MB_STAIRS_OUTSIDE_ABANDONED_SHIP
|| metatileBehavior == MB_SHOAL_CAVE_ENTRANCE)
return TRUE;
else
return FALSE;
}
bool8 MetatileBehavior_IsThinIce(u8 metatileBehavior)
{
if (metatileBehavior == MB_THIN_ICE)
return TRUE;
else
return FALSE;
}
bool8 MetatileBehavior_IsCrackedIce(u8 metatileBehavior)
{
if (metatileBehavior == MB_CRACKED_ICE)
return TRUE;
else
return FALSE;
}
bool8 MetatileBehavior_IsDeepOrOceanWater(u8 metatileBehavior)
{
if (metatileBehavior == MB_OCEAN_WATER
|| metatileBehavior == MB_INTERIOR_DEEP_WATER
|| metatileBehavior == MB_DEEP_WATER)
return TRUE;
else
return FALSE;
}
bool8 Unref_MetatileBehavior_IsUnusedSootopolisWater(u8 metatileBehavior)
{
if (metatileBehavior == MB_UNUSED_SOOTOPOLIS_DEEP_WATER
|| metatileBehavior == MB_UNUSED_SOOTOPOLIS_DEEP_WATER_2)
return TRUE;
else
return FALSE;
}
bool8 MetatileBehavior_IsSurfableAndNotWaterfall(u8 metatileBehavior)
{
if (MetatileBehavior_IsSurfableWaterOrUnderwater(metatileBehavior)
&& MetatileBehavior_IsWaterfall(metatileBehavior) == FALSE)
return TRUE;
else
return FALSE;
}
bool8 MetatileBehavior_IsEastBlocked(u8 metatileBehavior)
{
if (metatileBehavior == MB_IMPASSABLE_EAST
|| metatileBehavior == MB_IMPASSABLE_NORTHEAST
|| metatileBehavior == MB_IMPASSABLE_SOUTHEAST
|| metatileBehavior == MB_IMPASSABLE_WEST_AND_EAST
|| metatileBehavior == MB_SECRET_BASE_BREAKABLE_DOOR)
return TRUE;
else
return FALSE;
}
bool8 MetatileBehavior_IsWestBlocked(u8 metatileBehavior)
{
if (metatileBehavior == MB_IMPASSABLE_WEST
|| metatileBehavior == MB_IMPASSABLE_NORTHWEST
|| metatileBehavior == MB_IMPASSABLE_SOUTHWEST
|| metatileBehavior == MB_IMPASSABLE_WEST_AND_EAST
|| metatileBehavior == MB_SECRET_BASE_BREAKABLE_DOOR)
return TRUE;
else
return FALSE;
}
bool8 MetatileBehavior_IsNorthBlocked(u8 metatileBehavior)
{
if (metatileBehavior == MB_IMPASSABLE_NORTH
|| metatileBehavior == MB_IMPASSABLE_NORTHEAST
|| metatileBehavior == MB_IMPASSABLE_NORTHWEST
|| metatileBehavior == MB_IMPASSABLE_SOUTH_AND_NORTH)
return TRUE;
else
return FALSE;
}
bool8 MetatileBehavior_IsSouthBlocked(u8 metatileBehavior)
{
if (metatileBehavior == MB_IMPASSABLE_SOUTH
|| metatileBehavior == MB_IMPASSABLE_SOUTHEAST
|| metatileBehavior == MB_IMPASSABLE_SOUTHWEST
|| metatileBehavior == MB_IMPASSABLE_SOUTH_AND_NORTH)
return TRUE;
else
return FALSE;
}
bool8 MetatileBehavior_IsShortGrass(u8 metatileBehavior)
{
if (metatileBehavior == MB_SHORT_GRASS)
return TRUE;
else
return FALSE;
}
bool8 MetatileBehavior_IsHotSprings(u8 metatileBehavior)
{
if (metatileBehavior == MB_HOT_SPRINGS)
return TRUE;
else
return FALSE;
}
bool8 MetatileBehavior_IsWaterfall(u8 metatileBehavior)
{
if (metatileBehavior == MB_WATERFALL)
return TRUE;
else
return FALSE;