obj_event constants account for expansion, all functions use constants

This allows for discrepancies between expansion and non-expansion projects, as well as projects that have extra object events that offset stuff.
This commit is contained in:
W1serV1ser committed 2022-03-22 12:16:41 -07:00
1 parent 4e511f6149
commit ef6f39d32f
3 files changed
+227 -36

No files matched your search

+190
View File
@@ -492,6 +492,8 @@
#define OBJ_EVENT_GFX_HOOH_FOLLOWER 488 #define OBJ_EVENT_GFX_HOOH_FOLLOWER 488
#define OBJ_EVENT_GFX_CELEBI 489 #define OBJ_EVENT_GFX_CELEBI 489
#ifndef POKEMON_EXPANSION
#define OBJ_EVENT_GFX_GREAT_BALL 490 #define OBJ_EVENT_GFX_GREAT_BALL 490
#define OBJ_EVENT_GFX_ULTRA_BALL 491 #define OBJ_EVENT_GFX_ULTRA_BALL 491
#define OBJ_EVENT_GFX_MASTER_BALL 492 #define OBJ_EVENT_GFX_MASTER_BALL 492
@@ -676,6 +678,194 @@
#define NUM_OBJ_EVENT_GFX 680 #define NUM_OBJ_EVENT_GFX 680
#else
// There are no OLD_UNOWN constants in the pokemon_expansion
#define OBJ_EVENT_GFX_TREECKO 490
#define OBJ_EVENT_GFX_GROVYLE 491
#define OBJ_EVENT_GFX_SCEPTILE 492
#define OBJ_EVENT_GFX_TORCHIC 493
#define OBJ_EVENT_GFX_COMBUSKEN 494
#define OBJ_EVENT_GFX_BLAZIKEN 495
#define OBJ_EVENT_GFX_MUDKIP 496
#define OBJ_EVENT_GFX_MARSHTOMP 497
#define OBJ_EVENT_GFX_SWAMPERT 498
#define OBJ_EVENT_GFX_POOCHYENA_FOLLOWER 499
#define OBJ_EVENT_GFX_MIGHTYENA 500
#define OBJ_EVENT_GFX_ZIGZAGOON_FOLLOWER 501
#define OBJ_EVENT_GFX_LINOONE 502
#define OBJ_EVENT_GFX_WURMPLE 503
#define OBJ_EVENT_GFX_SILCOON 504
#define OBJ_EVENT_GFX_BEAUTIFLY 505
#define OBJ_EVENT_GFX_CASCOON 506
#define OBJ_EVENT_GFX_DUSTOX 507
#define OBJ_EVENT_GFX_LOTAD 508
#define OBJ_EVENT_GFX_LOMBRE 509
#define OBJ_EVENT_GFX_LUDICOLO 510
#define OBJ_EVENT_GFX_SEEDOT 511
#define OBJ_EVENT_GFX_NUZLEAF 512
#define OBJ_EVENT_GFX_SHIFTRY 513
#define OBJ_EVENT_GFX_NINCADA 514
#define OBJ_EVENT_GFX_NINJASK 515
#define OBJ_EVENT_GFX_SHEDINJA 516
#define OBJ_EVENT_GFX_TAILLOW 517
#define OBJ_EVENT_GFX_SWELLOW 518
#define OBJ_EVENT_GFX_SHROOMISH 519
#define OBJ_EVENT_GFX_BRELOOM 520
#define OBJ_EVENT_GFX_SPINDA 521
#define OBJ_EVENT_GFX_WINGULL_FOLLOWER 522
#define OBJ_EVENT_GFX_PELIPPER 523
#define OBJ_EVENT_GFX_SURSKIT 524
#define OBJ_EVENT_GFX_MASQUERAIN 525
#define OBJ_EVENT_GFX_WAILMER 526
#define OBJ_EVENT_GFX_WAILORD 527
#define OBJ_EVENT_GFX_SKITTY_FOLLOWER 528
#define OBJ_EVENT_GFX_DELCATTY 529
#define OBJ_EVENT_GFX_KECLEON_FOLLOWER 530
#define OBJ_EVENT_GFX_BALTOY 531
#define OBJ_EVENT_GFX_CLAYDOL 532
#define OBJ_EVENT_GFX_NOSEPASS 533
#define OBJ_EVENT_GFX_TORKOAL 534
#define OBJ_EVENT_GFX_SABLEYE 535
#define OBJ_EVENT_GFX_BARBOACH 536
#define OBJ_EVENT_GFX_WHISCASH 537
#define OBJ_EVENT_GFX_LUVDISC 538
#define OBJ_EVENT_GFX_CORPHISH 539
#define OBJ_EVENT_GFX_CRAWDAUNT 540
#define OBJ_EVENT_GFX_FEEBAS 541
#define OBJ_EVENT_GFX_MILOTIC 542
#define OBJ_EVENT_GFX_CARVANHA 543
#define OBJ_EVENT_GFX_SHARPEDO 544
#define OBJ_EVENT_GFX_TRAPINCH 545
#define OBJ_EVENT_GFX_VIBRAVA 546
#define OBJ_EVENT_GFX_FLYGON 547
#define OBJ_EVENT_GFX_MAKUHITA 548
#define OBJ_EVENT_GFX_HARIYAMA 549
#define OBJ_EVENT_GFX_ELECTRIKE 550
#define OBJ_EVENT_GFX_MANECTRIC 551
#define OBJ_EVENT_GFX_NUMEL 552
#define OBJ_EVENT_GFX_CAMERUPT 553
#define OBJ_EVENT_GFX_SPHEAL 554
#define OBJ_EVENT_GFX_SEALEO 555
#define OBJ_EVENT_GFX_WALREIN 556
#define OBJ_EVENT_GFX_CACNEA 557
#define OBJ_EVENT_GFX_CACTURNE 558
#define OBJ_EVENT_GFX_SNORUNT 559
#define OBJ_EVENT_GFX_GLALIE 560
#define OBJ_EVENT_GFX_LUNATONE 561
#define OBJ_EVENT_GFX_SOLROCK 562
#define OBJ_EVENT_GFX_AZURILL_FOLLOWER 563
#define OBJ_EVENT_GFX_SPOINK 564
#define OBJ_EVENT_GFX_GRUMPIG 565
#define OBJ_EVENT_GFX_PLUSLE 566
#define OBJ_EVENT_GFX_MINUN 567
#define OBJ_EVENT_GFX_MAWILE 568
#define OBJ_EVENT_GFX_MEDITITE 569
#define OBJ_EVENT_GFX_MEDICHAM 570
#define OBJ_EVENT_GFX_SWABLU 571
#define OBJ_EVENT_GFX_ALTARIA 572
#define OBJ_EVENT_GFX_WYNAUT 573
#define OBJ_EVENT_GFX_DUSKULL 574
#define OBJ_EVENT_GFX_DUSCLOPS_FOLLOWER 575
#define OBJ_EVENT_GFX_ROSELIA 576
#define OBJ_EVENT_GFX_SLAKOTH 577
#define OBJ_EVENT_GFX_VIGOROTH_FOLLOWER 578
#define OBJ_EVENT_GFX_SLAKING 579
#define OBJ_EVENT_GFX_GULPIN 580
#define OBJ_EVENT_GFX_SWALOT 581
#define OBJ_EVENT_GFX_TROPIUS 582
#define OBJ_EVENT_GFX_WHISMUR 583
#define OBJ_EVENT_GFX_LOUDRED 584
#define OBJ_EVENT_GFX_EXPLOUD 585
#define OBJ_EVENT_GFX_CLAMPERL 586
#define OBJ_EVENT_GFX_HUNTAIL 587
#define OBJ_EVENT_GFX_GOREBYSS 588
#define OBJ_EVENT_GFX_ABSOL 589
#define OBJ_EVENT_GFX_SHUPPET 590
#define OBJ_EVENT_GFX_BANETTE 591
#define OBJ_EVENT_GFX_SEVIPER 592
#define OBJ_EVENT_GFX_ZANGOOSE 593
#define OBJ_EVENT_GFX_RELICANTH 594
#define OBJ_EVENT_GFX_ARON 595
#define OBJ_EVENT_GFX_LAIRON 596
#define OBJ_EVENT_GFX_AGGRON 597
#define OBJ_EVENT_GFX_CASTFORM 598
#define OBJ_EVENT_GFX_VOLBEAT 599
#define OBJ_EVENT_GFX_ILLUMISE 600
#define OBJ_EVENT_GFX_LILEEP 601
#define OBJ_EVENT_GFX_CRADILY 602
#define OBJ_EVENT_GFX_ANORITH 603
#define OBJ_EVENT_GFX_ARMALDO 604
#define OBJ_EVENT_GFX_RALTS 605
#define OBJ_EVENT_GFX_KIRLIA_FOLLOWER 606
#define OBJ_EVENT_GFX_GARDEVOIR 607
#define OBJ_EVENT_GFX_BAGON 608
#define OBJ_EVENT_GFX_SHELGON 609
#define OBJ_EVENT_GFX_SALAMENCE 610
#define OBJ_EVENT_GFX_BELDUM 611
#define OBJ_EVENT_GFX_METANG 612
#define OBJ_EVENT_GFX_METAGROSS 613
#define OBJ_EVENT_GFX_REGIROCK_FOLLOWER 614
#define OBJ_EVENT_GFX_REGICE_FOLLOWER 615
#define OBJ_EVENT_GFX_REGISTEEL_FOLLOWER 616
#define OBJ_EVENT_GFX_KYOGRE 617
#define OBJ_EVENT_GFX_GROUDON 618
#define OBJ_EVENT_GFX_RAYQUAZA_FOLLOWER 619
#define OBJ_EVENT_GFX_LATIAS_FOLLOWER 620
#define OBJ_EVENT_GFX_LATIOS_FOLLOWER 621
#define OBJ_EVENT_GFX_JIRACHI 622
#define OBJ_EVENT_GFX_DEOXYS_NORMAL 623
#define OBJ_EVENT_GFX_CHIMECHO 624
// Other forms
#define OBJ_EVENT_GFX_DEOXYS_ATTACK 625
#define OBJ_EVENT_GFX_DEOXYS_DEFENSE 626
#define OBJ_EVENT_GFX_DEOXYS_SPEED 627
#define OBJ_EVENT_GFX_UNOWN_B 628
#define OBJ_EVENT_GFX_UNOWN_C 629
#define OBJ_EVENT_GFX_UNOWN_D 630
#define OBJ_EVENT_GFX_UNOWN_E 631
#define OBJ_EVENT_GFX_UNOWN_F 632
#define OBJ_EVENT_GFX_UNOWN_G 633
#define OBJ_EVENT_GFX_UNOWN_H 634
#define OBJ_EVENT_GFX_UNOWN_I 635
#define OBJ_EVENT_GFX_UNOWN_J 636
#define OBJ_EVENT_GFX_UNOWN_K 637
#define OBJ_EVENT_GFX_UNOWN_L 638
#define OBJ_EVENT_GFX_UNOWN_M 639
#define OBJ_EVENT_GFX_UNOWN_N 640
#define OBJ_EVENT_GFX_UNOWN_O 641
#define OBJ_EVENT_GFX_UNOWN_P 642
#define OBJ_EVENT_GFX_UNOWN_Q 643
#define OBJ_EVENT_GFX_UNOWN_R 644
#define OBJ_EVENT_GFX_UNOWN_S 645
#define OBJ_EVENT_GFX_UNOWN_T 646
#define OBJ_EVENT_GFX_UNOWN_U 647
#define OBJ_EVENT_GFX_UNOWN_V 648
#define OBJ_EVENT_GFX_UNOWN_W 649
#define OBJ_EVENT_GFX_UNOWN_X 650
#define OBJ_EVENT_GFX_UNOWN_Y 651
#define OBJ_EVENT_GFX_UNOWN_Z 652
#define OBJ_EVENT_GFX_UNOWN_EXCLAMATION 653
#define OBJ_EVENT_GFX_UNOWN_QUESTION 654
#define OBJ_EVENT_GFX_GREAT_BALL 655
#define OBJ_EVENT_GFX_ULTRA_BALL 656
#define OBJ_EVENT_GFX_MASTER_BALL 657
#define OBJ_EVENT_GFX_SAFARI_BALL 658
#define OBJ_EVENT_GFX_NET_BALL 659
#define OBJ_EVENT_GFX_DIVE_BALL 660
#define OBJ_EVENT_GFX_NEST_BALL 661
#define OBJ_EVENT_GFX_REPEAT_BALL 662
#define OBJ_EVENT_GFX_TIMER_BALL 663
#define OBJ_EVENT_GFX_LUXURY_BALL 664
#define OBJ_EVENT_GFX_PREMIER_BALL 665
#define OBJ_EVENT_GFX_EXPANDING_SPARKLE 666
#define NUM_OBJ_EVENT_GFX 667
#endif
// These are dynamic object gfx ids. // These are dynamic object gfx ids.
// They correspond with the values of the VAR_OBJ_GFX_ID_X vars. // They correspond with the values of the VAR_OBJ_GFX_ID_X vars.
+11 -11
View File
@@ -10030,37 +10030,37 @@ u8 MovementAction_FollowingPokemon_Shrink_Step0(struct ObjectEvent *objectEvent,
switch(GetMonData(&gPlayerParty[GetLeadMonNotFaintedIndex()], MON_DATA_POKEBALL)) switch(GetMonData(&gPlayerParty[GetLeadMonNotFaintedIndex()], MON_DATA_POKEBALL))
{ {
case 1: // Master Ball case ITEM_MASTER_BALL:
spriteId = CreateObjectGraphicsSprite(OBJ_EVENT_GFX_MASTER_BALL, &PokeballCallback, x, y, 2); spriteId = CreateObjectGraphicsSprite(OBJ_EVENT_GFX_MASTER_BALL, &PokeballCallback, x, y, 2);
break; break;
case 2: // Ultra Ball case ITEM_ULTRA_BALL:
spriteId = CreateObjectGraphicsSprite(OBJ_EVENT_GFX_ULTRA_BALL, &PokeballCallback, x, y, 2); spriteId = CreateObjectGraphicsSprite(OBJ_EVENT_GFX_ULTRA_BALL, &PokeballCallback, x, y, 2);
break; break;
case 3: // Great Ball case ITEM_GREAT_BALL:
spriteId = CreateObjectGraphicsSprite(OBJ_EVENT_GFX_GREAT_BALL, &PokeballCallback, x, y, 2); spriteId = CreateObjectGraphicsSprite(OBJ_EVENT_GFX_GREAT_BALL, &PokeballCallback, x, y, 2);
break; break;
case 5: // Safari Ball case ITEM_SAFARI_BALL:
spriteId = CreateObjectGraphicsSprite(OBJ_EVENT_GFX_SAFARI_BALL, &PokeballCallback, x, y, 2); spriteId = CreateObjectGraphicsSprite(OBJ_EVENT_GFX_SAFARI_BALL, &PokeballCallback, x, y, 2);
break; break;
case 6: // Net Ball case ITEM_NET_BALL:
spriteId = CreateObjectGraphicsSprite(OBJ_EVENT_GFX_NET_BALL, &PokeballCallback, x, y, 2); spriteId = CreateObjectGraphicsSprite(OBJ_EVENT_GFX_NET_BALL, &PokeballCallback, x, y, 2);
break; break;
case 7: // Dive Ball case ITEM_DIVE_BALL:
spriteId = CreateObjectGraphicsSprite(OBJ_EVENT_GFX_DIVE_BALL, &PokeballCallback, x, y, 2); spriteId = CreateObjectGraphicsSprite(OBJ_EVENT_GFX_DIVE_BALL, &PokeballCallback, x, y, 2);
break; break;
case 8: // Nest Ball case ITEM_NEST_BALL:
spriteId = CreateObjectGraphicsSprite(OBJ_EVENT_GFX_NEST_BALL, &PokeballCallback, x, y, 2); spriteId = CreateObjectGraphicsSprite(OBJ_EVENT_GFX_NEST_BALL, &PokeballCallback, x, y, 2);
break; break;
case 9: // Repeat Ball case ITEM_REPEAT_BALL:
spriteId = CreateObjectGraphicsSprite(OBJ_EVENT_GFX_REPEAT_BALL, &PokeballCallback, x, y, 2); spriteId = CreateObjectGraphicsSprite(OBJ_EVENT_GFX_REPEAT_BALL, &PokeballCallback, x, y, 2);
break; break;
case 10: // Timer Ball case ITEM_TIMER_BALL:
spriteId = CreateObjectGraphicsSprite(OBJ_EVENT_GFX_TIMER_BALL, &PokeballCallback, x, y, 2); spriteId = CreateObjectGraphicsSprite(OBJ_EVENT_GFX_TIMER_BALL, &PokeballCallback, x, y, 2);
break; break;
case 11: // Luxury Ball case ITEM_LUXURY_BALL:
spriteId = CreateObjectGraphicsSprite(OBJ_EVENT_GFX_LUXURY_BALL, &PokeballCallback, x, y, 2); spriteId = CreateObjectGraphicsSprite(OBJ_EVENT_GFX_LUXURY_BALL, &PokeballCallback, x, y, 2);
break; break;
case 12: // Premier Ball case ITEM_PREMIER_BALL:
spriteId = CreateObjectGraphicsSprite(OBJ_EVENT_GFX_PREMIER_BALL, &PokeballCallback, x, y, 2); spriteId = CreateObjectGraphicsSprite(OBJ_EVENT_GFX_PREMIER_BALL, &PokeballCallback, x, y, 2);
break; break;
default: // PokeBall default: // PokeBall
+26 -25
View File
@@ -71,6 +71,7 @@
#include "constants/weather.h" #include "constants/weather.h"
#include "constants/event_object_movement.h" #include "constants/event_object_movement.h"
#include "constants/event_objects.h" #include "constants/event_objects.h"
#include "constants/items.h"
struct CableClubPlayer struct CableClubPlayer
{ {
@@ -3639,7 +3640,7 @@ void UpdateFollowerPokemonGraphic(void)
{ {
// Loaded in case the player changed the species of the Pokemon in the lead of the party. // Loaded in case the player changed the species of the Pokemon in the lead of the party.
// If so, the following Pokemon needs to change. // If so, the following Pokemon needs to change.
u16 leadMonGraphicId = GetMonData(&gPlayerParty[GetLeadMonNotFaintedIndex()], MON_DATA_SPECIES, NULL) + 238; u16 leadMonGraphicId = GetMonData(&gPlayerParty[GetLeadMonNotFaintedIndex()], MON_DATA_SPECIES, NULL) + OBJ_EVENT_GFX_BULBASAUR - 1;
struct ObjectEvent *follower = &gObjectEvents[gSaveBlock2Ptr->follower.objId]; struct ObjectEvent *follower = &gObjectEvents[gSaveBlock2Ptr->follower.objId];
// If the lead Pokemon is Unown, use the correct sprite // If the lead Pokemon is Unown, use the correct sprite
@@ -4069,41 +4070,41 @@ void FollowerPokeballSparkle(void)
switch(GetMonData(&gPlayerParty[GetLeadMonNotFaintedIndex()], MON_DATA_POKEBALL)) switch(GetMonData(&gPlayerParty[GetLeadMonNotFaintedIndex()], MON_DATA_POKEBALL))
{ {
case 1: // Master Ball case ITEM_MASTER_BALL:
spriteId = CreateObjectGraphicsSprite(492, &SparklePokeballCallback, x, y, 2); spriteId = CreateObjectGraphicsSprite(OBJ_EVENT_GFX_MASTER_BALL, &SparklePokeballCallback, x, y, 2);
break; break;
case 2: // Ultra Ball case ITEM_ULTRA_BALL:
spriteId = CreateObjectGraphicsSprite(491, &SparklePokeballCallback, x, y, 2); spriteId = CreateObjectGraphicsSprite(OBJ_EVENT_GFX_ULTRA_BALL, &SparklePokeballCallback, x, y, 2);
break; break;
case 3: // Great Ball case ITEM_GREAT_BALL:
spriteId = CreateObjectGraphicsSprite(490, &SparklePokeballCallback, x, y, 2); spriteId = CreateObjectGraphicsSprite(OBJ_EVENT_GFX_GREAT_BALL, &SparklePokeballCallback, x, y, 2);
break; break;
case 5: // Safari Ball case ITEM_SAFARI_BALL:
spriteId = CreateObjectGraphicsSprite(493, &SparklePokeballCallback, x, y, 2); spriteId = CreateObjectGraphicsSprite(OBJ_EVENT_GFX_SAFARI_BALL, &SparklePokeballCallback, x, y, 2);
break; break;
case 6: // Net Ball case ITEM_NET_BALL:
spriteId = CreateObjectGraphicsSprite(494, &SparklePokeballCallback, x, y, 2); spriteId = CreateObjectGraphicsSprite(OBJ_EVENT_GFX_NET_BALL, &SparklePokeballCallback, x, y, 2);
break; break;
case 7: // Dive Ball case ITEM_DIVE_BALL:
spriteId = CreateObjectGraphicsSprite(495, &SparklePokeballCallback, x, y, 2); spriteId = CreateObjectGraphicsSprite(OBJ_EVENT_GFX_DIVE_BALL, &SparklePokeballCallback, x, y, 2);
break; break;
case 8: // Nest Ball case ITEM_NEST_BALL:
spriteId = CreateObjectGraphicsSprite(496, &SparklePokeballCallback, x, y, 2); spriteId = CreateObjectGraphicsSprite(OBJ_EVENT_GFX_NEST_BALL, &SparklePokeballCallback, x, y, 2);
break; break;
case 9: // Repeat Ball case ITEM_REPEAT_BALL:
spriteId = CreateObjectGraphicsSprite(497, &SparklePokeballCallback, x, y, 2); spriteId = CreateObjectGraphicsSprite(OBJ_EVENT_GFX_REPEAT_BALL, &SparklePokeballCallback, x, y, 2);
break; break;
case 10: // Timer Ball case ITEM_TIMER_BALL:
spriteId = CreateObjectGraphicsSprite(498, &SparklePokeballCallback, x, y, 2); spriteId = CreateObjectGraphicsSprite(OBJ_EVENT_GFX_TIMER_BALL, &SparklePokeballCallback, x, y, 2);
break; break;
case 11: // Luxury Ball case ITEM_LUXURY_BALL:
spriteId = CreateObjectGraphicsSprite(499, &SparklePokeballCallback, x, y, 2); spriteId = CreateObjectGraphicsSprite(OBJ_EVENT_GFX_LUXURY_BALL, &SparklePokeballCallback, x, y, 2);
break; break;
case 12: // Premier Ball case ITEM_PREMIER_BALL:
spriteId = CreateObjectGraphicsSprite(500, &SparklePokeballCallback, x, y, 2); spriteId = CreateObjectGraphicsSprite(OBJ_EVENT_GFX_PREMIER_BALL, &SparklePokeballCallback, x, y, 2);
break; break;
default: // PokeBall, at default rather than 4 in case of item_expansion default: // PokeBall
spriteId = CreateObjectGraphicsSprite(59, &SparklePokeballCallback, x, y, 2); spriteId = CreateObjectGraphicsSprite(OBJ_EVENT_GFX_ITEM_BALL, &SparklePokeballCallback, x, y, 2);
break; break;
} }