matched 3 npc functions (#814)

* 3 npc functions

* fixed warnings

* added padding

* code improvements
This commit is contained in:
Unnunu 2022-10-11 00:57:21 +03:00 committed by GitHub
parent cc6f4d9a66
commit f918be9c7e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 402 additions and 960 deletions

View File

@ -258,10 +258,10 @@ typedef struct Npc {
/* 0x0C2 */ char unk_C2[2];
/* 0x0C4 */ PAL_PTR* spritePaletteList;
/* 0x0C8 */ PAL_BIN localPaletteData[16][16];
/* 0x2C8 */ PAL_PTR* localPalettes[16];
/* 0x2C8 */ PAL_PTR localPalettes[16];
/* 0x308 */ s16 unk_308;
/* 0x30A */ s16 unk_30A;
/* 0x30C */ s16 unk_30C;
/* 0x30C */ u16 unk_30C;
/* 0x30E */ s16 unk_30E;
/* 0x310 */ s16 unk_310;
/* 0x312 */ s16 unk_312;

417
src/npc.c
View File

@ -3,11 +3,24 @@
#include "effects.h"
#include "sprite.h"
s8 D_80077BF0[] = {
0x01, 0x02, 0x00, 0x34, 0x01, 0x04, 0x00, 0x36, 0x00, 0x36, 0x01, 0x02, 0x00, 0x1C, 0x01, 0x02, 0x00, 0x06, 0x01, 0x02, 0x00, 0x2C, 0x01, 0x02, 0x00, 0x2C, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00
u8 D_80077BF0[] = {
1, 2,
0, 52,
1, 4,
0, 54,
0, 54,
1, 2,
0, 28,
1, 2,
0, 6,
1, 2,
0, 44,
1, 2,
0, 44,
255, 0,
};
s32 D_80077C0C = 0; // padding?
f32 D_80077C10 = 0.0f;
s16 D_80077C14 = 4;
s16 D_80077C16 = 0; // padding?
@ -15,10 +28,10 @@ f32 D_80077C18 = 0;
s16 D_80077C1C = 4;
s16 D_80077C1E = 5;
s32 D_80077C20 = 0;
s32 D_80077C24 = 0;
f32 D_80077C24 = 0.0f;
s16 D_80077C28 = 4;
s16 D_80077C2A = 0; // padding?
s32 D_80077C2C = 0;
f32 D_80077C2C = 0.0f;
s16 D_80077C30 = 4;
s16 D_80077C32 = 0; // padding?
s32 D_80077C34 = 0;
@ -1144,15 +1157,114 @@ void npc_draw_palswap_mode_0(Npc* npc, s32 arg1, Matrix4f mtx) {
}
if (!(npc->flags & NPC_FLAG_NO_ANIMS_LOADED)) {
s32 temp_a2 = (npc->alpha * npc->alpha2 / 255);
s32 temp = temp_a2 < 255; // TODO: better match?
spr_draw_npc_sprite(npc->spriteInstanceID | (temp) << 31, arg1, temp_a2, NULL, mtx);
s32 alpha = (npc->alpha * npc->alpha2 / 255);
u32 mask;
if (alpha < 255) {
mask = DRAW_SPRITE_OVERRIDE_ALPHA;
} else {
mask = 0;
}
spr_draw_npc_sprite(npc->spriteInstanceID | mask, arg1, alpha, NULL, mtx);
} else {
spr_draw_player_sprite(0x40000001, arg1, 0, 0, mtx);
}
}
INCLUDE_ASM(s32, "npc", npc_draw_palswap_mode_1);
s32 npc_draw_palswap_mode_1(Npc* npc, s32 arg1, Matrix4f mtx) {
s32 i, j;
s32 temp3;
PAL_PTR src;
PAL_PTR dst;
if (npc->dirtyPalettes != 0) {
npc->spritePaletteList = spr_get_npc_palettes(npc->currentAnim >> 16);
npc->paletteCount = 0;
while ((s32)npc->spritePaletteList[npc->paletteCount] != -1) {
npc->paletteCount++;
}
npc->unk_C0 = spr_get_npc_color_variations(npc->currentAnim >> 16);
for (i = 0; i < npc->paletteCount; i++) {
dst = npc->localPaletteData[i];
src = npc->spritePaletteList[i];
if (src != NULL) {
for (j = 0; j < 16; j++) {
*dst++ = *src++;
}
}
}
npc->palSwapState = -2;
npc->palSwapLerpAlpha = 0;
npc->dirtyPalettes = 0;
npc->palSwapTimer = 0;
}
if (npc->palSwapTimer == 0) {
npc->palSwapState += 2;
temp3 = D_80077BF0[npc->palSwapState];
if (temp3 == 255) {
npc->palSwapState = 0;
}
npc->palSwapTimer = D_80077BF0[npc->palSwapState + 1] / 2;
}
temp3 = D_80077BF0[npc->palSwapState];
npc->palSwapTimer--;
switch(temp3) {
case 0:
for (i = 0; i < npc->unk_C0; i++) {
dst = npc->localPaletteData[i];
src = npc->spritePaletteList[i];
if (src != NULL) {
for (j = 0; j < 16; j++) {
*dst++ = *src++;
}
}
}
break;
case 1:
for (i = 0; i < npc->unk_C0; i++) {
dst = npc->localPaletteData[i];
src = npc->spritePaletteList[npc->unk_C0 * 5 + i];
if (src != NULL) {
for (j = 0; j < 16; j++) {
*dst++ = *src++;
}
}
}
break;
case 2:
for (i = 0; i < npc->unk_C0; i++) {
dst = npc->localPaletteData[i];
src = npc->spritePaletteList[npc->unk_C0 * 6 + i];
if (src != NULL) {
for (j = 0; j < 16; j++) {
*dst++ = *src++;
}
}
}
break;
}
for (i = 0; i < npc->paletteCount; i++) {
npc->localPalettes[i] = npc->localPaletteData[i];
}
if (!(npc->flags & NPC_FLAG_NO_ANIMS_LOADED)) {
s32 alpha = npc->alpha * npc->alpha2 / 255;
u32 mask;
if (alpha < 255) {
mask = DRAW_SPRITE_OVERRIDE_ALPHA;
} else {
mask = 0;
}
mask |= DRAW_SPRITE_OVERRIDE_PALETTES;
spr_draw_npc_sprite(npc->spriteInstanceID | mask, arg1, alpha, npc->localPalettes, mtx);
}
npc->palSwapLerpAlpha--;
}
u16 npc_blend_palette_colors(u16 colorA, u16 colorB, s32 lerpAlpha) {
u32 r = ((((colorA >> 11) & 0x1F) * (255 - lerpAlpha)) + (((colorB >> 11) & 0x1F) * lerpAlpha)) / 255;
@ -1162,9 +1274,275 @@ u16 npc_blend_palette_colors(u16 colorA, u16 colorB, s32 lerpAlpha) {
return (colorB & 1) | (((r & 0xFF) << 11) | ((g & 0xFF) << 6) | ((b & 0xFF) << 1));
}
INCLUDE_ASM(s32, "npc", npc_draw_palswap_mode_2);
s32 npc_draw_palswap_mode_2(Npc* npc, s32 arg1, s32 arg2, Matrix4f mtx) {
s32 i, j;
PAL_PTR src;
PAL_PTR dst;
PAL_PTR src2;
s32 blendAlpha;
INCLUDE_ASM(s32, "npc", npc_draw_palswap_mode_4);
if (npc->dirtyPalettes != 0) {
if (!(npc->flags & NPC_FLAG_NO_ANIMS_LOADED)) {
npc->spritePaletteList = spr_get_npc_palettes(npc->currentAnim >> 16);
}
npc->paletteCount = 0;
while ((s32)npc->spritePaletteList[npc->paletteCount] != -1) {
npc->paletteCount++;
}
if (npc->dirtyPalettes == 1) {
npc->palSwapState = 0;
npc->palSwapLerpAlpha = 0;
} else {
npc->palSwapState = 0;
npc->palSwapLerpAlpha = 255;
}
for (i = 0; i < npc->paletteCount; i++) {
src2 = npc->localPaletteData[i];
src = npc->spritePaletteList[i];
npc->localPalettes[i] = src2;
if (src != NULL) {
for (j = 0; j < 16; j++) {
*src2++ = *src++;
}
}
}
if (arg2 == 0) {
s32 temp2 = npc->unk_30C;
npc->unk_30C = 0;
npc->unk_30E = temp2;
npc->unk_310 = temp2;
npc->unk_312 = npc->unk_30E;
}
npc->palSwapLerpAlpha = 0;
npc->palSwapState = 0;
npc->dirtyPalettes = 0;
npc->palSwapTimer = npc->unk_30C;
}
switch (npc->palSwapState) {
case 0:
if (npc->palSwapTimer != 0) {
npc->palSwapTimer--;
break;
} else {
npc->palSwapLerpAlpha = 0;
npc->palSwapState = 1;
}
/* fallthrough */
case 1:
npc->palSwapLerpAlpha += 25600 / npc->unk_30E;
if (npc->palSwapLerpAlpha > 25500) {
npc->palSwapLerpAlpha = 25500;
}
blendAlpha = npc->palSwapLerpAlpha / 100;
dst = npc->localPaletteData[0];
src = npc->spritePaletteList[npc->unk_308];
src2 = npc->spritePaletteList[npc->unk_30A];
npc->localPalettes[0] = dst;
for (j = 0; j < 16; j++) {
*dst++ = npc_blend_palette_colors(*src++, *src2++, blendAlpha);
}
if (blendAlpha == 255) {
npc->palSwapState = 2;
npc->palSwapTimer = npc->unk_310;
}
break;
}
switch (npc->palSwapState) {
case 2:
if (npc->palSwapTimer != 0) {
npc->palSwapTimer--;
break;
} else {
npc->palSwapLerpAlpha = 0;
npc->palSwapState = 3;
}
/* fallthrough */
case 3:
npc->palSwapLerpAlpha += 25600 / npc->unk_312;
if (npc->palSwapLerpAlpha > 25500) {
npc->palSwapLerpAlpha = 25500;
}
blendAlpha = npc->palSwapLerpAlpha / 100;
dst = npc->localPaletteData[0];
src = npc->spritePaletteList[npc->unk_30A];
src2 = npc->spritePaletteList[npc->unk_308];
npc->localPalettes[0] = dst;
for (j = 0; j < 16; j++) {
*dst++ = npc_blend_palette_colors(*src++, *src2++, blendAlpha);
}
if (blendAlpha == 255) {
npc->palSwapState = 0;
npc->palSwapTimer = npc->unk_30C;
}
break;
}
if (npc->palSwapState < 4) {
if (npc->palSwapState >= 0) {
if (!(npc->flags & NPC_FLAG_NO_ANIMS_LOADED)) {
u32 mask;
blendAlpha = npc->alpha * npc->alpha2 / 255;
if (blendAlpha < 255) {
mask = DRAW_SPRITE_OVERRIDE_ALPHA;
} else {
mask = 0;
}
mask |= DRAW_SPRITE_OVERRIDE_PALETTES;
spr_draw_npc_sprite(npc->spriteInstanceID | mask, arg1, blendAlpha, npc->localPalettes, mtx);
}
}
}
}
s32 npc_draw_palswap_mode_4(Npc* npc, s32 arg1, Matrix4f mtx) {
s32 i, j;
PAL_PTR src;
PAL_PTR src2;
PAL_PTR dst;
u8 blendAlpha;
if (npc->dirtyPalettes != 0) {
if (!(npc->flags & NPC_FLAG_NO_ANIMS_LOADED)) {
npc->spritePaletteList = spr_get_npc_palettes(npc->currentAnim >> 16);
}
npc->paletteCount = 0;
while ((s32)npc->spritePaletteList[npc->paletteCount] != -1) {
npc->paletteCount++;
}
if (npc->dirtyPalettes == 1) {
npc->palSwapState = 0;
npc->palSwapLerpAlpha = 0;
} else {
npc->palSwapState = 0;
npc->palSwapLerpAlpha = 255;
}
for (i = 0; i < npc->paletteCount; i++) {
src2 = npc->localPaletteData[i];
src = npc->spritePaletteList[i];
npc->localPalettes[i] = src2;
if (src != NULL) {
for (j = 0; j < 16; j++) {
*src2++ = *src++;
}
}
}
npc->palSwapLerpAlpha = 0;
npc->palSwapState = 0;
npc->dirtyPalettes = 0;
npc->palSwapTimer = npc->unk_30C;
}
switch (npc->palSwapState) {
case 0:
if (npc->palSwapTimer != 0) {
npc->palSwapTimer--;
break;
} else {
npc->palSwapLerpAlpha = 0;
npc->palSwapState = 1;
}
/* fallthrough */
case 1:
npc->palSwapLerpAlpha += 25600 / npc->unk_30E;
if (npc->palSwapLerpAlpha > 25500) {
npc->palSwapLerpAlpha = 25500;
}
blendAlpha = npc->palSwapLerpAlpha / 100;
dst = npc->localPaletteData[0];
src = npc->spritePaletteList[npc->unk_308];
src2 = npc->spritePaletteList[npc->unk_30A];
npc->localPalettes[0] = dst;
for (j = 0; j < 16; j++) {
*dst++ = npc_blend_palette_colors(*src++, *src2++, blendAlpha);
}
dst = npc->localPaletteData[3];
src = npc->spritePaletteList[npc->unk_314];
src2 = npc->spritePaletteList[npc->unk_316];
npc->localPalettes[3] = dst;
for (j = 0; j < 16; j++) {
*dst++ = npc_blend_palette_colors(*src++, *src2++, blendAlpha);
}
if (blendAlpha == 255) {
npc->palSwapState = 2;
npc->palSwapTimer = npc->unk_310;
}
break;
}
switch (npc->palSwapState) {
case 2:
if (npc->palSwapTimer != 0) {
npc->palSwapTimer--;
break;
} else {
npc->palSwapLerpAlpha = 0;
npc->palSwapState = 3;
}
/* fallthrough */
case 3:
npc->palSwapLerpAlpha += 25600 / npc->unk_312;
if (npc->palSwapLerpAlpha > 25500) {
npc->palSwapLerpAlpha = 25500;
}
blendAlpha = npc->palSwapLerpAlpha / 100;
dst = npc->localPaletteData[0];
src = npc->spritePaletteList[npc->unk_30A];
src2 = npc->spritePaletteList[npc->unk_308];
npc->localPalettes[0] = dst;
for (j = 0; j < 16; j++) {
*dst++ = npc_blend_palette_colors(*src++, *src2++, blendAlpha);
}
dst = npc->localPaletteData[1];
src = npc->spritePaletteList[npc->unk_316];
src2 = npc->spritePaletteList[npc->unk_314];
npc->localPalettes[3] = npc->localPaletteData[3];
for (j = 0; j < 16; j++) {
*dst++ = npc_blend_palette_colors(*src++, *src2++, blendAlpha);
}
if (blendAlpha == 255) {
npc->palSwapState = 0;
npc->palSwapTimer = npc->unk_30C;
}
break;
}
if (npc->palSwapState < 4) {
if (npc->palSwapState >= 0) {
if (!(npc->flags & NPC_FLAG_NO_ANIMS_LOADED)) {
s32 temp;
u32 spriteInstanceMask;
blendAlpha = npc->alpha * npc->alpha2 / 255;
temp = blendAlpha < 255;
spriteInstanceMask = ((temp) << 31) | 0x20000000;
spr_draw_npc_sprite(npc->spriteInstanceID | spriteInstanceMask, arg1, blendAlpha, npc->localPalettes, mtx);
}
}
}
}
void npc_set_decoration(Npc* npc, s32 idx, s32 decorationType) {
npc__remove_decoration(npc, idx);
@ -1726,15 +2104,14 @@ INCLUDE_ASM(void, "npc", func_8003DA38, Npc* npc, s32 arg1);
// floats suqqz
#ifdef NON_EQUIVALENT
void func_8003DC38(Npc* npc, s32 arg1) {
f32 temp_f0;
f32 xTemp;
f32 zTemp;
f32 yTemp;
f32 theta;
f32 sinTheta;
s32 i;
s32 var_v0;
f32 cosTheta;
f32 angle;
s32 i;
D_80077C2C += 0.1f;
if (arg1 == 2) {
@ -1744,10 +2121,13 @@ void func_8003DC38(Npc* npc, s32 arg1) {
for (i = 0; i < 4; i++) {
xTemp = rand_int(10) - 5;
yTemp = -2.0f;
zTemp = rand_int(10) - 5;
yTemp = -2.0f - (SQ(xTemp) + SQ(zTemp) / 5.0f);
yTemp -= (SQ(xTemp) + SQ(zTemp)) / 5.0f;
D_80077C28 = 0;
theta = DEG_TO_RAD(clamp_angle(-npc->yaw + (i * 90)));
theta = DEG_TO_RAD(clamp_angle(-npc->yaw + i * 90));
sinTheta = sin_rad(theta);
cosTheta = cos_rad(theta);
fx_cloud_trail(
@ -1759,9 +2139,12 @@ void func_8003DC38(Npc* npc, s32 arg1) {
}
} else {
xTemp = rand_int(10) - 5;
yTemp = -2.0f;
zTemp = rand_int(10) - 5;
yTemp = -2.0f - (SQ(xTemp) + SQ(zTemp) / 5.0f);
yTemp -= (SQ(xTemp) + SQ(zTemp)) / 5.0f;
D_80077C28 = 0;
theta = DEG_TO_RAD(clamp_angle(-npc->yaw));
sinTheta = sin_rad(theta);
cosTheta = cos_rad(theta);

View File

@ -1,268 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel npc_draw_palswap_mode_1
/* 169B4 8003B5B4 27BDFFD8 */ addiu $sp, $sp, -0x28
/* 169B8 8003B5B8 AFB00018 */ sw $s0, 0x18($sp)
/* 169BC 8003B5BC 0080802D */ daddu $s0, $a0, $zero
/* 169C0 8003B5C0 AFB20020 */ sw $s2, 0x20($sp)
/* 169C4 8003B5C4 00A0902D */ daddu $s2, $a1, $zero
/* 169C8 8003B5C8 AFBF0024 */ sw $ra, 0x24($sp)
/* 169CC 8003B5CC AFB1001C */ sw $s1, 0x1c($sp)
/* 169D0 8003B5D0 820200B6 */ lb $v0, 0xb6($s0)
/* 169D4 8003B5D4 10400034 */ beqz $v0, .L8003B6A8
/* 169D8 8003B5D8 00C0882D */ daddu $s1, $a2, $zero
/* 169DC 8003B5DC 96040028 */ lhu $a0, 0x28($s0)
/* 169E0 8003B5E0 0C0B7A90 */ jal spr_get_npc_palettes
/* 169E4 8003B5E4 00000000 */ nop
/* 169E8 8003B5E8 AE0200C4 */ sw $v0, 0xc4($s0)
/* 169EC 8003B5EC 0040202D */ daddu $a0, $v0, $zero
/* 169F0 8003B5F0 A20000C1 */ sb $zero, 0xc1($s0)
/* 169F4 8003B5F4 8C830000 */ lw $v1, ($a0)
/* 169F8 8003B5F8 2402FFFF */ addiu $v0, $zero, -1
/* 169FC 8003B5FC 1062000B */ beq $v1, $v0, .L8003B62C
/* 16A00 8003B600 0080182D */ daddu $v1, $a0, $zero
/* 16A04 8003B604 0040202D */ daddu $a0, $v0, $zero
.L8003B608:
/* 16A08 8003B608 920200C1 */ lbu $v0, 0xc1($s0)
/* 16A0C 8003B60C 24420001 */ addiu $v0, $v0, 1
/* 16A10 8003B610 A20200C1 */ sb $v0, 0xc1($s0)
/* 16A14 8003B614 00021600 */ sll $v0, $v0, 0x18
/* 16A18 8003B618 00021583 */ sra $v0, $v0, 0x16
/* 16A1C 8003B61C 00431021 */ addu $v0, $v0, $v1
/* 16A20 8003B620 8C420000 */ lw $v0, ($v0)
/* 16A24 8003B624 1444FFF8 */ bne $v0, $a0, .L8003B608
/* 16A28 8003B628 00000000 */ nop
.L8003B62C:
/* 16A2C 8003B62C 0C0B7A9B */ jal spr_get_npc_color_variations
/* 16A30 8003B630 96040028 */ lhu $a0, 0x28($s0)
/* 16A34 8003B634 820300C1 */ lb $v1, 0xc1($s0)
/* 16A38 8003B638 0000302D */ daddu $a2, $zero, $zero
/* 16A3C 8003B63C 18600015 */ blez $v1, .L8003B694
/* 16A40 8003B640 A20200C0 */ sb $v0, 0xc0($s0)
/* 16A44 8003B644 240700C8 */ addiu $a3, $zero, 0xc8
.L8003B648:
/* 16A48 8003B648 8E0300C4 */ lw $v1, 0xc4($s0)
/* 16A4C 8003B64C 00061080 */ sll $v0, $a2, 2
/* 16A50 8003B650 00431021 */ addu $v0, $v0, $v1
/* 16A54 8003B654 8C430000 */ lw $v1, ($v0)
/* 16A58 8003B658 10600009 */ beqz $v1, .L8003B680
/* 16A5C 8003B65C 02072821 */ addu $a1, $s0, $a3
/* 16A60 8003B660 0000202D */ daddu $a0, $zero, $zero
.L8003B664:
/* 16A64 8003B664 94620000 */ lhu $v0, ($v1)
/* 16A68 8003B668 24630002 */ addiu $v1, $v1, 2
/* 16A6C 8003B66C 24840001 */ addiu $a0, $a0, 1
/* 16A70 8003B670 A4A20000 */ sh $v0, ($a1)
/* 16A74 8003B674 28820010 */ slti $v0, $a0, 0x10
/* 16A78 8003B678 1440FFFA */ bnez $v0, .L8003B664
/* 16A7C 8003B67C 24A50002 */ addiu $a1, $a1, 2
.L8003B680:
/* 16A80 8003B680 820200C1 */ lb $v0, 0xc1($s0)
/* 16A84 8003B684 24C60001 */ addiu $a2, $a2, 1
/* 16A88 8003B688 00C2102A */ slt $v0, $a2, $v0
/* 16A8C 8003B68C 1440FFEE */ bnez $v0, .L8003B648
/* 16A90 8003B690 24E70020 */ addiu $a3, $a3, 0x20
.L8003B694:
/* 16A94 8003B694 2402FFFE */ addiu $v0, $zero, -2
/* 16A98 8003B698 A20200B7 */ sb $v0, 0xb7($s0)
/* 16A9C 8003B69C A60000BE */ sh $zero, 0xbe($s0)
/* 16AA0 8003B6A0 A20000B6 */ sb $zero, 0xb6($s0)
/* 16AA4 8003B6A4 A60000BC */ sh $zero, 0xbc($s0)
.L8003B6A8:
/* 16AA8 8003B6A8 860200BC */ lh $v0, 0xbc($s0)
/* 16AAC 8003B6AC 14400013 */ bnez $v0, .L8003B6FC
/* 16AB0 8003B6B0 00000000 */ nop
/* 16AB4 8003B6B4 920200B7 */ lbu $v0, 0xb7($s0)
/* 16AB8 8003B6B8 3C038007 */ lui $v1, %hi(D_80077BF0)
/* 16ABC 8003B6BC 24637BF0 */ addiu $v1, $v1, %lo(D_80077BF0)
/* 16AC0 8003B6C0 24420002 */ addiu $v0, $v0, 2
/* 16AC4 8003B6C4 A20200B7 */ sb $v0, 0xb7($s0)
/* 16AC8 8003B6C8 00021600 */ sll $v0, $v0, 0x18
/* 16ACC 8003B6CC 00021603 */ sra $v0, $v0, 0x18
/* 16AD0 8003B6D0 3C048007 */ lui $a0, %hi(D_80077BF0)
/* 16AD4 8003B6D4 00822021 */ addu $a0, $a0, $v0
/* 16AD8 8003B6D8 90847BF0 */ lbu $a0, %lo(D_80077BF0)($a0)
/* 16ADC 8003B6DC 240200FF */ addiu $v0, $zero, 0xff
/* 16AE0 8003B6E0 50820001 */ beql $a0, $v0, .L8003B6E8
/* 16AE4 8003B6E4 A20000B7 */ sb $zero, 0xb7($s0)
.L8003B6E8:
/* 16AE8 8003B6E8 820200B7 */ lb $v0, 0xb7($s0)
/* 16AEC 8003B6EC 00431021 */ addu $v0, $v0, $v1
/* 16AF0 8003B6F0 90420001 */ lbu $v0, 1($v0)
/* 16AF4 8003B6F4 00021042 */ srl $v0, $v0, 1
/* 16AF8 8003B6F8 A60200BC */ sh $v0, 0xbc($s0)
.L8003B6FC:
/* 16AFC 8003B6FC 960300BC */ lhu $v1, 0xbc($s0)
/* 16B00 8003B700 820200B7 */ lb $v0, 0xb7($s0)
/* 16B04 8003B704 2463FFFF */ addiu $v1, $v1, -1
/* 16B08 8003B708 3C048007 */ lui $a0, %hi(D_80077BF0)
/* 16B0C 8003B70C 00822021 */ addu $a0, $a0, $v0
/* 16B10 8003B710 90847BF0 */ lbu $a0, %lo(D_80077BF0)($a0)
/* 16B14 8003B714 24020001 */ addiu $v0, $zero, 1
/* 16B18 8003B718 10820025 */ beq $a0, $v0, .L8003B7B0
/* 16B1C 8003B71C A60300BC */ sh $v1, 0xbc($s0)
/* 16B20 8003B720 28820002 */ slti $v0, $a0, 2
/* 16B24 8003B724 10400005 */ beqz $v0, .L8003B73C
/* 16B28 8003B728 24020002 */ addiu $v0, $zero, 2
/* 16B2C 8003B72C 10800007 */ beqz $a0, .L8003B74C
/* 16B30 8003B730 00000000 */ nop
/* 16B34 8003B734 0800EE2B */ j .L8003B8AC
/* 16B38 8003B738 00000000 */ nop
.L8003B73C:
/* 16B3C 8003B73C 1082003C */ beq $a0, $v0, .L8003B830
/* 16B40 8003B740 00000000 */ nop
/* 16B44 8003B744 0800EE2B */ j .L8003B8AC
/* 16B48 8003B748 00000000 */ nop
.L8003B74C:
/* 16B4C 8003B74C 820200C0 */ lb $v0, 0xc0($s0)
/* 16B50 8003B750 18400056 */ blez $v0, .L8003B8AC
/* 16B54 8003B754 0000302D */ daddu $a2, $zero, $zero
/* 16B58 8003B758 240700C8 */ addiu $a3, $zero, 0xc8
.L8003B75C:
/* 16B5C 8003B75C 8E0300C4 */ lw $v1, 0xc4($s0)
/* 16B60 8003B760 00061080 */ sll $v0, $a2, 2
/* 16B64 8003B764 00431021 */ addu $v0, $v0, $v1
/* 16B68 8003B768 8C430000 */ lw $v1, ($v0)
/* 16B6C 8003B76C 10600009 */ beqz $v1, .L8003B794
/* 16B70 8003B770 02072821 */ addu $a1, $s0, $a3
/* 16B74 8003B774 0000202D */ daddu $a0, $zero, $zero
.L8003B778:
/* 16B78 8003B778 94620000 */ lhu $v0, ($v1)
/* 16B7C 8003B77C 24630002 */ addiu $v1, $v1, 2
/* 16B80 8003B780 24840001 */ addiu $a0, $a0, 1
/* 16B84 8003B784 A4A20000 */ sh $v0, ($a1)
/* 16B88 8003B788 28820010 */ slti $v0, $a0, 0x10
/* 16B8C 8003B78C 1440FFFA */ bnez $v0, .L8003B778
/* 16B90 8003B790 24A50002 */ addiu $a1, $a1, 2
.L8003B794:
/* 16B94 8003B794 820200C0 */ lb $v0, 0xc0($s0)
/* 16B98 8003B798 24C60001 */ addiu $a2, $a2, 1
/* 16B9C 8003B79C 00C2102A */ slt $v0, $a2, $v0
/* 16BA0 8003B7A0 1440FFEE */ bnez $v0, .L8003B75C
/* 16BA4 8003B7A4 24E70020 */ addiu $a3, $a3, 0x20
/* 16BA8 8003B7A8 0800EE2B */ j .L8003B8AC
/* 16BAC 8003B7AC 00000000 */ nop
.L8003B7B0:
/* 16BB0 8003B7B0 820200C0 */ lb $v0, 0xc0($s0)
/* 16BB4 8003B7B4 920300C0 */ lbu $v1, 0xc0($s0)
/* 16BB8 8003B7B8 1840003C */ blez $v0, .L8003B8AC
/* 16BBC 8003B7BC 0000302D */ daddu $a2, $zero, $zero
/* 16BC0 8003B7C0 240700C8 */ addiu $a3, $zero, 0xc8
.L8003B7C4:
/* 16BC4 8003B7C4 00031600 */ sll $v0, $v1, 0x18
/* 16BC8 8003B7C8 00021603 */ sra $v0, $v0, 0x18
/* 16BCC 8003B7CC 00021880 */ sll $v1, $v0, 2
/* 16BD0 8003B7D0 00621821 */ addu $v1, $v1, $v0
/* 16BD4 8003B7D4 00661821 */ addu $v1, $v1, $a2
/* 16BD8 8003B7D8 8E0200C4 */ lw $v0, 0xc4($s0)
/* 16BDC 8003B7DC 00031880 */ sll $v1, $v1, 2
/* 16BE0 8003B7E0 00621821 */ addu $v1, $v1, $v0
/* 16BE4 8003B7E4 8C630000 */ lw $v1, ($v1)
/* 16BE8 8003B7E8 10600009 */ beqz $v1, .L8003B810
/* 16BEC 8003B7EC 02072821 */ addu $a1, $s0, $a3
/* 16BF0 8003B7F0 0000202D */ daddu $a0, $zero, $zero
.L8003B7F4:
/* 16BF4 8003B7F4 94620000 */ lhu $v0, ($v1)
/* 16BF8 8003B7F8 24630002 */ addiu $v1, $v1, 2
/* 16BFC 8003B7FC 24840001 */ addiu $a0, $a0, 1
/* 16C00 8003B800 A4A20000 */ sh $v0, ($a1)
/* 16C04 8003B804 28820010 */ slti $v0, $a0, 0x10
/* 16C08 8003B808 1440FFFA */ bnez $v0, .L8003B7F4
/* 16C0C 8003B80C 24A50002 */ addiu $a1, $a1, 2
.L8003B810:
/* 16C10 8003B810 24C60001 */ addiu $a2, $a2, 1
/* 16C14 8003B814 820200C0 */ lb $v0, 0xc0($s0)
/* 16C18 8003B818 920300C0 */ lbu $v1, 0xc0($s0)
/* 16C1C 8003B81C 00C2102A */ slt $v0, $a2, $v0
/* 16C20 8003B820 1440FFE8 */ bnez $v0, .L8003B7C4
/* 16C24 8003B824 24E70020 */ addiu $a3, $a3, 0x20
/* 16C28 8003B828 0800EE2B */ j .L8003B8AC
/* 16C2C 8003B82C 00000000 */ nop
.L8003B830:
/* 16C30 8003B830 820200C0 */ lb $v0, 0xc0($s0)
/* 16C34 8003B834 920300C0 */ lbu $v1, 0xc0($s0)
/* 16C38 8003B838 1840001C */ blez $v0, .L8003B8AC
/* 16C3C 8003B83C 0000302D */ daddu $a2, $zero, $zero
/* 16C40 8003B840 240700C8 */ addiu $a3, $zero, 0xc8
.L8003B844:
/* 16C44 8003B844 00031600 */ sll $v0, $v1, 0x18
/* 16C48 8003B848 00021603 */ sra $v0, $v0, 0x18
/* 16C4C 8003B84C 00021840 */ sll $v1, $v0, 1
/* 16C50 8003B850 00621821 */ addu $v1, $v1, $v0
/* 16C54 8003B854 00031840 */ sll $v1, $v1, 1
/* 16C58 8003B858 00661821 */ addu $v1, $v1, $a2
/* 16C5C 8003B85C 8E0200C4 */ lw $v0, 0xc4($s0)
/* 16C60 8003B860 00031880 */ sll $v1, $v1, 2
/* 16C64 8003B864 00621821 */ addu $v1, $v1, $v0
/* 16C68 8003B868 8C630000 */ lw $v1, ($v1)
/* 16C6C 8003B86C 10600009 */ beqz $v1, .L8003B894
/* 16C70 8003B870 02072821 */ addu $a1, $s0, $a3
/* 16C74 8003B874 0000202D */ daddu $a0, $zero, $zero
.L8003B878:
/* 16C78 8003B878 94620000 */ lhu $v0, ($v1)
/* 16C7C 8003B87C 24630002 */ addiu $v1, $v1, 2
/* 16C80 8003B880 24840001 */ addiu $a0, $a0, 1
/* 16C84 8003B884 A4A20000 */ sh $v0, ($a1)
/* 16C88 8003B888 28820010 */ slti $v0, $a0, 0x10
/* 16C8C 8003B88C 1440FFFA */ bnez $v0, .L8003B878
/* 16C90 8003B890 24A50002 */ addiu $a1, $a1, 2
.L8003B894:
/* 16C94 8003B894 24C60001 */ addiu $a2, $a2, 1
/* 16C98 8003B898 820200C0 */ lb $v0, 0xc0($s0)
/* 16C9C 8003B89C 920300C0 */ lbu $v1, 0xc0($s0)
/* 16CA0 8003B8A0 00C2102A */ slt $v0, $a2, $v0
/* 16CA4 8003B8A4 1440FFE7 */ bnez $v0, .L8003B844
/* 16CA8 8003B8A8 24E70020 */ addiu $a3, $a3, 0x20
.L8003B8AC:
/* 16CAC 8003B8AC 820200C1 */ lb $v0, 0xc1($s0)
/* 16CB0 8003B8B0 1840000B */ blez $v0, .L8003B8E0
/* 16CB4 8003B8B4 0000302D */ daddu $a2, $zero, $zero
/* 16CB8 8003B8B8 240400C8 */ addiu $a0, $zero, 0xc8
/* 16CBC 8003B8BC 0200182D */ daddu $v1, $s0, $zero
.L8003B8C0:
/* 16CC0 8003B8C0 02041021 */ addu $v0, $s0, $a0
/* 16CC4 8003B8C4 24840020 */ addiu $a0, $a0, 0x20
/* 16CC8 8003B8C8 AC6202C8 */ sw $v0, 0x2c8($v1)
/* 16CCC 8003B8CC 820200C1 */ lb $v0, 0xc1($s0)
/* 16CD0 8003B8D0 24C60001 */ addiu $a2, $a2, 1
/* 16CD4 8003B8D4 00C2102A */ slt $v0, $a2, $v0
/* 16CD8 8003B8D8 1440FFF9 */ bnez $v0, .L8003B8C0
/* 16CDC 8003B8DC 24630004 */ addiu $v1, $v1, 4
.L8003B8E0:
/* 16CE0 8003B8E0 8E020000 */ lw $v0, ($s0)
/* 16CE4 8003B8E4 3C034000 */ lui $v1, 0x4000
/* 16CE8 8003B8E8 00431024 */ and $v0, $v0, $v1
/* 16CEC 8003B8EC 14400016 */ bnez $v0, .L8003B948
/* 16CF0 8003B8F0 0240282D */ daddu $a1, $s2, $zero
/* 16CF4 8003B8F4 920200AC */ lbu $v0, 0xac($s0)
/* 16CF8 8003B8F8 920300AD */ lbu $v1, 0xad($s0)
/* 16CFC 8003B8FC 00430018 */ mult $v0, $v1
/* 16D00 8003B900 00001012 */ mflo $v0
/* 16D04 8003B904 3C038080 */ lui $v1, 0x8080
/* 16D08 8003B908 34638081 */ ori $v1, $v1, 0x8081
/* 16D0C 8003B90C 00430018 */ mult $v0, $v1
/* 16D10 8003B910 8E030024 */ lw $v1, 0x24($s0)
/* 16D14 8003B914 260702C8 */ addiu $a3, $s0, 0x2c8
/* 16D18 8003B918 AFB10010 */ sw $s1, 0x10($sp)
/* 16D1C 8003B91C 00004810 */ mfhi $t1
/* 16D20 8003B920 01223021 */ addu $a2, $t1, $v0
/* 16D24 8003B924 000631C3 */ sra $a2, $a2, 7
/* 16D28 8003B928 000217C3 */ sra $v0, $v0, 0x1f
/* 16D2C 8003B92C 00C23023 */ subu $a2, $a2, $v0
/* 16D30 8003B930 28C400FF */ slti $a0, $a2, 0xff
/* 16D34 8003B934 000427C0 */ sll $a0, $a0, 0x1f
/* 16D38 8003B938 3C022000 */ lui $v0, 0x2000
/* 16D3C 8003B93C 00822025 */ or $a0, $a0, $v0
/* 16D40 8003B940 0C0B78F6 */ jal spr_draw_npc_sprite
/* 16D44 8003B944 00642025 */ or $a0, $v1, $a0
.L8003B948:
/* 16D48 8003B948 960200BE */ lhu $v0, 0xbe($s0)
/* 16D4C 8003B94C 2442FFFF */ addiu $v0, $v0, -1
/* 16D50 8003B950 A60200BE */ sh $v0, 0xbe($s0)
/* 16D54 8003B954 8FBF0024 */ lw $ra, 0x24($sp)
/* 16D58 8003B958 8FB20020 */ lw $s2, 0x20($sp)
/* 16D5C 8003B95C 8FB1001C */ lw $s1, 0x1c($sp)
/* 16D60 8003B960 8FB00018 */ lw $s0, 0x18($sp)
/* 16D64 8003B964 03E00008 */ jr $ra
/* 16D68 8003B968 27BD0028 */ addiu $sp, $sp, 0x28

View File

@ -1,319 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel npc_draw_palswap_mode_2
/* 16E60 8003BA60 27BDFFC0 */ addiu $sp, $sp, -0x40
/* 16E64 8003BA64 AFB30024 */ sw $s3, 0x24($sp)
/* 16E68 8003BA68 0080982D */ daddu $s3, $a0, $zero
/* 16E6C 8003BA6C AFB60030 */ sw $s6, 0x30($sp)
/* 16E70 8003BA70 00A0B02D */ daddu $s6, $a1, $zero
/* 16E74 8003BA74 AFB40028 */ sw $s4, 0x28($sp)
/* 16E78 8003BA78 00C0A02D */ daddu $s4, $a2, $zero
/* 16E7C 8003BA7C AFBF0038 */ sw $ra, 0x38($sp)
/* 16E80 8003BA80 AFB70034 */ sw $s7, 0x34($sp)
/* 16E84 8003BA84 AFB5002C */ sw $s5, 0x2c($sp)
/* 16E88 8003BA88 AFB20020 */ sw $s2, 0x20($sp)
/* 16E8C 8003BA8C AFB1001C */ sw $s1, 0x1c($sp)
/* 16E90 8003BA90 AFB00018 */ sw $s0, 0x18($sp)
/* 16E94 8003BA94 826200B6 */ lb $v0, 0xb6($s3)
/* 16E98 8003BA98 10400049 */ beqz $v0, .L8003BBC0
/* 16E9C 8003BA9C 00E0B82D */ daddu $s7, $a3, $zero
/* 16EA0 8003BAA0 8E620000 */ lw $v0, ($s3)
/* 16EA4 8003BAA4 3C034000 */ lui $v1, 0x4000
/* 16EA8 8003BAA8 00431024 */ and $v0, $v0, $v1
/* 16EAC 8003BAAC 14400004 */ bnez $v0, .L8003BAC0
/* 16EB0 8003BAB0 00000000 */ nop
/* 16EB4 8003BAB4 0C0B7A90 */ jal spr_get_npc_palettes
/* 16EB8 8003BAB8 96640028 */ lhu $a0, 0x28($s3)
/* 16EBC 8003BABC AE6200C4 */ sw $v0, 0xc4($s3)
.L8003BAC0:
/* 16EC0 8003BAC0 8E6400C4 */ lw $a0, 0xc4($s3)
/* 16EC4 8003BAC4 A26000C1 */ sb $zero, 0xc1($s3)
/* 16EC8 8003BAC8 8C830000 */ lw $v1, ($a0)
/* 16ECC 8003BACC 2402FFFF */ addiu $v0, $zero, -1
/* 16ED0 8003BAD0 1062000B */ beq $v1, $v0, .L8003BB00
/* 16ED4 8003BAD4 0080182D */ daddu $v1, $a0, $zero
/* 16ED8 8003BAD8 0040202D */ daddu $a0, $v0, $zero
.L8003BADC:
/* 16EDC 8003BADC 926200C1 */ lbu $v0, 0xc1($s3)
/* 16EE0 8003BAE0 24420001 */ addiu $v0, $v0, 1
/* 16EE4 8003BAE4 A26200C1 */ sb $v0, 0xc1($s3)
/* 16EE8 8003BAE8 00021600 */ sll $v0, $v0, 0x18
/* 16EEC 8003BAEC 00021583 */ sra $v0, $v0, 0x16
/* 16EF0 8003BAF0 00431021 */ addu $v0, $v0, $v1
/* 16EF4 8003BAF4 8C420000 */ lw $v0, ($v0)
/* 16EF8 8003BAF8 1444FFF8 */ bne $v0, $a0, .L8003BADC
/* 16EFC 8003BAFC 00000000 */ nop
.L8003BB00:
/* 16F00 8003BB00 826300B6 */ lb $v1, 0xb6($s3)
/* 16F04 8003BB04 24020001 */ addiu $v0, $zero, 1
/* 16F08 8003BB08 14620004 */ bne $v1, $v0, .L8003BB1C
/* 16F0C 8003BB0C 240200FF */ addiu $v0, $zero, 0xff
/* 16F10 8003BB10 A26000B7 */ sb $zero, 0xb7($s3)
/* 16F14 8003BB14 0800EEC9 */ j .L8003BB24
/* 16F18 8003BB18 A66000BE */ sh $zero, 0xbe($s3)
.L8003BB1C:
/* 16F1C 8003BB1C A26000B7 */ sb $zero, 0xb7($s3)
/* 16F20 8003BB20 A66200BE */ sh $v0, 0xbe($s3)
.L8003BB24:
/* 16F24 8003BB24 826200C1 */ lb $v0, 0xc1($s3)
/* 16F28 8003BB28 18400018 */ blez $v0, .L8003BB8C
/* 16F2C 8003BB2C 0000202D */ daddu $a0, $zero, $zero
/* 16F30 8003BB30 0260302D */ daddu $a2, $s3, $zero
/* 16F34 8003BB34 240500C8 */ addiu $a1, $zero, 0xc8
.L8003BB38:
/* 16F38 8003BB38 8E6300C4 */ lw $v1, 0xc4($s3)
/* 16F3C 8003BB3C 00041080 */ sll $v0, $a0, 2
/* 16F40 8003BB40 00431021 */ addu $v0, $v0, $v1
/* 16F44 8003BB44 8C520000 */ lw $s2, ($v0)
/* 16F48 8003BB48 02658821 */ addu $s1, $s3, $a1
/* 16F4C 8003BB4C 12400009 */ beqz $s2, .L8003BB74
/* 16F50 8003BB50 ACD102C8 */ sw $s1, 0x2c8($a2)
/* 16F54 8003BB54 0000802D */ daddu $s0, $zero, $zero
.L8003BB58:
/* 16F58 8003BB58 96420000 */ lhu $v0, ($s2)
/* 16F5C 8003BB5C 26520002 */ addiu $s2, $s2, 2
/* 16F60 8003BB60 26100001 */ addiu $s0, $s0, 1
/* 16F64 8003BB64 A6220000 */ sh $v0, ($s1)
/* 16F68 8003BB68 2A020010 */ slti $v0, $s0, 0x10
/* 16F6C 8003BB6C 1440FFFA */ bnez $v0, .L8003BB58
/* 16F70 8003BB70 26310002 */ addiu $s1, $s1, 2
.L8003BB74:
/* 16F74 8003BB74 24C60004 */ addiu $a2, $a2, 4
/* 16F78 8003BB78 826200C1 */ lb $v0, 0xc1($s3)
/* 16F7C 8003BB7C 24840001 */ addiu $a0, $a0, 1
/* 16F80 8003BB80 0082102A */ slt $v0, $a0, $v0
/* 16F84 8003BB84 1440FFEC */ bnez $v0, .L8003BB38
/* 16F88 8003BB88 24A50020 */ addiu $a1, $a1, 0x20
.L8003BB8C:
/* 16F8C 8003BB8C 16800007 */ bnez $s4, .L8003BBAC
/* 16F90 8003BB90 00000000 */ nop
/* 16F94 8003BB94 9662030C */ lhu $v0, 0x30c($s3)
/* 16F98 8003BB98 A660030C */ sh $zero, 0x30c($s3)
/* 16F9C 8003BB9C A662030E */ sh $v0, 0x30e($s3)
/* 16FA0 8003BBA0 0040182D */ daddu $v1, $v0, $zero
/* 16FA4 8003BBA4 A6620310 */ sh $v0, 0x310($s3)
/* 16FA8 8003BBA8 A6630312 */ sh $v1, 0x312($s3)
.L8003BBAC:
/* 16FAC 8003BBAC 9662030C */ lhu $v0, 0x30c($s3)
/* 16FB0 8003BBB0 A66000BE */ sh $zero, 0xbe($s3)
/* 16FB4 8003BBB4 A26000B7 */ sb $zero, 0xb7($s3)
/* 16FB8 8003BBB8 A26000B6 */ sb $zero, 0xb6($s3)
/* 16FBC 8003BBBC A66200BC */ sh $v0, 0xbc($s3)
.L8003BBC0:
/* 16FC0 8003BBC0 826300B7 */ lb $v1, 0xb7($s3)
/* 16FC4 8003BBC4 10600005 */ beqz $v1, .L8003BBDC
/* 16FC8 8003BBC8 24020001 */ addiu $v0, $zero, 1
/* 16FCC 8003BBCC 1062000C */ beq $v1, $v0, .L8003BC00
/* 16FD0 8003BBD0 24020002 */ addiu $v0, $zero, 2
/* 16FD4 8003BBD4 0800EF40 */ j .L8003BD00
/* 16FD8 8003BBD8 00000000 */ nop
.L8003BBDC:
/* 16FDC 8003BBDC 866200BC */ lh $v0, 0xbc($s3)
/* 16FE0 8003BBE0 966300BC */ lhu $v1, 0xbc($s3)
/* 16FE4 8003BBE4 10400003 */ beqz $v0, .L8003BBF4
/* 16FE8 8003BBE8 2462FFFF */ addiu $v0, $v1, -1
/* 16FEC 8003BBEC 0800EF3E */ j .L8003BCF8
/* 16FF0 8003BBF0 A66200BC */ sh $v0, 0xbc($s3)
.L8003BBF4:
/* 16FF4 8003BBF4 24020001 */ addiu $v0, $zero, 1
/* 16FF8 8003BBF8 A66000BE */ sh $zero, 0xbe($s3)
/* 16FFC 8003BBFC A26200B7 */ sb $v0, 0xb7($s3)
.L8003BC00:
/* 17000 8003BC00 8662030E */ lh $v0, 0x30e($s3)
/* 17004 8003BC04 24036400 */ addiu $v1, $zero, 0x6400
/* 17008 8003BC08 14400002 */ bnez $v0, .L8003BC14
/* 1700C 8003BC0C 0062001A */ div $zero, $v1, $v0
/* 17010 8003BC10 0007000D */ break 7
.L8003BC14:
/* 17014 8003BC14 2401FFFF */ addiu $at, $zero, -1
/* 17018 8003BC18 14410004 */ bne $v0, $at, .L8003BC2C
/* 1701C 8003BC1C 3C018000 */ lui $at, 0x8000
/* 17020 8003BC20 14610002 */ bne $v1, $at, .L8003BC2C
/* 17024 8003BC24 00000000 */ nop
/* 17028 8003BC28 0006000D */ break 6
.L8003BC2C:
/* 1702C 8003BC2C 00001812 */ mflo $v1
/* 17030 8003BC30 966200BE */ lhu $v0, 0xbe($s3)
/* 17034 8003BC34 00431021 */ addu $v0, $v0, $v1
/* 17038 8003BC38 A66200BE */ sh $v0, 0xbe($s3)
/* 1703C 8003BC3C 00021400 */ sll $v0, $v0, 0x10
/* 17040 8003BC40 00021403 */ sra $v0, $v0, 0x10
/* 17044 8003BC44 2842639D */ slti $v0, $v0, 0x639d
/* 17048 8003BC48 14400003 */ bnez $v0, .L8003BC58
/* 1704C 8003BC4C 3C0651EB */ lui $a2, 0x51eb
/* 17050 8003BC50 2402639C */ addiu $v0, $zero, 0x639c
/* 17054 8003BC54 A66200BE */ sh $v0, 0xbe($s3)
.L8003BC58:
/* 17058 8003BC58 34C6851F */ ori $a2, $a2, 0x851f
/* 1705C 8003BC5C 267400C8 */ addiu $s4, $s3, 0xc8
/* 17060 8003BC60 0000802D */ daddu $s0, $zero, $zero
/* 17064 8003BC64 86620308 */ lh $v0, 0x308($s3)
/* 17068 8003BC68 8E6500C4 */ lw $a1, 0xc4($s3)
/* 1706C 8003BC6C 966300BE */ lhu $v1, 0xbe($s3)
/* 17070 8003BC70 00021080 */ sll $v0, $v0, 2
/* 17074 8003BC74 00451021 */ addu $v0, $v0, $a1
/* 17078 8003BC78 00031C00 */ sll $v1, $v1, 0x10
/* 1707C 8003BC7C 00032403 */ sra $a0, $v1, 0x10
/* 17080 8003BC80 8C520000 */ lw $s2, ($v0)
/* 17084 8003BC84 8662030A */ lh $v0, 0x30a($s3)
/* 17088 8003BC88 00860018 */ mult $a0, $a2
/* 1708C 8003BC8C 00021080 */ sll $v0, $v0, 2
/* 17090 8003BC90 00451021 */ addu $v0, $v0, $a1
/* 17094 8003BC94 8C510000 */ lw $s1, ($v0)
/* 17098 8003BC98 00031FC3 */ sra $v1, $v1, 0x1f
/* 1709C 8003BC9C AE7402C8 */ sw $s4, 0x2c8($s3)
/* 170A0 8003BCA0 00004010 */ mfhi $t0
/* 170A4 8003BCA4 00081143 */ sra $v0, $t0, 5
/* 170A8 8003BCA8 00431023 */ subu $v0, $v0, $v1
/* 170AC 8003BCAC 00021400 */ sll $v0, $v0, 0x10
/* 170B0 8003BCB0 0002AC03 */ sra $s5, $v0, 0x10
.L8003BCB4:
/* 170B4 8003BCB4 96440000 */ lhu $a0, ($s2)
/* 170B8 8003BCB8 26520002 */ addiu $s2, $s2, 2
/* 170BC 8003BCBC 96250000 */ lhu $a1, ($s1)
/* 170C0 8003BCC0 26310002 */ addiu $s1, $s1, 2
/* 170C4 8003BCC4 02A0302D */ daddu $a2, $s5, $zero
/* 170C8 8003BCC8 0C00EE5B */ jal npc_blend_palette_colors
/* 170CC 8003BCCC 26100001 */ addiu $s0, $s0, 1
/* 170D0 8003BCD0 A6820000 */ sh $v0, ($s4)
/* 170D4 8003BCD4 2A020010 */ slti $v0, $s0, 0x10
/* 170D8 8003BCD8 1440FFF6 */ bnez $v0, .L8003BCB4
/* 170DC 8003BCDC 26940002 */ addiu $s4, $s4, 2
/* 170E0 8003BCE0 240200FF */ addiu $v0, $zero, 0xff
/* 170E4 8003BCE4 16A20004 */ bne $s5, $v0, .L8003BCF8
/* 170E8 8003BCE8 24020002 */ addiu $v0, $zero, 2
/* 170EC 8003BCEC 96630310 */ lhu $v1, 0x310($s3)
/* 170F0 8003BCF0 A26200B7 */ sb $v0, 0xb7($s3)
/* 170F4 8003BCF4 A66300BC */ sh $v1, 0xbc($s3)
.L8003BCF8:
/* 170F8 8003BCF8 826300B7 */ lb $v1, 0xb7($s3)
/* 170FC 8003BCFC 24020002 */ addiu $v0, $zero, 2
.L8003BD00:
/* 17100 8003BD00 10620005 */ beq $v1, $v0, .L8003BD18
/* 17104 8003BD04 24020003 */ addiu $v0, $zero, 3
/* 17108 8003BD08 1062000A */ beq $v1, $v0, .L8003BD34
/* 1710C 8003BD0C 00000000 */ nop
/* 17110 8003BD10 0800EF8B */ j .L8003BE2C
/* 17114 8003BD14 00000000 */ nop
.L8003BD18:
/* 17118 8003BD18 866200BC */ lh $v0, 0xbc($s3)
/* 1711C 8003BD1C 966300BC */ lhu $v1, 0xbc($s3)
/* 17120 8003BD20 14400041 */ bnez $v0, .L8003BE28
/* 17124 8003BD24 2462FFFF */ addiu $v0, $v1, -1
/* 17128 8003BD28 24020003 */ addiu $v0, $zero, 3
/* 1712C 8003BD2C A66000BE */ sh $zero, 0xbe($s3)
/* 17130 8003BD30 A26200B7 */ sb $v0, 0xb7($s3)
.L8003BD34:
/* 17134 8003BD34 86620312 */ lh $v0, 0x312($s3)
/* 17138 8003BD38 24036400 */ addiu $v1, $zero, 0x6400
/* 1713C 8003BD3C 14400002 */ bnez $v0, .L8003BD48
/* 17140 8003BD40 0062001A */ div $zero, $v1, $v0
/* 17144 8003BD44 0007000D */ break 7
.L8003BD48:
/* 17148 8003BD48 2401FFFF */ addiu $at, $zero, -1
/* 1714C 8003BD4C 14410004 */ bne $v0, $at, .L8003BD60
/* 17150 8003BD50 3C018000 */ lui $at, 0x8000
/* 17154 8003BD54 14610002 */ bne $v1, $at, .L8003BD60
/* 17158 8003BD58 00000000 */ nop
/* 1715C 8003BD5C 0006000D */ break 6
.L8003BD60:
/* 17160 8003BD60 00001812 */ mflo $v1
/* 17164 8003BD64 966200BE */ lhu $v0, 0xbe($s3)
/* 17168 8003BD68 00431021 */ addu $v0, $v0, $v1
/* 1716C 8003BD6C A66200BE */ sh $v0, 0xbe($s3)
/* 17170 8003BD70 00021400 */ sll $v0, $v0, 0x10
/* 17174 8003BD74 00021403 */ sra $v0, $v0, 0x10
/* 17178 8003BD78 2842639D */ slti $v0, $v0, 0x639d
/* 1717C 8003BD7C 14400003 */ bnez $v0, .L8003BD8C
/* 17180 8003BD80 3C0651EB */ lui $a2, 0x51eb
/* 17184 8003BD84 2402639C */ addiu $v0, $zero, 0x639c
/* 17188 8003BD88 A66200BE */ sh $v0, 0xbe($s3)
.L8003BD8C:
/* 1718C 8003BD8C 34C6851F */ ori $a2, $a2, 0x851f
/* 17190 8003BD90 267400C8 */ addiu $s4, $s3, 0xc8
/* 17194 8003BD94 0000802D */ daddu $s0, $zero, $zero
/* 17198 8003BD98 8662030A */ lh $v0, 0x30a($s3)
/* 1719C 8003BD9C 8E6500C4 */ lw $a1, 0xc4($s3)
/* 171A0 8003BDA0 966300BE */ lhu $v1, 0xbe($s3)
/* 171A4 8003BDA4 00021080 */ sll $v0, $v0, 2
/* 171A8 8003BDA8 00451021 */ addu $v0, $v0, $a1
/* 171AC 8003BDAC 00031C00 */ sll $v1, $v1, 0x10
/* 171B0 8003BDB0 00032403 */ sra $a0, $v1, 0x10
/* 171B4 8003BDB4 8C520000 */ lw $s2, ($v0)
/* 171B8 8003BDB8 86620308 */ lh $v0, 0x308($s3)
/* 171BC 8003BDBC 00860018 */ mult $a0, $a2
/* 171C0 8003BDC0 00021080 */ sll $v0, $v0, 2
/* 171C4 8003BDC4 00451021 */ addu $v0, $v0, $a1
/* 171C8 8003BDC8 8C510000 */ lw $s1, ($v0)
/* 171CC 8003BDCC 00031FC3 */ sra $v1, $v1, 0x1f
/* 171D0 8003BDD0 AE7402C8 */ sw $s4, 0x2c8($s3)
/* 171D4 8003BDD4 00004010 */ mfhi $t0
/* 171D8 8003BDD8 00081143 */ sra $v0, $t0, 5
/* 171DC 8003BDDC 00431023 */ subu $v0, $v0, $v1
/* 171E0 8003BDE0 00021400 */ sll $v0, $v0, 0x10
/* 171E4 8003BDE4 0002AC03 */ sra $s5, $v0, 0x10
.L8003BDE8:
/* 171E8 8003BDE8 96440000 */ lhu $a0, ($s2)
/* 171EC 8003BDEC 26520002 */ addiu $s2, $s2, 2
/* 171F0 8003BDF0 96250000 */ lhu $a1, ($s1)
/* 171F4 8003BDF4 26310002 */ addiu $s1, $s1, 2
/* 171F8 8003BDF8 02A0302D */ daddu $a2, $s5, $zero
/* 171FC 8003BDFC 0C00EE5B */ jal npc_blend_palette_colors
/* 17200 8003BE00 26100001 */ addiu $s0, $s0, 1
/* 17204 8003BE04 A6820000 */ sh $v0, ($s4)
/* 17208 8003BE08 2A020010 */ slti $v0, $s0, 0x10
/* 1720C 8003BE0C 1440FFF6 */ bnez $v0, .L8003BDE8
/* 17210 8003BE10 26940002 */ addiu $s4, $s4, 2
/* 17214 8003BE14 240200FF */ addiu $v0, $zero, 0xff
/* 17218 8003BE18 16A20004 */ bne $s5, $v0, .L8003BE2C
/* 1721C 8003BE1C 00000000 */ nop
/* 17220 8003BE20 9662030C */ lhu $v0, 0x30c($s3)
/* 17224 8003BE24 A26000B7 */ sb $zero, 0xb7($s3)
.L8003BE28:
/* 17228 8003BE28 A66200BC */ sh $v0, 0xbc($s3)
.L8003BE2C:
/* 1722C 8003BE2C 826300B7 */ lb $v1, 0xb7($s3)
/* 17230 8003BE30 28620004 */ slti $v0, $v1, 4
/* 17234 8003BE34 1040001D */ beqz $v0, .L8003BEAC
/* 17238 8003BE38 00000000 */ nop
/* 1723C 8003BE3C 0460001B */ bltz $v1, .L8003BEAC
/* 17240 8003BE40 3C034000 */ lui $v1, 0x4000
/* 17244 8003BE44 8E620000 */ lw $v0, ($s3)
/* 17248 8003BE48 00431024 */ and $v0, $v0, $v1
/* 1724C 8003BE4C 14400017 */ bnez $v0, .L8003BEAC
/* 17250 8003BE50 02C0282D */ daddu $a1, $s6, $zero
/* 17254 8003BE54 926300AC */ lbu $v1, 0xac($s3)
/* 17258 8003BE58 926200AD */ lbu $v0, 0xad($s3)
/* 1725C 8003BE5C 00620018 */ mult $v1, $v0
/* 17260 8003BE60 00001812 */ mflo $v1
/* 17264 8003BE64 3C028080 */ lui $v0, 0x8080
/* 17268 8003BE68 34428081 */ ori $v0, $v0, 0x8081
/* 1726C 8003BE6C 00620018 */ mult $v1, $v0
/* 17270 8003BE70 8E660024 */ lw $a2, 0x24($s3)
/* 17274 8003BE74 266702C8 */ addiu $a3, $s3, 0x2c8
/* 17278 8003BE78 AFB70010 */ sw $s7, 0x10($sp)
/* 1727C 8003BE7C 00004810 */ mfhi $t1
/* 17280 8003BE80 01231021 */ addu $v0, $t1, $v1
/* 17284 8003BE84 000211C3 */ sra $v0, $v0, 7
/* 17288 8003BE88 00031FC3 */ sra $v1, $v1, 0x1f
/* 1728C 8003BE8C 0043A823 */ subu $s5, $v0, $v1
/* 17290 8003BE90 2AA400FF */ slti $a0, $s5, 0xff
/* 17294 8003BE94 000427C0 */ sll $a0, $a0, 0x1f
/* 17298 8003BE98 3C022000 */ lui $v0, 0x2000
/* 1729C 8003BE9C 00822025 */ or $a0, $a0, $v0
/* 172A0 8003BEA0 00C42025 */ or $a0, $a2, $a0
/* 172A4 8003BEA4 0C0B78F6 */ jal spr_draw_npc_sprite
/* 172A8 8003BEA8 02A0302D */ daddu $a2, $s5, $zero
.L8003BEAC:
/* 172AC 8003BEAC 8FBF0038 */ lw $ra, 0x38($sp)
/* 172B0 8003BEB0 8FB70034 */ lw $s7, 0x34($sp)
/* 172B4 8003BEB4 8FB60030 */ lw $s6, 0x30($sp)
/* 172B8 8003BEB8 8FB5002C */ lw $s5, 0x2c($sp)
/* 172BC 8003BEBC 8FB40028 */ lw $s4, 0x28($sp)
/* 172C0 8003BEC0 8FB30024 */ lw $s3, 0x24($sp)
/* 172C4 8003BEC4 8FB20020 */ lw $s2, 0x20($sp)
/* 172C8 8003BEC8 8FB1001C */ lw $s1, 0x1c($sp)
/* 172CC 8003BECC 8FB00018 */ lw $s0, 0x18($sp)
/* 172D0 8003BED0 03E00008 */ jr $ra
/* 172D4 8003BED4 27BD0040 */ addiu $sp, $sp, 0x40

View File

@ -1,354 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel npc_draw_palswap_mode_4
/* 172D8 8003BED8 27BDFFB8 */ addiu $sp, $sp, -0x48
/* 172DC 8003BEDC AFB40030 */ sw $s4, 0x30($sp)
/* 172E0 8003BEE0 0080A02D */ daddu $s4, $a0, $zero
/* 172E4 8003BEE4 AFB60038 */ sw $s6, 0x38($sp)
/* 172E8 8003BEE8 00A0B02D */ daddu $s6, $a1, $zero
/* 172EC 8003BEEC AFBF0040 */ sw $ra, 0x40($sp)
/* 172F0 8003BEF0 AFB7003C */ sw $s7, 0x3c($sp)
/* 172F4 8003BEF4 AFB50034 */ sw $s5, 0x34($sp)
/* 172F8 8003BEF8 AFB3002C */ sw $s3, 0x2c($sp)
/* 172FC 8003BEFC AFB20028 */ sw $s2, 0x28($sp)
/* 17300 8003BF00 AFB10024 */ sw $s1, 0x24($sp)
/* 17304 8003BF04 AFB00020 */ sw $s0, 0x20($sp)
/* 17308 8003BF08 828200B6 */ lb $v0, 0xb6($s4)
/* 1730C 8003BF0C 10400041 */ beqz $v0, .L8003C014
/* 17310 8003BF10 00C0B82D */ daddu $s7, $a2, $zero
/* 17314 8003BF14 8E820000 */ lw $v0, ($s4)
/* 17318 8003BF18 3C034000 */ lui $v1, 0x4000
/* 1731C 8003BF1C 00431024 */ and $v0, $v0, $v1
/* 17320 8003BF20 14400004 */ bnez $v0, .L8003BF34
/* 17324 8003BF24 00000000 */ nop
/* 17328 8003BF28 0C0B7A90 */ jal spr_get_npc_palettes
/* 1732C 8003BF2C 96840028 */ lhu $a0, 0x28($s4)
/* 17330 8003BF30 AE8200C4 */ sw $v0, 0xc4($s4)
.L8003BF34:
/* 17334 8003BF34 8E8400C4 */ lw $a0, 0xc4($s4)
/* 17338 8003BF38 A28000C1 */ sb $zero, 0xc1($s4)
/* 1733C 8003BF3C 8C830000 */ lw $v1, ($a0)
/* 17340 8003BF40 2402FFFF */ addiu $v0, $zero, -1
/* 17344 8003BF44 1062000B */ beq $v1, $v0, .L8003BF74
/* 17348 8003BF48 0080182D */ daddu $v1, $a0, $zero
/* 1734C 8003BF4C 0040202D */ daddu $a0, $v0, $zero
.L8003BF50:
/* 17350 8003BF50 928200C1 */ lbu $v0, 0xc1($s4)
/* 17354 8003BF54 24420001 */ addiu $v0, $v0, 1
/* 17358 8003BF58 A28200C1 */ sb $v0, 0xc1($s4)
/* 1735C 8003BF5C 00021600 */ sll $v0, $v0, 0x18
/* 17360 8003BF60 00021583 */ sra $v0, $v0, 0x16
/* 17364 8003BF64 00431021 */ addu $v0, $v0, $v1
/* 17368 8003BF68 8C420000 */ lw $v0, ($v0)
/* 1736C 8003BF6C 1444FFF8 */ bne $v0, $a0, .L8003BF50
/* 17370 8003BF70 00000000 */ nop
.L8003BF74:
/* 17374 8003BF74 828300B6 */ lb $v1, 0xb6($s4)
/* 17378 8003BF78 24020001 */ addiu $v0, $zero, 1
/* 1737C 8003BF7C 14620004 */ bne $v1, $v0, .L8003BF90
/* 17380 8003BF80 240200FF */ addiu $v0, $zero, 0xff
/* 17384 8003BF84 A28000B7 */ sb $zero, 0xb7($s4)
/* 17388 8003BF88 0800EFE6 */ j .L8003BF98
/* 1738C 8003BF8C A68000BE */ sh $zero, 0xbe($s4)
.L8003BF90:
/* 17390 8003BF90 A28000B7 */ sb $zero, 0xb7($s4)
/* 17394 8003BF94 A68200BE */ sh $v0, 0xbe($s4)
.L8003BF98:
/* 17398 8003BF98 828200C1 */ lb $v0, 0xc1($s4)
/* 1739C 8003BF9C 18400018 */ blez $v0, .L8003C000
/* 173A0 8003BFA0 0000202D */ daddu $a0, $zero, $zero
/* 173A4 8003BFA4 0280302D */ daddu $a2, $s4, $zero
/* 173A8 8003BFA8 240500C8 */ addiu $a1, $zero, 0xc8
.L8003BFAC:
/* 173AC 8003BFAC 8E8300C4 */ lw $v1, 0xc4($s4)
/* 173B0 8003BFB0 00041080 */ sll $v0, $a0, 2
/* 173B4 8003BFB4 00431021 */ addu $v0, $v0, $v1
/* 173B8 8003BFB8 8C520000 */ lw $s2, ($v0)
/* 173BC 8003BFBC 02858021 */ addu $s0, $s4, $a1
/* 173C0 8003BFC0 12400009 */ beqz $s2, .L8003BFE8
/* 173C4 8003BFC4 ACD002C8 */ sw $s0, 0x2c8($a2)
/* 173C8 8003BFC8 0000882D */ daddu $s1, $zero, $zero
.L8003BFCC:
/* 173CC 8003BFCC 96420000 */ lhu $v0, ($s2)
/* 173D0 8003BFD0 26520002 */ addiu $s2, $s2, 2
/* 173D4 8003BFD4 26310001 */ addiu $s1, $s1, 1
/* 173D8 8003BFD8 A6020000 */ sh $v0, ($s0)
/* 173DC 8003BFDC 2A220010 */ slti $v0, $s1, 0x10
/* 173E0 8003BFE0 1440FFFA */ bnez $v0, .L8003BFCC
/* 173E4 8003BFE4 26100002 */ addiu $s0, $s0, 2
.L8003BFE8:
/* 173E8 8003BFE8 24C60004 */ addiu $a2, $a2, 4
/* 173EC 8003BFEC 828200C1 */ lb $v0, 0xc1($s4)
/* 173F0 8003BFF0 24840001 */ addiu $a0, $a0, 1
/* 173F4 8003BFF4 0082102A */ slt $v0, $a0, $v0
/* 173F8 8003BFF8 1440FFEC */ bnez $v0, .L8003BFAC
/* 173FC 8003BFFC 24A50020 */ addiu $a1, $a1, 0x20
.L8003C000:
/* 17400 8003C000 9682030C */ lhu $v0, 0x30c($s4)
/* 17404 8003C004 A68000BE */ sh $zero, 0xbe($s4)
/* 17408 8003C008 A28000B7 */ sb $zero, 0xb7($s4)
/* 1740C 8003C00C A28000B6 */ sb $zero, 0xb6($s4)
/* 17410 8003C010 A68200BC */ sh $v0, 0xbc($s4)
.L8003C014:
/* 17414 8003C014 828300B7 */ lb $v1, 0xb7($s4)
/* 17418 8003C018 10600005 */ beqz $v1, .L8003C030
/* 1741C 8003C01C 24020001 */ addiu $v0, $zero, 1
/* 17420 8003C020 1062000C */ beq $v1, $v0, .L8003C054
/* 17424 8003C024 24020002 */ addiu $v0, $zero, 2
/* 17428 8003C028 0800F06B */ j .L8003C1AC
/* 1742C 8003C02C 00000000 */ nop
.L8003C030:
/* 17430 8003C030 868200BC */ lh $v0, 0xbc($s4)
/* 17434 8003C034 968300BC */ lhu $v1, 0xbc($s4)
/* 17438 8003C038 10400003 */ beqz $v0, .L8003C048
/* 1743C 8003C03C 2462FFFF */ addiu $v0, $v1, -1
/* 17440 8003C040 0800F069 */ j .L8003C1A4
/* 17444 8003C044 A68200BC */ sh $v0, 0xbc($s4)
.L8003C048:
/* 17448 8003C048 24020001 */ addiu $v0, $zero, 1
/* 1744C 8003C04C A68000BE */ sh $zero, 0xbe($s4)
/* 17450 8003C050 A28200B7 */ sb $v0, 0xb7($s4)
.L8003C054:
/* 17454 8003C054 8682030E */ lh $v0, 0x30e($s4)
/* 17458 8003C058 24036400 */ addiu $v1, $zero, 0x6400
/* 1745C 8003C05C 14400002 */ bnez $v0, .L8003C068
/* 17460 8003C060 0062001A */ div $zero, $v1, $v0
/* 17464 8003C064 0007000D */ break 7
.L8003C068:
/* 17468 8003C068 2401FFFF */ addiu $at, $zero, -1
/* 1746C 8003C06C 14410004 */ bne $v0, $at, .L8003C080
/* 17470 8003C070 3C018000 */ lui $at, 0x8000
/* 17474 8003C074 14610002 */ bne $v1, $at, .L8003C080
/* 17478 8003C078 00000000 */ nop
/* 1747C 8003C07C 0006000D */ break 6
.L8003C080:
/* 17480 8003C080 00001812 */ mflo $v1
/* 17484 8003C084 968200BE */ lhu $v0, 0xbe($s4)
/* 17488 8003C088 00431021 */ addu $v0, $v0, $v1
/* 1748C 8003C08C A68200BE */ sh $v0, 0xbe($s4)
/* 17490 8003C090 00021400 */ sll $v0, $v0, 0x10
/* 17494 8003C094 00021403 */ sra $v0, $v0, 0x10
/* 17498 8003C098 2842639D */ slti $v0, $v0, 0x639d
/* 1749C 8003C09C 14400003 */ bnez $v0, .L8003C0AC
/* 174A0 8003C0A0 3C0651EB */ lui $a2, 0x51eb
/* 174A4 8003C0A4 2402639C */ addiu $v0, $zero, 0x639c
/* 174A8 8003C0A8 A68200BE */ sh $v0, 0xbe($s4)
.L8003C0AC:
/* 174AC 8003C0AC 34C6851F */ ori $a2, $a2, 0x851f
/* 174B0 8003C0B0 269300C8 */ addiu $s3, $s4, 0xc8
/* 174B4 8003C0B4 0000882D */ daddu $s1, $zero, $zero
/* 174B8 8003C0B8 86820308 */ lh $v0, 0x308($s4)
/* 174BC 8003C0BC 8E8500C4 */ lw $a1, 0xc4($s4)
/* 174C0 8003C0C0 968300BE */ lhu $v1, 0xbe($s4)
/* 174C4 8003C0C4 00021080 */ sll $v0, $v0, 2
/* 174C8 8003C0C8 00451021 */ addu $v0, $v0, $a1
/* 174CC 8003C0CC 00031C00 */ sll $v1, $v1, 0x10
/* 174D0 8003C0D0 00032403 */ sra $a0, $v1, 0x10
/* 174D4 8003C0D4 8C520000 */ lw $s2, ($v0)
/* 174D8 8003C0D8 8682030A */ lh $v0, 0x30a($s4)
/* 174DC 8003C0DC 00860018 */ mult $a0, $a2
/* 174E0 8003C0E0 00021080 */ sll $v0, $v0, 2
/* 174E4 8003C0E4 00451021 */ addu $v0, $v0, $a1
/* 174E8 8003C0E8 8C500000 */ lw $s0, ($v0)
/* 174EC 8003C0EC 00031FC3 */ sra $v1, $v1, 0x1f
/* 174F0 8003C0F0 AE9302C8 */ sw $s3, 0x2c8($s4)
/* 174F4 8003C0F4 00004010 */ mfhi $t0
/* 174F8 8003C0F8 00081143 */ sra $v0, $t0, 5
/* 174FC 8003C0FC 0043A823 */ subu $s5, $v0, $v1
.L8003C100:
/* 17500 8003C100 96440000 */ lhu $a0, ($s2)
/* 17504 8003C104 26520002 */ addiu $s2, $s2, 2
/* 17508 8003C108 96050000 */ lhu $a1, ($s0)
/* 1750C 8003C10C 26100002 */ addiu $s0, $s0, 2
/* 17510 8003C110 32A600FF */ andi $a2, $s5, 0xff
/* 17514 8003C114 0C00EE5B */ jal npc_blend_palette_colors
/* 17518 8003C118 26310001 */ addiu $s1, $s1, 1
/* 1751C 8003C11C A6620000 */ sh $v0, ($s3)
/* 17520 8003C120 2A220010 */ slti $v0, $s1, 0x10
/* 17524 8003C124 1440FFF6 */ bnez $v0, .L8003C100
/* 17528 8003C128 26730002 */ addiu $s3, $s3, 2
/* 1752C 8003C12C 26930128 */ addiu $s3, $s4, 0x128
/* 17530 8003C130 86820314 */ lh $v0, 0x314($s4)
/* 17534 8003C134 8E8400C4 */ lw $a0, 0xc4($s4)
/* 17538 8003C138 86830316 */ lh $v1, 0x316($s4)
/* 1753C 8003C13C 00021080 */ sll $v0, $v0, 2
/* 17540 8003C140 00441021 */ addu $v0, $v0, $a0
/* 17544 8003C144 00031880 */ sll $v1, $v1, 2
/* 17548 8003C148 00641821 */ addu $v1, $v1, $a0
/* 1754C 8003C14C 8C520000 */ lw $s2, ($v0)
/* 17550 8003C150 8C700000 */ lw $s0, ($v1)
/* 17554 8003C154 0000882D */ daddu $s1, $zero, $zero
/* 17558 8003C158 AE9302D4 */ sw $s3, 0x2d4($s4)
.L8003C15C:
/* 1755C 8003C15C 96440000 */ lhu $a0, ($s2)
/* 17560 8003C160 26520002 */ addiu $s2, $s2, 2
/* 17564 8003C164 96050000 */ lhu $a1, ($s0)
/* 17568 8003C168 26100002 */ addiu $s0, $s0, 2
/* 1756C 8003C16C 32A600FF */ andi $a2, $s5, 0xff
/* 17570 8003C170 0C00EE5B */ jal npc_blend_palette_colors
/* 17574 8003C174 26310001 */ addiu $s1, $s1, 1
/* 17578 8003C178 A6620000 */ sh $v0, ($s3)
/* 1757C 8003C17C 2A220010 */ slti $v0, $s1, 0x10
/* 17580 8003C180 1440FFF6 */ bnez $v0, .L8003C15C
/* 17584 8003C184 26730002 */ addiu $s3, $s3, 2
/* 17588 8003C188 32A300FF */ andi $v1, $s5, 0xff
/* 1758C 8003C18C 240200FF */ addiu $v0, $zero, 0xff
/* 17590 8003C190 14620004 */ bne $v1, $v0, .L8003C1A4
/* 17594 8003C194 24020002 */ addiu $v0, $zero, 2
/* 17598 8003C198 96830310 */ lhu $v1, 0x310($s4)
/* 1759C 8003C19C A28200B7 */ sb $v0, 0xb7($s4)
/* 175A0 8003C1A0 A68300BC */ sh $v1, 0xbc($s4)
.L8003C1A4:
/* 175A4 8003C1A4 828300B7 */ lb $v1, 0xb7($s4)
/* 175A8 8003C1A8 24020002 */ addiu $v0, $zero, 2
.L8003C1AC:
/* 175AC 8003C1AC 10620005 */ beq $v1, $v0, .L8003C1C4
/* 175B0 8003C1B0 24020003 */ addiu $v0, $zero, 3
/* 175B4 8003C1B4 1062000A */ beq $v1, $v0, .L8003C1E0
/* 175B8 8003C1B8 00000000 */ nop
/* 175BC 8003C1BC 0800F0CD */ j .L8003C334
/* 175C0 8003C1C0 00000000 */ nop
.L8003C1C4:
/* 175C4 8003C1C4 868200BC */ lh $v0, 0xbc($s4)
/* 175C8 8003C1C8 968300BC */ lhu $v1, 0xbc($s4)
/* 175CC 8003C1CC 14400058 */ bnez $v0, .L8003C330
/* 175D0 8003C1D0 2462FFFF */ addiu $v0, $v1, -1
/* 175D4 8003C1D4 24020003 */ addiu $v0, $zero, 3
/* 175D8 8003C1D8 A68000BE */ sh $zero, 0xbe($s4)
/* 175DC 8003C1DC A28200B7 */ sb $v0, 0xb7($s4)
.L8003C1E0:
/* 175E0 8003C1E0 86820312 */ lh $v0, 0x312($s4)
/* 175E4 8003C1E4 24036400 */ addiu $v1, $zero, 0x6400
/* 175E8 8003C1E8 14400002 */ bnez $v0, .L8003C1F4
/* 175EC 8003C1EC 0062001A */ div $zero, $v1, $v0
/* 175F0 8003C1F0 0007000D */ break 7
.L8003C1F4:
/* 175F4 8003C1F4 2401FFFF */ addiu $at, $zero, -1
/* 175F8 8003C1F8 14410004 */ bne $v0, $at, .L8003C20C
/* 175FC 8003C1FC 3C018000 */ lui $at, 0x8000
/* 17600 8003C200 14610002 */ bne $v1, $at, .L8003C20C
/* 17604 8003C204 00000000 */ nop
/* 17608 8003C208 0006000D */ break 6
.L8003C20C:
/* 1760C 8003C20C 00001812 */ mflo $v1
/* 17610 8003C210 968200BE */ lhu $v0, 0xbe($s4)
/* 17614 8003C214 00431021 */ addu $v0, $v0, $v1
/* 17618 8003C218 A68200BE */ sh $v0, 0xbe($s4)
/* 1761C 8003C21C 00021400 */ sll $v0, $v0, 0x10
/* 17620 8003C220 00021403 */ sra $v0, $v0, 0x10
/* 17624 8003C224 2842639D */ slti $v0, $v0, 0x639d
/* 17628 8003C228 14400003 */ bnez $v0, .L8003C238
/* 1762C 8003C22C 3C0651EB */ lui $a2, 0x51eb
/* 17630 8003C230 2402639C */ addiu $v0, $zero, 0x639c
/* 17634 8003C234 A68200BE */ sh $v0, 0xbe($s4)
.L8003C238:
/* 17638 8003C238 34C6851F */ ori $a2, $a2, 0x851f
/* 1763C 8003C23C 269300C8 */ addiu $s3, $s4, 0xc8
/* 17640 8003C240 0000882D */ daddu $s1, $zero, $zero
/* 17644 8003C244 8682030A */ lh $v0, 0x30a($s4)
/* 17648 8003C248 8E8500C4 */ lw $a1, 0xc4($s4)
/* 1764C 8003C24C 968300BE */ lhu $v1, 0xbe($s4)
/* 17650 8003C250 00021080 */ sll $v0, $v0, 2
/* 17654 8003C254 00451021 */ addu $v0, $v0, $a1
/* 17658 8003C258 00031C00 */ sll $v1, $v1, 0x10
/* 1765C 8003C25C 00032403 */ sra $a0, $v1, 0x10
/* 17660 8003C260 8C520000 */ lw $s2, ($v0)
/* 17664 8003C264 86820308 */ lh $v0, 0x308($s4)
/* 17668 8003C268 00860018 */ mult $a0, $a2
/* 1766C 8003C26C 00021080 */ sll $v0, $v0, 2
/* 17670 8003C270 00451021 */ addu $v0, $v0, $a1
/* 17674 8003C274 8C500000 */ lw $s0, ($v0)
/* 17678 8003C278 00031FC3 */ sra $v1, $v1, 0x1f
/* 1767C 8003C27C AE9302C8 */ sw $s3, 0x2c8($s4)
/* 17680 8003C280 00004010 */ mfhi $t0
/* 17684 8003C284 00081143 */ sra $v0, $t0, 5
/* 17688 8003C288 0043A823 */ subu $s5, $v0, $v1
.L8003C28C:
/* 1768C 8003C28C 96440000 */ lhu $a0, ($s2)
/* 17690 8003C290 26520002 */ addiu $s2, $s2, 2
/* 17694 8003C294 96050000 */ lhu $a1, ($s0)
/* 17698 8003C298 26100002 */ addiu $s0, $s0, 2
/* 1769C 8003C29C 32A600FF */ andi $a2, $s5, 0xff
/* 176A0 8003C2A0 0C00EE5B */ jal npc_blend_palette_colors
/* 176A4 8003C2A4 26310001 */ addiu $s1, $s1, 1
/* 176A8 8003C2A8 A6620000 */ sh $v0, ($s3)
/* 176AC 8003C2AC 2A220010 */ slti $v0, $s1, 0x10
/* 176B0 8003C2B0 1440FFF6 */ bnez $v0, .L8003C28C
/* 176B4 8003C2B4 26730002 */ addiu $s3, $s3, 2
/* 176B8 8003C2B8 269300E8 */ addiu $s3, $s4, 0xe8
/* 176BC 8003C2BC 0000882D */ daddu $s1, $zero, $zero
/* 176C0 8003C2C0 86830316 */ lh $v1, 0x316($s4)
/* 176C4 8003C2C4 8E8400C4 */ lw $a0, 0xc4($s4)
/* 176C8 8003C2C8 86820314 */ lh $v0, 0x314($s4)
/* 176CC 8003C2CC 00031880 */ sll $v1, $v1, 2
/* 176D0 8003C2D0 00641821 */ addu $v1, $v1, $a0
/* 176D4 8003C2D4 00021080 */ sll $v0, $v0, 2
/* 176D8 8003C2D8 00441021 */ addu $v0, $v0, $a0
/* 176DC 8003C2DC 8C720000 */ lw $s2, ($v1)
/* 176E0 8003C2E0 8C500000 */ lw $s0, ($v0)
/* 176E4 8003C2E4 26820128 */ addiu $v0, $s4, 0x128
/* 176E8 8003C2E8 AE8202D4 */ sw $v0, 0x2d4($s4)
.L8003C2EC:
/* 176EC 8003C2EC 96440000 */ lhu $a0, ($s2)
/* 176F0 8003C2F0 26520002 */ addiu $s2, $s2, 2
/* 176F4 8003C2F4 96050000 */ lhu $a1, ($s0)
/* 176F8 8003C2F8 26100002 */ addiu $s0, $s0, 2
/* 176FC 8003C2FC 32A600FF */ andi $a2, $s5, 0xff
/* 17700 8003C300 0C00EE5B */ jal npc_blend_palette_colors
/* 17704 8003C304 26310001 */ addiu $s1, $s1, 1
/* 17708 8003C308 A6620000 */ sh $v0, ($s3)
/* 1770C 8003C30C 2A220010 */ slti $v0, $s1, 0x10
/* 17710 8003C310 1440FFF6 */ bnez $v0, .L8003C2EC
/* 17714 8003C314 26730002 */ addiu $s3, $s3, 2
/* 17718 8003C318 32A300FF */ andi $v1, $s5, 0xff
/* 1771C 8003C31C 240200FF */ addiu $v0, $zero, 0xff
/* 17720 8003C320 14620004 */ bne $v1, $v0, .L8003C334
/* 17724 8003C324 00000000 */ nop
/* 17728 8003C328 9682030C */ lhu $v0, 0x30c($s4)
/* 1772C 8003C32C A28000B7 */ sb $zero, 0xb7($s4)
.L8003C330:
/* 17730 8003C330 A68200BC */ sh $v0, 0xbc($s4)
.L8003C334:
/* 17734 8003C334 828300B7 */ lb $v1, 0xb7($s4)
/* 17738 8003C338 28620004 */ slti $v0, $v1, 4
/* 1773C 8003C33C 1040001B */ beqz $v0, .L8003C3AC
/* 17740 8003C340 00000000 */ nop
/* 17744 8003C344 04600019 */ bltz $v1, .L8003C3AC
/* 17748 8003C348 3C034000 */ lui $v1, 0x4000
/* 1774C 8003C34C 8E820000 */ lw $v0, ($s4)
/* 17750 8003C350 00431024 */ and $v0, $v0, $v1
/* 17754 8003C354 14400015 */ bnez $v0, .L8003C3AC
/* 17758 8003C358 02C0282D */ daddu $a1, $s6, $zero
/* 1775C 8003C35C 928200AC */ lbu $v0, 0xac($s4)
/* 17760 8003C360 928300AD */ lbu $v1, 0xad($s4)
/* 17764 8003C364 00430018 */ mult $v0, $v1
/* 17768 8003C368 00001012 */ mflo $v0
/* 1776C 8003C36C 3C038080 */ lui $v1, 0x8080
/* 17770 8003C370 34638081 */ ori $v1, $v1, 0x8081
/* 17774 8003C374 00430018 */ mult $v0, $v1
/* 17778 8003C378 8E830024 */ lw $v1, 0x24($s4)
/* 1777C 8003C37C 268702C8 */ addiu $a3, $s4, 0x2c8
/* 17780 8003C380 AFB70010 */ sw $s7, 0x10($sp)
/* 17784 8003C384 00004810 */ mfhi $t1
/* 17788 8003C388 01221021 */ addu $v0, $t1, $v0
/* 1778C 8003C38C 0002A9C2 */ srl $s5, $v0, 7
/* 17790 8003C390 32A600FF */ andi $a2, $s5, 0xff
/* 17794 8003C394 2CC400FF */ sltiu $a0, $a2, 0xff
/* 17798 8003C398 000427C0 */ sll $a0, $a0, 0x1f
/* 1779C 8003C39C 3C022000 */ lui $v0, 0x2000
/* 177A0 8003C3A0 00822025 */ or $a0, $a0, $v0
/* 177A4 8003C3A4 0C0B78F6 */ jal spr_draw_npc_sprite
/* 177A8 8003C3A8 00642025 */ or $a0, $v1, $a0
.L8003C3AC:
/* 177AC 8003C3AC 8FBF0040 */ lw $ra, 0x40($sp)
/* 177B0 8003C3B0 8FB7003C */ lw $s7, 0x3c($sp)
/* 177B4 8003C3B4 8FB60038 */ lw $s6, 0x38($sp)
/* 177B8 8003C3B8 8FB50034 */ lw $s5, 0x34($sp)
/* 177BC 8003C3BC 8FB40030 */ lw $s4, 0x30($sp)
/* 177C0 8003C3C0 8FB3002C */ lw $s3, 0x2c($sp)
/* 177C4 8003C3C4 8FB20028 */ lw $s2, 0x28($sp)
/* 177C8 8003C3C8 8FB10024 */ lw $s1, 0x24($sp)
/* 177CC 8003C3CC 8FB00020 */ lw $s0, 0x20($sp)
/* 177D0 8003C3D0 03E00008 */ jr $ra
/* 177D4 8003C3D4 27BD0048 */ addiu $sp, $sp, 0x48