Skip to content

Commit

Permalink
Field Moves + Move Item
Browse files Browse the repository at this point in the history
  • Loading branch information
Skeli789 committed Sep 20, 2019
1 parent 1b48e40 commit aeb7a73
Show file tree
Hide file tree
Showing 26 changed files with 1,067 additions and 322 deletions.
20 changes: 17 additions & 3 deletions BPRE.ld
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ gMapHeader = 0x2036DFC;
gWeatherPtr = 0x2037F34;
gEncounterRate = 0x20386D0;
gFieldEffectArguments = 0x20386E0;
FieldCallback = 0x3005020;
gPostMenuFieldCallback = 0x203B0C4;
gFieldCallback = 0x3005020;
gFieldCallback2 = 0x3005024;

/* Audio RAM */
gMPlay_BGM = 0x3007300;
Expand Down Expand Up @@ -246,6 +248,7 @@ BufferPokeNameSize = 0x80A08CC | 1;
Special_0DD_DeleteMove = 0x80BFBA8 | 1;
GetStarterChoice = 0x80CBDB0 | 1;
GetCombinedOTID = 0x80CC1E4 | 1;
GetMonNickname = 0x81202E0 | 1;
GetTutorMove = 0x8120BA8 | 1;
CanLearnTutorMove = 0x8120BE8 | 1;
MonKnowsMove = 0x8125AC0 | 1;
Expand Down Expand Up @@ -702,12 +705,16 @@ MetatileBehavior_IsDeepOrOceanWater = 0x805A01C | 1;
MetatileBehavior_IsRunningDisallowed = 0x805A234 | 1;
SetPlayerAvatarTransitionFlags = 0x805BDEC | 1;
sub_805C780 = 0x805C780 | 1;
PartyHasMonWithSurf = 0x805C83C | 1;
IsPlayerFacingSurfableFishableWater = 0x805C8B0 | 1;
MoveCoords = 0x8063A20 | 1;
GetOppositeDirection = 0x8064480 | 1;
FaceDirection = 0x80645F4 | 1;
ScriptCall = 0x80698D4 | 1;
MapHeaderCheckScriptTable = 0x8069BD8 | 1;
UpdateHappinessStepCounter = 0x806D74C | 1;
UpdatePoisonStepCounter = 0x806D79C | 1;
TrySetDiveWarp = 0x806DFB8 | 1;
FieldCallback_ReturnToEventScript2 = 0x807DD24 | 1;
FieldEffectActiveListRemove = 0x80837fc | 1;
GetMapName = 0x80C4D78 | 1;
Expand Down Expand Up @@ -872,8 +879,12 @@ ZeroEnemyPartyMons = 0x803DA34 | 1;
CheckPartyPokerus = 0x8043A70 | 1;
sub_80BF77C = 0x80BF77C | 1;
DisplayPartyPokemonSelectData = 0x811F2FC | 1;
sub_811F818 = 0x811F818 | 1;
sub_811FA78 = 0x811FA78 | 1;
GetCursorSelectionMonId = 0x811FB0C | 1;
sub_811FB28 = 0x811FB28 | 1;
sub_811FD88 = 0x811FD88 | 1;
PartyMenuButtonHandler = 0x811FEFC | 1;
sub_812029C = 0x812029C | 1;
DisplayPartyMenuMsgBox = 0x81202F8 | 1;
sub_81203B8 = 0x81203B8 | 1;
Expand All @@ -884,11 +895,14 @@ DisplayPartyPokemonLevelCheck = 0x8121790 | 1;
DisplayPartyPokemonGenderNidoranCheck = 0x8121854 | 1;
DisplayPartyPokemonOtherText = 0x8121C70 | 1;
sub_8121CE4 = 0x8121CE4 | 1;
display_pokemon_menu_message = 0x8121D0C | 1;
PrintPartyMenuPromptText = 0x8121D0C | 1;
sub_81224B4 = 0x81224B4 | 1;
sub_8122D78 = 0x8122D78 | 1;
sub_8123BF0 = 0x8123BF0 | 1;
sub_8124258 = 0x8124258 | 1;
FieldCallback_PrepareFadeInFromMenu = 0x81248B0 | 1;
sub_813A45C = 0x813A45C | 1;

some_other_kind_of_link_test = 0x80BF748 |1;

/* Window Functions */
InitWindows = 0x8003B24 | 1;
Expand Down
Binary file modified CFRU Documentation.docx
Binary file not shown.
Binary file modified CFRU Documentation.pdf
Binary file not shown.
17 changes: 1 addition & 16 deletions Credits.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1 @@
Graphics:
Golche - Attack Particles, Battle Backgrounds, Other Graphics
Bela - Poke Balls
Solo993 - Backsprites
Criminon - Mega Indicators
canstockphoto.ca - Battle Backgrounds

