diff --git a/src/game/game_097ba0.c b/src/game/game_097ba0.c index 1276a5dd8..03cdc2790 100644 --- a/src/game/game_097ba0.c +++ b/src/game/game_097ba0.c @@ -22800,7 +22800,7 @@ glabel func0f0abcb0 /* f0abcd4: 8c4f192c */ lw $t7,0x192c($v0) /* f0abcd8: 15e00009 */ bnez $t7,.L0f0abd00 /* f0abcdc: 00000000 */ sll $zero,$zero,0x0 -/* f0abce0: 0fc2c7d6 */ jal func0f0b1f58 +/* f0abce0: 0fc2c7d6 */ jal currentPlayerGetSight /* f0abce4: 00000000 */ sll $zero,$zero,0x0 /* f0abce8: 02002025 */ or $a0,$s0,$zero /* f0abcec: 24050001 */ addiu $a1,$zero,0x1 @@ -22809,7 +22809,7 @@ glabel func0f0abcb0 /* f0abcf8: 10000008 */ beqz $zero,.L0f0abd1c /* f0abcfc: 00408025 */ or $s0,$v0,$zero .L0f0abd00: -/* f0abd00: 0fc2c7d6 */ jal func0f0b1f58 +/* f0abd00: 0fc2c7d6 */ jal currentPlayerGetSight /* f0abd04: 00000000 */ sll $zero,$zero,0x0 /* f0abd08: 02002025 */ or $a0,$s0,$zero /* f0abd0c: 00002825 */ or $a1,$zero,$zero diff --git a/src/game/game_0b0420.c b/src/game/game_0b0420.c index d6d1c8167..696cfcbab 100644 --- a/src/game/game_0b0420.c +++ b/src/game/game_0b0420.c @@ -24,79 +24,6 @@ const u32 var7f1acdd0[] = {0x3dcccccd}; const u32 var7f1acdd4[] = {0x3dcccccd}; -const u32 var7f1acdd8[] = {0x7f0b1fe0}; -const u32 var7f1acddc[] = {0x7f0b1fe0}; -const u32 var7f1acde0[] = {0x7f0b1fe0}; -const u32 var7f1acde4[] = {0x7f0b1fe0}; -const u32 var7f1acde8[] = {0x7f0b1fe8}; -const u32 var7f1acdec[] = {0x7f0b1fe8}; -const u32 var7f1acdf0[] = {0x7f0b1ff0}; -const u32 var7f1acdf4[] = {0x7f0b1ff8}; -const u32 var7f1acdf8[] = {0x7f0b1fe0}; -const u32 var7f1acdfc[] = {0x7f0b1fe0}; -const u32 var7f1ace00[] = {0x7f0b1fe0}; -const u32 var7f1ace04[] = {0x7f0b1fe0}; -const u32 var7f1ace08[] = {0x7f0b1ff8}; -const u32 var7f1ace0c[] = {0x7f0b1fe0}; -const u32 var7f1ace10[] = {0x7f0b1fe8}; -const u32 var7f1ace14[] = {0x7f0b1fe8}; -const u32 var7f1ace18[] = {0x7f0b1fe8}; -const u32 var7f1ace1c[] = {0x7f0b1fe8}; -const u32 var7f1ace20[] = {0x7f0b1fe8}; -const u32 var7f1ace24[] = {0x7f0b1fe0}; -const u32 var7f1ace28[] = {0x7f0b1ff0}; -const u32 var7f1ace2c[] = {0x7f0b1fe8}; -const u32 var7f1ace30[] = {0x7f0b1ff8}; -const u32 var7f1ace34[] = {0x7f0b1fe0}; -const u32 var7f1ace38[] = {0x7f0b1fe0}; -const u32 var7f1ace3c[] = {0x7f0b1fe0}; -const u32 var7f1ace40[] = {0x7f0b1fe0}; -const u32 var7f1ace44[] = {0x7f0b1fe0}; -const u32 var7f1ace48[] = {0x7f0b1fe0}; -const u32 var7f1ace4c[] = {0x7f0b1fe0}; -const u32 var7f1ace50[] = {0x7f0b1fe0}; -const u32 var7f1ace54[] = {0x7f0b1fe0}; -const u32 var7f1ace58[] = {0x7f0b1fe0}; -const u32 var7f1ace5c[] = {0x7f0b1fe0}; -const u32 var7f1ace60[] = {0x7f0b1fe0}; -const u32 var7f1ace64[] = {0x7f0b2008}; -const u32 var7f1ace68[] = {0x7f0b2000}; -const u32 var7f1ace6c[] = {0x7f0b2000}; -const u32 var7f1ace70[] = {0x7f0b2000}; -const u32 var7f1ace74[] = {0x7f0b2000}; -const u32 var7f1ace78[] = {0x7f0b2000}; -const u32 var7f1ace7c[] = {0x7f0b2000}; -const u32 var7f1ace80[] = {0x7f0b2000}; -const u32 var7f1ace84[] = {0x7f0b2000}; -const u32 var7f1ace88[] = {0x7f0b2008}; -const u32 var7f1ace8c[] = {0x7f0b2008}; -const u32 var7f1ace90[] = {0x7f0b2008}; -const u32 var7f1ace94[] = {0x7f0b2008}; -const u32 var7f1ace98[] = {0x7f0b2008}; -const u32 var7f1ace9c[] = {0x7f0b2008}; -const u32 var7f1acea0[] = {0x7f0b1fd8}; -const u32 var7f1acea4[] = {0x7f0b2008}; -const u32 var7f1acea8[] = {0x7f0b2008}; -const u32 var7f1aceac[] = {0x7f0b1fe0}; - -const char var7f1aceb0[] = "MOT : Type 1 = %d/%d (%d)"; -const char var7f1acecc[] = "MOT : Type 2 = %d/%d (%d)"; -const char var7f1acee8[] = "MOT : Type 3 = %d/%d (%d)"; -const char var7f1acf04[] = "MOT : Type OI = %d/%d/%d/%d"; -const char var7f1acf20[] = "MOT : Type OA = %d/%d/%d/%d"; -const char var7f1acf3c[] = "MOT : g_ObjCount = %d"; -const char var7f1acf54[] = "MOT : g_AnimCount = %d"; -const char var7f1acf6c[] = "Allocating %d bytes for objinst structure\n"; -const char var7f1acf98[] = "MotInst: Using cache entry type 1 %d (0x%08x) - Bytes=%d\n"; -const char var7f1acfd4[] = "MotInst: Using cache entry type 2 %d (0x%08x) - Bytes=%d\n"; -const char var7f1ad010[] = "MotInst: Using cache entry type 3 %d (0x%08x) - Bytes=%d\n"; -const char var7f1ad04c[] = "***************************************\n"; -const char var7f1ad078[] = "***************************************\n"; -const char var7f1ad0a4[] = "\nMotInst: Freeing type 2 cache entry %d (0x%08x)\n\n"; -const char var7f1ad0d8[] = "\nMotInst: Freeing type 3 cache entry %d (0x%08x)\n\n"; -const char var7f1ad10c[] = "MotInst -> Attempt to free item not in cache\n"; - -const u32 var7f1ad13c[] = {0x00000000}; GLOBAL_ASM( glabel func0f0b0420 @@ -2137,62 +2064,74 @@ glabel func0f0b1ee8 /* f0b1f54: 01201025 */ or $v0,$t1,$zero ); -GLOBAL_ASM( -glabel func0f0b1f58 -/* f0b1f58: 3c02800a */ lui $v0,0x800a -/* f0b1f5c: 8c42a244 */ lw $v0,-0x5dbc($v0) -/* f0b1f60: 27bdffe8 */ addiu $sp,$sp,-24 -/* f0b1f64: afbf0014 */ sw $ra,0x14($sp) -/* f0b1f68: 9045063b */ lbu $a1,0x63b($v0) -/* f0b1f6c: 0fc2c401 */ jal weaponGetFunctionById -/* f0b1f70: 90440638 */ lbu $a0,0x638($v0) -/* f0b1f74: 10400008 */ beqz $v0,.L0f0b1f98 -/* f0b1f78: 00000000 */ sll $zero,$zero,0x0 -/* f0b1f7c: 8c4e0000 */ lw $t6,0x0($v0) -/* f0b1f80: 24010003 */ addiu $at,$zero,0x3 -/* f0b1f84: 31cf00ff */ andi $t7,$t6,0xff -/* f0b1f88: 15e10003 */ bne $t7,$at,.L0f0b1f98 -/* f0b1f8c: 00000000 */ sll $zero,$zero,0x0 -/* f0b1f90: 1000001e */ beqz $zero,.L0f0b200c -/* f0b1f94: 24020007 */ addiu $v0,$zero,0x7 -.L0f0b1f98: -/* f0b1f98: 0fc41b99 */ jal cheatIsActive -/* f0b1f9c: 2404000f */ addiu $a0,$zero,0xf -/* f0b1fa0: 10400003 */ beqz $v0,.L0f0b1fb0 -/* f0b1fa4: 3c18800a */ lui $t8,0x800a -/* f0b1fa8: 10000018 */ beqz $zero,.L0f0b200c -/* f0b1fac: 24020001 */ addiu $v0,$zero,0x1 -.L0f0b1fb0: -/* f0b1fb0: 8f18a244 */ lw $t8,-0x5dbc($t8) -/* f0b1fb4: 93190638 */ lbu $t9,0x638($t8) -/* f0b1fb8: 2f210036 */ sltiu $at,$t9,0x36 -/* f0b1fbc: 10200012 */ beqz $at,.L0f0b2008 -/* f0b1fc0: 0019c880 */ sll $t9,$t9,0x2 -/* f0b1fc4: 3c017f1b */ lui $at,%hi(var7f1acdd8) -/* f0b1fc8: 00390821 */ addu $at,$at,$t9 -/* f0b1fcc: 8c39cdd8 */ lw $t9,%lo(var7f1acdd8)($at) -/* f0b1fd0: 03200008 */ jr $t9 -/* f0b1fd4: 00000000 */ sll $zero,$zero,0x0 -/* f0b1fd8: 1000000c */ beqz $zero,.L0f0b200c -/* f0b1fdc: 24020007 */ addiu $v0,$zero,0x7 -/* f0b1fe0: 1000000a */ beqz $zero,.L0f0b200c -/* f0b1fe4: 00001025 */ or $v0,$zero,$zero -/* f0b1fe8: 10000008 */ beqz $zero,.L0f0b200c -/* f0b1fec: 24020005 */ addiu $v0,$zero,0x5 -/* f0b1ff0: 10000006 */ beqz $zero,.L0f0b200c -/* f0b1ff4: 24020004 */ addiu $v0,$zero,0x4 -/* f0b1ff8: 10000004 */ beqz $zero,.L0f0b200c -/* f0b1ffc: 24020006 */ addiu $v0,$zero,0x6 -/* f0b2000: 10000002 */ beqz $zero,.L0f0b200c -/* f0b2004: 24020001 */ addiu $v0,$zero,0x1 -.L0f0b2008: -/* f0b2008: 00001025 */ or $v0,$zero,$zero -.L0f0b200c: -/* f0b200c: 8fbf0014 */ lw $ra,0x14($sp) -/* f0b2010: 27bd0018 */ addiu $sp,$sp,0x18 -/* f0b2014: 03e00008 */ jr $ra -/* f0b2018: 00000000 */ sll $zero,$zero,0x0 -); +u32 currentPlayerGetSight(void) +{ + struct weaponfunc *func = weaponGetFunctionById(g_Vars.currentplayer->unk0638, g_Vars.currentplayer->unk063b); + + if (func && (func->type & 0xff) == INVENTORYFUNCTYPE_CLOSE) { + return SIGHT_NONE; + } + + if (cheatIsActive(CHEAT_CLASSICSIGHT)) { + return SIGHT_CLASSIC; + } + + switch (g_Vars.currentplayer->unk0638) { + case WEAPON_HORIZONSCANNER: + return SIGHT_NONE; + case WEAPON_NONE: + case WEAPON_UNARMED: + case WEAPON_FALCON2: + case WEAPON_FALCON2_SILENCER: + case WEAPON_DY357MAGNUM: + case WEAPON_DY357LX: + case WEAPON_CMP150: + case WEAPON_CYCLONE: + case WEAPON_RCP120: + case WEAPON_SHOTGUN: + case WEAPON_DEVASTATOR: + case WEAPON_ROCKETLAUNCHER: + case WEAPON_SLAYER: + case WEAPON_COMBATKNIFE: + case WEAPON_CROSSBOW: + case WEAPON_TRANQUILIZER: + case WEAPON_LASER: + case WEAPON_GRENADE: + case WEAPON_NBOMB: + case WEAPON_TIMEDMINE: + case WEAPON_PROXIMITYMINE: + case WEAPON_REMOTEMINE: + case WEAPON_ECMMINE: + return SIGHT_DEFAULT; + case WEAPON_FALCON2_SCOPE: + case WEAPON_MAGSEC4: + case WEAPON_SNIPERRIFLE: + case WEAPON_LAPTOPGUN: + case WEAPON_DRAGON: + case WEAPON_K7AVENGER: + case WEAPON_AR34: + case WEAPON_SUPERDRAGON: + return SIGHT_ZOOM; + case WEAPON_MAULER: + case WEAPON_REAPER: + return SIGHT_SKEDAR; + case WEAPON_PHOENIX: + case WEAPON_CALLISTONTG: + case WEAPON_FARSIGHTXR20: + return SIGHT_MAIAN; + case WEAPON_PP9I: + case WEAPON_CC13: + case WEAPON_KL01313: + case WEAPON_KF7SPECIAL: + case WEAPON_ZZT: + case WEAPON_DMC: + case WEAPON_AR53: + case WEAPON_RCP45: + return SIGHT_CLASSIC; + } + + return SIGHT_DEFAULT; +} GLOBAL_ASM( glabel func0f0b201c diff --git a/src/game/game_0b2150.c b/src/game/game_0b2150.c index aae105be7..c97c1f896 100644 --- a/src/game/game_0b2150.c +++ b/src/game/game_0b2150.c @@ -11,6 +11,23 @@ #include "lib/lib_09660.h" #include "types.h" +const char var7f1aceb0[] = "MOT : Type 1 = %d/%d (%d)"; +const char var7f1acecc[] = "MOT : Type 2 = %d/%d (%d)"; +const char var7f1acee8[] = "MOT : Type 3 = %d/%d (%d)"; +const char var7f1acf04[] = "MOT : Type OI = %d/%d/%d/%d"; +const char var7f1acf20[] = "MOT : Type OA = %d/%d/%d/%d"; +const char var7f1acf3c[] = "MOT : g_ObjCount = %d"; +const char var7f1acf54[] = "MOT : g_AnimCount = %d"; +const char var7f1acf6c[] = "Allocating %d bytes for objinst structure\n"; +const char var7f1acf98[] = "MotInst: Using cache entry type 1 %d (0x%08x) - Bytes=%d\n"; +const char var7f1acfd4[] = "MotInst: Using cache entry type 2 %d (0x%08x) - Bytes=%d\n"; +const char var7f1ad010[] = "MotInst: Using cache entry type 3 %d (0x%08x) - Bytes=%d\n"; +const char var7f1ad04c[] = "***************************************\n"; +const char var7f1ad078[] = "***************************************\n"; +const char var7f1ad0a4[] = "\nMotInst: Freeing type 2 cache entry %d (0x%08x)\n\n"; +const char var7f1ad0d8[] = "\nMotInst: Freeing type 3 cache entry %d (0x%08x)\n\n"; +const char var7f1ad10c[] = "MotInst -> Attempt to free item not in cache\n"; + GLOBAL_ASM( glabel func0f0b2150 /* f0b2150: 27bdffb0 */ addiu $sp,$sp,-80 diff --git a/src/game/game_0dcdb0.c b/src/game/game_0dcdb0.c index 4d0f57696..06260575a 100644 --- a/src/game/game_0dcdb0.c +++ b/src/game/game_0dcdb0.c @@ -4376,7 +4376,7 @@ glabel func0f0dcdbc /* f0dce9c: 2f020001 */ sltiu $v0,$t8,0x1 /* f0dcea0: 50400011 */ beqzl $v0,.L0f0dcee8 /* f0dcea4: 8fbf0014 */ lw $ra,0x14($sp) -/* f0dcea8: 0fc2c7d6 */ jal func0f0b1f58 +/* f0dcea8: 0fc2c7d6 */ jal currentPlayerGetSight /* f0dceac: 00000000 */ sll $zero,$zero,0x0 /* f0dceb0: 38590005 */ xori $t9,$v0,0x5 /* f0dceb4: 2f220001 */ sltiu $v0,$t9,0x1 diff --git a/src/include/constants.h b/src/include/constants.h index 98252619b..bfffa7b4f 100644 --- a/src/include/constants.h +++ b/src/include/constants.h @@ -1655,6 +1655,14 @@ #define SCREENSPLIT_HORIZONTAL 0 #define SCREENSPLIT_VERTICAL 1 +#define SIGHT_DEFAULT 0 +#define SIGHT_CLASSIC 1 +#define SIGHT_EMPTYBOX 3 +#define SIGHT_SKEDAR 4 +#define SIGHT_ZOOM 5 +#define SIGHT_MAIAN 6 +#define SIGHT_NONE 7 + #define SIMTYPE_GENERAL 0 #define SIMTYPE_PEACE 1 #define SIMTYPE_SHIELD 2 diff --git a/src/include/game/game_0b0420.h b/src/include/game/game_0b0420.h index 6b13a8bf6..04682079e 100644 --- a/src/include/game/game_0b0420.h +++ b/src/include/game/game_0b0420.h @@ -46,7 +46,7 @@ u32 func0f0b1e28(void); u32 func0f0b1e68(void); u32 func0f0b1ea8(void); u32 func0f0b1ee8(void); -u32 func0f0b1f58(void); +u32 currentPlayerGetSight(void); u32 func0f0b201c(void); u32 func0f0b20e8(void); u32 func0f0b2118(void); diff --git a/src/include/types.h b/src/include/types.h index a34d712a0..c6be16375 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -1463,6 +1463,9 @@ struct player { /*0x0634*/ u16 unk0634; /*0x0636*/ u16 unk0636; /*0x0638*/ u8 unk0638; + /*0x0639*/ u8 unk0639; + /*0x063a*/ u8 unk063a; + /*0x063b*/ u8 unk063b; /*0x063c*/ u32 unk063c; /*0x0640*/ u32 unk0640; /*0x0644*/ u32 unk0644;