Skip to content

Commit 7f5b82f

Browse files
authored
Merge pull request #144 from Kelebek1/fragment12
fragment12
2 parents 3fd0c93 + d4d22d8 commit 7f5b82f

File tree

3 files changed

+251
-14
lines changed

3 files changed

+251
-14
lines changed

src/fragments/12/fragment12.c

+231-11
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,241 @@
1-
#include "global.h"
1+
#include "fragment12.h"
2+
#include "src/12D80.h"
3+
#include "src/17300.h"
4+
#include "src/18140.h"
5+
#include "src/18480.h"
6+
#include "src/19840.h"
7+
#include "src/1C720.h"
8+
#include "src/1CF30.h"
9+
#include "src/20330.h"
10+
#include "src/20470.h"
11+
#include "src/3FB0.h"
12+
#include "src/6A40.h"
13+
#include "src/6BC0.h"
14+
#include "src/F420.h"
15+
#include "src/controller.h"
16+
#include "src/memory.h"
17+
#include "src/stage_loader.h"
218

3-
#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/12/fragment12/func_86600020.s")
19+
static u32 D_86600850[] = {
20+
0x0C00FFFF, 0x05000000, 0x0B00001E, 0x00000000, 0x014000F0, 0x0000000F, 0x00000000, 0x00000000,
21+
0x05000000, 0x0D000000, 0x05000000, 0x0F000002, 0x05000000, 0x1F00FFFF, 0x00000000, 0x00000000,
22+
0x00000000, 0x00640064, 0x00640000, 0x05000000, 0x00000000, 0x8D000020, 0x06000000, 0x06000000,
23+
0x14000000, 0x002B0012, 0xFFFFFF32, 0x16FFFFFF, 0x0F000003, 0x05000000, 0x0A000000, 0x800AC840,
24+
0x06000000, 0x06000000, 0x06000000, 0x06000000, 0x01000000,
25+
};
426

5-
#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/12/fragment12/func_86600050.s")
27+
static unk_D_86002F30* D_86600940;
28+
static unk_D_86002F34_000* D_86600944;
29+
static unk_D_86002F34_00C* D_86600948;
30+
static unk_D_86002F58_004_000 D_86600950;
31+
static s16 D_86600AB8;
32+
static s16 D_86600ABA;
33+
static s16 D_86600ABC;
634

7-
#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/12/fragment12/func_866000FC.s")
35+
void func_86600020(void) {
36+
Cont_StartReadInputs();
37+
Cont_ReadInputs();
38+
func_8001F730();
39+
}
840

9-
#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/12/fragment12/func_86600264.s")
41+
void func_86600050(void) {
42+
D_86600948 = D_86600944->unk_0C;
1043

11-
#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/12/fragment12/func_86600438.s")
44+
D_86600AB8 = 0x100;
45+
D_86600ABA = 0;
46+
D_86600ABC = 0x78;
1247

13-
#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/12/fragment12/func_8660048C.s")
48+
D_86600948->unk_24.near = 10.0f;
49+
D_86600948->unk_24.far = 6400.0f;
1450

15-
#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/12/fragment12/func_866004F8.s")
51+
func_80010354(&D_86600948->unk_60.at, &D_86600948->unk_60.eye, D_86600ABC, D_86600AB8, D_86600ABA);
52+
}
1653