Code:
Skeli - A Bunch of Stuff
Ghoulslash - Attack Animations, Various Code
Lixdel - Attack Animations
Pret - PokeRuby, PokeFireRed, PokeEmerald
Sagari - Trainer Class Poke Balls, Pickup Update
DizzyEgg - Emerald Battle Engine Upgrade V1 & V2, Dizzy's Emerald Hacked Engine
FBI - Expanded Saveblock
Touched - Mega Evolution Original Code
See CFRU Documentation.pdf
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ A complete upgrade for Fire Red, including an upgraded Battle Engine.
* Updated Exp. Share
* Inverse Battles, Sky Battles
* Overworld trainer facing
* Move types light up on move menu based on effectiveness
* Battle Frontier
* Expanded Move Reminder (up to 50 moves)
* Improved Tm/Hm Expansion, Reusable TMs
Expand Down Expand Up @@ -65,6 +66,8 @@ A complete upgrade for Fire Red, including an upgraded Battle Engine.
* Footstep noise in grass & on sand
* Omnidirectional Jumping
* Item Image on obtain
* Move Items on Party Screen
* New Field Moves like Rock Climb & Defog

**NOTE** Personalized options are available in *src/config.h*. The options can be customized by commenting and uncommenting lines.

Expand Down
153 changes: 153 additions & 0 deletions assembly/overworld_scripts/system_scripts.s
Original file line number Diff line number Diff line change
Expand Up @@ -182,3 +182,156 @@ ObtainedMultipleItemMsg:
buffernumber 0x0 0x8005
preparemsg gText_ObtainedMultipleItems
return

@;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

.equ FLAG_FR_BADGE_6, 0x825
.equ PREVENT_ROUTE_ESCAPE_FLAG, 0x988
.equ HM08_ROCK_CLIMB, 128
.equ SPECIAL_POKEMON_IN_PARTY_THAT_CAN_LEARN_TM_HM, 0xD0
EventScript_RockClimb:
checkflag FLAG_FR_BADGE_6
if NOT_SET _goto EventScript_RockClimbDoNothing
checkflag PREVENT_ROUTE_ESCAPE_FLAG @;Can't climb if someone's following you
if SET _goto EventScript_RockClimbDoNothing
setvar 0x8000 HM08_ROCK_CLIMB
special2 LASTRESULT SPECIAL_POKEMON_IN_PARTY_THAT_CAN_LEARN_TM_HM
compare LASTRESULT PARTY_SIZE
if equal _goto EventScript_RockClimbDoNothing
setanimation 0x0 LASTRESULT
bufferpartypokemon 0x0 LASTRESULT
bufferattack 0x1 MOVE_ROCKCLIMB
msgbox gText_WantToScaleCliff MSG_YESNO
compare LASTRESULT NO
if equal _goto EventScript_RockClimbEnd
msgbox 0x81BDFD7 MSG_NORMAL@;[BUFFER1] used [BUFFER2]!
goto SystemScript_RockClimb

EventScript_RockClimbDoNothing:
msgbox gText_RockIsRocky MSG_NORMAL
EventScript_RockClimbEnd:
end

.equ SPECIAL_GET_PLAYER_FACING, 0x1AA
.global SystemScript_RockClimb
SystemScript_RockClimb:
lockall
doanimation 0x25
waitstate
special2 PLAYERFACING SPECIAL_GET_PLAYER_FACING
compare PLAYERFACING DOWN
if equal _goto SystemScript_RockClimbDown
compare PLAYERFACING LEFT
if equal _goto SystemScript_RockClimbLeft
compare PLAYERFACING RIGHT
if equal _goto SystemScript_RockClimbRight

SystemScript_RockClimbUp:
applymovement PLAYER m_RockClimbUp
waitmovement PLAYER
callasm ShouldRockClimbContinue
compare LASTRESULT 0
if equal _goto SystemScript_RockClimbUpFinish
goto SystemScript_RockClimbUp

SystemScript_RockClimbDown:
applymovement PLAYER m_RockClimbDown
waitmovement PLAYER
callasm ShouldRockClimbContinue
compare LASTRESULT 0
if equal _goto SystemScript_RockClimbDownFinish
goto SystemScript_RockClimbDown

SystemScript_RockClimbLeft:
applymovement PLAYER m_RockClimbLeft
SystemScript_RockClimbLeftWaitmovement:
waitmovement PLAYER
callasm ShouldRockClimbContinueDiagonally
compare LASTRESULT 1
if equal _goto SystemScript_RockClimbLeftUp
compare LASTRESULT 2
if equal _goto SystemScript_RockClimbLeftDown
callasm ShouldRockClimbContinue
compare LASTRESULT 0
if equal _goto SystemScript_RockClimbLeftFinish
goto SystemScript_RockClimbLeft

