diff --git a/src/game/chr/chr.c b/src/game/chr/chr.c index 5ed4d087f..730a35e7f 100644 --- a/src/game/chr/chr.c +++ b/src/game/chr/chr.c @@ -5511,7 +5511,7 @@ glabel var7f1a87d8 /* f024224: 260400f8 */ addiu $a0,$s0,0xf8 /* f024228: 11a00003 */ beqz $t5,.L0f024238 /* f02422c: 00000000 */ nop -/* f024230: 0fc1a5c4 */ jal func0f069710 +/* f024230: 0fc1a5c4 */ jal colourTween /* f024234: 260500fc */ addiu $a1,$s0,0xfc .L0f024238: /* f024238: 0c006a7a */ jal func0001a9e8 diff --git a/src/game/game_097ba0.c b/src/game/game_097ba0.c index f0d6e7437..2d0b068f7 100644 --- a/src/game/game_097ba0.c +++ b/src/game/game_097ba0.c @@ -20653,7 +20653,7 @@ void currentPlayerTickInventory(bool triggeron) } else { u8 shadecol[4]; func0f069144(g_Vars.currentplayer->prop, shadecol, player->floorcol); - func0f069710(player->gunshadecol, shadecol); + colourTween(player->gunshadecol, shadecol); } invIncrementHeldTime(handGetWeaponNum(HAND_RIGHT), handGetWeaponNum(HAND_LEFT)); diff --git a/src/game/propobj.c b/src/game/propobj.c index 26cddfd84..ef441c9bc 100644 --- a/src/game/propobj.c +++ b/src/game/propobj.c @@ -3996,26 +3996,21 @@ glabel func0f069630 /* f06970c: 00000000 */ nop ); -GLOBAL_ASM( -glabel func0f069710 -/* f069710: 00001025 */ or $v0,$zero,$zero -/* f069714: 00a03025 */ or $a2,$a1,$zero -/* f069718: 00803825 */ or $a3,$a0,$zero -/* f06971c: 24080004 */ addiu $t0,$zero,0x4 -.L0f069720: -/* f069720: 90e40000 */ lbu $a0,0x0($a3) -/* f069724: 90ce0000 */ lbu $t6,0x0($a2) -/* f069728: 24420001 */ addiu $v0,$v0,0x1 -/* f06972c: 24c60001 */ addiu $a2,$a2,0x1 -/* f069730: 01c41823 */ subu $v1,$t6,$a0 -/* f069734: 00037843 */ sra $t7,$v1,0x1 -/* f069738: 008f2821 */ addu $a1,$a0,$t7 -/* f06973c: 24e70001 */ addiu $a3,$a3,0x1 -/* f069740: 1448fff7 */ bne $v0,$t0,.L0f069720 -/* f069744: a0e5ffff */ sb $a1,-0x1($a3) -/* f069748: 03e00008 */ jr $ra -/* f06974c: 00000000 */ nop -); +/** + * Shift shadecol to be closer to nextcol. + * + * It works by moving halfway towards the nextcol colour each time it's called. + */ +void colourTween(u8 *col, u8 *nextcol) +{ + s32 i; + + for (i = 0; i < 4; i++) { + s32 remaining = nextcol[i] - col[i]; + s32 newcol = col[i] + (remaining >> 1); + col[i] = newcol; + } +} GLOBAL_ASM( glabel func0f069750 @@ -27444,7 +27439,7 @@ s32 objTick(struct prop *prop) if (sp572) { if (prop->flags & PROPFLAG_80) { - func0f069710(obj->shadecol, obj->nextcol); + colourTween(obj->shadecol, obj->nextcol); } else { obj->shadecol[0] = obj->nextcol[0]; obj->shadecol[1] = obj->nextcol[1]; diff --git a/src/include/game/propobj.h b/src/include/game/propobj.h index 103119a5a..8f3ef3c38 100644 --- a/src/include/game/propobj.h +++ b/src/include/game/propobj.h @@ -88,7 +88,7 @@ u32 func0f068c04(void); s32 func0f068fc8(struct prop *prop, bool arg1); void func0f069144(struct prop *prop, u8 *nextcol, u16 floorcol); void func0f069630(struct prop *prop, u8 *nextcol, u16 floorcol); -void func0f069710(u8 *shadecol, u8 *nextcol); +void colourTween(u8 *col, u8 *nextcol); void func0f069750(s32 *arg0, s32 arg1, f32 *arg2); void func0f069850(struct defaultobj *obj, struct coord *pos, f32 *realrot, struct tiletype3 *geo); void func0f069b4c(struct defaultobj *obj);