documentation, 2

This commit is contained in:
PikalaxALT 2024-05-09 19:53:04 -04:00
parent 07cda82a66
commit 17f2b42781
33 changed files with 337 additions and 338 deletions

View File

@ -32,7 +32,7 @@
.public Pokepic_SetAttr
.public Pokepic_GetAttr
.public Pokepic_AddAttr
.public sub_0200908C
.public Pokepic_SetVisible
.public Pokepic_StartPaletteFade
.public sub_02009138
.public Pokepic_ScheduleReloadFromNarc

View File

@ -32,7 +32,7 @@
.public GfGfxLoader_LoadCharData
.public GfGfxLoader_LoadScrnData
.public PokepicManager_Create
.public sub_02008120
.public PokepicManager_DrawAll
.public PokepicManager_Delete
.public PokepicManager_SetPlttBaseAddrAndSize
.public PokepicManager_HandleLoadImgAndOrPltt

View File

@ -14,15 +14,15 @@
.public IsCryFinished
.public NARC_New
.public NARC_Delete
.public sub_02008550
.public sub_020085DC
.public Pokepic_StartAnim
.public Pokepic_IsAnimFinished
.public PokepicManager_CreatePokepic
.public PokepicManager_CreatePokepicAt
.public Pokepic_Delete
.public Pokepic_SetAttr
.public Pokepic_GetAttr
.public Pokepic_AddAttr
.public sub_0200908C
.public Pokepic_SetVisible
.public Pokepic_StartPaletteFade
.public Pokepic_StartPaletteFadeAll
.public sub_02009138
@ -80,7 +80,7 @@
.public sub_0207204C
.public MaskOfFlagNo
.public TrainerClassToBackpicID
.public sub_02072914
.public NARC_ReadPokepicAnimScript
.public sub_0207294C
.public sub_020729A4
.public sub_020729D8

View File

@ -27,7 +27,7 @@
.public GfGfxLoader_LoadCharDataFromOpenNarc
.public GfGfxLoader_LoadScrnDataFromOpenNarc
.public PokepicManager_Create
.public sub_02008120
.public PokepicManager_DrawAll
.public PokepicManager_Delete
.public PokepicManager_CreatePokepic
.public Pokepic_Delete

View File

@ -28,7 +28,7 @@
.public GfGfxLoader_GXLoadPalFromOpenNarc
.public GfGfxLoader_LoadFromOpenNarc
.public PokepicManager_Create
.public sub_02008120
.public PokepicManager_DrawAll
.public PokepicManager_Delete
.public PokepicManager_CreatePokepic
.public Pokepic_Delete

View File

@ -26,10 +26,10 @@
.public GfGfxLoader_LoadCharDataFromOpenNarc
.public GfGfxLoader_LoadScrnDataFromOpenNarc
.public PokepicManager_Create
.public sub_02008120
.public PokepicManager_DrawAll
.public PokepicManager_Delete
.public sub_02008550
.public sub_020085DC
.public Pokepic_StartAnim
.public Pokepic_IsAnimFinished
.public PokepicManager_CreatePokepic
.public Pokepic_Delete
.public Pokepic_SetAttr
@ -196,7 +196,7 @@
.public GetPokemonSpriteCharAndPlttNarcIds
.public sub_0207083C
.public CopyPokemonToPokemon
.public sub_02072914
.public NARC_ReadPokepicAnimScript
.public sub_0207294C
.public Pokemon_GetIconNaix
.public GetMonIconPaletteEx

View File

@ -17,7 +17,7 @@
.public GfGfxLoader_LoadScrnDataFromOpenNarc
.public GfGfxLoader_GXLoadPalFromOpenNarc
.public PokepicManager_Create
.public sub_02008120
.public PokepicManager_DrawAll
.public PokepicManager_Delete
.public PokepicManager_CreatePokepic
.public Pokepic_Delete

View File

@ -23,7 +23,7 @@
.public NARC_Delete
.public GfGfxLoader_GetScrnDataFromOpenNarc
.public PokepicManager_Create
.public sub_02008120
.public PokepicManager_DrawAll
.public PokepicManager_Delete
.public PokepicManager_CreatePokepic
.public Pokepic_SetAttr

View File

@ -24,9 +24,9 @@
.public GfGfxLoader_GetAnimBank
.public GfGfxLoader_LoadFromNarc
.public PokepicManager_Create
.public sub_02008120
.public PokepicManager_DrawAll
.public PokepicManager_Delete
.public sub_02008550
.public Pokepic_StartAnim
.public PokepicManager_CreatePokepic
.public Pokepic_Delete
.public Pokepic_SetAttr
@ -140,7 +140,7 @@
.public GetMonBaseStat_HandleAlternateForm
.public GetBoxmonSpriteCharAndPlttNarcIds
.public sub_02070854
.public sub_02072914
.public NARC_ReadPokepicAnimScript
.public sub_020729A4
.public NNS_G2dSetupSoftwareSpriteCamera
.public NNS_G2dInitOamManagerModule

View File

@ -35,7 +35,7 @@
.public GfGfxLoader_GXLoadPalFromOpenNarc
.public GfGfxLoader_GetScrnDataFromOpenNarc
.public PokepicManager_Create
.public sub_02008120
.public PokepicManager_DrawAll
.public PokepicManager_Delete
.public PokepicManager_CreatePokepic
.public Pokepic_Delete

View File

@ -30,10 +30,10 @@
.public GfGfxLoader_LoadCharDataFromOpenNarc
.public GfGfxLoader_LoadScrnDataFromOpenNarc
.public PokepicManager_Create
.public sub_02008120
.public PokepicManager_DrawAll
.public PokepicManager_Delete
.public sub_02008550
.public sub_020085DC
.public Pokepic_StartAnim
.public Pokepic_IsAnimFinished
.public PokepicManager_CreatePokepic
.public Pokepic_Delete
.public Pokepic_SetAttr
@ -154,7 +154,7 @@
.public GetPokemonSpriteCharAndPlttNarcIds
.public sub_0207083C
.public Mon_GetBoxMon
.public sub_02072914
.public NARC_ReadPokepicAnimScript
.public sub_0207294C
.public sub_020729A4
.public NNS_G2dSetupSoftwareSpriteCamera

View File

@ -3,11 +3,11 @@
.public BlendPalette
.public AllocAndReadWholeNarcMemberByIdPair
.public PokepicManager_Create
.public sub_02008120
.public PokepicManager_DrawAll
.public PokepicManager_Delete
.public sub_02008550
.public sub_020085C8
.public sub_020085DC
.public Pokepic_StartAnim
.public Pokepic_SetAnimScript
.public Pokepic_IsAnimFinished
.public PokepicManager_CreatePokepic
.public PokepicManager_CreatePokepicAt
.public Pokepic_Delete
@ -15,7 +15,7 @@
.public Pokepic_SetAttr
.public Pokepic_GetAttr
.public Pokepic_AddAttr
.public sub_0200908C
.public Pokepic_SetVisible
.public Pokepic_StartPaletteFade
.public Pokepic_StartPaletteFadeAll
.public sub_02009138

View File

@ -31,11 +31,11 @@
.public GfGfxLoader_LoadCharDataFromOpenNarc
.public GfGfxLoader_LoadScrnDataFromOpenNarc
.public PokepicManager_Create
.public sub_02008120
.public PokepicManager_DrawAll
.public PokepicManager_Delete
.public sub_02008550
.public sub_020085C8
.public sub_020085DC
.public Pokepic_StartAnim
.public Pokepic_SetAnimScript
.public Pokepic_IsAnimFinished
.public PokepicManager_CreatePokepic
.public Pokepic_SetAttr
.public Pokepic_GetAttr
@ -144,7 +144,7 @@
.public MonTryLearnMoveOnLevelUp
.public CopyPokemonToPokemon
.public UpdateMonAbility
.public sub_02072914
.public NARC_ReadPokepicAnimScript
.public sub_0207294C
.public sub_020729A4
.public Party_AddMon

View File

@ -1,9 +1,9 @@
#include <nitro/fs/overlay.h>
#pragma once
.public PokepicManager_Create
.public sub_02008120
.public PokepicManager_DrawAll
.public PokepicManager_Delete
.public sub_02008550
.public Pokepic_StartAnim
.public PokepicManager_CreatePokepic
.public Pokepic_SetAttr
.public sub_02016F2C
@ -18,7 +18,7 @@
.public TouchscreenHitbox_FindRectAtTouchNew
.public GetPokemonSpriteCharAndPlttNarcIds
.public GetBoxmonSpriteCharAndPlttNarcIds
.public sub_02072914
.public NARC_ReadPokepicAnimScript
.public sub_0207294C
.public sub_0208A520
.public sub_0208DE40

View File