SystemScript_RockClimbLeftUp:
applymovement PLAYER m_RockClimbLeftUp
goto SystemScript_RockClimbLeftWaitmovement

SystemScript_RockClimbLeftDown:
applymovement PLAYER m_RockClimbLeftDown
goto SystemScript_RockClimbLeftWaitmovement

SystemScript_RockClimbRight:
applymovement PLAYER m_RockClimbRight
SystemScript_RockClimbRightWaitmovement:
waitmovement PLAYER
callasm ShouldRockClimbContinueDiagonally
compare LASTRESULT 1
if equal _goto SystemScript_RockClimbRightUp
compare LASTRESULT 2
if equal _goto SystemScript_RockClimbRightDown
callasm ShouldRockClimbContinue
compare LASTRESULT 0
if equal _goto SystemScript_RockClimbRightFinish
goto SystemScript_RockClimbRight

SystemScript_RockClimbRightUp:
applymovement PLAYER m_RockClimbRightUp
goto SystemScript_RockClimbRightWaitmovement

SystemScript_RockClimbRightDown:
applymovement PLAYER m_RockClimbRightDown
goto SystemScript_RockClimbRightWaitmovement

SystemScript_RockClimbDownFinish:
applymovement PLAYER m_RockClimbDown
waitmovement PLAYER
releaseall
end

SystemScript_RockClimbUpFinish:
applymovement PLAYER m_RockClimbUp
waitmovement PLAYER
releaseall
end

SystemScript_RockClimbLeftFinish:
applymovement PLAYER m_RockClimbLeft
waitmovement PLAYER
releaseall
end

SystemScript_RockClimbRightFinish:
applymovement PLAYER m_RockClimbRight
waitmovement PLAYER
releaseall
end

m_RockClimbDown: .byte 0x1D, end_m
m_RockClimbUp: .byte 0x1e, end_m
m_RockClimbLeft: .byte 0x1f, end_m
m_RockClimbRight: .byte 0x20, end_m

m_RockClimbLeftUp: .byte 0xC8, end_m
m_RockClimbLeftDown: .byte 0xC4, end_m
m_RockClimbRightUp: .byte 0xC9, end_m
m_RockClimbRightDown: .byte 0xC5, end_m

@;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

.global SystemScript_Defog
SystemScript_Defog:
lockall
doanimation 0x28
waitstate
checksound
sound 0x7E
setweather 0x0
doweather
checksound
msgbox gText_DefogBlewAwayFog MSG_KEEPOPEN
releaseall
end
15 changes: 15 additions & 0 deletions bytereplacement
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "src/config.h"
#include "include/party_menu.h"
#include "include/pokemon_storage_system.h"
#include "include/constants/tutors.h"
#include "include/new/catching.h"
Expand Down Expand Up @@ -460,6 +461,20 @@
##IsPokemonStorageFull special
0815FF30 A1 0F 04 08

##New Field Moves
08121F36 MENU_FIELD_MOVES_MINUS_1
08122146 MENU_FIELD_MOVES_MINUS_1
0812219E MENU_FIELD_MOVES
08122A6A MENU_FIELD_MOVES
081245BC MENU_FIELD_MOVES
0845A768 04

#ifdef GEN4_PLUS_SELECTION_SCREEN
0845A148 02 16 0B 07 08 0E 61 03
#else
0845A148 02 16 0B 07 08 0E 73 03
#endif

#ifdef UNBOUND

##Specific For Unbound, overrites a hook that shouldn't be there with vanilla data.##
Expand Down
5 changes: 1 addition & 4 deletions include/constants/metatile_behaviors.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#ifndef GUARD_METATILE_BEHAVIORS
#define GUARD_METATILE_BEHAVIORS
#pragma once

#define METATILE_COUNT 0xF0
#define MB_NORMAL 0x00
Expand Down Expand Up @@ -116,5 +115,3 @@
#define MB_A3 0xA3
#define MB_CYCLING_ROAD_PULL_DOWN 0xD0
#define MB_CYCLING_ROAD_PULL_DOWN_GRASS 0xD1

#endif // GUARD_METATILE_BEHAVIORS
2 changes: 1 addition & 1 deletion include/event_object_movement.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ u8 __attribute__((long_call)) GetEventObjectIdByLocalId(u8 localId);
void __attribute__((long_call)) FaceDirection(struct EventObject *eventObject, struct Sprite *sprite, u8 direction);
u8 __attribute__((long_call)) GetOppositeDirection(u8 direction);
u8 __attribute__((long_call)) CreateVirtualSprite(u8 graphicsId, u8 a1, s16 x, s16 y, u8 z, u8 direction);
void __attribute__((long_call)) MoveCoords(u8, s16 *, s16 *);

