diff --git a/data/layouts/BattleFrontier_BattleDomeBattleRoom/map.bin b/data/layouts/BattleFrontier_BattleDomeBattleRoom/map.bin index e0f2dc82f0..ffb450f3c3 100644 --- a/data/layouts/BattleFrontier_BattleDomeBattleRoom/map.bin +++ b/data/layouts/BattleFrontier_BattleDomeBattleRoom/map.bin @@ -1,2 +1,2 @@ -Ð2Ð2ÑÐ2Ð2Ð2Ð2Ð2Ð2Ð2ÑÐ2Ð2Ð2Ð2Ð2ÑÐ2Ð2Ð2ÐRÐRÑÐRÐRÐRÐRÐRÐRÐRÑÐRÐRÐRÐRÐRÑÐRÐRÐRÒ2Ò2ÓÒ2Ò2Ò2Ò2Ò2Ò2Ò2ÓÒ2Ò2Ò2Ò2Ò2ÓÒ2Ò2Ò2ÔÕÖרÙÚÔÕÖרÙÚÔÕÖ×ØÙ 3 3á2â2ã2ä2å2æ2ç23333333 3 3 3 3 3 3é2êëìíBîBïBCCC3 3 3 3 3 3 3ñ2òBóBôBõBöB÷B C!C"C#C$C%C&3 3 3 3 3 3 3ù2úûüýBþBÿB(C)C*C+,-.3 3 3 3 3 3 3333301233435363 3 3 3 3 3 3 3 -3 3 3 3338393:3;3<3=3>3>3 3 3 3 \ No newline at end of file +ÐÐÑÐÐÐÐÐÐÐÑÐÐÐÐÐÑÐÐÐÐÐÑÐÐÐÐÐÐÐÑÐÐÐÐÐÑÐÐÐÒÒÓÒÒÒÒÒÒÒÓÒÒÒÒÒÓÒÒÒÔÕÖרÙÚÔÕÖרÙÚÔÕÖ×ØÙ  áâãäåæç      éêëìíîï      ñòóôõö÷ !"#$%&      ùúûüýþÿ()*+,-.      0123456        +   89:;<=>>    \ No newline at end of file diff --git a/data/scripts/field_move_scripts.inc b/data/scripts/field_move_scripts.inc index b2c5dc84d4..e15115f826 100644 --- a/data/scripts/field_move_scripts.inc +++ b/data/scripts/field_move_scripts.inc @@ -1,3 +1,8 @@ +.macro IsFollowerFieldMoveUser var:req +callfunc ScrFunc_IsFollowerFieldMoveUser +.2byte \var +.endm + @ Interact with cuttable tree EventScript_CutTree:: lockall @@ -12,8 +17,7 @@ EventScript_CutTree:: msgbox Text_MonUsedFieldMove, MSGBOX_DEFAULT closemessage EventScript_CutTreeCommon: - callfunc ScrFunc_IsFollowerFieldMoveUser - .2byte VAR_0x8004 + IsFollowerFieldMoveUser VAR_0x8004 setfieldeffectargument 3, VAR_0x8004 @ skip pose if so dofieldeffect FLDEFF_USE_CUT_ON_TREE waitstate @@ -77,8 +81,7 @@ EventScript_RockSmash:: closemessage EventScript_RockSmashCommon: @ check if follower should use the field move - callfunc ScrFunc_IsFollowerFieldMoveUser - .2byte VAR_0x8004 + IsFollowerFieldMoveUser VAR_0x8004 setfieldeffectargument 3, VAR_0x8004 @ skip pose if so dofieldeffect FLDEFF_USE_ROCK_SMASH waitstate diff --git a/data/scripts/follower.inc b/data/scripts/follower.inc index f0ef6dbb3b..1be8689a68 100644 --- a/data/scripts/follower.inc +++ b/data/scripts/follower.inc @@ -1,5 +1,5 @@ gText_FollowerLovesYou:: - .string "123456789012345678901234567890123\n$" + .string "{STR_VAR_1} is regarding you with\nadoration!$" gText_FollowerLostInThought:: .string "{STR_VAR_1} seems lost in thought.$" @@ -36,8 +36,8 @@ EventScript_FollowerEnd:: end EventScript_FollowerLovesYou:: - applymovement 0xFE ContestHall_Movement_Heart - waitmovement 0xFE + applymovement OBJ_EVENT_ID_FOLLOWER ContestHall_Movement_Heart + waitmovement OBJ_EVENT_ID_FOLLOWER waitmoncry msgbox gText_FollowerLovesYou, MSGBOX_DEFAULT return @@ -54,8 +54,8 @@ EventScript_FollowerGenericSkipFace: EventScript_FollowerJump:: faceplayer - applymovement 0xFE FollowerSplashMovement - waitmovement 0xFE + applymovement OBJ_EVENT_ID_FOLLOWER FollowerSplashMovement + waitmovement OBJ_EVENT_ID_FOLLOWER waitfieldeffect FLDEFF_EMOTE message 0x0 waitmessage @@ -394,44 +394,44 @@ EventScript_FollowerIsShivering:: goto EventScript_FollowerGeneric ShiverVertical: - applymovement 0xFE FollowerShiverVerticalMovement - waitmovement 0xFE + applymovement OBJ_EVENT_ID_FOLLOWER FollowerShiverVerticalMovement + waitmovement OBJ_EVENT_ID_FOLLOWER return ShiverHorizontal: - applymovement 0xFE FollowerShiverHorizontalMovement - waitmovement 0xFE + applymovement OBJ_EVENT_ID_FOLLOWER FollowerShiverHorizontalMovement + waitmovement OBJ_EVENT_ID_FOLLOWER return EventScript_FollowerNostalgia:: - applymovement 0xFE FollowerNostalgiaMovement - waitmovement 0xFE + applymovement OBJ_EVENT_ID_FOLLOWER FollowerNostalgiaMovement + waitmovement OBJ_EVENT_ID_FOLLOWER goto EventScript_FollowerGeneric EventScript_FollowerHopping:: faceplayer - applymovement 0xFE FollowerSkippingMovement - waitmovement 0xFE + applymovement OBJ_EVENT_ID_FOLLOWER FollowerSkippingMovement + waitmovement OBJ_EVENT_ID_FOLLOWER goto EventScript_FollowerGeneric JumpOnN: - applymovement 0xFE FollowerJumpOnPlayerNorth - waitmovement 0xFE + applymovement OBJ_EVENT_ID_FOLLOWER FollowerJumpOnPlayerNorth + waitmovement OBJ_EVENT_ID_FOLLOWER return JumpOnS: - applymovement 0xFE FollowerJumpOnPlayerSouth - waitmovement 0xFE + applymovement OBJ_EVENT_ID_FOLLOWER FollowerJumpOnPlayerSouth + waitmovement OBJ_EVENT_ID_FOLLOWER return JumpOnE: - applymovement 0xFE FollowerJumpOnPlayerEast - waitmovement 0xFE + applymovement OBJ_EVENT_ID_FOLLOWER FollowerJumpOnPlayerEast + waitmovement OBJ_EVENT_ID_FOLLOWER return JumpOnW: - applymovement 0xFE FollowerJumpOnPlayerWest - waitmovement 0xFE + applymovement OBJ_EVENT_ID_FOLLOWER FollowerJumpOnPlayerWest + waitmovement OBJ_EVENT_ID_FOLLOWER return EventScript_FollowerJumpOnPlayer:: @@ -447,23 +447,23 @@ EventScript_FollowerJumpOnPlayer:: goto EventScript_FollowerGeneric CuddleN: - applymovement 0xFE FollowerCuddlingNorth - waitmovement 0xFE + applymovement OBJ_EVENT_ID_FOLLOWER FollowerCuddlingNorth + waitmovement OBJ_EVENT_ID_FOLLOWER return CuddleS: - applymovement 0xFE FollowerCuddlingSouth - waitmovement 0xFE + applymovement OBJ_EVENT_ID_FOLLOWER FollowerCuddlingSouth + waitmovement OBJ_EVENT_ID_FOLLOWER return CuddleE: - applymovement 0xFE FollowerCuddlingEast - waitmovement 0xFE + applymovement OBJ_EVENT_ID_FOLLOWER FollowerCuddlingEast + waitmovement OBJ_EVENT_ID_FOLLOWER return CuddleW: - applymovement 0xFE FollowerCuddlingWest - waitmovement 0xFE + applymovement OBJ_EVENT_ID_FOLLOWER FollowerCuddlingWest + waitmovement OBJ_EVENT_ID_FOLLOWER return EventScript_FollowerCuddling:: @ similar to Std_MsgboxDefault @@ -479,31 +479,31 @@ EventScript_FollowerCuddling:: @ similar to Std_MsgboxDefault goto EventScript_FollowerGeneric ShCuddleN: - applymovement 0xFE FollowerShiverVerticalMovement - waitmovement 0xFE - applymovement 0xFE FollowerCuddlingNorth - waitmovement 0xFE + applymovement OBJ_EVENT_ID_FOLLOWER FollowerShiverVerticalMovement + waitmovement OBJ_EVENT_ID_FOLLOWER + applymovement OBJ_EVENT_ID_FOLLOWER FollowerCuddlingNorth + waitmovement OBJ_EVENT_ID_FOLLOWER return ShCuddleS: - applymovement 0xFE FollowerShiverVerticalMovement - waitmovement 0xFE - applymovement 0xFE FollowerCuddlingSouth - waitmovement 0xFE + applymovement OBJ_EVENT_ID_FOLLOWER FollowerShiverVerticalMovement + waitmovement OBJ_EVENT_ID_FOLLOWER + applymovement OBJ_EVENT_ID_FOLLOWER FollowerCuddlingSouth + waitmovement OBJ_EVENT_ID_FOLLOWER return ShCuddleE: - applymovement 0xFE FollowerShiverHorizontalMovement - waitmovement 0xFE - applymovement 0xFE FollowerCuddlingEast - waitmovement 0xFE + applymovement OBJ_EVENT_ID_FOLLOWER FollowerShiverHorizontalMovement + waitmovement OBJ_EVENT_ID_FOLLOWER + applymovement OBJ_EVENT_ID_FOLLOWER FollowerCuddlingEast + waitmovement OBJ_EVENT_ID_FOLLOWER return ShCuddleW: - applymovement 0xFE FollowerShiverHorizontalMovement - waitmovement 0xFE - applymovement 0xFE FollowerCuddlingWest - waitmovement 0xFE + applymovement OBJ_EVENT_ID_FOLLOWER FollowerShiverHorizontalMovement + waitmovement OBJ_EVENT_ID_FOLLOWER + applymovement OBJ_EVENT_ID_FOLLOWER FollowerCuddlingWest + waitmovement OBJ_EVENT_ID_FOLLOWER return EventScript_FollowerShiverCuddling:: @@ -519,23 +519,23 @@ EventScript_FollowerShiverCuddling:: goto EventScript_FollowerGeneric CreepCloserN: - applymovement 0xFE FollowerGetCloserNorth - waitmovement 0xFE + applymovement OBJ_EVENT_ID_FOLLOWER FollowerGetCloserNorth + waitmovement OBJ_EVENT_ID_FOLLOWER return CreepCloserS: - applymovement 0xFE FollowerGetCloserSouth - waitmovement 0xFE + applymovement OBJ_EVENT_ID_FOLLOWER FollowerGetCloserSouth + waitmovement OBJ_EVENT_ID_FOLLOWER return CreepCloserE: - applymovement 0xFE FollowerGetCloserEast - waitmovement 0xFE + applymovement OBJ_EVENT_ID_FOLLOWER FollowerGetCloserEast + waitmovement OBJ_EVENT_ID_FOLLOWER return CreepCloserW: - applymovement 0xFE FollowerGetCloserWest - waitmovement 0xFE + applymovement OBJ_EVENT_ID_FOLLOWER FollowerGetCloserWest + waitmovement OBJ_EVENT_ID_FOLLOWER return EventScript_FollowerGetCloser:: @@ -551,23 +551,23 @@ EventScript_FollowerGetCloser:: goto EventScript_FollowerGeneric PokePlayerN: - applymovement 0xFE FollowerGetCloserNorth - waitmovement 0xFE + applymovement OBJ_EVENT_ID_FOLLOWER FollowerGetCloserNorth + waitmovement OBJ_EVENT_ID_FOLLOWER return PokePlayerS: - applymovement 0xFE FollowerGetCloserSouth - waitmovement 0xFE + applymovement OBJ_EVENT_ID_FOLLOWER FollowerGetCloserSouth + waitmovement OBJ_EVENT_ID_FOLLOWER return PokePlayerE: - applymovement 0xFE FollowerGetCloserEast - waitmovement 0xFE + applymovement OBJ_EVENT_ID_FOLLOWER FollowerGetCloserEast + waitmovement OBJ_EVENT_ID_FOLLOWER return PokePlayerW: - applymovement 0xFE FollowerGetCloserWest - waitmovement 0xFE + applymovement OBJ_EVENT_ID_FOLLOWER FollowerGetCloserWest + waitmovement OBJ_EVENT_ID_FOLLOWER return EventScript_FollowerPokingPlayer:: @@ -583,60 +583,60 @@ EventScript_FollowerPokingPlayer:: goto EventScript_FollowerGeneric EventScript_FollowerLookAround:: - applymovement 0xFE FollowerLookAround - waitmovement 0xFE + applymovement OBJ_EVENT_ID_FOLLOWER FollowerLookAround + waitmovement OBJ_EVENT_ID_FOLLOWER goto EventScript_FollowerGeneric EventScript_FollowerLookAway:: - applymovement 0xFE FollowerLookAway - waitmovement 0xFE + applymovement OBJ_EVENT_ID_FOLLOWER FollowerLookAway + waitmovement OBJ_EVENT_ID_FOLLOWER goto EventScript_FollowerGenericSkipFace EventScript_FollowerLookAwayBark:: - applymovement 0xFE FollowerLookAwayBark - waitmovement 0xFE + applymovement OBJ_EVENT_ID_FOLLOWER FollowerLookAwayBark + waitmovement OBJ_EVENT_ID_FOLLOWER goto EventScript_FollowerGenericSkipFace EventScript_FollowerLookAwayPoke:: - applymovement 0xFE FollowerLookAwayPokeG - waitmovement 0xFE + applymovement OBJ_EVENT_ID_FOLLOWER FollowerLookAwayPokeG + waitmovement OBJ_EVENT_ID_FOLLOWER goto EventScript_FollowerGenericSkipFace EventScript_FollowerPokeGround:: faceplayer - applymovement 0xFE FollowerPokeGround - waitmovement 0xFE + applymovement OBJ_EVENT_ID_FOLLOWER FollowerPokeGround + waitmovement OBJ_EVENT_ID_FOLLOWER goto EventScript_FollowerGeneric EventScript_FollowerStartled:: - applymovement 0xFE FollowerStartled - waitmovement 0xFE + applymovement OBJ_EVENT_ID_FOLLOWER FollowerStartled + waitmovement OBJ_EVENT_ID_FOLLOWER goto EventScript_FollowerGenericSkipFace EventScript_FollowerFastHopping:: - applymovement 0xFE FollowerHopFast - waitmovement 0xFE + applymovement OBJ_EVENT_ID_FOLLOWER FollowerHopFast + waitmovement OBJ_EVENT_ID_FOLLOWER goto EventScript_FollowerGenericSkipFace EventScript_FollowerDizzy:: - applymovement 0xFE FollowerDizzy + applymovement OBJ_EVENT_ID_FOLLOWER FollowerDizzy waitmovement 0 goto EventScript_FollowerGenericSkipFace EventScript_FollowerLookAroundScared:: - applymovement 0xFE FollowerLookAroundScared - waitmovement 0xFE + applymovement OBJ_EVENT_ID_FOLLOWER FollowerLookAroundScared + waitmovement OBJ_EVENT_ID_FOLLOWER goto EventScript_FollowerGeneric EventScript_FollowerDance:: faceplayer - applymovement 0xFE FollowerDance + applymovement OBJ_EVENT_ID_FOLLOWER FollowerDance waitmovement 0 goto EventScript_FollowerGenericSkipFace EventScript_FollowerFaceUp:: - applymovement 0xFE Common_Movement_FaceUp - waitmovement 0xFE + applymovement OBJ_EVENT_ID_FOLLOWER Common_Movement_FaceUp + waitmovement OBJ_EVENT_ID_FOLLOWER goto EventScript_FollowerGenericSkipFace EventScript_FollowerFaceResult:: @ Face towards direction in VAR_RESULT @@ -648,16 +648,16 @@ EventScript_FollowerFaceResult:: @ Face towards direction in VAR_RESULT goto EventScript_FollowerGeneric EventScript_FollowerFaceDown: - applymovement 0xFE Common_Movement_FaceDown - waitmovement 0xFE + applymovement OBJ_EVENT_ID_FOLLOWER Common_Movement_FaceDown + waitmovement OBJ_EVENT_ID_FOLLOWER goto EventScript_FollowerGenericSkipFace EventScript_FollowerFaceLeft: - applymovement 0xFE Common_Movement_FaceLeft - waitmovement 0xFE + applymovement OBJ_EVENT_ID_FOLLOWER Common_Movement_FaceLeft + waitmovement OBJ_EVENT_ID_FOLLOWER goto EventScript_FollowerGenericSkipFace EventScript_FollowerFaceRight: - applymovement 0xFE Common_Movement_FaceRight - waitmovement 0xFE + applymovement OBJ_EVENT_ID_FOLLOWER Common_Movement_FaceRight + waitmovement OBJ_EVENT_ID_FOLLOWER goto EventScript_FollowerGenericSkipFace diff --git a/data/scripts/movement.inc b/data/scripts/movement.inc index 383c014130..a5ebc0ae7f 100644 --- a/data/scripts/movement.inc +++ b/data/scripts/movement.inc @@ -1,3 +1,6 @@ +@ Starting from here, these movements are considered +@ 'safe' (won't put follower into a Pokeball) +Common_Movement_FollowerSafeStart:: Common_Movement_QuestionMark: emote_question_mark step_end @@ -68,6 +71,10 @@ Common_Movement_WalkInPlaceRight: walk_in_place_right step_end +@ End of follower-safe movements +Common_Movement_FollowerSafeEnd:: + step_end + Common_Movement_WalkUp6: walk_up walk_up diff --git a/data/scripts/pkmn_center_nurse.inc b/data/scripts/pkmn_center_nurse.inc index c0fe80a994..9c5afba8d6 100644 --- a/data/scripts/pkmn_center_nurse.inc +++ b/data/scripts/pkmn_center_nurse.inc @@ -33,7 +33,7 @@ EventScript_PkmnCenterNurse_IllTakeYourPkmn2:: return EventScript_PkmnCenterNurse_TakeAndHealPkmn:: - applymovement VAR_0x800B, Common_Movement_WalkInPlaceFasterLeft @ TODO: Make follower disappear here + applymovement VAR_0x800B, Movement_PkmnCenterNurse_Turn waitmovement 0 dofieldeffect FLDEFF_POKECENTER_HEAL waitfieldeffect FLDEFF_POKECENTER_HEAL @@ -117,6 +117,10 @@ EventScript_PkmnCenterNurse_GoldCardHealPkmn:: goto EventScript_PkmnCenterNurse_HealPkmn end +Movement_PkmnCenterNurse_Turn: + walk_in_place_faster_left + step_end + Movement_PkmnCenterNurse_Bow: nurse_joy_bow delay_4 diff --git a/emotions.txt b/emotions.txt deleted file mode 100644 index 590be93530..0000000000 --- a/emotions.txt +++ /dev/null @@ -1,149 +0,0 @@ -Happy (Special): -Specific map: -{STR_VAR_1} greeted your mom. - -Landscape/map feature: -{STR_VAR_1} greeted everyone! -{STR_VAR_1} greeted the two. (when standing in front of 2 trainers). -{STR_VAR_1} is very eager! ( gym ) must have type advantage. -{STR_VAR_1} greeted Amphy! - -Neutral (Special): -Specific map: -Why is it doing warm-up exercises? (Cerulean Gym). -{STR_VAR_1} is running along the side of the pool! (Cerulean Gym). - -Map feature: -Your pokemon is smelling the scent of the flowers. (When next to flowers in Cherrygrove City). -{STR_VAR_1} Greeted Slowbro (Cerulean city, in front of Slowbro). -{STR_VAR_1} is playing on the sand. -{STR_VAR_1} is staring fixedly at the sea. -{STR_VAR_1} is stomping on the grass! -{STR_VAR_1} is playing around, Picking bits of grass. -{STR_VAR_1} seems highly interested in the tree. -{STR_VAR_1} is looking outside and frolicking! - -Pokemon exclusive: -(MAGIKARP) is leaping around more than usual (lake of rage, During team rockets broadcast) ( Pokemon Exclusive ). - -Pokemon feature: -{STR_VAR_1} seems happy to have taken a shower! (Celadon gym) (Grass,Water type). - -Misc: -{STR_VAR_1} seems dazzled after seeing the sky. -{STR_VAR_1} is fidgeting in front of everyone (maybe baby pokemon). -{STR_VAR_1} roared! -{STR_VAR_1} spun around in a circle! - -Sad (Special): -Pokemon feature: - -Upset (Special): -Specific map(s): -It seems to have eaten something strange. It's making an odd face... (Olivine Cafe). -{STR_VAR_1} is staring at the crumbling floor (burnt tower). -{STR_VAR_1} seems to think that (Player) has disappeared! ( Morty's Gym ). - -Map feature: -{STR_VAR_1} is splashing around in the wet grass. - -Pokemon feature: -Your pokemon doesn't like splashing around on the ground (must be fire type). - -Misc: -{STR_VAR_1} seems to feel a little claustrophobic. -{STR_VAR_1} is a bit nervous about the narrow space! -{STR_VAR_1} seems uneasy and is poking (PLAYER). - -Angry (Special): -Map feature: -{STR_VAR_1} is staring at the Persian statue and glaring. -{STR_VAR_1} is glaring at the PERSIAN statue! -{STR_VAR_1} is glaring at your foe! -{STR_VAR_1} is intimidating your foe! - -Pensive (Special): -Specific map(s): -{STR_VAR_1} seems to be listening to the sound of rustling leaves. -{STR_VAR_1} is preoccupied by the ceiling, which seems like it may collapse (burnt tower). -{STR_VAR_1} is concerned about the swaying pillar (sprout tower). -Your pokemon is drooling a little (Olivine Cafe). -{STR_VAR_1} is preoccupied by the floor, which seems like it may collapse (burnt tower). - -Map feature: -{STR_VAR_1} is staring intently at the reflection of its face. -{STR_VAR_1} seems interested in Amphy... -{STR_VAR_1} has a sleepy look on its face... (Near Jigglypuff in Radio Tower.). - -Misc: -Your pokemon turned to face the other way, showing a defiant expression. - -Music (Special): -Map feature: -{STR_VAR_1} is pulling out the grass. -{STR_VAR_1} is happy to see what's out doors! -{STR_VAR_1} is listening intently to the sound of the waves. -Your pokemon is staring spellbound at the night sky! -Your pokemon seems to be enjoying sliding around! -{STR_VAR_1} is steadily observing the flow of the river. -{STR_VAR_1} is noticing the scent of the grass. -Misc: -{STR_VAR_1} seems happy at the sight of water on the window! -{STR_VAR_1} is looking up at the ceiling. -{STR_VAR_1} seems to be enjoying this a little bit! -{STR_VAR_1} is wandering around enjoying the forest scenery. -{STR_VAR_1} is playing around in the fallen leaves. -{STR_VAR_1} is playing around with a leaf. -{STR_VAR_1} is playing around, touching the leaves. -Your pokemon is happily gazing at the beautiful, starry sky! -{STR_VAR_1} is rolling around in the grass. -{STR_VAR_1} seems to want to return to the lab (after you receive the Mystery egg). -Your pokemon is staring at the various items. -{STR_VAR_1} is looking up the tall mountain... (Mt. Mortar). -{STR_VAR_1} seems concerned about the waterfall. -{STR_VAR_1} is sniffing around the room. (Inside Hero's Room). -{STR_VAR_1} is dancing around the pillar! (Seems to occur more for Bellsprout)(sprout tower). -{STR_VAR_1} swayed around, dancing in a strange manner.(Seems to occur more for Bellsprout)(sprout tower). -{STR_VAR_1} swayed and danced around as it pleased (Seems to occur more for Bellsprout)(sprout tower). -Your Pokemon is playing around and splashing in the water! (Water's edge). -{STR_VAR_1} is looking up at the sky. -{STR_VAR_1} is poking at garbage (Goldenrods underground path). -Your pokemon is rolling a screw from a bicycle around. -{STR_VAR_1} is looking up at the sky. -{STR_VAR_1} is clawing the grass! -{STR_VAR_1} is looking around restlessly at the Forest. -{STR_VAR_1} is playfully nibbling at the ground. -(CYNDAQUIL) blew out a fireball. ( Pokemon Exclusive ). -(CYNDAQUIL) blew out a couple of fireballs. ( Pokemon Exclusive ). -(CHIKORITA) is waving its leaf around ( Pokemon Exclusive ). -(CHIKORITA) is making its leaf twitch ( Pokemon Exclusive ). -(TODADILE) is moving its jaw ( Pokemon Exclusive ). -(TODADILE) is opening and closing its mouth ( Pokemon Exclusive ). -{STR_VAR_1} is playing in the puddle. -{STR_VAR_1} is gazing restlessly at the building ( in goldenrod). - -Surprised (Special): -{STR_VAR_1} seems to have gotten caught in the clumps of grass. -{STR_VAR_1} slipped on the floor and seems likely to fall! -Your pokemon is very concerned about the room below ( Burnt tower ). -Careful! seems like the floor could collapse, and it might fall. -{STR_VAR_1} seems to think that (Player) has disappeared! ( Morty's Gym ). -{STR_VAR_1} gazed surprisingly at the rock! -Huh? your pokemon found something in top of the mountain ( outside Mt. Mortar) (!). -{STR_VAR_1} got tangled up in the branches and almost fell down! -{STR_VAR_1} looked up at the sky and shouted loudly. -{STR_VAR_1} seems to have found something! -{STR_VAR_1} almost forgot it was holding that (Held item). -{STR_VAR_1} is happy at the sight of the water on the window! -{STR_VAR_1} was surprised by the sounds in the thicket! -Seems the breeze is coming from here. -Oh! its slipping and came over here for support (on ice). -{STR_VAR_1} seems to have gotten a bit of zap! (Power plant). -{STR_VAR_1} is dazzled by the shiny brightness of the bridge! (Standing on Nugget Bridge). -{STR_VAR_1} is slipping on the water and almost fell over! -Curious (Special): -{STR_VAR_1} feels something... (burnt tower basement). -{STR_VAR_1} seems to be hearing a strange sound. (Rocket hideout in Mahogany). -{STR_VAR_1} seems to be hearing a strange sound. (Team rocket hide out). -{STR_VAR_1} is concerned about the other side of the fence, it seems. -{STR_VAR_1} is looking at the machine in a strange manner. (Power plant). diff --git a/gflib/sprite.c b/gflib/sprite.c index 08030ab6f7..dc15e9cbd2 100644 --- a/gflib/sprite.c +++ b/gflib/sprite.c @@ -518,7 +518,7 @@ u32 CreateSpriteAt(u32 index, const struct SpriteTemplate *template, s16 x, s16 if (sprite->oam.affineMode & ST_OAM_AFFINE_ON_MASK) InitSpriteAffineAnim(sprite); - if (template->paletteTag != TAG_NONE) // TODO: Load sprite palette if tag not present + if (template->paletteTag != TAG_NONE) sprite->oam.paletteNum = IndexOfSpritePaletteTag(template->paletteTag); return index; diff --git a/gflib/sprite.h b/gflib/sprite.h index 18709c4093..6a3084add2 100644 --- a/gflib/sprite.h +++ b/gflib/sprite.h @@ -225,9 +225,9 @@ struct Sprite // is (offset + 1) << sheetSpan; // (This allows using frame-based anim tables for sheet sprites) u16 sheetSpan:3; - // u16 flags_4:1; //0x10 - // u16 flags_5:1; //0x20 - // u16 flags_6:1; //0x40 + // u16 flags_4:1; //0x10 + // u16 flags_5:1; //0x20 + // u16 flags_6:1; //0x40 u16 flags_7:1; //0x80 /*0x3F*/ u16 hFlip:1; //1 u16 vFlip:1; //2 diff --git a/graphics/object_events/palettes/light.pal b/graphics/object_events/palettes/light.pal deleted file mode 100644 index 3beca89bdf..0000000000 --- a/graphics/object_events/palettes/light.pal +++ /dev/null @@ -1,19 +0,0 @@ -JASC-PAL -0100 -16 -110 198 165 -255 213 18 -255 214 38 -254 217 39 -254 218 53 -255 220 65 -255 221 76 -255 223 86 -254 225 95 -254 228 104 -254 229 112 -254 230 120 -255 232 132 -255 235 148 -255 237 162 -255 240 176 diff --git a/graphics/object_events/pics/misc/animated_ball.png b/graphics/object_events/pics/misc/ball_poke.png similarity index 100% rename from graphics/object_events/pics/misc/animated_ball.png rename to graphics/object_events/pics/misc/ball_poke.png diff --git a/graphics/object_events/pics/misc/item_ball.png b/graphics/object_events/pics/misc/item_ball.png deleted file mode 100644 index ef02e158c9..0000000000 Binary files a/graphics/object_events/pics/misc/item_ball.png and /dev/null differ diff --git a/include/constants/event_objects.h b/include/constants/event_objects.h index 962aa6b10e..7200d51616 100644 --- a/include/constants/event_objects.h +++ b/include/constants/event_objects.h @@ -240,7 +240,7 @@ #define OBJ_EVENT_GFX_LINK_RS_MAY 236 #define OBJ_EVENT_GFX_LUGIA 237 #define OBJ_EVENT_GFX_HOOH 238 -#define OBJ_EVENT_GFX_ANIMATED_BALL 239 +#define OBJ_EVENT_GFX_POKE_BALL 239 #define OBJ_EVENT_GFX_OW_MON 240 // NOTE: By default, the max value for NUM_OBJ_EVENT_GFX is 239. diff --git a/include/event_object_movement.h b/include/event_object_movement.h index 790e04222c..48386c1768 100644 --- a/include/event_object_movement.h +++ b/include/event_object_movement.h @@ -458,7 +458,7 @@ bool8 FollowablePlayerMovement_Step(struct ObjectEvent *, struct Sprite *, u8, b bool8 FollowablePlayerMovement_GoSpeed1(struct ObjectEvent *, struct Sprite *, u8, bool8(u8)); bool8 FollowablePlayerMovement_GoSpeed2(struct ObjectEvent *, struct Sprite *, u8, bool8(u8)); bool8 FollowablePlayerMovement_Slide(struct ObjectEvent *, struct Sprite *, u8, bool8(u8)); -bool8 fph_IM_DIFFERENT(struct ObjectEvent *, struct Sprite *, u8, bool8(u8)); +bool8 FollowablePlayerMovement_JumpInPlace(struct ObjectEvent *, struct Sprite *, u8, bool8(u8)); bool8 FollowablePlayerMovement_GoSpeed4(struct ObjectEvent *, struct Sprite *, u8, bool8(u8)); bool8 FollowablePlayerMovement_Jump(struct ObjectEvent *, struct Sprite *, u8, bool8(u8)); bool8 CopyablePlayerMovement_Jump2(struct ObjectEvent *, struct Sprite *, u8, bool8(u8)); diff --git a/include/event_scripts.h b/include/event_scripts.h index e97a8215d7..fa0bfe5c6e 100644 --- a/include/event_scripts.h +++ b/include/event_scripts.h @@ -644,4 +644,7 @@ extern const u8 VSSeeker_Text_NoTrainersWithinRange[]; extern const u8 VSSeeker_Text_TrainersNotReady[]; extern const u8 EventScript_VsSeekerChargingDone[]; +extern const u8 Common_Movement_FollowerSafeStart[]; +extern const u8 Common_Movement_FollowerSafeEnd[]; + #endif // GUARD_EVENT_SCRIPTS_H diff --git a/include/global.fieldmap.h b/include/global.fieldmap.h index 928bcc7629..bbe2ec8d1d 100644 --- a/include/global.fieldmap.h +++ b/include/global.fieldmap.h @@ -195,6 +195,7 @@ struct ObjectEvent u32 fixedPriority:1; u32 hideReflection:1; u32 shiny:1; // OW mon shininess + u32 padding:3; /*0x04*/ u16 graphicsId; // 11 bits for species; high 5 bits for form /*0x06*/ u8 movementType; /*0x07*/ u8 trainerType; diff --git a/include/random.h b/include/random.h index d15aa28bfb..c399ae3cf2 100644 --- a/include/random.h +++ b/include/random.h @@ -233,4 +233,6 @@ u32 RandomUniformExceptDefault(enum RandomTag, u32 lo, u32 hi, bool32 (*reject)( u32 RandomWeightedArrayDefault(enum RandomTag, u32 sum, u32 n, const u8 *weights); const void *RandomElementArrayDefault(enum RandomTag, const void *array, size_t size, size_t count); +u8 RandomWeightedIndex(u8 *weights, u8 length); + #endif // GUARD_RANDOM_H diff --git a/spritesheet_rules.mk b/spritesheet_rules.mk index 6df10a11b2..a96fd34c6e 100644 --- a/spritesheet_rules.mk +++ b/spritesheet_rules.mk @@ -470,7 +470,7 @@ $(OBJEVENTGFXDIR)/pokemon_old/wingull.4bpp: %.4bpp: %.png $(OBJEVENTGFXDIR)/pokemon_old/zigzagoon.4bpp: %.4bpp: %.png $(GFX) $< $@ -mwidth 2 -mheight 2 -$(OBJEVENTGFXDIR)/misc/animated_ball.4bpp: %.4bpp: %.png +$(OBJEVENTGFXDIR)/misc/ball_poke.4bpp: %.4bpp: %.png $(GFX) $< $@ -mwidth 2 -mheight 4 $(OBJEVENTGFXDIR)/berry_trees/aguav.4bpp: %.4bpp: %.png diff --git a/src/data/object_events/movement_type_func_tables.h b/src/data/object_events/movement_type_func_tables.h index c30f7daaf7..749c14969c 100755 --- a/src/data/object_events/movement_type_func_tables.h +++ b/src/data/object_events/movement_type_func_tables.h @@ -414,7 +414,7 @@ bool8 (*const gFollowPlayerMovementFuncs[])(struct ObjectEvent *, struct Sprite [COPY_MOVE_WALK_FAST] = FollowablePlayerMovement_GoSpeed1, [COPY_MOVE_WALK_FASTER] = FollowablePlayerMovement_GoSpeed2, [COPY_MOVE_SLIDE] = FollowablePlayerMovement_Slide, - [COPY_MOVE_JUMP_IN_PLACE] = fph_IM_DIFFERENT, + [COPY_MOVE_JUMP_IN_PLACE] = FollowablePlayerMovement_JumpInPlace, [COPY_MOVE_JUMP] = FollowablePlayerMovement_GoSpeed4, [COPY_MOVE_JUMP2] = FollowablePlayerMovement_Step, [COPY_MOVE_EMPTY_1] = FollowablePlayerMovement_Idle, diff --git a/src/data/object_events/object_event_graphics.h b/src/data/object_events/object_event_graphics.h index e185339d8d..ff0d3f0568 100755 --- a/src/data/object_events/object_event_graphics.h +++ b/src/data/object_events/object_event_graphics.h @@ -122,7 +122,6 @@ const u32 gObjectEventPic_CyclingTriathleteF[] = INCBIN_U32("graphics/object_eve const u32 gObjectEventPic_Man4[] = INCBIN_U32("graphics/object_events/pics/people/man_4.4bpp"); const u32 gObjectEventPic_Man5[] = INCBIN_U32("graphics/object_events/pics/people/man_5.4bpp"); const u32 gObjectEventPic_Nurse[] = INCBIN_U32("graphics/object_events/pics/people/nurse.4bpp"); -const u32 gObjectEventPic_ItemBall[] = INCBIN_U32("graphics/object_events/pics/misc/item_ball.4bpp"); const u32 gObjectEventPic_ProfBirch[] = INCBIN_U32("graphics/object_events/pics/people/prof_birch.4bpp"); const u32 gObjectEventPic_ReporterM[] = INCBIN_U32("graphics/object_events/pics/people/reporter_m.4bpp"); const u32 gObjectEventPic_ReporterF[] = INCBIN_U32("graphics/object_events/pics/people/reporter_f.4bpp"); @@ -355,7 +354,7 @@ const u32 gObjectEventPic_Greta[] = INCBIN_U32("graphics/object_events/pics/peop const u32 gObjectEventPic_Noland[] = INCBIN_U32("graphics/object_events/pics/people/frontier_brains/noland.4bpp"); const u32 gObjectEventPic_Lucy[] = INCBIN_U32("graphics/object_events/pics/people/frontier_brains/lucy.4bpp"); const u32 gObjectEventPic_Brandon[] = INCBIN_U32("graphics/object_events/pics/people/frontier_brains/brandon.4bpp"); -const u32 gObjectEventPic_AnimatedBall[] = INCBIN_U32("graphics/object_events/pics/misc/animated_ball.4bpp"); +const u32 gObjectEventPic_PokeBall[] = INCBIN_U32("graphics/object_events/pics/misc/ball_poke.4bpp"); const u32 gObjectEventPic_DeoxysOld[] = INCBIN_U32("graphics/object_events/pics/pokemon_old/deoxys.4bpp"); const u32 gObjectEventPic_MewOld[] = INCBIN_U32("graphics/object_events/pics/pokemon_old/mew.4bpp"); diff --git a/src/data/object_events/object_event_graphics_info.h b/src/data/object_events/object_event_graphics_info.h index 7e7868c86e..5b8f971a49 100755 --- a/src/data/object_events/object_event_graphics_info.h +++ b/src/data/object_events/object_event_graphics_info.h @@ -1138,25 +1138,6 @@ const struct ObjectEventGraphicsInfo gObjectEventGraphicsInfo_Nurse = { .affineAnims = gDummySpriteAffineAnimTable, }; -const struct ObjectEventGraphicsInfo gObjectEventGraphicsInfo_ItemBall = { - .tileTag = TAG_NONE, - .paletteTag = OBJ_EVENT_PAL_TAG_NPC_3, - .reflectionPaletteTag = OBJ_EVENT_PAL_TAG_NONE, - .size = 128, - .width = 16, - .height = 16, - .paletteSlot = PALSLOT_NPC_3, - .shadowSize = SHADOW_SIZE_S, - .inanimate = TRUE, - .compressed = FALSE, - .tracks = TRACKS_NONE, - .oam = &gObjectEventBaseOam_16x16, - .subspriteTables = sOamTables_16x16, - .anims = sAnimTable_Inanimate, - .images = sPicTable_ItemBall, - .affineAnims = gDummySpriteAffineAnimTable, -}; - const struct ObjectEventGraphicsInfo gObjectEventGraphicsInfo_BerryTree = { .tileTag = TAG_NONE, .paletteTag = OBJ_EVENT_PAL_TAG_NPC_1, @@ -4653,7 +4634,7 @@ const struct ObjectEventGraphicsInfo gObjectEventGraphicsInfo_HoOh = { .affineAnims = gDummySpriteAffineAnimTable, }; -const struct ObjectEventGraphicsInfo gObjectEventGraphicsInfo_AnimatedBall = { +const struct ObjectEventGraphicsInfo gObjectEventGraphicsInfo_PokeBall = { .tileTag = TAG_NONE, .paletteTag = OBJ_EVENT_PAL_TAG_NPC_3, .reflectionPaletteTag = OBJ_EVENT_PAL_TAG_NONE, @@ -4668,7 +4649,7 @@ const struct ObjectEventGraphicsInfo gObjectEventGraphicsInfo_AnimatedBall = { .oam = &gObjectEventBaseOam_16x32, .subspriteTables = sOamTables_16x32, .anims = sAnimTable_Following, - .images = sPicTable_AnimatedBall, + .images = sPicTable_PokeBall, .affineAnims = gDummySpriteAffineAnimTable, }; diff --git a/src/data/object_events/object_event_graphics_info_pointers.h b/src/data/object_events/object_event_graphics_info_pointers.h index a4394a3e34..7f487a5ae5 100755 --- a/src/data/object_events/object_event_graphics_info_pointers.h +++ b/src/data/object_events/object_event_graphics_info_pointers.h @@ -57,7 +57,6 @@ extern const struct ObjectEventGraphicsInfo gObjectEventGraphicsInfo_Hiker; extern const struct ObjectEventGraphicsInfo gObjectEventGraphicsInfo_CyclingTriathleteM; extern const struct ObjectEventGraphicsInfo gObjectEventGraphicsInfo_CyclingTriathleteF; extern const struct ObjectEventGraphicsInfo gObjectEventGraphicsInfo_Nurse; -extern const struct ObjectEventGraphicsInfo gObjectEventGraphicsInfo_ItemBall; extern const struct ObjectEventGraphicsInfo gObjectEventGraphicsInfo_BerryTree; extern const struct ObjectEventGraphicsInfo gObjectEventGraphicsInfo_BerryTreeEarlyStages; extern const struct ObjectEventGraphicsInfo gObjectEventGraphicsInfo_BerryTreeLateStages; @@ -238,7 +237,7 @@ extern const struct ObjectEventGraphicsInfo gObjectEventGraphicsInfo_RubySapphir extern const struct ObjectEventGraphicsInfo gObjectEventGraphicsInfo_Lugia; extern const struct ObjectEventGraphicsInfo gObjectEventGraphicsInfo_HoOh; // Begin pokemon event objects -extern const struct ObjectEventGraphicsInfo gObjectEventGraphicsInfo_AnimatedBall; +extern const struct ObjectEventGraphicsInfo gObjectEventGraphicsInfo_PokeBall; extern const struct ObjectEventGraphicsInfo gObjectEventGraphicsInfo_Follower; extern const struct ObjectEventGraphicsInfo gObjectEventGraphicsInfo_Bard; @@ -309,7 +308,7 @@ const struct ObjectEventGraphicsInfo *const gObjectEventGraphicsInfoPointers[NUM [OBJ_EVENT_GFX_CYCLING_TRIATHLETE_M] = &gObjectEventGraphicsInfo_CyclingTriathleteM, [OBJ_EVENT_GFX_CYCLING_TRIATHLETE_F] = &gObjectEventGraphicsInfo_CyclingTriathleteF, [OBJ_EVENT_GFX_NURSE] = &gObjectEventGraphicsInfo_Nurse, - [OBJ_EVENT_GFX_ITEM_BALL] = &gObjectEventGraphicsInfo_ItemBall, + [OBJ_EVENT_GFX_ITEM_BALL] = &gObjectEventGraphicsInfo_PokeBall, [OBJ_EVENT_GFX_BERRY_TREE] = &gObjectEventGraphicsInfo_BerryTree, [OBJ_EVENT_GFX_BERRY_TREE_EARLY_STAGES] = &gObjectEventGraphicsInfo_BerryTreeEarlyStages, [OBJ_EVENT_GFX_BERRY_TREE_LATE_STAGES] = &gObjectEventGraphicsInfo_BerryTreeLateStages, @@ -489,7 +488,7 @@ const struct ObjectEventGraphicsInfo *const gObjectEventGraphicsInfoPointers[NUM [OBJ_EVENT_GFX_LINK_RS_MAY] = &gObjectEventGraphicsInfo_RubySapphireMay, [OBJ_EVENT_GFX_LUGIA] = &gObjectEventGraphicsInfo_Lugia, [OBJ_EVENT_GFX_HOOH] = &gObjectEventGraphicsInfo_HoOh, - [OBJ_EVENT_GFX_ANIMATED_BALL] = &gObjectEventGraphicsInfo_AnimatedBall, + [OBJ_EVENT_GFX_POKE_BALL] = &gObjectEventGraphicsInfo_PokeBall, [OBJ_EVENT_GFX_OW_MON] = &gObjectEventGraphicsInfo_Follower, }; diff --git a/src/data/object_events/object_event_pic_tables.h b/src/data/object_events/object_event_pic_tables.h index 682b57f236..181d675e75 100755 --- a/src/data/object_events/object_event_pic_tables.h +++ b/src/data/object_events/object_event_pic_tables.h @@ -282,10 +282,6 @@ static const struct SpriteFrameImage sPicTable_Nurse[] = { overworld_frame(gObjectEventPic_Nurse, 2, 4, 3), }; -static const struct SpriteFrameImage sPicTable_ItemBall[] = { - obj_frame_tiles(gObjectEventPic_ItemBall), -}; - static const struct SpriteFrameImage sPicTable_ProfBirch[] = { overworld_ascending_frames(gObjectEventPic_ProfBirch, 2, 4), }; @@ -1112,13 +1108,13 @@ static const struct SpriteFrameImage sPicTable_Brandon[] = { overworld_ascending_frames(gObjectEventPic_Brandon, 2, 4), }; -static const struct SpriteFrameImage sPicTable_AnimatedBall[] = { - overworld_frame(gObjectEventPic_AnimatedBall, 2, 4, 0), - overworld_frame(gObjectEventPic_AnimatedBall, 2, 4, 1), - overworld_frame(gObjectEventPic_AnimatedBall, 2, 4, 2), - overworld_frame(gObjectEventPic_AnimatedBall, 2, 4, 3), - overworld_frame(gObjectEventPic_AnimatedBall, 2, 4, 4), - overworld_frame(gObjectEventPic_AnimatedBall, 2, 4, 0), +static const struct SpriteFrameImage sPicTable_PokeBall[] = { + overworld_frame(gObjectEventPic_PokeBall, 2, 4, 0), + overworld_frame(gObjectEventPic_PokeBall, 2, 4, 1), + overworld_frame(gObjectEventPic_PokeBall, 2, 4, 2), + overworld_frame(gObjectEventPic_PokeBall, 2, 4, 3), + overworld_frame(gObjectEventPic_PokeBall, 2, 4, 4), + overworld_frame(gObjectEventPic_PokeBall, 2, 4, 0), }; #if OW_MON_POKEBALLS diff --git a/src/data/object_events/object_event_subsprites.h b/src/data/object_events/object_event_subsprites.h index 9a191adc8f..6bdece8ef1 100755 --- a/src/data/object_events/object_event_subsprites.h +++ b/src/data/object_events/object_event_subsprites.h @@ -2130,6 +2130,327 @@ static const struct Subsprite sOamTable_24x32_4[] = { }, }; +static const struct Subsprite sOamTable_64x64_Follower[] = { + { + .x = -32, .y = -32, + SUBSPRITE_SHAPE(64, 32), + .tileOffset = 0, + .priority = 1 + }, + { + .x = -32, .y = 0, + SUBSPRITE_SHAPE(64, 32), + .tileOffset = 32, + .priority = 2 + } +}; + +static const struct Subsprite sOamTable_64x64_HotSprings[] = { + { + .x = -32, + .y = -32, + SUBSPRITE_SHAPE(64, 32), + .tileOffset = 0, + .priority = 2 + }, + { + .x = -32, + .y = 0, + SUBSPRITE_SHAPE(32, 8), + .tileOffset = 32, + .priority = 2 + }, + { + .x = 0, + .y = 0, + SUBSPRITE_SHAPE(32, 8), + .tileOffset = 36, + .priority = 2 + }, + { + .x = -32, + .y = 8, + SUBSPRITE_SHAPE(32, 8), + .tileOffset = 40, + .priority = 2 + }, + { + .x = 0, + .y = 8, + SUBSPRITE_SHAPE(32, 8), + .tileOffset = 44, + .priority = 2 + }, + { + .x = -32, + .y = 16, + SUBSPRITE_SHAPE(32, 8), + .tileOffset = 48, + .priority = 2 + }, + { + .x = 0, + .y = 16, + SUBSPRITE_SHAPE(32, 8), + .tileOffset = 52, + .priority = 2 + }, + { + .x = -32, + .y = 24, + SUBSPRITE_SHAPE(32, 8), + .tileOffset = 56, + .priority = 3 + }, + { + .x = 0, + .y = 24, + SUBSPRITE_SHAPE(32, 8), + .tileOffset = 60, + .priority = 3 + }, +}; + +static const struct Subsprite sOamTable_64x64_Grass2[] = { + { + .x = -32, + .y = -32, + SUBSPRITE_SHAPE(64, 32), + .tileOffset = 0, + .priority = 2 + }, + { + .x = -32, + .y = 0, + SUBSPRITE_SHAPE(32, 8), + .tileOffset = 32, + .priority = 2 + }, + { + .x = 0, + .y = 0, + SUBSPRITE_SHAPE(32, 8), + .tileOffset = 36, + .priority = 2 + }, + { + .x = -32, + .y = 8, + SUBSPRITE_SHAPE(32, 8), + .tileOffset = 40, + .priority = 2 + }, + { + .x = 0, + .y = 8, + SUBSPRITE_SHAPE(32, 8), + .tileOffset = 44, + .priority = 2 + }, + { + .x = -32, + .y = 16, + SUBSPRITE_SHAPE(32, 8), + .tileOffset = 48, + .priority = 3 + }, + { + .x = 0, + .y = 16, + SUBSPRITE_SHAPE(32, 8), + .tileOffset = 52, + .priority = 3 + }, + { + .x = -32, + .y = 24, + SUBSPRITE_SHAPE(32, 8), + .tileOffset = 56, + .priority = 3 + }, + { + .x = 0, + .y = 24, + SUBSPRITE_SHAPE(32, 8), + .tileOffset = 60, + .priority = 3 + }, +}; + +static const struct Subsprite sOamTable_64x64_Grass1[] = { + { + .x = -32, + .y = -32, + SUBSPRITE_SHAPE(64, 32), + .tileOffset = 0, + .priority = 1 + }, + { + .x = -32, + .y = 0, + SUBSPRITE_SHAPE(32, 8), + .tileOffset = 32, + .priority = 1 + }, + { + .x = 0, + .y = 0, + SUBSPRITE_SHAPE(32, 8), + .tileOffset = 36, + .priority = 1 + }, + { + .x = -32, + .y = 8, + SUBSPRITE_SHAPE(32, 8), + .tileOffset = 40, + .priority = 1 + }, + { + .x = 0, + .y = 8, + SUBSPRITE_SHAPE(32, 8), + .tileOffset = 44, + .priority = 1 + }, + { + .x = -32, + .y = 16, + SUBSPRITE_SHAPE(32, 8), + .tileOffset = 48, + .priority = 3 + }, + { + .x = 0, + .y = 16, + SUBSPRITE_SHAPE(32, 8), + .tileOffset = 52, + .priority = 3 + }, + { + .x = -32, + .y = 24, + SUBSPRITE_SHAPE(32, 8), + .tileOffset = 56, + .priority = 3 + }, + { + .x = 0, + .y = 24, + SUBSPRITE_SHAPE(32, 8), + .tileOffset = 60, + .priority = 3 + }, +}; + +static const struct Subsprite sOamTable_64x64_Grass3[] = { + { + .x = -32, + .y = -24, + SUBSPRITE_SHAPE(64, 32), + .tileOffset = 0, + .priority = 2 + }, + { + .x = -32, + .y = 8, + SUBSPRITE_SHAPE(64, 32), + .tileOffset = 32, + .priority = 3 + } +}; + +static const struct Subsprite sOamTable_64x64_Grass4[] = { + { + .x = -32, + .y = -24, + SUBSPRITE_SHAPE(64, 32), + .tileOffset = 0, + .priority = 1 + }, + { + .x = -32, + .y = 8, + SUBSPRITE_SHAPE(64, 32), + .tileOffset = 32, + .priority = 3 + } +}; + + +static const struct SubspriteTable sOamTables_16x24[] = { + SUBSPRITE_TABLE_ENTRY(sOamTable_16x24_0), + SUBSPRITE_TABLE_ENTRY(sOamTable_16x24_0), + SUBSPRITE_TABLE_ENTRY(sOamTable_16x24_1), + SUBSPRITE_TABLE_ENTRY(sOamTable_16x24_2), + SUBSPRITE_TABLE_ENTRY(sOamTable_16x24_3), + SUBSPRITE_TABLE_ENTRY(sOamTable_16x24_4), +}; + + +static const struct SubspriteTable sOamTables_24x16[] = { + SUBSPRITE_TABLE_ENTRY(sOamTable_24x16_0), + SUBSPRITE_TABLE_ENTRY(sOamTable_24x16_0), + SUBSPRITE_TABLE_ENTRY(sOamTable_24x16_1), + SUBSPRITE_TABLE_ENTRY(sOamTable_24x16_2), + SUBSPRITE_TABLE_ENTRY(sOamTable_24x16_3), + SUBSPRITE_TABLE_ENTRY(sOamTable_24x16_3), +}; + +static const struct SubspriteTable sOamTables_24x24[] = { + SUBSPRITE_TABLE_ENTRY(sOamTable_24x24_0), // reflections + SUBSPRITE_TABLE_ENTRY(sOamTable_24x24_0), // all 2 + SUBSPRITE_TABLE_ENTRY(sOamTable_24x24_1), // all 1 + SUBSPRITE_TABLE_ENTRY(sOamTable_24x24_2), // bottom 8 3 + SUBSPRITE_TABLE_ENTRY(sOamTable_24x24_3), // bottom 16 3 + SUBSPRITE_TABLE_ENTRY(sOamTable_24x24_4), // top 1, bottom 16 3 +}; + +static const struct SubspriteTable sOamTables_24x32[] = { + SUBSPRITE_TABLE_ENTRY(sOamTable_24x32_0), + SUBSPRITE_TABLE_ENTRY(sOamTable_24x32_0), + SUBSPRITE_TABLE_ENTRY(sOamTable_24x32_1), + SUBSPRITE_TABLE_ENTRY(sOamTable_24x32_2), + SUBSPRITE_TABLE_ENTRY(sOamTable_24x32_3), + SUBSPRITE_TABLE_ENTRY(sOamTable_24x32_4), +}; + + +static const struct SubspriteTable sOamTables_32x24[] = { + SUBSPRITE_TABLE_ENTRY(sOamTable_32x24_0), + SUBSPRITE_TABLE_ENTRY(sOamTable_32x24_0), + SUBSPRITE_TABLE_ENTRY(sOamTable_32x24_1), + SUBSPRITE_TABLE_ENTRY(sOamTable_32x24_2), + SUBSPRITE_TABLE_ENTRY(sOamTable_32x24_3), + SUBSPRITE_TABLE_ENTRY(sOamTable_32x24_4), +}; + + +// For following pokemon +// Makes the top 32 pixels priority 1, +// so that very tall pokemon's heads +// will appear on top of buildings, etc. +static const struct SubspriteTable sOamTables_64x64_Tall[] = { + {}, // unused + SUBSPRITE_TABLE_ENTRY(sOamTable_64x64_Follower), // elevation 3 + SUBSPRITE_TABLE_ENTRY(sOamTable_64x64_1), // elevation 4 + SUBSPRITE_TABLE_ENTRY(sOamTable_64x64_HotSprings), // hot springs + SUBSPRITE_TABLE_ENTRY(sOamTable_64x64_Grass2), // long grass + SUBSPRITE_TABLE_ENTRY(sOamTable_64x64_Grass1) // long grass priority 1 +}; + +// Like sOamTables_64x64_Tall, but fewer pixels visible in long grass +// Meant for pokemon that are more long than tall like Wailord +static const struct SubspriteTable sOamTables_64x64_Long[] = { + {}, // unused + SUBSPRITE_TABLE_ENTRY(sOamTable_64x64_Follower), // elevation 3 + SUBSPRITE_TABLE_ENTRY(sOamTable_64x64_1), // elevation 4 + SUBSPRITE_TABLE_ENTRY(sOamTable_64x64_HotSprings), // hot springs + SUBSPRITE_TABLE_ENTRY(sOamTable_64x64_Grass3), // long grass + SUBSPRITE_TABLE_ENTRY(sOamTable_64x64_Grass4) // long grass priority 1 +}; +#endif + static const struct Subsprite sOamTable_48x48[] = { { .x = -24, @@ -2565,302 +2886,7 @@ static const struct Subsprite sOamTable_48x48_Grass1[] = { } }; -static const struct Subsprite sOamTable_64x64_Follower[] = { - { - .x = -32, .y = -32, - SUBSPRITE_SHAPE(64, 32), - .tileOffset = 0, - .priority = 1 - }, - { - .x = -32, .y = 0, - SUBSPRITE_SHAPE(64, 32), - .tileOffset = 32, - .priority = 2 - } -}; - -static const struct Subsprite sOamTable_64x64_HotSprings[] = { - { - .x = -32, - .y = -32, - SUBSPRITE_SHAPE(64, 32), - .tileOffset = 0, - .priority = 2 - }, - { - .x = -32, - .y = 0, - SUBSPRITE_SHAPE(32, 8), - .tileOffset = 32, - .priority = 2 - }, - { - .x = 0, - .y = 0, - SUBSPRITE_SHAPE(32, 8), - .tileOffset = 36, - .priority = 2 - }, - { - .x = -32, - .y = 8, - SUBSPRITE_SHAPE(32, 8), - .tileOffset = 40, - .priority = 2 - }, - { - .x = 0, - .y = 8, - SUBSPRITE_SHAPE(32, 8), - .tileOffset = 44, - .priority = 2 - }, - { - .x = -32, - .y = 16, - SUBSPRITE_SHAPE(32, 8), - .tileOffset = 48, - .priority = 2 - }, - { - .x = 0, - .y = 16, - SUBSPRITE_SHAPE(32, 8), - .tileOffset = 52, - .priority = 2 - }, - { - .x = -32, - .y = 24, - SUBSPRITE_SHAPE(32, 8), - .tileOffset = 56, - .priority = 3 - }, - { - .x = 0, - .y = 24, - SUBSPRITE_SHAPE(32, 8), - .tileOffset = 60, - .priority = 3 - }, -}; - -static const struct Subsprite sOamTable_64x64_Grass2[] = { - { - .x = -32, - .y = -32, - SUBSPRITE_SHAPE(64, 32), - .tileOffset = 0, - .priority = 2 - }, - { - .x = -32, - .y = 0, - SUBSPRITE_SHAPE(32, 8), - .tileOffset = 32, - .priority = 2 - }, - { - .x = 0, - .y = 0, - SUBSPRITE_SHAPE(32, 8), - .tileOffset = 36, - .priority = 2 - }, - { - .x = -32, - .y = 8, - SUBSPRITE_SHAPE(32, 8), - .tileOffset = 40, - .priority = 2 - }, - { - .x = 0, - .y = 8, - SUBSPRITE_SHAPE(32, 8), - .tileOffset = 44, - .priority = 2 - }, - { - .x = -32, - .y = 16, - SUBSPRITE_SHAPE(32, 8), - .tileOffset = 48, - .priority = 3 - }, - { - .x = 0, - .y = 16, - SUBSPRITE_SHAPE(32, 8), - .tileOffset = 52, - .priority = 3 - }, - { - .x = -32, - .y = 24, - SUBSPRITE_SHAPE(32, 8), - .tileOffset = 56, - .priority = 3 - }, - { - .x = 0, - .y = 24, - SUBSPRITE_SHAPE(32, 8), - .tileOffset = 60, - .priority = 3 - }, -}; - -static const struct Subsprite sOamTable_64x64_Grass1[] = { - { - .x = -32, - .y = -32, - SUBSPRITE_SHAPE(64, 32), - .tileOffset = 0, - .priority = 1 - }, - { - .x = -32, - .y = 0, - SUBSPRITE_SHAPE(32, 8), - .tileOffset = 32, - .priority = 1 - }, - { - .x = 0, - .y = 0, - SUBSPRITE_SHAPE(32, 8), - .tileOffset = 36, - .priority = 1 - }, - { - .x = -32, - .y = 8, - SUBSPRITE_SHAPE(32, 8), - .tileOffset = 40, - .priority = 1 - }, - { - .x = 0, - .y = 8, - SUBSPRITE_SHAPE(32, 8), - .tileOffset = 44, - .priority = 1 - }, - { - .x = -32, - .y = 16, - SUBSPRITE_SHAPE(32, 8), - .tileOffset = 48, - .priority = 3 - }, - { - .x = 0, - .y = 16, - SUBSPRITE_SHAPE(32, 8), - .tileOffset = 52, - .priority = 3 - }, - { - .x = -32, - .y = 24, - SUBSPRITE_SHAPE(32, 8), - .tileOffset = 56, - .priority = 3 - }, - { - .x = 0, - .y = 24, - SUBSPRITE_SHAPE(32, 8), - .tileOffset = 60, - .priority = 3 - }, -}; - -static const struct Subsprite sOamTable_64x64_Grass3[] = { - { - .x = -32, - .y = -24, - SUBSPRITE_SHAPE(64, 32), - .tileOffset = 0, - .priority = 2 - }, - { - .x = -32, - .y = 8, - SUBSPRITE_SHAPE(64, 32), - .tileOffset = 32, - .priority = 3 - } -}; - -static const struct Subsprite sOamTable_64x64_Grass4[] = { - { - .x = -32, - .y = -24, - SUBSPRITE_SHAPE(64, 32), - .tileOffset = 0, - .priority = 1 - }, - { - .x = -32, - .y = 8, - SUBSPRITE_SHAPE(64, 32), - .tileOffset = 32, - .priority = 3 - } -}; - - -static const struct SubspriteTable sOamTables_16x24[] = { - SUBSPRITE_TABLE_ENTRY(sOamTable_16x24_0), - SUBSPRITE_TABLE_ENTRY(sOamTable_16x24_0), - SUBSPRITE_TABLE_ENTRY(sOamTable_16x24_1), - SUBSPRITE_TABLE_ENTRY(sOamTable_16x24_2), - SUBSPRITE_TABLE_ENTRY(sOamTable_16x24_3), - SUBSPRITE_TABLE_ENTRY(sOamTable_16x24_4), -}; - - -static const struct SubspriteTable sOamTables_24x16[] = { - SUBSPRITE_TABLE_ENTRY(sOamTable_24x16_0), - SUBSPRITE_TABLE_ENTRY(sOamTable_24x16_0), - SUBSPRITE_TABLE_ENTRY(sOamTable_24x16_1), - SUBSPRITE_TABLE_ENTRY(sOamTable_24x16_2), - SUBSPRITE_TABLE_ENTRY(sOamTable_24x16_3), - SUBSPRITE_TABLE_ENTRY(sOamTable_24x16_3), -}; - -static const struct SubspriteTable sOamTables_24x24[] = { - SUBSPRITE_TABLE_ENTRY(sOamTable_24x24_0), // reflections - SUBSPRITE_TABLE_ENTRY(sOamTable_24x24_0), // all 2 - SUBSPRITE_TABLE_ENTRY(sOamTable_24x24_1), // all 1 - SUBSPRITE_TABLE_ENTRY(sOamTable_24x24_2), // bottom 8 3 - SUBSPRITE_TABLE_ENTRY(sOamTable_24x24_3), // bottom 16 3 - SUBSPRITE_TABLE_ENTRY(sOamTable_24x24_4), // top 1, bottom 16 3 -}; - -static const struct SubspriteTable sOamTables_24x32[] = { - SUBSPRITE_TABLE_ENTRY(sOamTable_24x32_0), - SUBSPRITE_TABLE_ENTRY(sOamTable_24x32_0), - SUBSPRITE_TABLE_ENTRY(sOamTable_24x32_1), - SUBSPRITE_TABLE_ENTRY(sOamTable_24x32_2), - SUBSPRITE_TABLE_ENTRY(sOamTable_24x32_3), - SUBSPRITE_TABLE_ENTRY(sOamTable_24x32_4), -}; - - -static const struct SubspriteTable sOamTables_32x24[] = { - SUBSPRITE_TABLE_ENTRY(sOamTable_32x24_0), - SUBSPRITE_TABLE_ENTRY(sOamTable_32x24_0), - SUBSPRITE_TABLE_ENTRY(sOamTable_32x24_1), - SUBSPRITE_TABLE_ENTRY(sOamTable_32x24_2), - SUBSPRITE_TABLE_ENTRY(sOamTable_32x24_3), - SUBSPRITE_TABLE_ENTRY(sOamTable_32x24_4), -}; - - +// Also used for truck static const struct SubspriteTable sOamTables_48x48[] = { SUBSPRITE_TABLE_ENTRY(sOamTable_48x48), // reflections SUBSPRITE_TABLE_ENTRY(sOamTable_48x48), // elevation 3 @@ -2868,30 +2894,4 @@ static const struct SubspriteTable sOamTables_48x48[] = { SUBSPRITE_TABLE_ENTRY(sOamTable_48x48_HotSprings), // hot springs SUBSPRITE_TABLE_ENTRY(sOamTable_48x48_Grass2), // long grass SUBSPRITE_TABLE_ENTRY(sOamTable_48x48_Grass1) // long grass priority 1 -}; - - -// For following pokemon -// Makes the top 32 pixels priority 1, -// so that very tall pokemon's heads -// will appear on top of buildings, etc. -static const struct SubspriteTable sOamTables_64x64_Tall[] = { - {}, // unused - SUBSPRITE_TABLE_ENTRY(sOamTable_64x64_Follower), // elevation 3 - SUBSPRITE_TABLE_ENTRY(sOamTable_64x64_1), // elevation 4 - SUBSPRITE_TABLE_ENTRY(sOamTable_64x64_HotSprings), // hot springs - SUBSPRITE_TABLE_ENTRY(sOamTable_64x64_Grass2), // long grass - SUBSPRITE_TABLE_ENTRY(sOamTable_64x64_Grass1) // long grass priority 1 -}; - -// Like sOamTables_64x64_Tall, but fewer pixels visible in long grass -// Meant for pokemon that are more long than tall like Wailord -static const struct SubspriteTable sOamTables_64x64_Long[] = { - {}, // unused - SUBSPRITE_TABLE_ENTRY(sOamTable_64x64_Follower), // elevation 3 - SUBSPRITE_TABLE_ENTRY(sOamTable_64x64_1), // elevation 4 - SUBSPRITE_TABLE_ENTRY(sOamTable_64x64_HotSprings), // hot springs - SUBSPRITE_TABLE_ENTRY(sOamTable_64x64_Grass3), // long grass - SUBSPRITE_TABLE_ENTRY(sOamTable_64x64_Grass4) // long grass priority 1 -}; -#endif \ No newline at end of file +}; \ No newline at end of file diff --git a/src/event_object_movement.c b/src/event_object_movement.c index b3e1a4ae41..6a434521c8 100644 --- a/src/event_object_movement.c +++ b/src/event_object_movement.c @@ -163,7 +163,7 @@ static const struct ObjectEventTemplate *GetObjectEventTemplateByLocalIdAndMap(u static void RemoveObjectEventIfOutsideView(struct ObjectEvent *); static void SpawnObjectEventOnReturnToField(u8, s16, s16); static void SetPlayerAvatarObjectEventIdAndObjectId(u8, u8); -static u8 UpdateSpritePalette(const struct SpritePalette * spritePalette, struct Sprite * sprite); +static u8 UpdateSpritePalette(const struct SpritePalette *spritePalette, struct Sprite *sprite); static void ResetObjectEventFldEffData(struct ObjectEvent *); static u8 LoadSpritePaletteIfTagExists(const struct SpritePalette *); static u8 FindObjectEventPaletteIndexByTag(u16); @@ -192,7 +192,7 @@ static void CreateLevitateMovementTask(struct ObjectEvent *); static void DestroyLevitateMovementTask(u8); static bool8 GetFollowerInfo(u16 *species, u8 *form, u8 *shiny); static u8 LoadDynamicFollowerPalette(u16 species, u8 form, bool32 shiny); -static const struct ObjectEventGraphicsInfo * SpeciesToGraphicsInfo(u16 species, u8 form); +static const struct ObjectEventGraphicsInfo *SpeciesToGraphicsInfo(u16 species, u8 form); static bool8 NpcTakeStep(struct Sprite *); static bool8 IsElevationMismatchAt(u8, s16, s16); static bool8 AreElevationsCompatible(u8, u8); @@ -1589,7 +1589,6 @@ static u8 TrySetupObjectEventSprite(const struct ObjectEventTemplate *objectEven // Use palette from species palette table if (spriteTemplate->paletteTag == OBJ_EVENT_PAL_TAG_DYNAMIC) sprite->oam.paletteNum = LoadDynamicFollowerPalette(OW_SPECIES(objectEvent), OW_FORM(objectEvent), objectEvent->shiny); - if (OW_GFX_COMPRESS && sprite->usingSheet) sprite->sheetSpan = GetSpanPerImage(sprite->oam.shape, sprite->oam.size); GetMapCoordsFromSpritePos(objectEvent->currentCoords.x + cameraX, objectEvent->currentCoords.y + cameraY, &sprite->x, &sprite->y); @@ -1832,7 +1831,7 @@ u8 CreateVirtualObject(u16 graphicsId, u8 virtualObjId, s16 x, s16 y, u8 elevati } // Return address of first conscious party mon or NULL -struct Pokemon * GetFirstLiveMon(void) +struct Pokemon *GetFirstLiveMon(void) { u32 i; for (i = 0; i < PARTY_SIZE; i++) @@ -1844,7 +1843,7 @@ struct Pokemon * GetFirstLiveMon(void) } // Return follower ObjectEvent or NULL -struct ObjectEvent * GetFollowerObject(void) +struct ObjectEvent *GetFollowerObject(void) { u32 i; for (i = 0; i < OBJECT_EVENTS_COUNT; i++) @@ -1856,7 +1855,7 @@ struct ObjectEvent * GetFollowerObject(void) } // Return graphicsInfo for a pokemon species & form -static const struct ObjectEventGraphicsInfo * SpeciesToGraphicsInfo(u16 species, u8 form) +static const struct ObjectEventGraphicsInfo *SpeciesToGraphicsInfo(u16 species, u8 form) { const struct ObjectEventGraphicsInfo *graphicsInfo = NULL; #if OW_FOLLOWERS_ENABLED @@ -1964,9 +1963,8 @@ static void RefreshFollowerGraphics(struct ObjectEvent *objEvent) if (graphicsInfo->oam->size != sprite->oam.size) { - #if LARGE_OW_SUPPORT && !OW_GFX_COMPRESS - ReallocSpriteTiles(sprite, graphicsInfo->images->size); - #endif + if (LARGE_OW_SUPPORT && !OW_GFX_COMPRESS) + ReallocSpriteTiles(sprite, graphicsInfo->images->size); // Add difference in Y vectors sprite->y += -(graphicsInfo->height >> 1) - sprite->centerToCornerVecY; } @@ -2126,25 +2124,6 @@ static bool8 SpeciesHasType(u16 species, u8 type) return gSpeciesInfo[species].types[0] == type || gSpeciesInfo[species].types[1] == type; } -// Returns a random index according to a list of weights -static u8 RandomWeightedIndex(u8 *weights, u8 length) -{ - u32 i; - u16 random_value; - u16 weightSum = 0; - for (i = 0; i < length; i++) - weightSum += weights[i]; - random_value = Random() % weightSum; - weightSum = 0; - for (i = 0; i < length; i++) - { - weightSum += weights[i]; - if (random_value <= weightSum) - return i; - } - return 0; -} - // Display an emote above an object event // Note that this is not a movement action static void ObjectEventEmote(struct ObjectEvent *objEvent, u8 emotion) @@ -2617,7 +2596,7 @@ static void SetPlayerAvatarObjectEventIdAndObjectId(u8 objectEventId, u8 spriteI } // Update sprite's palette, freeing old palette if necessary -static u8 UpdateSpritePalette(const struct SpritePalette * spritePalette, struct Sprite * sprite) +static u8 UpdateSpritePalette(const struct SpritePalette *spritePalette, struct Sprite *sprite) { // Free palette if otherwise unused sprite->inUse = FALSE; @@ -2627,7 +2606,7 @@ static u8 UpdateSpritePalette(const struct SpritePalette * spritePalette, struct } // Find and update based on template's paletteTag -u8 UpdateSpritePaletteByTemplate(const struct SpriteTemplate * template, struct Sprite * sprite) +u8 UpdateSpritePaletteByTemplate(const struct SpriteTemplate *template, struct Sprite *sprite) { u8 i = FindObjectEventPaletteIndexByTag(template->paletteTag); if (i == 0xFF) @@ -2643,11 +2622,9 @@ static void ObjectEventSetGraphics(struct ObjectEvent *objectEvent, const struct if (i != 0xFF) UpdateSpritePalette(&sObjectEventSpritePalettes[i], sprite); - #if LARGE_OW_SUPPORT && !OW_GFX_COMPRESS // If gfx size changes, we need to reallocate tiles - if (graphicsInfo->oam->size != sprite->oam.size) + if (LARGE_OW_SUPPORT && !OW_GFX_COMPRESS && graphicsInfo->oam->size != sprite->oam.size) ReallocSpriteTiles(sprite, graphicsInfo->images->size); - #endif #if OW_GFX_COMPRESS LoadSheetGraphicsInfo(graphicsInfo, objectEvent->graphicsId, sprite); @@ -5552,7 +5529,7 @@ bool8 FollowablePlayerMovement_Slide(struct ObjectEvent *objectEvent, struct Spr return TRUE; } -bool8 fph_IM_DIFFERENT(struct ObjectEvent *objectEvent, struct Sprite *sprite, u8 playerDirection, bool8 tileCallback(u8)) +bool8 FollowablePlayerMovement_JumpInPlace(struct ObjectEvent *objectEvent, struct Sprite *sprite, u8 playerDirection, bool8 tileCallback(u8)) { u32 direction; @@ -7079,7 +7056,7 @@ static void ObjectEventSetPokeballGfx(struct ObjectEvent *objEvent) } } #endif - ObjectEventSetGraphicsId(objEvent, OBJ_EVENT_GFX_ANIMATED_BALL); + ObjectEventSetGraphicsId(objEvent, OBJ_EVENT_GFX_POKE_BALL); } #define sDuration data[3] @@ -7174,10 +7151,8 @@ bool8 MovementAction_ExitPokeball_Step1(struct ObjectEvent *objectEvent, struct LoadFillColorPalette(RGB_WHITE, OBJ_EVENT_PAL_TAG_WHITE, sprite); // Initialize affine animation sprite->affineAnims = sAffineAnims_PokeballFollower; - #if LARGE_OW_SUPPORT - if (!IS_POW_OF_TWO(-sprite->centerToCornerVecX)) + if (LARGE_OW_SUPPORT && !IS_POW_OF_TWO(-sprite->centerToCornerVecX)) return FALSE; - #endif sprite->affineAnims = sAffineAnims_PokeballFollower; sprite->oam.affineMode = ST_OAM_AFFINE_NORMAL; InitSpriteAffineAnim(sprite); @@ -7221,12 +7196,10 @@ bool8 MovementAction_EnterPokeball_Step1(struct ObjectEvent *objectEvent, struct // Set palette to white & start affine LoadFillColorPalette(RGB_WHITE, OBJ_EVENT_PAL_TAG_WHITE, sprite); sprite->subspriteTableNum = 0; - #if LARGE_OW_SUPPORT // Only do affine if sprite width is power of 2 // (effect looks weird on sprites composed of subsprites like 48x48, etc) - if (!IS_POW_OF_TWO(-sprite->centerToCornerVecX)) + if (LARGE_OW_SUPPORT && !IS_POW_OF_TWO(-sprite->centerToCornerVecX)) return FALSE; - #endif sprite->affineAnims = sAffineAnims_PokeballFollower; sprite->oam.affineMode = ST_OAM_AFFINE_NORMAL; InitSpriteAffineAnim(sprite); @@ -9266,11 +9239,10 @@ static void UpdateObjectEventElevationAndPriority(struct ObjectEvent *objEvent, ObjectEventUpdateElevation(objEvent, sprite); if (objEvent->localId == OBJ_EVENT_ID_FOLLOWER) { - #if LARGE_OW_SUPPORT // keep subspriteMode synced with player's // so that it disappears under bridges when they do - sprite->subspriteMode |= gSprites[gPlayerAvatar.spriteId].subspriteMode & SUBSPRITES_IGNORE_PRIORITY; - #endif + if (LARGE_OW_SUPPORT) + sprite->subspriteMode |= gSprites[gPlayerAvatar.spriteId].subspriteMode & SUBSPRITES_IGNORE_PRIORITY; // if transitioning between elevations, use the player's elevation if (!objEvent->currentElevation) objEvent = &gObjectEvents[gPlayerAvatar.objectEventId]; @@ -9299,11 +9271,10 @@ void ObjectEventUpdateElevation(struct ObjectEvent *objEvent, struct Sprite *spr if (curElevation == 15 || prevElevation == 15) { - #if LARGE_OW_SUPPORT // Ignore subsprite priorities under bridges // so all subsprites will display below it - sprite->subspriteMode = SUBSPRITES_IGNORE_PRIORITY; - #endif + if (LARGE_OW_SUPPORT) + sprite->subspriteMode = SUBSPRITES_IGNORE_PRIORITY; return; } @@ -9705,9 +9676,8 @@ static void DoGroundEffects_OnSpawn(struct ObjectEvent *objEvent, struct Sprite #endif { flags = 0; - #if LARGE_OW_SUPPORT - sprite->subspriteMode = SUBSPRITES_ON; - #endif + if (LARGE_OW_SUPPORT && !sprite->oam.affineMode) + sprite->subspriteMode = SUBSPRITES_ON; UpdateObjectEventElevationAndPriority(objEvent, sprite); GetAllGroundEffectFlags_OnSpawn(objEvent, &flags); SetObjectEventSpriteOamTableForLongGrass(objEvent, sprite); @@ -9728,9 +9698,8 @@ static void DoGroundEffects_OnBeginStep(struct ObjectEvent *objEvent, struct Spr #endif { flags = 0; - #if LARGE_OW_SUPPORT - sprite->subspriteMode = SUBSPRITES_ON; - #endif + if (LARGE_OW_SUPPORT && !sprite->oam.affineMode) + sprite->subspriteMode = SUBSPRITES_ON; UpdateObjectEventElevationAndPriority(objEvent, sprite); GetAllGroundEffectFlags_OnBeginStep(objEvent, &flags); SetObjectEventSpriteOamTableForLongGrass(objEvent, sprite); @@ -10413,7 +10382,7 @@ static void DoShadowFieldEffect(struct ObjectEvent *objectEvent) { if (!objectEvent->hasShadow) { - objectEvent->hasShadow = 1; + objectEvent->hasShadow = TRUE; StartFieldEffectForObjectEvent(FLDEFF_SHADOW, objectEvent); } } diff --git a/src/field_effect.c b/src/field_effect.c index 8314b00332..1bd9ece5aa 100644 --- a/src/field_effect.c +++ b/src/field_effect.c @@ -3105,7 +3105,7 @@ u8 FldEff_RayquazaSpotlight(void) struct Sprite *sprite = &gSprites[spriteId]; sprite->oam.priority = 1; - sprite->oam.paletteNum = 4; // TODO: What (dynamic) palette should this Raquaza use? + sprite->oam.paletteNum = 4; sprite->data[0] = 0; sprite->data[1] = 0; sprite->data[2] = 0; diff --git a/src/random.c b/src/random.c index 3ec3638fe1..9850df1aff 100644 --- a/src/random.c +++ b/src/random.c @@ -239,3 +239,22 @@ const void *RandomElementArrayDefault(enum RandomTag tag, const void *array, siz { return (const u8 *)array + size * RandomUniformDefault(tag, 0, count - 1); } + +// Returns a random index according to a list of weights +u8 RandomWeightedIndex(u8 *weights, u8 length) +{ + u32 i; + u16 random_value; + u16 weightSum = 0; + for (i = 0; i < length; i++) + weightSum += weights[i]; + random_value = Random() % weightSum; + weightSum = 0; + for (i = 0; i < length; i++) + { + weightSum += weights[i]; + if (random_value <= weightSum) + return i; + } + return 0; +} diff --git a/src/scrcmd.c b/src/scrcmd.c index d59bb42d6c..c8bd1d3387 100644 --- a/src/scrcmd.c +++ b/src/scrcmd.c @@ -1005,25 +1005,27 @@ bool8 ScrCmd_fadeinbgm(struct ScriptContext *ctx) bool8 ScrCmd_applymovement(struct ScriptContext *ctx) { u16 localId = VarGet(ScriptReadHalfword(ctx)); - const void *movementScript = (const void *)ScriptReadWord(ctx); + const u8 *movementScript = (const u8 *)ScriptReadWord(ctx); struct ObjectEvent *objEvent; // When applying script movements to follower, it may have frozen animation that must be cleared if (localId == OBJ_EVENT_ID_FOLLOWER && (objEvent = GetFollowerObject()) && objEvent->frozen) { ClearObjectEventMovement(objEvent, &gSprites[objEvent->spriteId]); - gSprites[objEvent->spriteId].animCmdIndex = 0; // Needed to set start frame of animation + gSprites[objEvent->spriteId].animCmdIndex = 0; // Reset start frame of animation } ScriptMovement_StartObjectMovementScript(localId, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, movementScript); sMovingNpcId = localId; + objEvent = GetFollowerObject(); // Force follower into pokeball - if (localId != OBJ_EVENT_ID_FOLLOWER && !FlagGet(FLAG_SAFE_FOLLOWER_MOVEMENT)) + if (localId != OBJ_EVENT_ID_FOLLOWER + && !FlagGet(FLAG_SAFE_FOLLOWER_MOVEMENT) + && (movementScript < Common_Movement_FollowerSafeStart || movementScript > Common_Movement_FollowerSafeEnd) + && (objEvent = GetFollowerObject()) + && !objEvent->invisible) { - objEvent = GetFollowerObject(); - // return early if no follower or in shadowing state - if (objEvent == NULL || gSprites[objEvent->spriteId].data[1] == 0) - return FALSE; ClearObjectEventMovement(objEvent, &gSprites[objEvent->spriteId]); + gSprites[objEvent->spriteId].animCmdIndex = 0; // Reset start frame of animation ScriptMovement_StartObjectMovementScript(OBJ_EVENT_ID_FOLLOWER, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, EnterPokeballMovement); } return FALSE; @@ -1251,7 +1253,7 @@ bool8 ScrCmd_lockall(struct ScriptContext *ctx) } } -// lock freezes all object events except the player and the selected object immediately. +// lock freezes all object events except the player, follower, and the selected object immediately. // The player and selected object are frozen after waiting for their current movement to finish. bool8 ScrCmd_lock(struct ScriptContext *ctx) { @@ -1261,16 +1263,22 @@ bool8 ScrCmd_lock(struct ScriptContext *ctx) } else { + struct ObjectEvent *followerObj = GetFollowerObject(); if (gObjectEvents[gSelectedObjectEvent].active) { FreezeObjects_WaitForPlayerAndSelected(); SetupNativeScript(ctx, IsFreezeSelectedObjectAndPlayerFinished); + // follower is being talked to; keep it frozen + if (gObjectEvents[gSelectedObjectEvent].localId == OBJ_EVENT_ID_FOLLOWER) + followerObj = NULL; } else { FreezeObjects_WaitForPlayer(); SetupNativeScript(ctx, IsFreezePlayerFinished); } + if (followerObj) // Unfreeze follower object + UnfreezeObjectEvent(followerObj); return TRUE; } }