99#include "sprite.h"
1010#include "system.h"
1111
12- BattleFactoryAppCursor * BattleFactoryAppCursor_New (BattleFactoryAppSpriteManager * spriteMan , u8 param1 , u8 param2 , u8 param3 , u8 startingSlot , const CoordinatesS16 * positions , const u8 * animIDs )
12+ BattleFactoryAppCursor * BattleFactoryAppCursor_New (BattleFactoryAppSpriteManager * spriteMan , u8 numSlots , u8 numBallSlots , u8 cursorMode , u8 startingSlot , const CoordinatesS16 * positions , const u8 * animIDs )
1313{
1414 BattleFactoryAppCursor * cursor = Heap_Alloc (HEAP_ID_BATTLE_FACTORY_APP , sizeof (BattleFactoryAppCursor ));
1515 memset (cursor , 0 , sizeof (BattleFactoryAppCursor ));
1616
17- cursor -> unk_00 = param1 ;
18- cursor -> unk_10 = param2 ;
19- cursor -> unk_01 = param3 ;
17+ cursor -> numSlots = numSlots ;
18+ cursor -> numBallSlots = numBallSlots ;
19+ cursor -> cursorMode = cursorMode ;
2020 cursor -> currentSlot = startingSlot ;
2121 cursor -> positions = positions ;
2222 cursor -> animIDs = animIDs ;
2323
2424 if (animIDs != NULL ) {
2525 cursor -> sprite = BattleFactoryApp_InitSprite (spriteMan , 0 , cursor -> animIDs [startingSlot ], 0 , 0 , FALSE);
2626 } else {
27- if (param3 == 0 ) {
27+ if (cursorMode == CURSOR_MODE_MON_ONLY ) {
2828 cursor -> sprite = BattleFactoryApp_InitSprite (spriteMan , 0 , ANIM_ID_CURSOR , 0 , 0 , FALSE);
2929 } else {
3030 cursor -> sprite = BattleFactoryApp_InitSprite (spriteMan , 0 , ANIM_ID_MENU_CURSOR , 0 , 0 , FALSE);
@@ -52,63 +52,63 @@ void BattleFactoryAppCursor_SetDrawFlag(BattleFactoryAppCursor *cursor, BOOL dra
5252 Sprite_SetDrawFlag (cursor -> sprite , draw );
5353}
5454
55- void ov105_02246080 (BattleFactoryAppCursor * cursor )
55+ void BattleFactoryAppCursor_ProcessInput (BattleFactoryAppCursor * cursor )
5656{
57- if (cursor -> unk_03 == 1 ) {
57+ if (cursor -> selectionActive == TRUE ) {
5858 return ;
5959 }
6060
6161 if (gSystem .pressedKeys == 0 ) {
6262 return ;
6363 }
6464
65- if (cursor -> unk_01 == 2 ) {
65+ if (cursor -> cursorMode == CURSOR_MODE_MON_AND_MENU ) {
6666 if (JOY_NEW (PAD_KEY_LEFT )) {
6767 if (cursor -> currentSlot == 0 ) {
68- cursor -> currentSlot = ( cursor -> unk_00 - 1 ) ;
68+ cursor -> currentSlot = cursor -> numSlots - 1 ;
6969 } else {
7070 cursor -> currentSlot -- ;
7171 }
7272 } else if (JOY_NEW (PAD_KEY_RIGHT )) {
73- if (cursor -> currentSlot == ( cursor -> unk_00 - 1 ) ) {
73+ if (cursor -> currentSlot == cursor -> numSlots - 1 ) {
7474 cursor -> currentSlot = 0 ;
7575 } else {
7676 cursor -> currentSlot ++ ;
7777 }
7878 } else if (JOY_NEW (PAD_KEY_DOWN )) {
79- if (cursor -> currentSlot < ( cursor -> unk_10 ) ) {
80- cursor -> currentSlot = cursor -> unk_10 ;
81- } else if (cursor -> currentSlot == ( cursor -> unk_00 - 1 ) ) {
79+ if (cursor -> currentSlot < cursor -> numBallSlots ) {
80+ cursor -> currentSlot = cursor -> numBallSlots ;
81+ } else if (cursor -> currentSlot == cursor -> numSlots - 1 ) {
8282 cursor -> currentSlot = 0 ;
8383 } else {
8484 cursor -> currentSlot ++ ;
8585 }
8686 } else if (JOY_NEW (PAD_KEY_UP )) {
87- if (cursor -> currentSlot < ( cursor -> unk_10 ) ) {
88- cursor -> currentSlot = ( cursor -> unk_00 - 1 ) ;
87+ if (cursor -> currentSlot < cursor -> numBallSlots ) {
88+ cursor -> currentSlot = cursor -> numSlots - 1 ;
8989 } else {
9090 cursor -> currentSlot -- ;
9191 }
9292 }
9393 } else {
94- u32 v1 , v2 ;
95- if (cursor -> unk_01 == 0 ) {
96- v1 = PAD_KEY_RIGHT ;
97- v2 = PAD_KEY_LEFT ;
94+ u32 nextDir , prevDir ;
95+ if (cursor -> cursorMode == CURSOR_MODE_MON_ONLY ) {
96+ nextDir = PAD_KEY_RIGHT ;
97+ prevDir = PAD_KEY_LEFT ;
9898 } else {
99- v1 = PAD_KEY_DOWN ;
100- v2 = PAD_KEY_UP ;
99+ nextDir = PAD_KEY_DOWN ;
100+ prevDir = PAD_KEY_UP ;
101101 }
102102
103- if (JOY_NEW (v1 )) {
103+ if (JOY_NEW (nextDir )) {
104104 cursor -> currentSlot ++ ;
105105
106- if (cursor -> currentSlot >= cursor -> unk_00 ) {
106+ if (cursor -> currentSlot >= cursor -> numSlots ) {
107107 cursor -> currentSlot = 0 ;
108108 }
109- } else if (JOY_NEW (v2 )) {
109+ } else if (JOY_NEW (prevDir )) {
110110 if (cursor -> currentSlot == 0 ) {
111- cursor -> currentSlot = cursor -> unk_00 ;
111+ cursor -> currentSlot = cursor -> numSlots ;
112112 }
113113
114114 cursor -> currentSlot -- ;
@@ -131,11 +131,11 @@ u8 BattleFactoryAppCursor_GetCurrentSlot(BattleFactoryAppCursor *cursor)
131131 return cursor -> currentSlot ;
132132}
133133
134- void ov105_022461A4 (BattleFactoryAppCursor * cursor , int param1 )
134+ void UpdateMonCursorState (BattleFactoryAppCursor * cursor , BOOL selectionActive )
135135{
136- cursor -> unk_03 = param1 ;
136+ cursor -> selectionActive = selectionActive ;
137137
138- if (param1 == 0 ) {
138+ if (selectionActive == FALSE ) {
139139 Sprite_SetAnimNoRestart (cursor -> sprite , ANIM_ID_CURSOR );
140140 } else {
141141 Sprite_SetAnimNoRestart (cursor -> sprite , ANIM_ID_CURSOR_SELECTED );
0 commit comments