17-
#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/12/fragment12/func_866005B8.s")
54+
void func_866000FC(void) {
55+
if (gPlayer1Controller->buttonDown & 0x800) {
56+
D_86600AB8 += 256;
57+
}
1858

19-
#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/12/fragment12/func_86600658.s")
59+
if (gPlayer1Controller->buttonDown & 0x400) {
60+
D_86600AB8 -= 256;
61+
}
2062

21-
#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/12/fragment12/func_8660070C.s")
63+
if (gPlayer1Controller->buttonDown & 0x200) {
64+
D_86600ABA += 256;
65+
}
66+
67+
if (gPlayer1Controller->buttonDown & 0x100) {
68+
D_86600ABA -= 256;
69+
}
70+
71+
if (gPlayer1Controller->buttonDown & 8) {
72+
D_86600ABC -= 10;
73+
}
74+
75+
if (gPlayer1Controller->buttonDown & 4) {
76+
D_86600ABC += 10;
77+
}
78+
79+
if (D_86600AB8 > 16128) {
80+
D_86600AB8 = 16128;
81+
}
82+
83+
if (D_86600AB8 < 0) {
84+
D_86600AB8 = 0;
85+
}
86+
87+
if (D_86600ABC < 50) {
88+
D_86600ABC = 50;
89+
}
90+
91+
if (D_86600ABC > 2000) {
92+
D_86600ABC = 2000;
93+
}
94+
95+
func_80010354(&D_86600948->unk_60.at, &D_86600948->unk_60.eye, D_86600ABC, D_86600AB8, D_86600ABA);
96+
}
97+
98+
void func_86600264(s32 arg0) {
99+
Color_RGB8 sp2C = { 0, 0, 30 };
100+
Color_RGB8 sp28 = { 0, 0, 250 };
101+
102+
func_8002053C(0xC8, 0xBE, 0x5A, 0x20, &sp2C, &sp28);
103+
func_80020460(0x1E, 0xBE, 0xA0, 0x20, 0x141);
104+
func_8001F3F4();
105+
func_8001F470();
106+
func_8001EBE0(4, -2);
107+
func_8001F324(0xFF, 0xFF, 0xFF, 0xFF);
108+
func_8001F36C(0x50, 0x50, 0xFF, 0xFF);
109+
func_8001F1E8(0x30, 0x14, "MINIGAME7 SAMPLE");
110+
func_8001F4C4();
111+
func_8001EBE0(2, -2);
112+
func_8001F324(0xFF, 0xC8, 0x32, 0xFF);
113+
114+
switch (arg0) {
115+
case 0:
116+
func_8001F1E8(0xCD, 0xC2, "OPENNING");
117+
break;
118+
119+
case 2:
120+
func_8001F1E8(0xCD, 0xC2, "PLAYING");
121+
break;
122+
123+
case 3:
124+
func_8001F1E8(0xCD, 0xC2, "ENDING");
125+
break;
126+
}
127+
128+
if (arg0 == 2) {
129+
func_8001F324(0xFF, 0xFF, 0xFF, 0xFF);
130+
func_8001F1E8(0x23, 0xC2, "CAMERA D:%d", D_86600ABC);
131+
func_8001F1E8(0x23, 0xCE, "X:%04hX Y:%04hX", D_86600AB8, D_86600ABA);
132+
}
133+
134+
func_8001F444();
135+
}
136+
137+
void func_86600438(s32 arg0) {
138+
func_800079C4();
139+
func_8000699C(&gDisplayListHead, 0xA6BF);
140+
func_80015348();
141+
func_80015094(D_86600944);
142+
func_86600264(arg0);
143+
func_80007778();
144+
}
145+
146+
void func_8660048C(void) {
147+
func_80006C6C(0x10);
148+
func_8001BD04(&D_86600950, 8);
149+
if (func_80017514(&D_86600950) == 0) {
150+
do {
151+
func_86600020();
152+
func_86600438(0);
153+
} while (func_80017514(&D_86600950) == 0);
154+
}
155+
}
156+
157+
void func_866004F8(void) {
158+
s32 var_s1 = 1;
159+
s32 var_s0 = 0;
160+
161+
func_8001BD04(&D_86600950, 0);
162+
163+
while (var_s1 != 0) {
164+
func_86600020();
165+
func_866000FC();
166+
167+
var_s0++;
168+
169+
if (gPlayer1Controller->buttonPressed & 0x1000) {
170+
var_s1 = 0;
171+
}
172+
173+
if (var_s0 == 60) {
174+
var_s0 = 0;
175+
func_80017788(&D_86600950);
176+
func_8001BD9C(&D_86600950, 0xA);
177+
}
178+
179+
func_86600438(2);
180+
}
181+
}
182+
183+
void func_866005B8(void) {
184+
s32 i;
185+
186+
func_8001BD04(&D_86600950, 0xB);
187+
func_8001BD9C(&D_86600950, 0xB);
188+
189+
while (func_80017514(&D_86600950) == 0) {
190+
func_86600020();
191+
func_86600438(3);
192+
}
193+
194+
func_80006CB4(30);
195+
196+
for (i = 0; i < 30; i++) {
197+
func_86600020();
198+
func_86600438(3);
199+
}
200+
}
201+
202+
void func_86600658(void) {
203+
MemoryBlock* sp1C = func_80002D10(main_pool_get_available(), 0);
204+
205+
D_86600944 = func_80018B70(sp1C, &D_86600850);
206+
func_80002D60(sp1C);
207+
func_8001BB20();
208+
func_8001BB58(&D_86600950);
209+
func_8001987C();
210+
D_86600940 = func_80019D18(0x19);
211+
func_8001BC34(&D_86600950, 0, 0x19, D_86600940->unk_08->unk_00[0]);
212+
func_8001BD04(&D_86600950, 0);
213+
func_86600050();
214+
}
215+
216+
s32 func_8660070C(UNUSED s32 arg0, UNUSED s32 arg1) {
217+
unk_func_80007444* sp24;
218+
219+
main_pool_push_state('MINI');
220+
221+
func_80005E40(0x10000, 0);
222+
sp24 = func_80007444(0, 1, 3, 1, 2, 1);
223+
func_8001E94C(6, 0);
224+
225+
ASSET_LOAD(D_1000000, common_menu1_ui, 0);
226+
227+
FRAGMENT_LOAD(fragment31);
228+
func_80004454((((u32)D_8D000000 & 0x0FF00000) >> 0x14) - 0x10, _5C7A70_ROM_START, pokedex_area_model_ROM_START);
229+
230+
func_86600658();
231+
func_80007678(sp24);
232+
func_8660048C();
233+
func_866004F8();
234+
func_866005B8();
235+
func_800076C0();
236+
func_8001E9CC();
237+
func_80005EAC();
238+
239+
main_pool_pop_state('MINI');
240+
return 0;
241+
}

