diff --git a/src/game/game_095320.c b/src/game/game_095320.c index 5cc3bc063..af682cba1 100644 --- a/src/game/game_095320.c +++ b/src/game/game_095320.c @@ -499,194 +499,59 @@ void objectiveCheckMultiroomEntered(s32 arg0, s16 *requiredrooms) } } -GLOBAL_ASM( -glabel objectiveCheckHolograph -/* f096088: 27bdff50 */ addiu $sp,$sp,-176 -/* f09608c: afb10034 */ sw $s1,0x34($sp) -/* f096090: 3c11800a */ lui $s1,%hi(g_HolographCriterias) -/* f096094: 8e31d0c0 */ lw $s1,%lo(g_HolographCriterias)($s1) -/* f096098: f7b60028 */ sdc1 $f22,0x28($sp) -/* f09609c: 46006586 */ mov.s $f22,$f12 -/* f0960a0: afbf004c */ sw $ra,0x4c($sp) -/* f0960a4: afb60048 */ sw $s6,0x48($sp) -/* f0960a8: afb50044 */ sw $s5,0x44($sp) -/* f0960ac: afb40040 */ sw $s4,0x40($sp) -/* f0960b0: afb3003c */ sw $s3,0x3c($sp) -/* f0960b4: afb20038 */ sw $s2,0x38($sp) -/* f0960b8: afb00030 */ sw $s0,0x30($sp) -/* f0960bc: 1220009a */ beqz $s1,.L0f096328 -/* f0960c0: f7b40020 */ sdc1 $f20,0x20($sp) -/* f0960c4: 3c12800a */ lui $s2,%hi(g_Vars) -/* f0960c8: 26529fc0 */ addiu $s2,$s2,%lo(g_Vars) -/* f0960cc: 27b6008c */ addiu $s6,$sp,0x8c -/* f0960d0: 27b50094 */ addiu $s5,$sp,0x94 -/* f0960d4: 27b4009c */ addiu $s4,$sp,0x9c -/* f0960d8: 24130026 */ addiu $s3,$zero,0x26 -/* f0960dc: 8e4e04b4 */ lw $t6,0x4b4($s2) -.L0f0960e0: -/* f0960e0: 566e0003 */ bnel $s3,$t6,.L0f0960f0 -/* f0960e4: 8e2f0008 */ lw $t7,0x8($s1) -/* f0960e8: ae200008 */ sw $zero,0x8($s1) -/* f0960ec: 8e2f0008 */ lw $t7,0x8($s1) -.L0f0960f0: -/* f0960f0: 55e0008b */ bnezl $t7,.L0f096320 -/* f0960f4: 8e31000c */ lw $s1,0xc($s1) -/* f0960f8: 0fc2556c */ jal objFindByTagId -/* f0960fc: 8e240004 */ lw $a0,0x4($s1) -/* f096100: 10400086 */ beqz $v0,.L0f09631c -/* f096104: 00408025 */ or $s0,$v0,$zero -/* f096108: 8c430014 */ lw $v1,0x14($v0) -/* f09610c: 50600084 */ beqzl $v1,.L0f096320 -/* f096110: 8e31000c */ lw $s1,0xc($s1) -/* f096114: 90780001 */ lbu $t8,0x1($v1) -/* f096118: 33190002 */ andi $t9,$t8,0x2 -/* f09611c: 53200080 */ beqzl $t9,.L0f096320 -/* f096120: 8e31000c */ lw $s1,0xc($s1) -/* f096124: c4640014 */ lwc1 $f4,0x14($v1) -/* f096128: 44803000 */ mtc1 $zero,$f6 -/* f09612c: 00000000 */ nop -/* f096130: 4604303e */ c.le.s $f6,$f4 -/* f096134: 00000000 */ nop -/* f096138: 45020079 */ bc1fl .L0f096320 -/* f09613c: 8e31000c */ lw $s1,0xc($s1) -/* f096140: 0fc21a6a */ jal objIsHealthy -/* f096144: 00402025 */ or $a0,$v0,$zero -/* f096148: 50400075 */ beqzl $v0,.L0f096320 -/* f09614c: 8e31000c */ lw $s1,0xc($s1) -/* f096150: 44804000 */ mtc1 $zero,$f8 -/* f096154: 3c01bf80 */ lui $at,0xbf80 -/* f096158: 44816000 */ mtc1 $at,$f12 -/* f09615c: 4608b032 */ c.eq.s $f22,$f8 -/* f096160: 02802825 */ or $a1,$s4,$zero -/* f096164: 02a03025 */ or $a2,$s5,$zero -/* f096168: 02c03825 */ or $a3,$s6,$zero -/* f09616c: 45030010 */ bc1tl .L0f0961b0 -/* f096170: 4616603c */ c.lt.s $f12,$f22 -/* f096174: 8e020014 */ lw $v0,0x14($s0) -/* f096178: 8e430284 */ lw $v1,0x284($s2) -/* f09617c: c44a0008 */ lwc1 $f10,0x8($v0) -/* f096180: c4701bb0 */ lwc1 $f16,0x1bb0($v1) -/* f096184: c4520010 */ lwc1 $f18,0x10($v0) -/* f096188: c4641bb8 */ lwc1 $f4,0x1bb8($v1) -/* f09618c: 46105001 */ sub.s $f0,$f10,$f16 -/* f096190: 46049081 */ sub.s $f2,$f18,$f4 -/* f096194: 46000182 */ mul.s $f6,$f0,$f0 -/* f096198: 00000000 */ nop -/* f09619c: 46021202 */ mul.s $f8,$f2,$f2 -/* f0961a0: 46083300 */ add.s $f12,$f6,$f8 -/* f0961a4: 4616b582 */ mul.s $f22,$f22,$f22 -/* f0961a8: 00000000 */ nop -/* f0961ac: 4616603c */ c.lt.s $f12,$f22 -.L0f0961b0: -/* f0961b0: 00000000 */ nop -/* f0961b4: 4502005a */ bc1fl .L0f096320 -/* f0961b8: 8e31000c */ lw $s1,0xc($s1) -/* f0961bc: 0fc22677 */ jal func0f0899dc -/* f0961c0: 8e040014 */ lw $a0,0x14($s0) -/* f0961c4: 10400055 */ beqz $v0,.L0f09631c -/* f0961c8: 02802025 */ or $a0,$s4,$zero -/* f0961cc: 27a80070 */ addiu $t0,$sp,0x70 -/* f0961d0: afa80010 */ sw $t0,0x10($sp) -/* f0961d4: 02a02825 */ or $a1,$s5,$zero -/* f0961d8: 02c03025 */ or $a2,$s6,$zero -/* f0961dc: 0fc1a00f */ jal func0f06803c -/* f0961e0: 27a70078 */ addiu $a3,$sp,0x78 -/* f0961e4: 0fc2d5fe */ jal currentPlayerGetScreenLeft -/* f0961e8: 00000000 */ nop -/* f0961ec: c7aa0078 */ lwc1 $f10,0x78($sp) -/* f0961f0: 460a003c */ c.lt.s $f0,$f10 -/* f0961f4: 00000000 */ nop -/* f0961f8: 45020049 */ bc1fl .L0f096320 -/* f0961fc: 8e31000c */ lw $s1,0xc($s1) -/* f096200: 0fc2d5fe */ jal currentPlayerGetScreenLeft -/* f096204: 00000000 */ nop -/* f096208: 0fc2d5f6 */ jal currentPlayerGetScreenWidth -/* f09620c: 46000506 */ mov.s $f20,$f0 -/* f096210: 46140480 */ add.s $f18,$f0,$f20 -/* f096214: c7b00078 */ lwc1 $f16,0x78($sp) -/* f096218: 4612803c */ c.lt.s $f16,$f18 -/* f09621c: 00000000 */ nop -/* f096220: 4502003f */ bc1fl .L0f096320 -/* f096224: 8e31000c */ lw $s1,0xc($s1) -/* f096228: 0fc2d5fe */ jal currentPlayerGetScreenLeft -/* f09622c: 00000000 */ nop -/* f096230: c7a40070 */ lwc1 $f4,0x70($sp) -/* f096234: 4604003c */ c.lt.s $f0,$f4 -/* f096238: 00000000 */ nop -/* f09623c: 45020038 */ bc1fl .L0f096320 -/* f096240: 8e31000c */ lw $s1,0xc($s1) -/* f096244: 0fc2d5fe */ jal currentPlayerGetScreenLeft -/* f096248: 00000000 */ nop -/* f09624c: 0fc2d5f6 */ jal currentPlayerGetScreenWidth -/* f096250: 46000506 */ mov.s $f20,$f0 -/* f096254: 46140200 */ add.s $f8,$f0,$f20 -/* f096258: c7a60070 */ lwc1 $f6,0x70($sp) -/* f09625c: 4608303c */ c.lt.s $f6,$f8 -/* f096260: 00000000 */ nop -/* f096264: 4502002e */ bc1fl .L0f096320 -/* f096268: 8e31000c */ lw $s1,0xc($s1) -/* f09626c: 0fc2d602 */ jal currentPlayerGetScreenTop -/* f096270: 00000000 */ nop -/* f096274: c7aa007c */ lwc1 $f10,0x7c($sp) -/* f096278: 460a003c */ c.lt.s $f0,$f10 -/* f09627c: 00000000 */ nop -/* f096280: 45020027 */ bc1fl .L0f096320 -/* f096284: 8e31000c */ lw $s1,0xc($s1) -/* f096288: 0fc2d602 */ jal currentPlayerGetScreenTop -/* f09628c: 00000000 */ nop -/* f096290: 0fc2d5fa */ jal currentPlayerGetScreenHeight -/* f096294: 46000506 */ mov.s $f20,$f0 -/* f096298: 46140480 */ add.s $f18,$f0,$f20 -/* f09629c: c7b0007c */ lwc1 $f16,0x7c($sp) -/* f0962a0: 4612803c */ c.lt.s $f16,$f18 -/* f0962a4: 00000000 */ nop -/* f0962a8: 4502001d */ bc1fl .L0f096320 -/* f0962ac: 8e31000c */ lw $s1,0xc($s1) -/* f0962b0: 0fc2d602 */ jal currentPlayerGetScreenTop -/* f0962b4: 00000000 */ nop -/* f0962b8: c7a40074 */ lwc1 $f4,0x74($sp) -/* f0962bc: 4604003c */ c.lt.s $f0,$f4 -/* f0962c0: 00000000 */ nop -/* f0962c4: 45020016 */ bc1fl .L0f096320 -/* f0962c8: 8e31000c */ lw $s1,0xc($s1) -/* f0962cc: 0fc2d602 */ jal currentPlayerGetScreenTop -/* f0962d0: 00000000 */ nop -/* f0962d4: 0fc2d5fa */ jal currentPlayerGetScreenHeight -/* f0962d8: 46000506 */ mov.s $f20,$f0 -/* f0962dc: 46140200 */ add.s $f8,$f0,$f20 -/* f0962e0: c7a60074 */ lwc1 $f6,0x74($sp) -/* f0962e4: 24090001 */ addiu $t1,$zero,0x1 -/* f0962e8: 4608303c */ c.lt.s $f6,$f8 -/* f0962ec: 00000000 */ nop -/* f0962f0: 4502000b */ bc1fl .L0f096320 -/* f0962f4: 8e31000c */ lw $s1,0xc($s1) -/* f0962f8: ae290008 */ sw $t1,0x8($s1) -/* f0962fc: 8e4a04b4 */ lw $t2,0x4b4($s2) -/* f096300: 566a0007 */ bnel $s3,$t2,.L0f096320 -/* f096304: 8e31000c */ lw $s1,0xc($s1) -/* f096308: 0fc68606 */ jal dtGetData -/* f09630c: 00000000 */ nop -/* f096310: 904c0000 */ lbu $t4,0x0($v0) -/* f096314: 358d0008 */ ori $t5,$t4,0x8 -/* f096318: a04d0000 */ sb $t5,0x0($v0) -.L0f09631c: -/* f09631c: 8e31000c */ lw $s1,0xc($s1) -.L0f096320: -/* f096320: 5620ff6f */ bnezl $s1,.L0f0960e0 -/* f096324: 8e4e04b4 */ lw $t6,0x4b4($s2) -.L0f096328: -/* f096328: 8fbf004c */ lw $ra,0x4c($sp) -/* f09632c: d7b40020 */ ldc1 $f20,0x20($sp) -/* f096330: d7b60028 */ ldc1 $f22,0x28($sp) -/* f096334: 8fb00030 */ lw $s0,0x30($sp) -/* f096338: 8fb10034 */ lw $s1,0x34($sp) -/* f09633c: 8fb20038 */ lw $s2,0x38($sp) -/* f096340: 8fb3003c */ lw $s3,0x3c($sp) -/* f096344: 8fb40040 */ lw $s4,0x40($sp) -/* f096348: 8fb50044 */ lw $s5,0x44($sp) -/* f09634c: 8fb60048 */ lw $s6,0x48($sp) -/* f096350: 03e00008 */ jr $ra -/* f096354: 27bd00b0 */ addiu $sp,$sp,0xb0 -/* f096358: 00000000 */ nop -/* f09635c: 00000000 */ nop -); +void objectiveCheckHolograph(f32 maxdist) +{ + struct criteria_holograph *criteria = g_HolographCriterias; + + while (criteria) { + if (g_Vars.stagenum == STAGE_CITRAINING) { + criteria->status = OBJECTIVE_INCOMPLETE; + } + + if (criteria->status == OBJECTIVE_INCOMPLETE) { + struct defaultobj *obj = objFindByTagId(criteria->obj); + u32 stack; + + if (obj && obj->prop + && (obj->prop->flags & PROPFLAG_02) + && obj->prop->z >= 0 + && objIsHealthy(obj)) { + f32 sp9c[2]; + f32 sp94[2]; + f32 sp8c[2]; + f32 dist = -1; + + if (maxdist != 0.0f) { + f32 xdiff = obj->prop->pos.x - g_Vars.currentplayer->cam_pos.x; + f32 zdiff = obj->prop->pos.z - g_Vars.currentplayer->cam_pos.z; + dist = xdiff * xdiff + zdiff * zdiff; + maxdist = maxdist * maxdist; + } + + if (dist < maxdist && func0f0899dc(obj->prop, sp9c, sp94, sp8c)) { + f32 sp78[2]; + f32 sp70[2]; + func0f06803c(sp9c, sp94, sp8c, sp78, sp70); + + if (sp78[0] > currentPlayerGetScreenLeft() + && sp78[0] < currentPlayerGetScreenLeft() + currentPlayerGetScreenWidth() + && sp70[0] > currentPlayerGetScreenLeft() + && sp70[0] < currentPlayerGetScreenLeft() + currentPlayerGetScreenWidth() + && sp78[1] > currentPlayerGetScreenTop() + && sp78[1] < currentPlayerGetScreenTop() + currentPlayerGetScreenHeight() + && sp70[1] > currentPlayerGetScreenTop() + && sp70[1] < currentPlayerGetScreenTop() + currentPlayerGetScreenHeight()) { + criteria->status = OBJECTIVE_COMPLETE; + + if (g_Vars.stagenum == STAGE_CITRAINING) { + struct trainingdata *data = dtGetData(); + data->holographedpc = true; + } + } + } + } + } + + criteria = criteria->next; + } +} diff --git a/src/include/game/game_095320.h b/src/include/game/game_095320.h index 9471b2827..5a3048cb7 100644 --- a/src/include/game/game_095320.h +++ b/src/include/game/game_095320.h @@ -17,7 +17,7 @@ void objectivesShowHudmsg(char *buffer, s32 hudmsgtype); void objectivesCheckAll(void); void objectiveCheckRoomEntered(s32 currentroom); void objectiveCheckMultiroomEntered(s32 arg0, s16 *requiredrooms); -void objectiveCheckHolograph(s32 arg0); +void objectiveCheckHolograph(f32 sqdist); struct prop *chopperGetTargetProp(struct chopperobj *heli); struct defaultobj *objFindByTagId(s32 tag_id); struct tag *tagFindById(s32 tag_id); diff --git a/src/include/game/propobj.h b/src/include/game/propobj.h index ca29d99ee..0aa9c4a56 100644 --- a/src/include/game/propobj.h +++ b/src/include/game/propobj.h @@ -50,7 +50,7 @@ u32 func0f067bc4(void); u32 func0f067d88(void); bool func0f067dc4(struct model *model, f32 *arg1, f32 *arg2, f32 *arg3, f32 *arg4); bool modelSetRedBox(struct model *model, f32 *arg1, f32 *arg2, f32 *arg3, f32 *arg4); -u32 func0f06803c(void); +void func0f06803c(f32 *arg0, f32 *arg1, f32 *arg2, f32 *arg3, f32 *arg4); struct defaultobj *objFindByPadNum(s32 padnum); u32 func0f068218(void); void func0f0682dc(struct obj48 *obj48); @@ -248,7 +248,7 @@ void weaponGetPickupText(char *buffer, s32 weaponnum, bool dual); void currentPlayerQueuePickupWeaponHudmsg(u32 weaponnum, bool dual); u32 func0f088840(struct prop *prop, bool showhudmsg); u32 func0f089014(void); -u32 func0f0899dc(void); +bool func0f0899dc(struct prop *prop, f32 *arg0, f32 *arg1, f32 *arg2); void func0f089a94(bool arg0, struct model *model); u32 func0f089c70(void); u32 func0f089d64(void);