@ -21063,7 +21063,7 @@ _02225A96:
ldr r1, [r4, #0x30]
ldr r2, [r4, #0x34]
ldr r3, [r4, #0x38]
bl sub_0200908C
bl Pokepic_SetVisible
ldr r0, [r4, #4]
ldr r1, _02225ADC ; =ov07_02225904
add r2, r4, #0
@ -21305,7 +21305,7 @@ _02225C92:
ldr r0, [r4, #0x30]
ldr r2, [r4, #0x3c]
mov r3, #0x50
bl sub_0200908C
bl Pokepic_SetVisible
pop {r3, r4, r5, pc}
_02225CA4:
ldr r0, [r4, #0x30]
@ -21372,7 +21372,7 @@ ov07_02225CC4: ; 0x02225CC4
str r1, [sp]
ldr r0, [r4, #0x30]
ldr r2, [r4, #0x3c]
bl sub_0200908C
bl Pokepic_SetVisible
ldr r0, [r4, #4]
ldr r1, _02225DB8 ; =ov07_02225C50
add r2, r4, #0
@ -21401,7 +21401,7 @@ _02225D46:
str r0, [sp]
ldr r0, [r4, #0x30]
add r2, r1, #0
bl sub_0200908C
bl Pokepic_SetVisible
ldr r0, [r4, #4]
ldr r1, _02225DBC ; =ov07_02225BC4
add r2, r4, #0
@ -21424,7 +21424,7 @@ _02225D86:
ldr r0, [r4, #0x30]
add r2, r1, #0
mov r3, #0x50
bl sub_0200908C
bl Pokepic_SetVisible
ldr r0, [r4, #4]
ldr r1, _02225DC0 ; =ov07_02225B38
add r2, r4, #0
@ -32826,7 +32826,7 @@ ov07_0222BADC: ; 0x0222BADC
mov r2, #0x50
sub r2, r2, r3
add r3, r4, #0
bl sub_0200908C
bl Pokepic_SetVisible
add sp, #4
pop {r3, r4, pc}
thumb_func_end ov07_0222BADC

View File

@ -3233,7 +3233,7 @@ _02239830:
add r0, r4, #0
add r0, #0x88
ldr r0, [r0]
bl sub_02008120
bl PokepicManager_DrawAll
add r4, #0x94
ldr r0, [r4]
bl sub_0200D020

View File

@ -2455,7 +2455,7 @@ _022599F2:
ldrh r2, [r5, #2]
ldrb r3, [r6, r3]
add r1, #3
bl sub_02072914
bl NARC_ReadPokepicAnimScript
ldr r1, _02259B8C ; =0x00000195
mov r0, #6
ldrb r2, [r6, r1]
@ -6127,7 +6127,7 @@ _0225B728:
cmp r0, #1
bne _0225B7B4
ldr r0, [r4, #8]
bl sub_020085DC
bl Pokepic_IsAnimFinished
cmp r0, #0
bne _0225B7B4
ldr r0, [r4, #0x28]
@ -6332,7 +6332,7 @@ _0225B8D0:
cmp r0, #1
bne _0225B95C
ldr r0, [r4, #8]
bl sub_020085DC
bl Pokepic_IsAnimFinished
cmp r0, #0
bne _0225B95C
ldr r0, [r4, #0x28]
@ -6571,7 +6571,7 @@ _0225BAAC:
ldrh r2, [r2]
ldrb r3, [r3]
add r1, sp, #0x24
bl sub_02072914
bl NARC_ReadPokepicAnimScript
add r0, r4, #0
add r0, #0x82
ldrb r3, [r0]
@ -6887,7 +6887,7 @@ _0225BD50:
bne _0225BE20
ldr r0, [r4, #4]
ldr r0, [r0, #0x20]
bl sub_020085DC
bl Pokepic_IsAnimFinished
cmp r0, #0
bne _0225BE20
ldr r0, [r4, #4]
@ -7109,7 +7109,7 @@ _0225BF18:
ldrh r2, [r2]
ldrb r3, [r3]
add r1, sp, #0x24
bl sub_02072914
bl NARC_ReadPokepicAnimScript
add r0, r4, #0
add r0, #0x82
ldrb r1, [r0]
@ -7299,7 +7299,7 @@ _0225C0B0:
bne _0225C17A
ldr r0, [r4, #4]
ldr r0, [r0, #0x20]
bl sub_020085DC
bl Pokepic_IsAnimFinished
cmp r0, #0
bne _0225C17A
ldr r0, [r4, #4]
@ -7476,7 +7476,7 @@ _0225C214:
ldrh r2, [r2]
ldrb r3, [r3]
add r1, sp, #0x30
bl sub_02072914
bl NARC_ReadPokepicAnimScript
add r0, r4, #0
add r0, #0x82
ldrb r3, [r0]
@ -7869,7 +7869,7 @@ _0225C566:
bne _0225C586
ldr r0, [r4, #4]
ldr r0, [r0, #0x20]
bl sub_020085DC
bl Pokepic_IsAnimFinished
cmp r0, #0
beq _0225C588
_0225C586:
@ -8076,7 +8076,7 @@ _0225C704:
ldrh r2, [r2]
ldrb r3, [r3]
add r1, sp, #0x24
bl sub_02072914
bl NARC_ReadPokepicAnimScript
add r0, r4, #0
add r0, #0x82
ldrb r1, [r0]
@ -8235,7 +8235,7 @@ _0225C858:
bne _0225C878
ldr r0, [r4, #4]
ldr r0, [r0, #0x20]
bl sub_020085DC
bl Pokepic_IsAnimFinished
cmp r0, #0
beq _0225C87A
_0225C878:
@ -15469,7 +15469,7 @@ _022602CE:
mov r1, #0
ldr r0, [r4, #8]
add r2, r1, #0
bl sub_0200908C
bl Pokepic_SetVisible
add r0, r4, #0
add r0, #0x66
ldrb r0, [r0]
@ -19105,7 +19105,7 @@ ov12_02261F38: ; 0x02261F38
bne _02261F8C
add r0, r6, #0
mov r1, #1
bl sub_02008550
bl Pokepic_StartAnim
add r0, r7, #0
bl ov12_0223B750
add r1, r0, #0

View File

@ -931,7 +931,7 @@ _0222BF0A:
_0222BF0E:
bl Thunk_G3X_Reset
ldr r0, [r4, #0x64]
bl sub_02008120
bl PokepicManager_DrawAll
mov r0, #1
mov r1, #0
bl RequestSwap3DBuffers

View File

@ -505,7 +505,7 @@ _02246234:
cmp r0, #0
beq _02246240
ldr r0, [r4, #0x20]
bl sub_02008120
bl PokepicManager_DrawAll
_02246240:
mov r0, #0
add r1, r0, #0
@ -1077,7 +1077,7 @@ _02246644:
cmp r0, #0
beq _02246650
ldr r0, [r5, #0x20]
bl sub_02008120
bl PokepicManager_DrawAll
_02246650:
ldr r0, _0224666C ; =0x04000448
mov r1, #1

View File

@ -270,7 +270,7 @@ _02237B0C:
mov r0, #0x71
lsl r0, r0, #2
ldr r0, [r4, r0]
bl sub_02008120
bl PokepicManager_DrawAll
bl ov57_02238C0C
mov r0, #0
pop {r4, pc}
@ -6598,7 +6598,7 @@ _0223AD38:
mov r0, #0x72
lsl r0, r0, #2
ldr r0, [r4, r0]
bl sub_020085DC
bl Pokepic_IsAnimFinished
cmp r0, #0
beq _0223AD66
_0223AD64:
@ -8193,7 +8193,7 @@ ov57_0223B950: ; 0x0223B950
add r1, sp, #0x10
lsr r2, r2, #0x10
mov r3, #1
bl sub_02072914
bl NARC_ReadPokepicAnimScript
ldr r0, _0223B9C4 ; =0xFFFFFD80
add r6, #0x30
str r0, [sp]
@ -8238,7 +8238,7 @@ ov57_0223B9C8: ; 0x0223B9C8
lsl r0, r0, #2
ldr r0, [r5, r0]
mov r1, #1
bl sub_02008550
bl Pokepic_StartAnim
mov r0, #2
str r0, [sp]
mov r0, #0

View File

@ -9023,7 +9023,7 @@ ov59_0223C304: ; 0x0223C304
bl NNS_G3dGlbFlushP
bl NNS_G2dSetupSoftwareSpriteCamera
ldr r0, [r4, #0xc]
bl sub_02008120
bl PokepicManager_DrawAll
bl sub_02015460
ldr r0, _0223C34C ; =0x04000540
mov r1, #1

View File

@ -3292,7 +3292,7 @@ ov68_021E734C: ; 0x021E734C
bl NNS_G3dGlbFlushP
bl NNS_G2dSetupSoftwareSpriteCamera
ldr r0, [r4, #4]
bl sub_02008120
bl PokepicManager_DrawAll
ldr r0, _021E7384 ; =0x04000540
mov r1, #1
str r1, [r0]

View File

@ -2221,7 +2221,7 @@ ov71_022479C8: ; 0x022479C8
ldr r0, [r4, #0xc]
bl PokepicManager_HandleLoadImgAndOrPltt
ldr r0, [r4, #0xc]
bl sub_02008120
bl PokepicManager_DrawAll
mov r2, #1
str r2, [sp]
mov r0, #0x12
@ -2611,7 +2611,7 @@ _02247D04:
bne _02247D80
ldr r0, [r4, #0x10]
mov r1, #1
bl sub_02008550
bl Pokepic_StartAnim
ldr r0, [r4]
bl ov71_022473A8
add r2, r0, #0
@ -2913,7 +2913,7 @@ ov71_02247F9C: ; 0x02247F9C
ldr r0, [r0]
add r1, #0x14
mov r3, #1
bl sub_02072914
bl NARC_ReadPokepicAnimScript
add r0, r4, #0
mov r1, #2
mov r2, #0
@ -9310,7 +9310,7 @@ ov71_0224B234: ; 0x0224B234
ldr r0, [r4, #0x10]
bl PokepicManager_HandleLoadImgAndOrPltt
ldr r0, [r4, #0x10]
bl sub_02008120
bl PokepicManager_DrawAll
mov r2, #1
str r2, [sp]
mov r0, #0x12
@ -9657,7 +9657,7 @@ _0224B504:
bl sub_020062E0
ldr r0, [r4, #0x14]
mov r1, #1
bl sub_02008550
bl Pokepic_StartAnim
_0224B55A:
mov r0, #0
str r0, [r4, #8]
@ -10004,7 +10004,7 @@ ov71_0224B7EC: ; 0x0224B7EC
ldr r0, [r0]
add r1, #0x18
mov r3, #1
bl sub_02072914
bl NARC_ReadPokepicAnimScript
add r0, r4, #0
mov r1, #2
mov r2, #0

View File

@ -9891,7 +9891,7 @@ ov81_02242C48: ; 0x02242C48
bl NNS_G3dGlbFlushP
bl NNS_G2dSetupSoftwareSpriteCamera
add r0, r4, #0
bl sub_02008120
bl PokepicManager_DrawAll
ldr r0, _02242C7C ; =0x04000540
mov r1, #1
str r1, [r0]

View File

@ -1212,7 +1212,7 @@ ov95_021E623C: ; 0x021E623C
add r1, sp, #0x14
lsr r2, r2, #0x10
mov r3, #1
bl sub_02072914
bl NARC_ReadPokepicAnimScript
mov r1, #0
str r1, [sp]
add r7, #0x60
@ -1247,7 +1247,7 @@ ov95_021E62A4: ; 0x021E62A4
bl GetMonNature
ldr r0, [r5, #0x70]
mov r1, #1
bl sub_02008550
bl Pokepic_StartAnim
mov r0, #2
str r0, [sp]
mov r0, #0
@ -1522,7 +1522,7 @@ _021E64D4:
cmp r0, #1
bne _021E6586
ldr r0, [r4, #0x70]
bl sub_020085DC
bl Pokepic_IsAnimFinished
cmp r0, #0
bne _021E6586
add r0, r4, #0
@ -1803,7 +1803,7 @@ _021E6726:
cmp r0, #1
bne _021E67D8
ldr r0, [r4, #0x70]
bl sub_020085DC
bl Pokepic_IsAnimFinished
cmp r0, #0
bne _021E67D8
add r0, r4, #0
@ -2754,7 +2754,7 @@ _021E6EDC:
b _021E6F04
_021E6EEC:
ldr r0, [r5, #0x3c]
bl sub_02008120
bl PokepicManager_DrawAll
bl ov95_021E5B58
b _021E6F04
_021E6EF8:

View File

@ -929,7 +929,7 @@ sub_02075D08: ; 0x02075D08
cmp r0, #0
bne _02075D2C
ldr r0, [r4, #0x18]
bl sub_02008120
bl PokepicManager_DrawAll
bl sub_020774E0
mov r0, #1
mov r1, #0
@ -1330,13 +1330,13 @@ _02076038:
ldr r0, [r0]
add r1, sp, #0x68
mov r3, #1
bl sub_02072914
bl NARC_ReadPokepicAnimScript
ldr r0, [r4, #0x1c]
add r1, sp, #0x68
bl sub_020085C8
bl Pokepic_SetAnimScript
ldr r0, [r4, #0x1c]
mov r1, #0
bl sub_02008550
bl Pokepic_StartAnim
add r0, r4, #0
add r1, r4, #0
add r0, #0x60
@ -1387,7 +1387,7 @@ _020760CE:
cmp r0, #1
bne _02076132
ldr r0, [r4, #0x1c]
bl sub_020085DC
bl Pokepic_IsAnimFinished
cmp r0, #0
bne _02076132
ldr r0, [r4, #0x58]
@ -1717,13 +1717,13 @@ _0207639A:
ldr r0, [r0]
add r1, sp, #0x40
mov r3, #1
bl sub_02072914
bl NARC_ReadPokepicAnimScript
ldr r0, [r4, #0x20]
add r1, sp, #0x40
bl sub_020085C8
bl Pokepic_SetAnimScript
ldr r0, [r4, #0x20]
mov r1, #0
bl sub_02008550
bl Pokepic_StartAnim
add r0, r4, #0
add r1, r4, #0
add r0, #0x62
@ -1749,7 +1749,7 @@ _020763FC:
cmp r0, #1
bne _020764F4
ldr r0, [r4, #0x20]
bl sub_020085DC
bl Pokepic_IsAnimFinished
cmp r0, #0
bne _020764F4
add r2, r4, #0
@ -2637,13 +2637,13 @@ _02076B56:
ldr r0, [r0]
add r1, sp, #0x18
mov r3, #1
bl sub_02072914
bl NARC_ReadPokepicAnimScript
ldr r0, [r4, #0x1c]
add r1, sp, #0x18
bl sub_020085C8
bl Pokepic_SetAnimScript
ldr r0, [r4, #0x1c]
mov r1, #0
bl sub_02008550
bl Pokepic_StartAnim
add r0, r4, #0
add r1, r4, #0
add r0, #0x60
@ -2669,7 +2669,7 @@ _02076BB8:
cmp r0, #1
bne _02076C76
ldr r0, [r4, #0x1c]
bl sub_020085DC
bl Pokepic_IsAnimFinished
cmp r0, #0
bne _02076C76
ldr r0, [r4, #0x28]

View File

@ -91,7 +91,7 @@ sub_0208DEDC: ; 0x0208DEDC
mov r0, #0x2a
lsl r0, r0, #4
ldr r0, [r4, r0]
bl sub_02008120
bl PokepicManager_DrawAll
ldr r0, _0208DEF8 ; =0x04000540
mov r1, #1
str r1, [r0]
@ -657,7 +657,7 @@ _0208E3E4:
ldrh r2, [r4, r2]
ldr r0, [r4, r0]
mov r3, #1
bl sub_02072914
bl NARC_ReadPokepicAnimScript
mov r1, #0xb5
lsl r1, r1, #2
mov r2, #0
@ -727,7 +727,7 @@ _0208E47C:
add r2, #0x50
ldr r0, [r4, r2]
mov r1, #1
bl sub_02008550
bl Pokepic_StartAnim
mov r3, #0xb5
lsl r3, r3, #2
mov r0, #2

View File

@ -193,7 +193,7 @@ BOOL SpeciesIsMythical(u16 species);
BOOL MonCheckFrontierIneligibility(Pokemon *mon);
BOOL BoxmonBelongsToPlayer(BoxPokemon *boxMon, PlayerProfile * profile, HeapID heapId);
int TrainerClassToBackpicID(int trainerClass, BOOL a1);
void sub_02072914(NARC *narc, struct UnkStruct_02007FD4_sub84 *dest, u16 species, u16 a3);
void NARC_ReadPokepicAnimScript(NARC *narc, PokepicAnimScript *dest, u16 species, u16 a3);
void sub_0207294C(NARC *narc, void *a1, void *a2, u16 a3, int a4, int a5, int a6);
void sub_020729A4(NARC *narc, u8 *ret, u16 a2, u16 a3);
void sub_020729D8(NARC *narc, s8 *ret, u16 a2, u16 a3);

View File

@ -5,41 +5,41 @@
#include "pokemon_types_def.h"
#include "heap.h"
typedef struct UnkStruct_02007FD4_sub84 {
s8 unk_0;
u8 unk_1;
s8 unk_2;
typedef struct PokepicAnimScript {
s8 next;
u8 duration;
s8 xOffset;
s8 unk_3;
} UnkStruct_02007FD4_sub84;
} PokepicAnimScript;
typedef struct UnkStruct_02009264 {
u8 unk_0;
u8 unk_1;
u8 unk_2;
u8 unk_3;
u8 unk_4[10];
struct UnkStruct_02007FD4_sub84 *unk_10;
} UnkStruct_02009264;
typedef struct PokepicAnim {
u8 active;
u8 whichAnimStep;
u8 whichAnim;
u8 stepDelay;
u8 loopTimers[10];
PokepicAnimScript *animScript;
} PokepicAnim;
typedef struct UnkStruct_02007FD4_sub_sub {
typedef struct PokepicDrawParam {
s16 xCenter;
s16 yCenter;
int zCenter;
s16 xOffset;
s16 yOffset;
int zOffset;
s16 unk_10;
s16 unk_12;
s16 affineWidth;
s16 affineHeight;
u16 rotX;
u16 rotY;
u16 rotZ;
u16 unk_1A;
s16 xPivot;
s16 yPivot;
u8 unk_20;
u8 unk_21;
u8 unk_22;
u8 unk_23;
u8 xOffset2;
u8 yOffset2;
u8 width;
u8 height;
u8 fadeCur;
u8 fadeEnd;
u8 fadeDelayCounter;
@ -51,7 +51,7 @@ typedef struct UnkStruct_02007FD4_sub_sub {
u32 ambientR:5;
u32 ambientG:5;
u32 ambientB:5;
u32 unk_2C_30:2;
u32 filler_2C_30:2;
u32 hasVanished:1;
u32 visible:1;
u32 alpha:5;
@ -62,47 +62,47 @@ typedef struct UnkStruct_02007FD4_sub_sub {
u32 dontDraw:1;
u32 fadeActive:1;
u32 mosaic:4;
u32 unk_30_11:15;
} UnkStruct_02007FD4_sub_sub;
u32 filler_30_11:15;
} PokepicDrawParam;
typedef struct UnkStruct_02007FD4_sub6C {
typedef struct PokepicShadow {
u16 palSlot:2;
u16 unk_0_2:1;
u16 unk_0_3:1;
u16 unk_0_4:1;
u16 unk_0_5:2;
u16 unk_0_7:9;
s8 unk_2;
u8 unk_3;
u16 shouldAdjustX:1;
u16 shouldAdjustY:1;
u16 isAffine:1;
u16 size:2;
u16 filler_0_7:9;
s8 height;
u8 filler_3[1];
s16 x;
s16 y;
s16 unk_8;
s16 unk_A;
} UnkStruct_02007FD4_sub6C;
s16 xOffset;
s16 yOffset;
} PokepicShadow;
struct Pokepic;
typedef void (*PokepicCallback)(struct Pokepic *, UnkStruct_02007FD4_sub_sub *);
typedef void (*PokepicCallback)(struct Pokepic *, PokepicDrawParam *);
typedef struct Pokepic {
u32 active:1;
u32 polygonId:6;
u32 needReloadChar:1;
u32 needReloadPltt:1;
u32 unk_00_09:23;
u32 filler_00_09:23;
PokepicTemplate template;
PokepicTemplate templateBak;
UnkStruct_02007FD4_sub_sub drawParam;
u8 unk_58;
u8 unk_59;
u8 unk_5A;
u8 unk_5B;
u8 unk_5C[10];
PokepicDrawParam drawParam;
u8 animActive;
u8 whichAnim;
u8 animStepDelay;
u8 whichAnimStep;
u8 animLoopTimers[10];
u8 filler_66[2];
PokepicCallback callback;
UnkStruct_02007FD4_sub6C shadow;
UnkStruct_02007FD4_sub6C shadowBak;
UnkStruct_02007FD4_sub84 unk_84[10];
PokepicShadow shadow;
PokepicShadow shadowBak;
PokepicAnimScript animScript[10];
} Pokepic; // size: 0xAC
typedef struct PokepicManager {
@ -119,33 +119,33 @@ typedef struct PokepicManager {
u16 *plttRawDataUnfaded;
NNSG2dCharacterData charData;
NNSG2dPaletteData plttData;
u8 unk_330;
u8 unread_330;
u8 needLoadImage;
u8 needLoadPltt;
u8 unk_333;
u32 unk_334;
u8 needG3Identity;
u32 flags;
} PokepicManager; // size: 0x338
PokepicManager *PokepicManager_Create(HeapID heapId);
void sub_02008120(PokepicManager *r5);
void PokepicManager_Delete(PokepicManager *r5);
void sub_02008550(Pokepic *pokepic);
void sub_020085C8(Pokepic *pokepic, UnkStruct_02007FD4_sub84 *a1);
BOOL sub_020085DC(Pokepic *pokepic);
Pokepic *PokepicManager_CreatePokepic(PokepicManager *pokepicManager, PokepicTemplate *template, int x, int y, int z, int polygonId, UnkStruct_02007FD4_sub84 *a6, PokepicCallback callback);
Pokepic *PokepicManager_CreatePokepicAt(PokepicManager *pokepicManager, PokepicTemplate *template, int x, int y, int z, int polygonId, int picIndex, UnkStruct_02007FD4_sub84 *a7, PokepicCallback callback);
void PokepicManager_DrawAll(PokepicManager *pokepicManager);
void PokepicManager_Delete(PokepicManager *pokepicManager);
void Pokepic_StartAnim(Pokepic *pokepic);
void Pokepic_SetAnimScript(Pokepic *pokepic, PokepicAnimScript *animScript);
BOOL Pokepic_IsAnimFinished(Pokepic *pokepic);
Pokepic *PokepicManager_CreatePokepic(PokepicManager *pokepicManager, PokepicTemplate *template, int x, int y, int z, int polygonId, PokepicAnimScript *animScript, PokepicCallback callback);
Pokepic *PokepicManager_CreatePokepicAt(PokepicManager *pokepicManager, PokepicTemplate *template, int x, int y, int z, int polygonId, int picIndex, PokepicAnimScript *animScript, PokepicCallback callback);
void Pokepic_Delete(Pokepic *pokepic);
void PokepicManager_DeleteAllPics(PokepicManager *pokepicManager);
void Pokepic_SetAttr(Pokepic *pokepic, int attr, int value);
int Pokepic_GetAttr(Pokepic *pokepic, int attr);
void Pokepic_AddAttr(Pokepic *pokepic, int attr, int addend);
void sub_0200908C(Pokepic *pokepic, int a1, int a2, int a3, int a4);
void Pokepic_SetVisible(Pokepic *pokepic, int x, int y, int width, int height);
void Pokepic_StartPaletteFade(Pokepic *pokepic, int start, int end, int framesPer, int targetColor);
void Pokepic_StartPaletteFadeAll(PokepicManager *pokepicManager, int start, int end, int framesPer, int targetColor);
BOOL sub_02009138(Pokepic *pokepic);
void sub_0200914C(Pokepic *pokepic, int a1);
void sub_02009264(UnkStruct_02009264 *a0, struct UnkStruct_02007FD4_sub84 *a1);
int sub_02009284(UnkStruct_02009264 *a0);
void sub_0200914C(Pokepic *pokepic, int y);
void PokepicAnim_Init(PokepicAnim *anim, PokepicAnimScript *animScript);
int PokepicAnim_Exec(PokepicAnim *anim);
void Pokepic_ScheduleReloadFromNarc(Pokepic *pokepic);
void Pokepic_Push(Pokepic *pokepic);
void Pokepic_Pop(Pokepic *pokepic);
@ -157,7 +157,7 @@ void sub_020094B0(PokepicManager *pokepicManager, int a1);
BOOL Pokepic_IsActive(Pokepic *pokepic);
void sub_020094D8(PokepicManager *pokepicManager, u32 a1);
void sub_020094E4(PokepicManager *pokepicManager, u32 a1);
void sub_020094FC(PokepicManager *pokepicManager);
void PokepicManager_BufferCharData(PokepicManager *pokepicManager);
void RawChardata_PlaceSpindaSpots(u8 *pRawData, u32 pid, BOOL isAnimated);
void UnscanPokepic(u8 *pRawData, NarcId narcId);

View File

@ -8,7 +8,7 @@ struct UnkStruct_02072914_sub {
u8 unk_0;
u8 unk_1;
u8 unk_2;
UnkStruct_02007FD4_sub84 unk_3[10];
PokepicAnimScript unk_3[10];
};
struct UnkStruct_02072914 {

View File

@ -4189,11 +4189,11 @@ void RestoreBoxMonPP(BoxPokemon *boxMon) {
ReleaseBoxMonLock(boxMon, decry);
}
void sub_02072914(NARC *narc, struct UnkStruct_02007FD4_sub84 *dest, u16 species, u16 a3) {
void NARC_ReadPokepicAnimScript(NARC *narc, PokepicAnimScript *dest, u16 species, u16 a3) {
struct UnkStruct_02072914 sp4;
int r5 = (a3 & 1 ? 0 : 1);
NARC_ReadFromMember(narc, 0, species * sizeof(struct UnkStruct_02072914), sizeof(struct UnkStruct_02072914), &sp4);
MI_CpuCopy8(&sp4.unk0[r5].unk_3[0], dest, sizeof(struct UnkStruct_02007FD4_sub84) * 10);
MI_CpuCopy8(&sp4.unk0[r5].unk_3[0], dest, sizeof(PokepicAnimScript) * 10);
}
void sub_0207294C(NARC *narc, void *a1, void *a2, u16 a3, int a4, int a5, int a6) {
@ -4207,10 +4207,10 @@ void sub_0207294C(NARC *narc, void *a1, void *a2, u16 a3, int a4, int a5, int a6
sub_02016F40(a1, a2, &sp4, a6);
}
void sub_020729A4(NARC *narc, u8 *ret, u16 a2, u16 a3) {
void sub_020729A4(NARC *narc, u8 *ret, u16 species, u16 isFrontpic) {
struct UnkStruct_02072914 sp4;
int r5 = (a3 & 1 ? 0 : 1);
NARC_ReadFromMember(narc, 0, a2 * sizeof(struct UnkStruct_02072914), sizeof(struct UnkStruct_02072914), &sp4);
int r5 = (isFrontpic & 1 ? 0 : 1);
NARC_ReadFromMember(narc, 0, species * sizeof(struct UnkStruct_02072914), sizeof(struct UnkStruct_02072914), &sp4);
*ret = sp4.unk0[r5].unk_0;
}

View File

@ -155,8 +155,8 @@ typedef struct RegisterHofMon {
u8 yOffset;
u32 metLocation;
int partyIndex;
struct UnkStruct_02007FD4_sub84 unk_001C[10];
struct UnkStruct_02007FD4_sub84 unk_0044[10];
PokepicAnimScript frontspriteAnim[10];
PokepicAnimScript backspriteAnim[10];
u16 frontspriteCharbuf[2][1600];
u16 backspriteCharbuf[2][1600];
u16 plttBak[16];
@ -255,14 +255,13 @@ typedef struct RegHOFSpritePosScaleAnimParam {
f32 scaleStart;
f32 scaleEnd;
} RegHOFSpritePosScaleAnimParam;
typedef struct RegisterHofTaskData_IndivMonAnimAndCry {
RegisterHofMon *hofMon;
UnkStruct_02009264 unk_04;
PokepicAnim anim;
NARC *narc;
u16 (*charbuf)[1600];
u32 imageLocation;
u16 unk_24;
u16 isFrontpic;
BOOL startCry;
} RegisterHofTaskData_IndivMonAnimAndCry;
@ -2374,8 +2373,8 @@ static void RegisterHallOfFame_GetPartyDetails(RegisterHallOfFameData *data) {
GetPokemonSpriteCharAndPlttNarcIds(&sp40, pokemon, MON_PIC_FACING_BACK);
sub_02014510((NarcId)sp40.narcID, sp40.charDataID, HEAP_ID_REGISTER_HALL_OF_FAME, &sp20[0], hofMon->backspriteCharbuf[0], hofMon->personality, TRUE, 0, hofMon->species);
sub_02014510((NarcId)sp40.narcID, sp40.charDataID, HEAP_ID_REGISTER_HALL_OF_FAME, &sp20[1], hofMon->backspriteCharbuf[1], hofMon->personality, TRUE, 0, hofMon->species);
sub_02072914(narc, hofMon->unk_001C, hofMon->species, 1);
sub_02072914(narc, hofMon->unk_0044, hofMon->species, 0);
NARC_ReadPokepicAnimScript(narc, hofMon->frontspriteAnim, hofMon->species, 1);
NARC_ReadPokepicAnimScript(narc, hofMon->backspriteAnim, hofMon->species, 0);
++data->numMons;
}
ReleaseMonLock(pokemon, encry);
@ -2449,12 +2448,12 @@ static void RegisterHallOfFame_CreateTask_IndivMonAnimAndCry(RegisterHallOfFameD
taskData->imageLocation = NNS_G2dGetImageLocation(Sprite_GetImageProxy(data->monPics[picIdx]->sprite), NNS_G2D_VRAM_TYPE_2DMAIN);
if (facing == MON_PIC_FACING_FRONT) {
taskData->charbuf = taskData->hofMon->frontspriteCharbuf;
taskData->unk_24 = 1;
sub_02009264(&taskData->unk_04, taskData->hofMon->unk_001C);
taskData->isFrontpic = 1;
PokepicAnim_Init(&taskData->anim, taskData->hofMon->frontspriteAnim);
} else {
taskData->charbuf = taskData->hofMon->backspriteCharbuf;
taskData->unk_24 = 0;
sub_02009264(&taskData->unk_04, taskData->hofMon->unk_0044);
taskData->isFrontpic = 0;
PokepicAnim_Init(&taskData->anim, taskData->hofMon->backspriteAnim);
}
SysTask_CreateOnMainQueue(Task_RegisterHallOfFame_IndivMonAnimAndCry, taskData, 0);
}
@ -2463,7 +2462,7 @@ static void Task_RegisterHallOfFame_IndivMonAnimAndCry(SysTask *task, void *task
u8 sp4;
RegisterHofTaskData_IndivMonAnimAndCry *showPic = (RegisterHofTaskData_IndivMonAnimAndCry *)taskData;
if (showPic->startCry == TRUE) {
sub_020729A4(showPic->narc, &sp4, showPic->hofMon->species, showPic->unk_24);
sub_020729A4(showPic->narc, &sp4, showPic->hofMon->species, showPic->isFrontpic);
if (showPic->hofMon->species == SPECIES_CHATOT) {
sub_02006EA0(NULL, 0, 100, 0, sp4);
} else {
@ -2471,9 +2470,9 @@ static void Task_RegisterHallOfFame_IndivMonAnimAndCry(SysTask *task, void *task
}
showPic->startCry = FALSE;
}
int r0 = sub_02009284(&showPic->unk_04);
if (r0 >= 0) {
RegisterHallOfFame_ReplaceSpriteChar(showPic->charbuf[r0], showPic->imageLocation, 3200);
int animStep = PokepicAnim_Exec(&showPic->anim);
if (animStep >= 0) {
RegisterHallOfFame_ReplaceSpriteChar(showPic->charbuf[animStep], showPic->imageLocation, 3200);
} else {
FreeToHeap(showPic);
SysTask_Destroy(task);

View File

@ -5,10 +5,10 @@
#include "poketool/pokegra/otherpoke.naix"
#include "constants/species.h"
static void sub_02009160(Pokepic *pokepic);
static void sub_020094FC(PokepicManager *pokepicManager);
static void sub_0200925C(Pokepic *pokepic);
static void sub_0200994C(PokepicManager *pokepicManager);
static void Pokepic_RunAnimInternal(Pokepic *pokepic);
static void Pokepic_RunAnim(Pokepic *pokepic);
static void PokepicManager_BufferCharData(PokepicManager *pokepicManager);
static void PokepicManager_BufferPlttData(PokepicManager *pokepicManager);
static u8 swapNybbles(u8 val);
static void Pokepic_MaybeAddSpindaSpots(Pokepic *pokepic, u8 *charData);
static u16 lcrngUpdate(u32 *p);
@ -267,7 +267,7 @@ static const u8 (*sSpindaSpotsCoordsPtrs[4])[2] = {
sSpindaSpot4Coords,
};
static const int _020F5B04[4][2][4] = {
static const int sPokepicUVParams[4][2][4] = {
{
{0x00, 0x00, 0x50, 0x50},
{0x50, 0x00, 0xA0, 0x50},
@ -286,7 +286,7 @@ static const int _020F5B04[4][2][4] = {
},
};
static const int _020F5988[4][4] = {
static const int sPokepicShadowUVParams[4][4] = {
{0xA0, 0xA0, 0xE0, 0xB0},
{0xA0, 0xA0, 0xE0, 0xB0},
{0xA0, 0xB0, 0xE0, 0xC0},
@ -297,7 +297,7 @@ PokepicManager *PokepicManager_Create(HeapID heapId) {
PokepicManager *ret = AllocFromHeap(heapId, sizeof(PokepicManager));
MI_CpuClearFast(ret, sizeof(PokepicManager));
ret->heapId = heapId;
ret->unk_330 = 0;
ret->unread_330 = 0;
ret->charBaseAddr = 0;
ret->charSize = 0x8000;
ret->plttBaseAddr = 0;
@ -311,7 +311,7 @@ PokepicManager *PokepicManager_Create(HeapID heapId) {
MI_CpuClearFast(&ret->pics[i], sizeof(Pokepic));
}
NNS_G2dSetupSoftwareSpriteCamera();
ret->unk_333 = FALSE;
ret->needG3Identity = FALSE;
NNSG2dCharacterData *charData;
u8 *pRawCharData;
@ -336,7 +336,7 @@ PokepicManager *PokepicManager_Create(HeapID heapId) {
return ret;
}
void sub_02008120(PokepicManager *pokepicManager) {
void PokepicManager_DrawAll(PokepicManager *pokepicManager) {
int i;
int width;
int height;
@ -345,8 +345,8 @@ void sub_02008120(PokepicManager *pokepicManager) {
int u1;
int v1;
sub_020094FC(pokepicManager);
sub_0200994C(pokepicManager);
PokepicManager_BufferCharData(pokepicManager);
PokepicManager_BufferPlttData(pokepicManager);
NNS_G3dGeFlushBuffer();
G3_PushMtx();
G3_TexImageParam(pokepicManager->imageProxy.attr.fmt, GX_TEXGEN_TEXCOORD, pokepicManager->imageProxy.attr.sizeS, pokepicManager->imageProxy.attr.sizeT, GX_TEXREPEAT_NONE, GX_TEXFLIP_NONE, pokepicManager->imageProxy.attr.plttUse, pokepicManager->charBaseAddr);
@ -356,10 +356,10 @@ void sub_02008120(PokepicManager *pokepicManager) {
pokepicManager->pics[i].callback(&pokepicManager->pics[i], &pokepicManager->pics[i].drawParam);
}
NNS_G3dGeFlushBuffer();
if (pokepicManager->unk_333 != TRUE) {
if (pokepicManager->needG3Identity != TRUE) {
G3_Identity();
}
sub_0200925C(&pokepicManager->pics[i]);
Pokepic_RunAnim(&pokepicManager->pics[i]);
G3_TexPlttBase(pokepicManager->plttBaseAddr + 0x20 * i, pokepicManager->imageProxy.attr.fmt);
G3_Translate((pokepicManager->pics[i].drawParam.xCenter + pokepicManager->pics[i].drawParam.xPivot) << FX32_SHIFT, (pokepicManager->pics[i].drawParam.yCenter + pokepicManager->pics[i].drawParam.yPivot) << FX32_SHIFT, (pokepicManager->pics[i].drawParam.zCenter) << FX32_SHIFT);
G3_RotX(FX_SinIdx(pokepicManager->pics[i].drawParam.rotX), FX_CosIdx(pokepicManager->pics[i].drawParam.rotX));
@ -370,31 +370,31 @@ void sub_02008120(PokepicManager *pokepicManager) {
G3_MaterialColorSpecEmi(GX_RGB(16, 16, 16), RGB_BLACK, FALSE);
G3_PolygonAttr(GX_LIGHTMASK_NONE, GX_POLYGONMODE_MODULATE, GX_CULL_NONE, pokepicManager->pics[i].polygonId, pokepicManager->pics[i].drawParam.alpha, 0);
if (pokepicManager->pics[i].drawParam.visible) {
u0 = _020F5B04[i][pokepicManager->pics[i].unk_5B][0] + pokepicManager->pics[i].drawParam.unk_20;
u1 = _020F5B04[i][pokepicManager->pics[i].unk_5B][0] + pokepicManager->pics[i].drawParam.unk_20 + pokepicManager->pics[i].drawParam.unk_22;
v0 = _020F5B04[i][pokepicManager->pics[i].unk_5B][1] + pokepicManager->pics[i].drawParam.unk_21;
v1 = _020F5B04[i][pokepicManager->pics[i].unk_5B][1] + pokepicManager->pics[i].drawParam.unk_21 + pokepicManager->pics[i].drawParam.unk_23;
u0 = sPokepicUVParams[i][pokepicManager->pics[i].whichAnimStep][0] + pokepicManager->pics[i].drawParam.xOffset2;
u1 = sPokepicUVParams[i][pokepicManager->pics[i].whichAnimStep][0] + pokepicManager->pics[i].drawParam.xOffset2 + pokepicManager->pics[i].drawParam.width;
v0 = sPokepicUVParams[i][pokepicManager->pics[i].whichAnimStep][1] + pokepicManager->pics[i].drawParam.yOffset2;
v1 = sPokepicUVParams[i][pokepicManager->pics[i].whichAnimStep][1] + pokepicManager->pics[i].drawParam.yOffset2 + pokepicManager->pics[i].drawParam.height;
NNS_G2dDrawSpriteFast(
pokepicManager->pics[i].drawParam.xCenter - 40 + pokepicManager->pics[i].drawParam.unk_20 + pokepicManager->pics[i].drawParam.xOffset,
pokepicManager->pics[i].drawParam.yCenter - 40 + pokepicManager->pics[i].drawParam.unk_21 + pokepicManager->pics[i].drawParam.yOffset - pokepicManager->pics[i].shadow.unk_2,
pokepicManager->pics[i].drawParam.xCenter - 40 + pokepicManager->pics[i].drawParam.xOffset2 + pokepicManager->pics[i].drawParam.xOffset,
pokepicManager->pics[i].drawParam.yCenter - 40 + pokepicManager->pics[i].drawParam.yOffset2 + pokepicManager->pics[i].drawParam.yOffset - pokepicManager->pics[i].shadow.height,
pokepicManager->pics[i].drawParam.zCenter + pokepicManager->pics[i].drawParam.zOffset,
pokepicManager->pics[i].drawParam.unk_22,
pokepicManager->pics[i].drawParam.unk_23,
pokepicManager->pics[i].drawParam.width,
pokepicManager->pics[i].drawParam.height,
u0,
v0,
u1,
v1
);
} else {
width = (80 * pokepicManager->pics[i].drawParam.unk_10) >> 8;
height = (80 * pokepicManager->pics[i].drawParam.unk_12) >> 8;
u0 = _020F5B04[i][pokepicManager->pics[i].unk_5B][0];
u1 = _020F5B04[i][pokepicManager->pics[i].unk_5B][2];
v0 = _020F5B04[i][pokepicManager->pics[i].unk_5B][1];
v1 = _020F5B04[i][pokepicManager->pics[i].unk_5B][3];
width = (80 * pokepicManager->pics[i].drawParam.affineWidth) >> 8;
height = (80 * pokepicManager->pics[i].drawParam.affineHeight) >> 8;
u0 = sPokepicUVParams[i][pokepicManager->pics[i].whichAnimStep][0];
u1 = sPokepicUVParams[i][pokepicManager->pics[i].whichAnimStep][2];
v0 = sPokepicUVParams[i][pokepicManager->pics[i].whichAnimStep][1];
v1 = sPokepicUVParams[i][pokepicManager->pics[i].whichAnimStep][3];
NNS_G2dDrawSpriteFast(
pokepicManager->pics[i].drawParam.xCenter - width / 2 + pokepicManager->pics[i].drawParam.xOffset,
pokepicManager->pics[i].drawParam.yCenter - height / 2 + pokepicManager->pics[i].drawParam.yOffset - pokepicManager->pics[i].shadow.unk_2,
pokepicManager->pics[i].drawParam.yCenter - height / 2 + pokepicManager->pics[i].drawParam.yOffset - pokepicManager->pics[i].shadow.height,
pokepicManager->pics[i].drawParam.zCenter + pokepicManager->pics[i].drawParam.zOffset,
width,
height,
@ -404,28 +404,28 @@ void sub_02008120(PokepicManager *pokepicManager) {
v1
);
}
if (pokepicManager->pics[i].shadow.palSlot != 0 && pokepicManager->pics[i].shadow.unk_0_5 != 0 && !pokepicManager->pics[i].drawParam.visible && !(pokepicManager->unk_334 & 1)) {
if (pokepicManager->unk_333 != TRUE) {
if (pokepicManager->pics[i].shadow.palSlot != 0 && pokepicManager->pics[i].shadow.size != 0 && !pokepicManager->pics[i].drawParam.visible && !(pokepicManager->flags & 1)) {
if (pokepicManager->needG3Identity != TRUE) {
G3_Identity();
}
G3_TexPlttBase(pokepicManager->plttBaseAddr + 0x20 * (3 + pokepicManager->pics[i].shadow.palSlot), pokepicManager->imageProxy.attr.fmt);
if (pokepicManager->pics[i].shadow.unk_0_4) {
width = (64 * pokepicManager->pics[i].drawParam.unk_10) >> 8;
height = (16 * pokepicManager->pics[i].drawParam.unk_12) >> 8;
if (pokepicManager->pics[i].shadow.isAffine) {
width = (64 * pokepicManager->pics[i].drawParam.affineWidth) >> 8;
height = (16 * pokepicManager->pics[i].drawParam.affineHeight) >> 8;
} else {
width = 64;
height = 16;
}
if (pokepicManager->pics[i].shadow.unk_0_2) {
pokepicManager->pics[i].shadow.x = pokepicManager->pics[i].drawParam.xCenter + pokepicManager->pics[i].drawParam.xOffset + pokepicManager->pics[i].shadow.unk_8;
if (pokepicManager->pics[i].shadow.shouldAdjustX) {
pokepicManager->pics[i].shadow.x = pokepicManager->pics[i].drawParam.xCenter + pokepicManager->pics[i].drawParam.xOffset + pokepicManager->pics[i].shadow.xOffset;
}
if (pokepicManager->pics[i].shadow.unk_0_3) {
pokepicManager->pics[i].shadow.y = pokepicManager->pics[i].drawParam.yCenter + pokepicManager->pics[i].drawParam.yOffset + pokepicManager->pics[i].shadow.unk_A;
if (pokepicManager->pics[i].shadow.shouldAdjustY) {
pokepicManager->pics[i].shadow.y = pokepicManager->pics[i].drawParam.yCenter + pokepicManager->pics[i].drawParam.yOffset + pokepicManager->pics[i].shadow.yOffset;
}
u0 = _020F5988[pokepicManager->pics[i].shadow.unk_0_5][0];
v0 = _020F5988[pokepicManager->pics[i].shadow.unk_0_5][1];
u1 = _020F5988[pokepicManager->pics[i].shadow.unk_0_5][2];
v1 = _020F5988[pokepicManager->pics[i].shadow.unk_0_5][3];
u0 = sPokepicShadowUVParams[pokepicManager->pics[i].shadow.size][0];
v0 = sPokepicShadowUVParams[pokepicManager->pics[i].shadow.size][1];
u1 = sPokepicShadowUVParams[pokepicManager->pics[i].shadow.size][2];
v1 = sPokepicShadowUVParams[pokepicManager->pics[i].shadow.size][3];
NNS_G2dDrawSpriteFast(
pokepicManager->pics[i].shadow.x - width / 2,
pokepicManager->pics[i].shadow.y - height / 2,
@ -450,30 +450,30 @@ void PokepicManager_Delete(PokepicManager *pokepicManager) {
FreeToHeap(pokepicManager);
}
void sub_02008550(Pokepic *pokepic) {
pokepic->unk_59 = 0;
void Pokepic_StartAnim(Pokepic *pokepic) {
pokepic->whichAnim = 0;
for (int i = 0; i < 10; ++i) {
pokepic->unk_5C[i] = 0;
pokepic->animLoopTimers[i] = 0;
}
if (pokepic->unk_84[pokepic->unk_59].unk_0 == -1) {
pokepic->unk_5B = 0;
if (pokepic->animScript[pokepic->whichAnim].next == -1) {
pokepic->whichAnimStep = 0;
} else {
pokepic->unk_58 = 1;
pokepic->unk_5B = pokepic->unk_84[pokepic->unk_59].unk_0;
pokepic->unk_5A = pokepic->unk_84[pokepic->unk_59].unk_1;
pokepic->drawParam.xOffset = pokepic->unk_84[pokepic->unk_59].unk_2;
pokepic->animActive = 1;
pokepic->whichAnimStep = pokepic->animScript[pokepic->whichAnim].next;
pokepic->animStepDelay = pokepic->animScript[pokepic->whichAnim].duration;
pokepic->drawParam.xOffset = pokepic->animScript[pokepic->whichAnim].xOffset;
}
}
void sub_020085C8(Pokepic *pokepic, UnkStruct_02007FD4_sub84 *a1) {
MI_CpuCopy8(a1, pokepic->unk_84, sizeof(struct UnkStruct_02007FD4_sub84) * 10);
void Pokepic_SetAnimScript(Pokepic *pokepic, PokepicAnimScript *animScript) {
MI_CpuCopy8(animScript, pokepic->animScript, sizeof(PokepicAnimScript) * 10);
}
BOOL sub_020085DC(Pokepic *pokepic) {
return pokepic->unk_58 != 0;
BOOL Pokepic_IsAnimFinished(Pokepic *pokepic) {
return !!pokepic->animActive;
}
Pokepic *PokepicManager_CreatePokepic(PokepicManager *pokepicManager, PokepicTemplate *template, int x, int y, int z, int polygonId, UnkStruct_02007FD4_sub84 *a6, PokepicCallback callback) {
Pokepic *PokepicManager_CreatePokepic(PokepicManager *pokepicManager, PokepicTemplate *template, int x, int y, int z, int polygonId, PokepicAnimScript *animScript, PokepicCallback callback) {
int i;
for (i = 0; i < 4; ++i) {
if (!pokepicManager->pics[i].active) {
@ -481,10 +481,10 @@ Pokepic *PokepicManager_CreatePokepic(PokepicManager *pokepicManager, PokepicTem
}
}
GF_ASSERT(i != 4);
return PokepicManager_CreatePokepicAt(pokepicManager, template, x, y, z, polygonId, i, a6, callback);
return PokepicManager_CreatePokepicAt(pokepicManager, template, x, y, z, polygonId, i, animScript, callback);
}
Pokepic *PokepicManager_CreatePokepicAt(PokepicManager *pokepicManager, PokepicTemplate *template, int x, int y, int z, int polygonId, int picIndex, UnkStruct_02007FD4_sub84 *a7, PokepicCallback callback) {
Pokepic *PokepicManager_CreatePokepicAt(PokepicManager *pokepicManager, PokepicTemplate *template, int x, int y, int z, int polygonId, int picIndex, PokepicAnimScript *animScript, PokepicCallback callback) {
GF_ASSERT(!pokepicManager->pics[picIndex].active);
MI_CpuClearFast(&pokepicManager->pics[picIndex], sizeof(Pokepic));
pokepicManager->pics[picIndex].active = TRUE;
@ -496,8 +496,8 @@ Pokepic *PokepicManager_CreatePokepicAt(PokepicManager *pokepicManager, PokepicT
pokepicManager->pics[picIndex].drawParam.xCenter = x;
pokepicManager->pics[picIndex].drawParam.yCenter = y;
pokepicManager->pics[picIndex].drawParam.zCenter = z;
pokepicManager->pics[picIndex].drawParam.unk_10 = 0x100;
pokepicManager->pics[picIndex].drawParam.unk_12 = 0x100;
pokepicManager->pics[picIndex].drawParam.affineWidth = 0x100;
pokepicManager->pics[picIndex].drawParam.affineHeight = 0x100;
pokepicManager->pics[picIndex].drawParam.alpha = 31;
pokepicManager->pics[picIndex].drawParam.diffuseR = 31;
pokepicManager->pics[picIndex].drawParam.diffuseG = 31;
@ -508,11 +508,11 @@ Pokepic *PokepicManager_CreatePokepicAt(PokepicManager *pokepicManager, PokepicT
pokepicManager->pics[picIndex].callback = callback;
pokepicManager->pics[picIndex].shadow.x = x;
pokepicManager->pics[picIndex].shadow.y = y;
pokepicManager->pics[picIndex].shadow.unk_0_2 = TRUE;
pokepicManager->pics[picIndex].shadow.unk_0_3 = TRUE;
pokepicManager->pics[picIndex].shadow.unk_0_4 = TRUE;
if (a7 != NULL) {
MI_CpuCopy8(a7, pokepicManager->pics[picIndex].unk_84, 10 * sizeof(UnkStruct_02007FD4_sub84));
pokepicManager->pics[picIndex].shadow.shouldAdjustX = TRUE;
pokepicManager->pics[picIndex].shadow.shouldAdjustY = TRUE;
pokepicManager->pics[picIndex].shadow.isAffine = TRUE;
if (animScript != NULL) {
MI_CpuCopy8(animScript, pokepicManager->pics[picIndex].animScript, 10 * sizeof(PokepicAnimScript));
}
return &pokepicManager->pics[picIndex];
}
@ -566,25 +566,25 @@ void Pokepic_SetAttr(Pokepic *pokepic, int attr, int value) {
pokepic->drawParam.yPivot = value;
break;
case 12:
pokepic->drawParam.unk_10 = value;
pokepic->drawParam.affineWidth = value;
break;
case 13:
pokepic->drawParam.unk_12 = value;
pokepic->drawParam.affineHeight = value;
break;
case 14:
pokepic->drawParam.visible = value;
break;
case 15:
pokepic->drawParam.unk_20 = value;
pokepic->drawParam.xOffset2 = value;
break;
case 16:
pokepic->drawParam.unk_21 = value;
pokepic->drawParam.yOffset2 = value;
break;
case 17:
pokepic->drawParam.unk_22 = value;
pokepic->drawParam.width = value;
break;
case 18:
pokepic->drawParam.unk_23 = value;
pokepic->drawParam.height = value;
break;
case 19:
pokepic->shadow.x = value;
@ -593,10 +593,10 @@ void Pokepic_SetAttr(Pokepic *pokepic, int attr, int value) {
pokepic->shadow.y = value;
break;
case 21:
pokepic->shadow.unk_8 = value;
pokepic->shadow.xOffset = value;
break;
case 22:
pokepic->shadow.unk_A = value;
pokepic->shadow.yOffset = value;
break;
case 23:
pokepic->drawParam.alpha = value;
@ -650,30 +650,30 @@ void Pokepic_SetAttr(Pokepic *pokepic, int attr, int value) {
pokepic->drawParam.dontDraw = value;
break;
case 38:
pokepic->unk_5B = value;
pokepic->whichAnimStep = value;
break;
case 40:
pokepic->drawParam.mosaic = value;
pokepic->needReloadChar = TRUE;
break;
case 41:
pokepic->shadow.unk_2 = value;
pokepic->shadow.height = value;
break;
case 42:
pokepic->shadow.palSlot = value;
pokepic->needReloadPltt = TRUE;
break;
case 43:
pokepic->shadow.unk_0_2 = value;
pokepic->shadow.shouldAdjustX = value;
break;
case 44:
pokepic->shadow.unk_0_3 = value;
pokepic->shadow.shouldAdjustY = value;
break;
case 45:
pokepic->shadow.unk_0_4 = value;
pokepic->shadow.isAffine = value;
break;
case 46:
pokepic->shadow.unk_0_5 = value;
pokepic->shadow.size = value;
break;
}
}
@ -705,27 +705,27 @@ int Pokepic_GetAttr(Pokepic *pokepic, int attr) {
case 11:
return pokepic->drawParam.yPivot;
case 12:
return pokepic->drawParam.unk_10;
return pokepic->drawParam.affineWidth;
case 13:
return pokepic->drawParam.unk_12;
return pokepic->drawParam.affineHeight;
case 14:
return pokepic->drawParam.visible;
case 15:
return pokepic->drawParam.unk_20;
return pokepic->drawParam.xOffset2;
case 16:
return pokepic->drawParam.unk_21;
return pokepic->drawParam.yOffset2;
case 17:
return pokepic->drawParam.unk_22;
return pokepic->drawParam.width;
case 18:
return pokepic->drawParam.unk_23;
return pokepic->drawParam.height;
case 19:
return pokepic->shadow.x;
case 20:
return pokepic->shadow.y;
case 21:
return pokepic->shadow.unk_8;
return pokepic->shadow.xOffset;
case 22:
return pokepic->shadow.unk_A;
return pokepic->shadow.yOffset;
case 23:
return pokepic->drawParam.alpha;
case 24:
@ -757,21 +757,21 @@ int Pokepic_GetAttr(Pokepic *pokepic, int attr) {
case 37:
return pokepic->drawParam.dontDraw;
case 38:
return pokepic->unk_5B;
return pokepic->whichAnimStep;
case 40:
return pokepic->drawParam.mosaic;
case 41:
return pokepic->shadow.unk_2;
return pokepic->shadow.height;
case 42:
return pokepic->shadow.palSlot;
case 43:
return pokepic->shadow.unk_0_2;
return pokepic->shadow.shouldAdjustX;
case 44:
return pokepic->shadow.unk_0_3;
return pokepic->shadow.shouldAdjustY;
case 45:
return pokepic->shadow.unk_0_4;
return pokepic->shadow.isAffine;
case 46:
return pokepic->shadow.unk_0_5;
return pokepic->shadow.size;
}
GF_ASSERT(FALSE);
@ -817,25 +817,25 @@ void Pokepic_AddAttr(Pokepic *pokepic, int attr, int addend) {
pokepic->drawParam.yPivot += addend;
break;
case 12:
pokepic->drawParam.unk_10 += addend;
pokepic->drawParam.affineWidth += addend;
break;
case 13:
pokepic->drawParam.unk_12 += addend;
pokepic->drawParam.affineHeight += addend;
break;
case 14:
pokepic->drawParam.visible += addend;
break;
case 15:
pokepic->drawParam.unk_20 += addend;
pokepic->drawParam.xOffset2 += addend;
break;
case 16:
pokepic->drawParam.unk_21 += addend;
pokepic->drawParam.yOffset2 += addend;
break;
case 17:
pokepic->drawParam.unk_22 += addend;
pokepic->drawParam.width += addend;
break;
case 18:
pokepic->drawParam.unk_23 += addend;
pokepic->drawParam.height += addend;
break;
case 19:
pokepic->shadow.x += addend;
@ -844,10 +844,10 @@ void Pokepic_AddAttr(Pokepic *pokepic, int attr, int addend) {
pokepic->shadow.y += addend;
break;
case 21:
pokepic->shadow.unk_8 += addend;
pokepic->shadow.xOffset += addend;
break;
case 22:
pokepic->shadow.unk_A += addend;
pokepic->shadow.yOffset += addend;
break;
case 23:
pokepic->drawParam.alpha += addend;
@ -901,40 +901,40 @@ void Pokepic_AddAttr(Pokepic *pokepic, int attr, int addend) {
pokepic->drawParam.dontDraw += addend;
break;
case 38:
pokepic->unk_5B += addend;
pokepic->whichAnimStep += addend;
break;
case 40:
pokepic->drawParam.mosaic += addend;
pokepic->needReloadChar = TRUE;
break;
case 41:
pokepic->shadow.unk_2 += addend;
pokepic->shadow.height += addend;
break;
case 42:
pokepic->shadow.palSlot += addend;
pokepic->needReloadPltt = TRUE;
break;
case 43:
pokepic->shadow.unk_0_2 += addend;
pokepic->shadow.shouldAdjustX += addend;
break;
case 44:
pokepic->shadow.unk_0_3 += addend;
pokepic->shadow.shouldAdjustY += addend;
break;
case 45:
pokepic->shadow.unk_0_4 += addend;
pokepic->shadow.isAffine += addend;
break;
case 46:
pokepic->shadow.unk_0_5 += addend;
pokepic->shadow.size += addend;
break;
}
}
void sub_0200908C(Pokepic *pokepic, int a1, int a2, int a3, int a4) {
void Pokepic_SetVisible(Pokepic *pokepic, int x, int y, int width, int height) {
pokepic->drawParam.visible = TRUE;
pokepic->drawParam.unk_20 = a1;
pokepic->drawParam.unk_21 = a2;
pokepic->drawParam.unk_22 = a3;
pokepic->drawParam.unk_23 = a4;
pokepic->drawParam.xOffset2 = x;
pokepic->drawParam.yOffset2 = y;
pokepic->drawParam.width = width;
pokepic->drawParam.height = height;
}
void Pokepic_StartPaletteFade(Pokepic *pokepic, int start, int end, int framesPer, int targetColor) {
@ -963,83 +963,83 @@ BOOL sub_02009138(Pokepic *pokepic) {
return pokepic->drawParam.fadeActive == TRUE;
}
void sub_0200914C(Pokepic *pokepic, int a1) {
pokepic->drawParam.yOffset = (40 - a1) - (((40 - a1) * pokepic->drawParam.unk_12) >> 8);
void sub_0200914C(Pokepic *pokepic, int y) {
pokepic->drawParam.yOffset = (40 - y) - (((40 - y) * pokepic->drawParam.affineHeight) >> 8);
}
static inline void sub_02009160_ex(u8 *a0, u8 *a1, u8 *a2, u8 *a3, u8 *a4, const UnkStruct_02007FD4_sub84 *a5) {
if (*a0 != 0) {
if (*a3 == 0) {
++(*a2);
while (a5[*a2].unk_0 < -1) {
++a4[*a2];
if (a5[*a2].unk_1 == a4[*a2] || a5[*a2].unk_1 == 0) {
a4[*a2] = 0;
++a2; // ++(*a2);
static inline void runPokepicAnim(u8 *pActive, u8 *pWhichAnimStep, u8 *pWhichAnim, u8 *pStepDelay, u8 *pLoopTimers, const PokepicAnimScript *animScript) {
if (*pActive != 0) {
if (*pStepDelay == 0) {
++(*pWhichAnim);
while (animScript[*pWhichAnim].next < -1) {
++pLoopTimers[*pWhichAnim];
if (animScript[*pWhichAnim].duration == pLoopTimers[*pWhichAnim] || animScript[*pWhichAnim].duration == 0) {
pLoopTimers[*pWhichAnim] = 0;
++pWhichAnim; // ++(*a2);
} else {
*a2 = -2 - a5[*a2].unk_0;
*pWhichAnim = -2 - animScript[*pWhichAnim].next;
}
}
if (a5[*a2].unk_0 == -1 || *a2 >= 10) {
*a1 = 0;
*a0 = 0;
if (animScript[*pWhichAnim].next == -1 || *pWhichAnim >= 10) {
*pWhichAnimStep = 0;
*pActive = 0;
} else {
*a1 = a5[*a2].unk_0;
*a3 = a5[*a2].unk_1;
*pWhichAnimStep = animScript[*pWhichAnim].next;
*pStepDelay = animScript[*pWhichAnim].duration;
}
} else {
--(*a3);
--(*pStepDelay);
}
}
}
static void sub_02009160(Pokepic *pokepic) {
if (pokepic->unk_58 != 0) {
if (pokepic->unk_5A == 0) {
++pokepic->unk_59;
while (pokepic->unk_84[pokepic->unk_59].unk_0 < -1) {
++pokepic->unk_5C[pokepic->unk_59];
if (pokepic->unk_84[pokepic->unk_59].unk_1 == pokepic->unk_5C[pokepic->unk_59] || pokepic->unk_84[pokepic->unk_59].unk_1 == 0) {
pokepic->unk_5C[pokepic->unk_59] = 0;
++pokepic->unk_59;
static void Pokepic_RunAnimInternal(Pokepic *pokepic) {
if (pokepic->animActive != 0) {
if (pokepic->animStepDelay == 0) {
++pokepic->whichAnim;
while (pokepic->animScript[pokepic->whichAnim].next < -1) {
++pokepic->animLoopTimers[pokepic->whichAnim];
if (pokepic->animScript[pokepic->whichAnim].duration == pokepic->animLoopTimers[pokepic->whichAnim] || pokepic->animScript[pokepic->whichAnim].duration == 0) {
pokepic->animLoopTimers[pokepic->whichAnim] = 0;
++pokepic->whichAnim;
} else {
pokepic->unk_59 = -2 - pokepic->unk_84[pokepic->unk_59].unk_0;
pokepic->whichAnim = -2 - pokepic->animScript[pokepic->whichAnim].next;
}
}
if (pokepic->unk_59 >= 10 || pokepic->unk_84[pokepic->unk_59].unk_0 == -1) {
pokepic->unk_5B = 0;
pokepic->unk_58 = 0;
if (pokepic->whichAnim >= 10 || pokepic->animScript[pokepic->whichAnim].next == -1) {
pokepic->whichAnimStep = 0;
pokepic->animActive = 0;
pokepic->drawParam.xOffset = 0;
} else {
pokepic->unk_5B = pokepic->unk_84[pokepic->unk_59].unk_0;
pokepic->unk_5A = pokepic->unk_84[pokepic->unk_59].unk_1;
pokepic->drawParam.xOffset = pokepic->unk_84[pokepic->unk_59].unk_2;
pokepic->whichAnimStep = pokepic->animScript[pokepic->whichAnim].next;
pokepic->animStepDelay = pokepic->animScript[pokepic->whichAnim].duration;
pokepic->drawParam.xOffset = pokepic->animScript[pokepic->whichAnim].xOffset;
}
} else {
--pokepic->unk_5A;
--pokepic->animStepDelay;
}
}
}
static void sub_0200925C(Pokepic *pokepic) {
sub_02009160(pokepic);
static void Pokepic_RunAnim(Pokepic *pokepic) {
Pokepic_RunAnimInternal(pokepic);
}
void sub_02009264(UnkStruct_02009264 *a0, struct UnkStruct_02007FD4_sub84 *a1) {
a0->unk_0 = 1;
a0->unk_2 = 0;
a0->unk_1 = a1->unk_0;
a0->unk_3 = a1->unk_1;
a0->unk_10 = a1;
void PokepicAnim_Init(PokepicAnim *anim, PokepicAnimScript *animScript) {
anim->active = 1;
anim->whichAnim = 0;
anim->whichAnimStep = animScript->next;
anim->stepDelay = animScript->duration;
anim->animScript = animScript;
for (int i = 0; i < 10; ++i) {
a0->unk_4[i] = 0;
anim->loopTimers[i] = 0;
}
}
int sub_02009284(UnkStruct_02009264 *a0) {
if (a0->unk_0) {
sub_02009160_ex(&a0->unk_0, &a0->unk_1, &a0->unk_2, &a0->unk_3, a0->unk_4, a0->unk_10);
return a0->unk_1;
int PokepicAnim_Exec(PokepicAnim *anim) {
if (anim->active) {
runPokepicAnim(&anim->active, &anim->whichAnimStep, &anim->whichAnim, &anim->stepDelay, anim->loopTimers, anim->animScript);
return anim->whichAnimStep;
}
return -1;
@ -1096,7 +1096,7 @@ void PokepicManager_HandleLoadImgAndOrPltt(PokepicManager *pokepicManager) {
}
void sub_020094B0(PokepicManager *pokepicManager, int a1) {
pokepicManager->unk_333 = a1;
pokepicManager->needG3Identity = a1;
}
BOOL Pokepic_IsActive(Pokepic *pokepic) {
@ -1105,14 +1105,14 @@ BOOL Pokepic_IsActive(Pokepic *pokepic) {
}
void sub_020094D8(PokepicManager *pokepicManager, u32 a1) {
pokepicManager->unk_334 |= a1;
pokepicManager->flags |= a1;
}
void sub_020094E4(PokepicManager *pokepicManager, u32 a1) {
pokepicManager->unk_334 &= (a1 ^ -1u);
pokepicManager->flags &= (a1 ^ -1u);
}
static void sub_020094FC(PokepicManager *pokepicManager) {
static void PokepicManager_BufferCharData(PokepicManager *pokepicManager) {
NNSG2dCharacterData *pCharData;
int i;
int k;
@ -1211,7 +1211,7 @@ static void sub_020094FC(PokepicManager *pokepicManager) {
pokepicManager->needLoadImage = needCharUpdate;
}
static void sub_0200994C(PokepicManager *pokepicManager) {
static void PokepicManager_BufferPlttData(PokepicManager *pokepicManager) {
NNSG2dPaletteData *plttData;
int i;
int j;