src/fragments/12/fragment12.h

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#ifndef _FRAGMENT12_H_
2+
#define _FRAGMENT12_H_
3+
4+
#include "global.h"
5+
6+
void func_86600020(void);
7+
void func_86600050(void);
8+
void func_866000FC(void);
9+
void func_86600264(s32 arg0);
10+
void func_86600438(s32 arg0);
11+
void func_8660048C(void);
12+
void func_866004F8(void);
13+
void func_866005B8(void);
14+
void func_86600658(void);
15+
s32 func_8660070C(UNUSED s32 arg0, UNUSED s32 arg1);
16+
17+
#endif // _FRAGMENT12_H_

yamls/us/rom.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -853,10 +853,10 @@
853853
subsegments:
854854
- [0x142B10, textbin, fragments/12/fragment12_header]
855855
- [0x142B30, c, fragments/12/fragment12]
856-
- [0x143360, data, fragments/12/fragment12_data]
857-
- [0x143400, rodata, fragments/12/fragment12_rodata]
856+
- [0x143360, .data, fragments/12/fragment12]
857+
- [0x143400, .rodata, fragments/12/fragment12]
858858

859-
- {vram: 0x86600940, type: bss, name: fragments/12/fragment12_bss}
859+
- {vram: 0x86600940, type: .bss, name: fragments/12/fragment12}
860860

861861
- name: fragment12_relocs
862862
type: code

0 commit comments

Comments
 (0)