1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
|
.extern currentHeap
.extern MakeScene
.extern DVDClass
.extern GetSceneLightInfo
.extern GetRes
.extern GetAnmScn
.extern BindAnmScn
.extern AssignAnmScnToLightInfo
.extern LoadBlight
.extern LoadBlmap
.extern OSReport
.text
.set sp,1
.set rtoc,2
.global LoadMapScene
LoadMapScene:
stwu sp, -0x30(sp)
mflr r0
stw r0, 0x34(sp)
stw r31, 0x2C(sp)
stw r30, 0x28(sp)
stw r29, 0x24(sp)
lis r30, m_str@h
ori r30, r30, m_str@l
mr r3, r30
li r4, 1
crclr 4*cr1+eq
bl OSReport
lis r3, currentHeap@h
ori r3, r3, currentHeap@l
lwz r3, 0(r3)
li r4, 36 #Light count
li r5, 8 #Ambient light count
li r6, 2 #Dunno
li r7, 0 #Make fog (bool)
li r8, 0 #Scene ID
bl MakeScene
mr r3, r30
li r4, 2
crclr 4*cr1+eq
bl OSReport
# Now make the actual scene!
# Get light info
li r3, 0
bl GetSceneLightInfo
mr r31, r3
mr r3, r30
li r4, 3
crclr 4*cr1+eq
bl OSReport
# Get scene/scene.brres
lis r3, DVDClass@h
ori r3, r3, DVDClass@l
lwz r3, 0(r3)
addi r3, r3, 4
lis r4, EnvWorld@h
ori r4, r4, EnvWorld@l
lis r5, SceneBrres@h
ori r5, r5, SceneBrres@l
bl GetRes
# Got that, now get the AnmScn we want (MainSelect)
stw r3, 0x0C(sp) #ResFile
mr r3, r30
li r4, 4
crclr 4*cr1+eq
bl OSReport
addi r3, sp, 0xC
lis r4, MainSelect@h
ori r4, r4, MainSelect@l
bl GetAnmScn
stw r3, 0x10(sp)
mr r3, r30
li r4, 5
crclr 4*cr1+eq
bl OSReport
# Bind it
addi r3, sp, 0x10
addi r4, sp, 0x10
bl BindAnmScn
mr r3, r30
li r4, 6
crclr 4*cr1+eq
bl OSReport
# Add it to lightinfo
mr r3, r31 #This
addi r4, sp, 0x10 #AnmScn pointer
li r5, -1 #Dunno
li r6, 3 #Dunno
lis r9, Zero@h
ori r9, r9, Zero@l
lfs f1, 0(r9) #Dunno
bl AssignAnmScnToLightInfo
mr r3, r30
li r4, 7
crclr 4*cr1+eq
bl OSReport
# Now set up the rest of the scene
# Get blight
lis r3, DVDClass@h
ori r3, r3, DVDClass@l
lwz r3, 0(r3)
addi r3, r3, 4
lis r4, EnvWorld@h
ori r4, r4, EnvWorld@l
lis r5, BlightW1@h
ori r5, r5, BlightW1@l
bl GetRes
mr r29, r3
mr r3, r30
li r4, 8
crclr 4*cr1+eq
bl OSReport
# Load it into lightinfo
mr r3, r31
mr r4, r29
bl LoadBlight
mr r3, r30
li r4, 9
crclr 4*cr1+eq
bl OSReport
# Do the same for blmap
lis r3, DVDClass@h
ori r3, r3, DVDClass@l
lwz r3, 0(r3)
addi r3, r3, 4
lis r4, EnvWorld@h
ori r4, r4, EnvWorld@l
lis r5, BlmapW1@h
ori r5, r5, BlmapW1@l
bl GetRes
mr r29, r3
mr r3, r30
li r4, 10
crclr 4*cr1+eq
bl OSReport
# Load it into its class
lwz r3, 0x14(r31)
mr r4, r29
bl LoadBlmap
mr r3, r30
li r4, 11
crclr 4*cr1+eq
bl OSReport
# DONE!!
lwz r29, 0x24(sp)
lwz r30, 0x28(sp)
lwz r31, 0x2C(sp)
lwz r0, 0x34(sp)
mtlr r0
addi sp, sp, 0x30
blr
.data
EnvWorld: .string "Env_world"
SceneBrres: .string "scene/scene.brres"
MainSelect: .string "MainSelect"
Zero: .float 0.0
BlightW1: .string "light/W8.blight"
BlmapW1: .string "light/W8.blmap"
m_str: .string "LMS:%d\n"
.align 4
|