/*
extern const struct SpriteFrameImage gEventObjectPicTable_PechaBerryTree[];
Expand Down Expand Up @@ -136,7 +137,6 @@ u8 GetWalkInPlaceFastMovementAction(u32);
u8 GetWalkInPlaceNormalMovementAction(u32);
u8 GetWalkInPlaceSlowMovementAction(u32);
u8 GetCollisionAtCoords(struct EventObject *, s16, s16, u32);
void MoveCoords(u8, s16 *, s16 *);
bool8 EventObjectIsHeldMovementActive(struct EventObject *);
u8 EventObjectClearHeldMovementIfFinished(struct EventObject *);
u8 GetEventObjectIdByXYZ(u16 x, u16 y, u8 z);
Expand Down
45 changes: 41 additions & 4 deletions include/field_control_avatar.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,45 @@
#ifndef GUARD_FIELD_CONTROL_AVATAR_H
#define GUARD_FIELD_CONTROL_AVATAR_H
#pragma once

#include "global.h"

extern u32 gUnknown_3005078;
struct FieldInput
{
bool8 pressedAButton:1;
bool8 checkStandardWildEncounter:1;
bool8 pressedStartButton:1;
bool8 pressedSelectButton:1;
bool8 heldDirection:1;
bool8 heldDirection2:1;
bool8 tookStep:1;
bool8 pressedBButton:1;
bool8 input_field_1_0:1;
bool8 input_field_1_1:1;
bool8 input_field_1_2:1;
bool8 input_field_1_3:1;
bool8 input_field_1_4:1;
bool8 input_field_1_5:1;
bool8 input_field_1_6:1;
bool8 input_field_1_7:1;
u8 dpadDirection;
};

#endif //GUARD_FIELD_CONTROL_AVATAR_H
u8 __attribute__((long_call)) TrySetDiveWarp(void);

/*
void FieldClearPlayerInput(struct FieldInput *pStruct);
void FieldGetPlayerInput(struct FieldInput *pStruct, u16 keys, u16 heldKeys);
int ProcessPlayerFieldInput(struct FieldInput *pStruct);
u8 *sub_80682A8(struct MapPosition *, u8, u8);
void overworld_poison_timer_set(void);
void RestartWildEncounterImmunitySteps(void);
u8 *sub_8068E24(struct MapPosition *);
const u8 *GetEventObjectScriptPointerPlayerFacing(void);
bool8 sub_8068870(u16 a);
bool8 sub_8068894(void);
bool8 sub_8068A64(struct MapPosition *, u16);
u8 sub_8068F18(void);
bool8 dive_warp(struct MapPosition *position, u16 b);
int SetCableClubWarp(void);
const u8 *GetInteractedLinkPlayerScript(struct MapPosition *position, u8 metatileBehavior, u8 direction);
u8 *GetCoordEventScriptAtMapPosition(struct MapPosition *position);
*/
6 changes: 2 additions & 4 deletions include/field_effect.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#ifndef GUARD_FIELD_EFFECTS_H
#define GUARD_FIELD_EFFECTS_H
#pragma once

#include "global.h"
#include "sprite.h"
Expand Down Expand Up @@ -77,7 +76,7 @@ enum FieldEffectScriptIdx
FLDEFF_UNK_41 // TODO: related to vs_seeker
};

//extern u32 gFieldEffectArguments[8];
#define gFieldEffectArguments ((struct FieldEffectArguments*) 0x20386E0) //extern u32 gFieldEffectArguments[8];

struct Coords32 {
s32 x;
Expand All @@ -104,4 +103,3 @@ void __attribute__((long_call)) BindObj(u8 spriteId, u8 value);
bool8 FieldEffectActiveListContains(u8 id);
void sub_80B69DC(void);
*/
#endif //GUARD_FIELD_EFFECTS_H
4 changes: 3 additions & 1 deletion include/field_player_avatar.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@
#include "global.h"

bool8 __attribute__((long_call)) TestPlayerAvatarFlags(u8);
void __attribute__((long_call)) SetPlayerAvatarTransitionFlags(u16 a);
void __attribute__((long_call)) SetPlayerAvatarTransitionFlags(u16 a);
bool8 __attribute__((long_call)) PartyHasMonWithSurf(void);
bool8 __attribute__((long_call)) IsPlayerFacingSurfableFishableWater(void);
Loading

0 comments on commit aeb7a73

Please sign in to comment.