diff --git a/src/files/setup/setupark.c b/src/files/setup/setupark.c index f036b782e..be4992e85 100644 --- a/src/files/setup/setupark.c +++ b/src/files/setup/setupark.c @@ -525,7 +525,7 @@ u8 func0403_stop_and_idle[] = { }; u8 func0404_init_drcaroll[] = { - set_self_chrflag(CHRCFLAG_01000000) + set_self_chrflag(CHRCFLAG_PUSHABLE) set_shield(100) set_ailist(CHR_SELF, GAILIST_IDLE) endlist diff --git a/src/files/setup/setupazt.c b/src/files/setup/setupazt.c index f73b17488..9fb06a94a 100644 --- a/src/files/setup/setupazt.c +++ b/src/files/setup/setupazt.c @@ -1493,7 +1493,7 @@ u8 func041c_president_waiting[] = { }; u8 func041d_president_running[] = { - set_self_chrflag(CHRCFLAG_01000000) + set_self_chrflag(CHRCFLAG_PUSHABLE) set_alertness(100) set_shotlist(AILIST_PRESIDENT_RUNNING) dprint 'R','E','S','T','A','R','T','\n',0, diff --git a/src/files/setup/setupcave.c b/src/files/setup/setupcave.c index 8ed3add22..ef9d84dd2 100644 --- a/src/files/setup/setupcave.c +++ b/src/files/setup/setupcave.c @@ -1037,7 +1037,7 @@ u8 func1004_guard_activation[] = { #define enable_takeover_guard2(chr, function) \ show_chr(chr) \ set_ailist(chr, function) \ - unset_chr_hiddenflag(chr, CHRHFLAG_40000000) \ + unset_chr_hiddenflag(chr, CHRHFLAG_ANTICANNOTPUSH) \ unset_chr_chrflag(chr, CHRCFLAG_HIDDEN) \ yield @@ -1089,7 +1089,7 @@ u8 func1004_guard_activation[] = { #define enable_bottom_guard(chr) \ show_chr(chr) \ set_ailist(chr, AILIST_INIT_POSTTAKEOVER_GUARD) \ - unset_chr_hiddenflag(chr, CHRHFLAG_40000000) \ + unset_chr_hiddenflag(chr, CHRHFLAG_ANTICANNOTPUSH) \ unset_chr_chrflag(chr, CHRCFLAG_HIDDEN) \ yield @@ -3982,7 +3982,7 @@ u8 func1024_double_dy357[] = { */ u8 func0416_watch_flag[] = { beginloop(0x00) - if_chr_has_hiddenflag(CHR_SELF, CHRHFLAG_40000000, /*goto*/ 0x31) + if_chr_has_hiddenflag(CHR_SELF, CHRHFLAG_ANTICANNOTPUSH, /*goto*/ 0x31) dprint 'F','L','A','G',' ','N','O','T',' ','S','E','T','\n',0, reloop(0x00) @@ -4321,27 +4321,27 @@ u8 func1032_unhide_guards_near_plane[] = { label(0x31) show_chr(0x1b) set_ailist(0x1b, 0x0422) - unset_chr_hiddenflag(0x1b, CHRHFLAG_40000000) + unset_chr_hiddenflag(0x1b, CHRHFLAG_ANTICANNOTPUSH) unset_chr_chrflag(0x1b, CHRCFLAG_HIDDEN) yield show_chr(0x19) set_ailist(0x19, AILIST_INIT_POSTTAKEOVER_GUARD) - unset_chr_hiddenflag(0x19, CHRHFLAG_40000000) + unset_chr_hiddenflag(0x19, CHRHFLAG_ANTICANNOTPUSH) unset_chr_chrflag(0x19, CHRCFLAG_HIDDEN) yield show_chr(0x1d) set_ailist(0x1d, AILIST_INIT_POSTTAKEOVER_GUARD) - unset_chr_hiddenflag(0x1d, CHRHFLAG_40000000) + unset_chr_hiddenflag(0x1d, CHRHFLAG_ANTICANNOTPUSH) unset_chr_chrflag(0x1d, CHRCFLAG_HIDDEN) yield show_chr(0x1e) set_ailist(0x1e, AILIST_INIT_POSTTAKEOVER_GUARD) - unset_chr_hiddenflag(0x1e, CHRHFLAG_40000000) + unset_chr_hiddenflag(0x1e, CHRHFLAG_ANTICANNOTPUSH) unset_chr_chrflag(0x1e, CHRCFLAG_HIDDEN) yield show_chr(0x20) set_ailist(0x20, AILIST_INIT_POSTTAKEOVER_GUARD) - unset_chr_hiddenflag(0x20, CHRHFLAG_40000000) + unset_chr_hiddenflag(0x20, CHRHFLAG_ANTICANNOTPUSH) unset_chr_chrflag(0x20, CHRCFLAG_HIDDEN) set_ailist(CHR_SELF, GAILIST_IDLE) endlist diff --git a/src/files/setup/setupdam.c b/src/files/setup/setupdam.c index c990d7c16..5470edccd 100644 --- a/src/files/setup/setupdam.c +++ b/src/files/setup/setupdam.c @@ -651,7 +651,7 @@ struct path paths[] = { u8 func1001_objectives_failed_msg[] = { yield set_chr_chrflag(CHR_ELVIS, CHRCFLAG_KEEPCORPSEKO) - set_chr_chrflag(CHR_ELVIS, CHRCFLAG_01000000) + set_chr_chrflag(CHR_ELVIS, CHRCFLAG_PUSHABLE) set_chr_chrflag(CHR_LABTECH1, CHRCFLAG_KEEPCORPSEKO) set_chr_chrflag(CHR_LABTECH2, CHRCFLAG_KEEPCORPSEKO) set_chr_chrflag(CHR_LABTECH3, CHRCFLAG_KEEPCORPSEKO) diff --git a/src/files/setup/setuppam.c b/src/files/setup/setuppam.c index 3079fc2bc..8cdc7a968 100644 --- a/src/files/setup/setuppam.c +++ b/src/files/setup/setuppam.c @@ -747,7 +747,7 @@ u8 func1400_setup_counterop[] = { u8 func040b_init_elvis[] = { set_self_chrflag(CHRCFLAG_RUNFASTER) set_self_chrflag(CHRCFLAG_00040000) - set_self_chrflag(CHRCFLAG_01000000) + set_self_chrflag(CHRCFLAG_PUSHABLE) set_accuracy(100) set_reaction_speed(100) set_alertness(100) @@ -889,7 +889,7 @@ u8 func0402_elvis_follow_and_reactive_teleportals[] = { label(0x6f) label(0x2e) - unset_self_chrflag(CHRCFLAG_01000000) + unset_self_chrflag(CHRCFLAG_PUSHABLE) chr_do_animation(ANIM_OPERATE_0204, -1, -1, 0x02, 0x10, CHR_SELF, 2) beginloop(0x10) @@ -900,7 +900,7 @@ u8 func0402_elvis_follow_and_reactive_teleportals[] = { say_quip(CHR_BOND, 0x2c, 0xff, 0x03, 0xff, BANK_1, 0x00, 0x00) show_hudmsg(CHR_BOND, L_PAM(30)) // "Teleportals have been reactivated." set_stage_flag(STAGEFLAG_TELEPORTALS_ACTIVATED) - set_self_chrflag(CHRCFLAG_01000000) + set_self_chrflag(CHRCFLAG_PUSHABLE) play_sound(0x8148, -1) set_lights_state(0x003c, LIGHTOP_4, 0x00, 0xff, 0xb4) set_chr_chrflag(0x14, CHRCFLAG_00040000) @@ -1051,7 +1051,7 @@ u8 func0404_elvis_follow_and_do_agent_megaweapon[] = { label(0x6f) label(0x2e) - unset_self_chrflag(CHRCFLAG_01000000) + unset_self_chrflag(CHRCFLAG_PUSHABLE) restart_timer chr_do_animation(ANIM_OPERATE_0205, -1, -1, 0x00, 0x10, CHR_SELF, 2) @@ -1061,7 +1061,7 @@ u8 func0404_elvis_follow_and_do_agent_megaweapon[] = { label(0x06) say_quip(CHR_BOND, 0x2c, 0xff, 0x03, 0xff, BANK_1, 0x00, 0x00) - set_self_chrflag(CHRCFLAG_01000000) + set_self_chrflag(CHRCFLAG_PUSHABLE) show_hudmsg(CHR_BOND, L_PAM(20)) // "Cetan megaweapon has been disabled." set_stage_flag(STAGEFLAG_AGENT_MEGAWEAPON_DISABLED) set_stage_flag(STAGEFLAG_MEGAWEAPON_DISABLED) @@ -1223,7 +1223,7 @@ u8 func0406_elvis_follow_and_do_sa_megaweapon[] = { label(0x1b) set_stage_flag(STAGEFLAG_ELVIS_STARTED_SA_MEGAWEAPON) - unset_self_chrflag(CHRCFLAG_01000000) + unset_self_chrflag(CHRCFLAG_PUSHABLE) call_rng if_rand_lt(86, /*goto*/ 0x63) if_rand_lt(172, /*goto*/ 0x64) @@ -1252,7 +1252,7 @@ u8 func0406_elvis_follow_and_do_sa_megaweapon[] = { label(0x2e) say_quip(CHR_BOND, 0x2c, 0xff, 0x0f, 0xff, BANK_1, 0x00, 0x00) - set_self_chrflag(CHRCFLAG_01000000) + set_self_chrflag(CHRCFLAG_PUSHABLE) show_hudmsg(CHR_BOND, L_PAM(20)) // "Cetan megaweapon has been disabled." set_stage_flag(STAGEFLAG_MEGAWEAPON_DISABLED) try_equip_weapon(MODEL_CHRMAIANPISTOL, WEAPON_PHOENIX, 0x00000000, /*goto*/ 0x04) diff --git a/src/files/setup/setuprit.c b/src/files/setup/setuprit.c index aa632a5a6..d9d838820 100644 --- a/src/files/setup/setuprit.c +++ b/src/files/setup/setuprit.c @@ -828,9 +828,9 @@ u8 func1006_hijack[] = { set_chr_team(CHR_TRENT, TEAM_04) set_chr_team(CHR_BLONDE1, TEAM_04) set_chr_team(CHR_BLONDE2, TEAM_04) - unset_chr_hiddenflag(CHR_TRENT, CHRHFLAG_40000000) - unset_chr_hiddenflag(CHR_BLONDE1, CHRHFLAG_40000000) - unset_chr_hiddenflag(CHR_BLONDE2, CHRHFLAG_40000000) + unset_chr_hiddenflag(CHR_TRENT, CHRHFLAG_ANTICANNOTPUSH) + unset_chr_hiddenflag(CHR_BLONDE1, CHRHFLAG_ANTICANNOTPUSH) + unset_chr_hiddenflag(CHR_BLONDE2, CHRHFLAG_ANTICANNOTPUSH) unlock_door(OBJ_COCKPITDOOR, 0x40) rebuild_teams rebuild_squadrons @@ -1432,7 +1432,7 @@ u8 func0405_president_in_room[] = { }; u8 func0404_president_running[] = { - set_self_chrflag(CHRCFLAG_01000000) + set_self_chrflag(CHRCFLAG_PUSHABLE) set_shotlist(AILIST_PRESIDENT_RUNNING) set_target_chr(CHR_PRESET) if_chr_dead(CHR_SELF, /*goto*/ 0x06) @@ -3328,7 +3328,7 @@ u8 func0407_stewardess[] = { increase_squadron_alertness(100) label(0x0a) - set_self_chrflag(CHRCFLAG_01000000) + set_self_chrflag(CHRCFLAG_PUSHABLE) chr_do_animation(ANIM_COWER_0229, -1, 190, 0x10, 0x0a, CHR_SELF, 2) beginloop(0x83) @@ -3754,7 +3754,7 @@ u8 func101c_check_equipment_switch_destroyed[] = { }; u8 func040c_init_defend_pad[] = { - unset_chr_hiddenflag(CHR_SELF, CHRHFLAG_40000000) + unset_chr_hiddenflag(CHR_SELF, CHRHFLAG_ANTICANNOTPUSH) set_chr_team(CHR_SELF, TEAM_ALLY) rebuild_teams rebuild_squadrons @@ -3786,7 +3786,7 @@ u8 func040d_init_defend_president[] = { }; u8 func042c_remove_if_offscreen[] = { - unset_chr_hiddenflag(CHR_SELF, CHRHFLAG_40000000) + unset_chr_hiddenflag(CHR_SELF, CHRHFLAG_ANTICANNOTPUSH) set_chr_team(CHR_SELF, TEAM_ALLY) rebuild_teams rebuild_squadrons diff --git a/src/files/setup/setuptra.c b/src/files/setup/setuptra.c index 1981ea7f3..00ba83ae6 100644 --- a/src/files/setup/setuptra.c +++ b/src/files/setup/setuptra.c @@ -783,7 +783,7 @@ u8 func1007_check_medpack_collected[] = { }; u8 func0403_init_jonathan[] = { - set_self_chrflag(CHRCFLAG_01000000) + set_self_chrflag(CHRCFLAG_PUSHABLE) set_self_chrflag(CHRCFLAG_NOAUTOAIM) if_difficulty_gt(DIFF_A, /*goto*/ 0x32) @@ -967,7 +967,7 @@ u8 func0404_jonathan_following_and_mine[] = { // In mine room label(0x0a) - unset_self_chrflag(CHRCFLAG_01000000) + unset_self_chrflag(CHRCFLAG_PUSHABLE) set_stage_flag(STAGEFLAG_JON_ENTERED_MINE_ROOM) speak(CHR_P1P2, L_TRA(27), 0x12b5, CHANNEL_4, COLOR_03_RED) // "Right, we're near. Cover me, Jo..." set_shotlist(AILIST_JONATHAN_SHOT_WHILE_PLANTING) @@ -1023,7 +1023,7 @@ u8 func0404_jonathan_following_and_mine[] = { set_shotlist(AILIST_JONATHAN_FOLLOWING_AND_MINE) set_stage_flag(STAGEFLAG_JON_FINISHED_EXPLOSIVES) unset_stage_flag(STAGEFLAG_JON_SHOT_WHILE_PLANTING) - set_self_chrflag(CHRCFLAG_01000000) + set_self_chrflag(CHRCFLAG_PUSHABLE) speak(CHR_P1P2, L_TRA(28), 0x12b6, CHANNEL_4, COLOR_03_RED) // "Okay - stand back." run_to_pad(0x0140) @@ -1987,7 +1987,7 @@ u8 func100c_medpack_activation[] = { u8 func0412_init_elvis[] = { dprint 'E','L','V','I','S',' ','W','O','K','E','\n',0, stop_chr - set_self_chrflag(CHRCFLAG_01000000) + set_self_chrflag(CHRCFLAG_PUSHABLE) set_stage_flag(STAGEFLAG_ELVIS_REVIVED) label(0x0a) label(0x06) diff --git a/src/files/setup/setupwax.c b/src/files/setup/setupwax.c index 9b6872816..851946d4f 100644 --- a/src/files/setup/setupwax.c +++ b/src/files/setup/setupwax.c @@ -1257,7 +1257,7 @@ u8 func0410_init_searching_guard[] = { u8 func0412_init_cass[] = { set_chr_maxdamage(CHR_SELF, 40) - set_self_chrflag(CHRCFLAG_01000000) + set_self_chrflag(CHRCFLAG_PUSHABLE) set_ailist(CHR_SELF, AILIST_CASS_IN_OFFICE) endlist }; diff --git a/src/game/bondbike.c b/src/game/bondbike.c index 979dd8e1b..a0e54aa81 100644 --- a/src/game/bondbike.c +++ b/src/game/bondbike.c @@ -1178,7 +1178,7 @@ glabel func0f0d3298 /* f0d32ac: 24010001 */ addiu $at,$zero,0x1 /* f0d32b0: 10410055 */ beq $v0,$at,.L0f0d3408 /* f0d32b4: afa20034 */ sw $v0,0x34($sp) -/* f0d32b8: 0c0093ac */ jal func00024eb0 +/* f0d32b8: 0c0093ac */ jal cdGetObstacle /* f0d32bc: 00000000 */ nop /* f0d32c0: 10400051 */ beqz $v0,.L0f0d3408 /* f0d32c4: 3c05800a */ lui $a1,%hi(g_Vars) diff --git a/src/game/bondeyespy.c b/src/game/bondeyespy.c index 5ffa766b2..6ec55aaa3 100644 --- a/src/game/bondeyespy.c +++ b/src/game/bondeyespy.c @@ -110,7 +110,7 @@ s32 eyespyCalculateNewY(f32 yvel) result = func0002a684(&dstpos, 26, dstrooms, sp4c, 1, 15, f0); propSetCollisionsEnabled(prop, true); - if (result == 1) { + if (result == CDRESULT_NOCOLLISION) { prop->pos.y = dstpos.y; func0f065c44(prop); roomsCopy(dstrooms, prop->rooms); @@ -185,15 +185,15 @@ s32 eyespyCalculateNewPosition(struct coord *vel) if (xdiff > halflimit || zdiff > halflimit || xdiff < -halflimit || zdiff < -halflimit) { result = func0002d95c(&eyespyprop->pos, eyespyprop->rooms, &dstpos, dstrooms, limit, sp70, 1, 15, f18); - if (result == 1) { + if (result == CDRESULT_NOCOLLISION) { result = func0002a9f0(&eyespyprop->pos, &dstpos, limit, dstrooms, sp70, 1, 15, f18); } } else { result = func0002a9f0(&eyespyprop->pos, &dstpos, limit, sp74, sp70, 1, 15, f18); } - if (result == 0) { - prop = func00024eb0(); + if (result == CDRESULT_COLLISION) { + prop = cdGetObstacle(); if (prop && prop->type == PROPTYPE_PLAYER) { playernum = g_Vars.currentplayernum; @@ -206,7 +206,7 @@ s32 eyespyCalculateNewPosition(struct coord *vel) propSetCollisionsEnabled(eyespyprop, true); - if (result == 1) { + if (result == CDRESULT_NOCOLLISION) { // Apply the destination eyespyprop->pos.x = dstpos.x; eyespyprop->pos.y = dstpos.y; @@ -223,13 +223,13 @@ s32 eyespyCalculateNewPosition(struct coord *vel) bool func0f0cf728(struct coord *vel) { - s32 moved = eyespyCalculateNewPosition(vel); + s32 result = eyespyCalculateNewPosition(vel); struct prop *prop; - if (moved != true) { + if (result != CDRESULT_NOCOLLISION) { var80070ec4 = 1; - prop = func00024eb0(); + prop = cdGetObstacle(); if (prop && g_Vars.lvupdate240 > 0) { if (prop->type == PROPTYPE_DOOR) { @@ -272,12 +272,11 @@ bool func0f0cf728(struct coord *vel) } } - return moved; + return result; } s32 func0f0cf890(struct coord *arg0, struct coord *arg1, struct coord *arg2, struct coord *arg3, struct coord *arg4) { - if (func00024ea4()) { struct coord sp24; s32 someint; @@ -407,15 +406,15 @@ s32 func0f0cfafc(struct coord *arg0, struct coord *arg1, struct coord *arg2) return false; } -bool func0f0cfdd0(struct coord *vel, struct coord *arg1, struct coord *arg2) +s32 func0f0cfdd0(struct coord *vel, struct coord *arg1, struct coord *arg2) { - bool moved = func0f0cf728(vel); + bool result = func0f0cf728(vel); - if (moved != true) { + if (result != CDRESULT_NOCOLLISION) { func00024e4c(arg1, arg2, 473, "bondeyespy.c"); } - return moved; + return result; } void eyespyCalculateVerticalMovement(void) @@ -445,7 +444,7 @@ void eyespyCalculateVerticalMovement(void) dist.y = 0; dist.z = g_Vars.currentplayer->eyespy->vel.z; - if (func0f0cfdd0(&dist, &spac, &spa0) == 0) { + if (func0f0cfdd0(&dist, &spac, &spa0) == CDRESULT_COLLISION) { if (func0f0cf890(&dist, &spac, &spa0, &sp60, &sp54)) { if (func0f0cf9f8(&dist, &spac, &spa0) <= 0) { func0f0cfafc(&dist, &spac, &spa0); diff --git a/src/game/bondgrab.c b/src/game/bondgrab.c index b6092e180..f885211ff 100644 --- a/src/game/bondgrab.c +++ b/src/game/bondgrab.c @@ -1086,7 +1086,7 @@ glabel func0f0cd970 /* f0cd988: 24010001 */ addiu $at,$zero,0x1 /* f0cd98c: 10410058 */ beq $v0,$at,.L0f0cdaf0 /* f0cd990: afa20034 */ sw $v0,0x34($sp) -/* f0cd994: 0c0093ac */ jal func00024eb0 +/* f0cd994: 0c0093ac */ jal cdGetObstacle /* f0cd998: 00000000 */ nop /* f0cd99c: 10400054 */ beqz $v0,.L0f0cdaf0 /* f0cd9a0: 3c04800a */ lui $a0,%hi(g_Vars) diff --git a/src/game/bondwalk.c b/src/game/bondwalk.c index d3d575f9a..48a45b447 100644 --- a/src/game/bondwalk.c +++ b/src/game/bondwalk.c @@ -40,7 +40,7 @@ void currentPlayerWalkInit(void) g_Vars.currentplayer->bondmovemode = MOVEMODE_WALK; g_Vars.currentplayer->bondonground = 0; - g_Vars.currentplayer->unk1aec = 0; + g_Vars.currentplayer->tank = NULL; g_Vars.currentplayer->unk1af0 = NULL; g_Vars.currentplayer->unk1af4 = 0; @@ -110,7 +110,7 @@ void currentPlayerWalkInit(void) delta.z = g_Vars.currentplayer->walkinitpos.z - g_Vars.currentplayer->prop->pos.z; propSetCollisionsEnabled(g_Vars.currentplayer->hoverbike, false); - func0f0c4250(&delta, 0, 1, 0, 63); + func0f0c4250(&delta, 0, true, 0, 63); propSetCollisionsEnabled(g_Vars.currentplayer->hoverbike, true); } else if (prevmode != MOVEMODE_GRAB && prevmode != MOVEMODE_WALK) { g_Vars.currentplayer->moveinitspeed.x = 0; @@ -169,8 +169,6 @@ void func0f0c3b38(struct coord *reltarget, struct defaultobj *obj) func0f082e84(obj, &posunk, &vector, &tween, false); } -const char var7f1ad75c[] = "bondwalk.c"; - bool currentPlayerHasGapToCeiling(f32 y) { bool result; @@ -207,7 +205,7 @@ bool currentPlayerHasGapToCeiling(f32 y) propSetCollisionsEnabled(g_Vars.currentplayer->prop, true); - if (result == true) { + if (result == CDRESULT_NOCOLLISION) { g_Vars.currentplayer->prop->pos.y = newpos.y; func0f065c44(g_Vars.currentplayer->prop); roomsCopy(rooms, g_Vars.currentplayer->prop->rooms); @@ -220,7 +218,7 @@ bool currentPlayerHasGapToCeiling(f32 y) bool bwalkCalculateNewPosition(struct coord *vel, f32 rotateamount, bool apply, f32 extrawidth, s32 arg4) { - bool valid = true; + s32 result = CDRESULT_NOCOLLISION; f32 halfwidth; struct coord dstpos; s16 dstrooms[8]; @@ -245,8 +243,8 @@ bool bwalkCalculateNewPosition(struct coord *vel, f32 rotateamount, bool apply, dstpos.z = g_Vars.currentplayer->prop->pos.z; if (vel->x || vel->y || vel->z) { - if (g_Vars.currentplayer->unk1aec) { - propSetCollisionsEnabled(g_Vars.currentplayer->unk1aec, false); + if (g_Vars.currentplayer->tank) { + propSetCollisionsEnabled(g_Vars.currentplayer->tank, false); } propSetCollisionsEnabled(g_Vars.currentplayer->prop, false); @@ -274,20 +272,20 @@ bool bwalkCalculateNewPosition(struct coord *vel, f32 rotateamount, bool apply, halfwidth = width * 0.5f; if (xdiff > halfwidth || zdiff > halfwidth || xdiff < -halfwidth || zdiff < -halfwidth) { - valid = func0002d95c(&g_Vars.currentplayer->prop->pos, + result = func0002d95c(&g_Vars.currentplayer->prop->pos, g_Vars.currentplayer->prop->rooms, &dstpos, dstrooms, width, sp60, 1, ymax - g_Vars.currentplayer->prop->pos.y, ymin - g_Vars.currentplayer->prop->pos.y); - if (valid == true) { - valid = func0002a9f0(&g_Vars.currentplayer->prop->pos, + if (result == CDRESULT_NOCOLLISION) { + result = func0002a9f0(&g_Vars.currentplayer->prop->pos, &dstpos, width, dstrooms, sp60, 1, ymax - g_Vars.currentplayer->prop->pos.y, ymin - g_Vars.currentplayer->prop->pos.y); } } else { - valid = func0002a9f0(&g_Vars.currentplayer->prop->pos, + result = func0002a9f0(&g_Vars.currentplayer->prop->pos, &dstpos, width, sp64, sp60, 1, ymax - g_Vars.currentplayer->prop->pos.y, ymin - g_Vars.currentplayer->prop->pos.y); @@ -295,12 +293,12 @@ bool bwalkCalculateNewPosition(struct coord *vel, f32 rotateamount, bool apply, propSetCollisionsEnabled(g_Vars.currentplayer->prop, true); - if (g_Vars.currentplayer->unk1aec) { - propSetCollisionsEnabled(g_Vars.currentplayer->unk1aec, true); + if (g_Vars.currentplayer->tank) { + propSetCollisionsEnabled(g_Vars.currentplayer->tank, true); } } - if (valid == true && apply) { + if (result == CDRESULT_NOCOLLISION && apply) { f32 angle = g_Vars.currentplayer->vv_theta + (rotateamount * 360) / M_BADTAU; while (angle < 0) { @@ -325,9 +323,11 @@ bool bwalkCalculateNewPosition(struct coord *vel, f32 rotateamount, bool apply, g_Vars.enableslopes = true; - return valid; + return result; } +const char var7f1ad75c[] = "bondwalk.c"; + GLOBAL_ASM( glabel func0f0c4250 /* f0c4250: 27bdff58 */ addiu $sp,$sp,-168 @@ -342,7 +342,7 @@ glabel func0f0c4250 /* f0c4274: 24010001 */ addiu $at,$zero,0x1 /* f0c4278: 10410135 */ beq $v0,$at,.L0f0c4750 /* f0c427c: afa200a4 */ sw $v0,0xa4($sp) -/* f0c4280: 0c0093ac */ jal func00024eb0 +/* f0c4280: 0c0093ac */ jal cdGetObstacle /* f0c4284: 00000000 */ nop /* f0c4288: 10400131 */ beqz $v0,.L0f0c4750 /* f0c428c: afa200a0 */ sw $v0,0xa0($sp) @@ -671,11 +671,154 @@ glabel func0f0c4250 /* f0c4760: 00000000 */ nop ); -bool func0f0c4764(struct coord *delta, struct coord *arg1, struct coord *arg2, s32 arg3) -{ - bool result = func0f0c4250(delta, 0, true, 0, arg3); +// Mismatch: The below loads 0.5f twice in the chr push code while goal reuses it. +//bool func0f0c4250(struct coord *delta, f32 rotateamount, bool apply, f32 extrawidth, s32 arg4) +//{ +// s32 result = bwalkCalculateNewPosition(delta, rotateamount, apply, extrawidth, arg4); +// +// if (result != CDRESULT_NOCOLLISION) { +// struct prop *obstacle = cdGetObstacle(); +// +// if (obstacle && g_Vars.lvupdate240 > 0) { +// if (obstacle->type == PROPTYPE_DOOR) { +// struct doorobj *door = obstacle->door; +// struct coord sp90; +// struct coord sp84; +// struct coord sp78; +// +// if (door->doorflags & DOORFLAG_DAMAGEONCONTACT) { +// if (!g_Vars.currentplayer->isdead) { +// func00024e4c(&sp84, &sp78, 465, "bondwalk.c"); +// +// sp90.x = sp78.f[2] - sp84.f[2]; +// sp90.y = 0; +// sp90.z = sp84.f[0] - sp78.f[0]; +// +// if (sp90.f[0] || sp90.f[2]) { +// scaleTo1(&sp90.x, &sp90.y, &sp90.z); +// } else { +// sp90.z = 1; +// } +// +// func0f03417c(g_Vars.currentplayer->prop->chr, 0.4f, &sp90, 0, g_Vars.currentplayer->prop); +// +// // Laser zap sound +// audioStart(var80095200, 0xf2, 0, -1, -1, -1, -1, -1); +// } +// } +// } else if (obstacle->type == PROPTYPE_CHR) { +// struct chrdata *chr = obstacle->chr; +// struct coord newpos; +// s16 newrooms[8]; +// f32 movingdist; +// f32 xdist; +// f32 zdist; +// f32 disttochr; +// bool canpush = false; +// +// if (g_Vars.normmplayerisrunning) { +// if (chrCompareTeams(g_Vars.currentplayer->prop->chr, chr, COMPARE_FRIENDS)) { +// // AI bot on same team +// canpush = true; +// } +// } else if (chr->chrflags & CHRCFLAG_PUSHABLE) { +// if (g_Vars.antiplayernum < 0 +// || g_Vars.currentplayer != g_Vars.anti +// || (chr->hidden & CHRHFLAG_ANTICANNOTPUSH) == 0) { +// canpush = true; +// } +// } +// +// if (canpush) { +// movingdist = sqrtf(delta->f[0] * delta->f[0] + delta->f[2] * delta->f[2]) / g_Vars.lvupdate240f; +// +// xdist = obstacle->pos.x - g_Vars.currentplayer->prop->pos.x; +// zdist = obstacle->pos.z - g_Vars.currentplayer->prop->pos.z; +// +// if (xdist || zdist) { +// disttochr = sqrtf(xdist * xdist + zdist * zdist); +// +// if (disttochr > 0) { +// xdist *= (movingdist / disttochr); +// zdist *= (movingdist / disttochr); +// +// chr->pushspeed[0] = 0.5f * xdist; +// chr->pushspeed[1] = 0.5f * zdist; +// +// newpos.x = obstacle->pos.x + chr->pushspeed[0] * g_Vars.lvupdate240f; +// newpos.y = obstacle->pos.y; +// newpos.z = obstacle->pos.z + chr->pushspeed[1] * g_Vars.lvupdate240f; +// +// func0f01e7f4(chr, &newpos, newrooms, 0); +// +// obstacle->pos.x = newpos.x; +// obstacle->pos.y = newpos.y; +// obstacle->pos.z = newpos.z; +// +// func0f065c44(obstacle); +// roomsCopy(newrooms, obstacle->rooms); +// func0f0220ac(chr); +// modelSetRootPosition(chr->model, &newpos); +// +// result = bwalkCalculateNewPosition(delta, rotateamount, apply, extrawidth, arg4); +// } +// } +// } +// } else if (obstacle->type == PROPTYPE_PLAYER) { +// // empty +// } else if (obstacle->type == PROPTYPE_OBJ) { +// struct defaultobj *obj = obstacle->obj; +// bool dothething; +// +// if ((obj->hidden & OBJHFLAG_04000000) == 0 && (obj->hidden & OBJHFLAG_GRABBED) == 0) { +// if (g_Vars.currentplayer->unk1af0 == 0 && obj->type == OBJTYPE_TANK) { +// g_Vars.currentplayer->tank = obstacle; +// } else if (obj->flags3 & OBJFLAG3_PUSHABLE) { +// g_Vars.currentplayer->speedmaxtime60 = 0; +// dothething = true; +// +// if ((obj->hidden & OBJHFLAG_AIRBORNE) && +// (obj->projectile->flags & PROJECTILEFLAG_00001000)) { +// dothething = false; +// } +// +// if (dothething) { +// func0f0c3b38(delta, obj); +// +// if (obj->hidden & OBJHFLAG_AIRBORNE && (obj->projectile->flags & PROJECTILEFLAG_00000800)) { +// bool somevalue; +// bool somebool = false; +// somevalue = func0f073c6c(obj, &somebool); +// +// if (obj->hidden & OBJHFLAG_AIRBORNE) { +// obj->projectile->flags |= PROJECTILEFLAG_00001000; +// +// if (somevalue) { +// obj->projectile->flags |= PROJECTILEFLAG_00002000; +// } else { +// obj->projectile->flags &= ~PROJECTILEFLAG_00002000; +// } +// } +// +// if (somevalue) { +// result = bwalkCalculateNewPosition(delta, rotateamount, apply, extrawidth, arg4); +// } +// } +// } +// } +// } +// } +// } +// } +// +// return result; +//} - if (!result) { +s32 func0f0c4764(struct coord *delta, struct coord *arg1, struct coord *arg2, s32 arg3) +{ + s32 result = func0f0c4250(delta, 0, true, 0, arg3); + + if (result == CDRESULT_COLLISION) { func00024e4c(arg1, arg2, 0x25f, "bondwalk.c"); } @@ -693,13 +836,13 @@ s32 func0f0c47d0(struct coord *a, struct coord *b, struct coord *c, quarter.x = a->x * mult * 0.25f; quarter.y = a->y * mult * 0.25f; quarter.z = a->z * mult * 0.25f; - result = func0f0c4250(&quarter, 0, 1, 0, arg6); + result = func0f0c4250(&quarter, 0, true, 0, arg6); - if (result == 1) { - return 1; + if (result == CDRESULT_NOCOLLISION) { + return CDRESULT_NOCOLLISION; } - if (result == 0) { + if (result == CDRESULT_COLLISION) { func00024e4c(d, e, 0x27b, "bondwalk.c"); if (b->x != d->x @@ -708,12 +851,12 @@ s32 func0f0c47d0(struct coord *a, struct coord *b, struct coord *c, || c->x != e->x || c->y != e->y || c->z != e->z) { - return 0; + return CDRESULT_COLLISION; } } } - return -1; + return CDRESULT_ERROR; } s32 func0f0c494c(struct coord *a, struct coord *b, struct coord *c, s32 arg3) @@ -738,7 +881,7 @@ s32 func0f0c494c(struct coord *a, struct coord *b, struct coord *c, s32 arg3) sp2c.y = 0; sp2c.z = sp38.z * tmp; - return func0f0c4250(&sp2c, 0, 1, 0, arg3); + return func0f0c4250(&sp2c, 0, true, 0, arg3); } return -1; @@ -778,7 +921,7 @@ s32 func0f0c4a5c(struct coord *arg0, struct coord *arg1, struct coord *arg2, s32 sp28.y = 0; sp28.z = sp34.z; - if (func0f0c4250(&sp28, 0, 1, 0, arg3) == 1) { + if (func0f0c4250(&sp28, 0, true, 0, arg3) == 1) { return true; } } @@ -806,7 +949,7 @@ s32 func0f0c4a5c(struct coord *arg0, struct coord *arg1, struct coord *arg2, s32 sp28.y = 0; sp28.z = sp34.z; - if (func0f0c4250(&sp28, 0, 1, 0, arg3) == 1) { + if (func0f0c4250(&sp28, 0, true, 0, arg3) == 1) { return true; } } @@ -1042,7 +1185,7 @@ void currentPlayerUpdateVerticalMovement(void) g_Vars.currentplayer->vv_manground = sumground; } else { // Not enough room above. If on a hoverbike, blow it up - prop = func00024eb0(); + prop = cdGetObstacle(); if (prop && g_Vars.currentplayer->prop->pos.y < prop->pos.y @@ -1115,7 +1258,7 @@ void currentPlayerUpdateVerticalMovement(void) && g_Vars.currentplayer->vv_ground < g_Vars.currentplayer->vv_manground - 30) { // Not falling - but still at least 30 units off the ground. // Must be something in the way... - prop = func00024eb0(); + prop = cdGetObstacle(); if (prop) { if (prop->type == PROPTYPE_CHR) { @@ -1348,15 +1491,16 @@ void func0f0c6180(void) void func0f0c6318(void) { - f32 thing1; - f32 thing2; + f32 mult; + f32 rotateamount; struct coord delta = {0, 0, 0}; - thing1 = 159.0f / g_Vars.currentplayer->vv_eyeheight; - thing2 = g_Vars.currentplayer->speedtheta * thing1 + // Turn speed is calculated from the chr's height + mult = 159.0f / g_Vars.currentplayer->vv_eyeheight; + rotateamount = g_Vars.currentplayer->speedtheta * mult * g_Vars.lvupdate240freal * 0.0174505133f * 3.5f; - func0f0c4250(&delta, thing2, 1, 0, 63); + func0f0c4250(&delta, rotateamount, true, 0, 63); } u32 var80070e68 = 0x00000000; @@ -1376,7 +1520,7 @@ void func0f0c63bc(struct coord *arg0, u32 arg1, s32 arg2) func0f0c4d98(); - if (func0f0c4764(arg0, &sp100, &sp88, arg2) == 0) { + if (func0f0c4764(arg0, &sp100, &sp88, arg2) == CDRESULT_COLLISION) { struct coord sp76; struct coord sp64; @@ -1388,7 +1532,7 @@ void func0f0c63bc(struct coord *arg0, u32 arg1, s32 arg2) } if (arg1 - && func0f0c494c(arg0, &sp100, &sp88, arg2) < 1 + && func0f0c494c(arg0, &sp100, &sp88, arg2) <= CDRESULT_COLLISION && func0f0c4a5c(arg0, &sp100, &sp88, arg2) <= 0) { // empty } @@ -1401,8 +1545,8 @@ void func0f0c63bc(struct coord *arg0, u32 arg1, s32 arg2) } if (arg1 - && func0f0c494c(arg0, &sp76, &sp64, arg2) < 1 - && func0f0c494c(arg0, &sp100, &sp88, arg2) < 1 + && func0f0c494c(arg0, &sp76, &sp64, arg2) <= CDRESULT_COLLISION + && func0f0c494c(arg0, &sp100, &sp88, arg2) <= CDRESULT_COLLISION && func0f0c4a5c(arg0, &sp76, &sp64, arg2) < 1) { func0f0c4a5c(arg0, &sp100, &sp88, arg2); } diff --git a/src/game/chr/chraction.c b/src/game/chr/chraction.c index 2d18a5332..f63c78457 100644 --- a/src/game/chr/chraction.c +++ b/src/game/chr/chraction.c @@ -16310,7 +16310,7 @@ glabel var7f1a9184 /* f040b24: 27a40228 */ addiu $a0,$sp,0x228 /* f040b28: 0c0093af */ jal func00024ebc /* f040b2c: 24052f28 */ addiu $a1,$zero,0x2f28 -/* f040b30: 0c0093ac */ jal func00024eb0 +/* f040b30: 0c0093ac */ jal cdGetObstacle /* f040b34: 00000000 */ nop /* f040b38: afa201cc */ sw $v0,0x1cc($sp) .L0f040b3c: @@ -21425,7 +21425,7 @@ glabel var7f1a9260 /* f045aac: e7a00018 */ swc1 $f0,0x18($sp) /* f045ab0: 14400004 */ bnez $v0,.L0f045ac4 /* f045ab4: 00000000 */ nop -/* f045ab8: 0c0093ac */ jal func00024eb0 +/* f045ab8: 0c0093ac */ jal cdGetObstacle /* f045abc: 00000000 */ nop /* f045ac0: 00408025 */ or $s0,$v0,$zero .L0f045ac4: @@ -26022,7 +26022,7 @@ bool func0f04b658(struct chrdata *chr) propSetCollisionsEnabled(target, false); if (!func0002dc18(&prop->pos, prop->rooms, &target->pos, 0x33)) { - struct prop *thing = func00024eb0(); + struct prop *thing = cdGetObstacle(); if (thing && thing->type == PROPTYPE_OBJ && chr->proppreset1 == (s16)(thing - g_Vars.props)) { diff --git a/src/game/chr/chraicommands.c b/src/game/chr/chraicommands.c index 99c6452c3..69b374103 100644 --- a/src/game/chr/chraicommands.c +++ b/src/game/chr/chraicommands.c @@ -6903,11 +6903,11 @@ glabel aiDetectEnemyOnSameFloor // && chrCompareTeams(g_Vars.chrdata, chr, COMPARE_ENEMIES) // && (chr->hidden & CHRHFLAG_CLOAKED) == 0 // && (chr->chrflags & CHRCFLAG_HIDDEN) == 0 -// && (chr->hidden & CHRHFLAG_40000000) == 0 +// && (chr->hidden & CHRHFLAG_ANTICANNOTPUSH) == 0 // && y - chr->prop->pos.y > -200 // && y - chr->prop->pos.y < 200 // && ((g_Vars.chrdata->hidden & CHRHFLAG_PSYCHOSISED) == 0 -// || (chr->hidden & CHRHFLAG_40000000) == 0 +// || (chr->hidden & CHRHFLAG_ANTICANNOTPUSH) == 0 // || chr->hidden & CHRHFLAG_08000000) // && g_Vars.chrdata->chrnum != chr->chrnum) { // distance = chrGetDistanceToChr(g_Vars.chrdata, chr->chrnum); @@ -6990,7 +6990,7 @@ bool aiDetectEnemy(void) && chr->team != TEAM_NONCOMBAT && ( (g_Vars.chrdata->hidden & CHRHFLAG_PSYCHOSISED) == 0 - || (chr->hidden & CHRHFLAG_40000000) == 0 + || (chr->hidden & CHRHFLAG_ANTICANNOTPUSH) == 0 || chr->hidden & CHRHFLAG_08000000)) { f32 distance = chrGetDistanceToChr(g_Vars.chrdata, chr->chrnum); diff --git a/src/game/data/ailists.c b/src/game/data/ailists.c index e91db2673..e62f3f079 100644 --- a/src/game/data/ailists.c +++ b/src/game/data/ailists.c @@ -4569,7 +4569,7 @@ u8 func0012_init_coop_100[] = { set_chr_hiddenflag(CHR_SELF, CHRHFLAG_PASSIVE) set_self_chrflag(CHRCFLAG_00040000) set_chr_team(CHR_SELF, TEAM_ALLY) - set_self_chrflag(CHRCFLAG_01000000) + set_self_chrflag(CHRCFLAG_PUSHABLE) set_chr_hiddenflag(CHR_SELF, CHRHFLAG_PSYCHOSISED) set_alertness(100) set_chrpreset(CHR_BOND) @@ -4643,7 +4643,7 @@ u8 func0013_init_coop_200[] = { set_chr_hiddenflag(CHR_SELF, CHRHFLAG_PASSIVE) set_chr_team(CHR_SELF, TEAM_ALLY) set_self_chrflag(CHRCFLAG_00040000) - set_self_chrflag(CHRCFLAG_01000000) + set_self_chrflag(CHRCFLAG_PUSHABLE) set_chr_hiddenflag(CHR_SELF, CHRHFLAG_PSYCHOSISED) set_alertness(200) yield @@ -5132,7 +5132,7 @@ u8 func0026_init_psychosis[] = { set_chr_team(CHR_SELF, TEAM_NONCOMBAT) set_self_flag_bankx(CHRFLAG1_80000000, BANK_1) set_self_chrflag(CHRCFLAG_00040000) - set_self_chrflag(CHRCFLAG_01000000) + set_self_chrflag(CHRCFLAG_PUSHABLE) set_self_flag_bankx(CHRFLAG1_00100000, BANK_1) set_self_flag_bankx(CHRFLAG1_40000000, BANK_1) set_chr_hiddenflag(CHR_SELF, CHRHFLAG_PSYCHOSISED) diff --git a/src/game/game_015010.c b/src/game/game_015010.c index 95d018bcf..f59d1f57f 100644 --- a/src/game/game_015010.c +++ b/src/game/game_015010.c @@ -40,7 +40,7 @@ void func0f015010(void) case OBJTYPE_29: case OBJTYPE_GLASS: case OBJTYPE_SAFE: - case OBJTYPE_2D: + case OBJTYPE_TANK: case OBJTYPE_TINTEDGLASS: case OBJTYPE_LIFT: case OBJTYPE_HOVERBIKE: diff --git a/src/game/game_091e10.c b/src/game/game_091e10.c index 67b9530ad..c921e1d26 100644 --- a/src/game/game_091e10.c +++ b/src/game/game_091e10.c @@ -63,7 +63,7 @@ u32 setupGetCommandLength(u32 *cmd) case OBJTYPE_PADLOCKEDDOOR: return 4; case OBJTYPE_TRUCK: return 34; case OBJTYPE_HELI: return 35; - case OBJTYPE_2D: return 32; + case OBJTYPE_TANK: return 32; case OBJTYPE_CAMERA2: return 7; case OBJTYPE_LIFT: return 37; case OBJTYPE_CONDITIONALSCENERY: return 5; @@ -326,7 +326,7 @@ struct defaultobj *setupCommandGetObject(u32 cmdindex) case OBJTYPE_29: case OBJTYPE_GLASS: case OBJTYPE_SAFE: - case OBJTYPE_2D: + case OBJTYPE_TANK: case OBJTYPE_TINTEDGLASS: case OBJTYPE_LIFT: case OBJTYPE_HOVERBIKE: diff --git a/src/game/game_190260.c b/src/game/game_190260.c index c8ff963cb..10633a05a 100644 --- a/src/game/game_190260.c +++ b/src/game/game_190260.c @@ -630,7 +630,7 @@ u32 propobjHandlePickupByAibot(struct prop *prop, struct chrdata *chr) case OBJTYPE_GLASS: case OBJTYPE_SAFE: case OBJTYPE_SAFEITEM: - case OBJTYPE_2D: + case OBJTYPE_TANK: case OBJTYPE_CAMERA2: case OBJTYPE_TINTEDGLASS: break; diff --git a/src/game/propobj.c b/src/game/propobj.c index 304e43fac..4fb539f2b 100644 --- a/src/game/propobj.c +++ b/src/game/propobj.c @@ -14113,7 +14113,7 @@ glabel var7f1aa320 /* f0727e8: 00808025 */ or $s0,$a0,$zero /* f0727ec: afa500a4 */ sw $a1,0xa4($sp) /* f0727f0: afa600a8 */ sw $a2,0xa8($sp) -/* f0727f4: 0c0093ac */ jal func00024eb0 +/* f0727f4: 0c0093ac */ jal cdGetObstacle /* f0727f8: e7a4009c */ swc1 $f4,0x9c($sp) /* f0727fc: 104000b2 */ beqz $v0,.L0f072ac8 /* f072800: 8faa00a4 */ lw $t2,0xa4($sp) @@ -23082,7 +23082,7 @@ glabel var7f1aa5a8 /* f07a310: 24c6a020 */ addiu $a2,$a2,%lo(var7f1aa020) /* f07a314: 0c0093af */ jal func00024ebc /* f07a318: 24052cc2 */ addiu $a1,$zero,0x2cc2 -/* f07a31c: 0c0093ac */ jal func00024eb0 +/* f07a31c: 0c0093ac */ jal cdGetObstacle /* f07a320: 00000000 */ nop /* f07a324: 1040006a */ beqz $v0,.L0f07a4d0 /* f07a328: afa20178 */ sw $v0,0x178($sp) @@ -23224,7 +23224,7 @@ glabel var7f1aa5a8 /* f07a51c: 24c6a02c */ addiu $a2,$a2,%lo(var7f1aa02c) /* f07a520: 0c0093af */ jal func00024ebc /* f07a524: 24052cf9 */ addiu $a1,$zero,0x2cf9 -/* f07a528: 0c0093ac */ jal func00024eb0 +/* f07a528: 0c0093ac */ jal cdGetObstacle /* f07a52c: 00000000 */ nop /* f07a530: 240c0001 */ addiu $t4,$zero,0x1 /* f07a534: afac0148 */ sw $t4,0x148($sp) @@ -26692,7 +26692,7 @@ glabel var7f1aa6e4 /* f07d690: e7a00018 */ swc1 $f0,0x18($sp) /* f07d694: 54400005 */ bnezl $v0,.L0f07d6ac /* f07d698: 8fa301f0 */ lw $v1,0x1f0($sp) -/* f07d69c: 0c0093ac */ jal func00024eb0 +/* f07d69c: 0c0093ac */ jal cdGetObstacle /* f07d6a0: 00000000 */ nop /* f07d6a4: afa201f0 */ sw $v0,0x1f0($sp) /* f07d6a8: 8fa301f0 */ lw $v1,0x1f0($sp) @@ -27470,7 +27470,7 @@ glabel var7f1aa6e4 // // if (active) { // if (func0002d7c0(&prop->pos, prop->rooms, &sp214, 0x5000, 0, 0, 0) == 0) { -// doorprop = func00024eb0(); +// doorprop = cdGetObstacle(); // } // // if (doorprop) { @@ -46676,7 +46676,7 @@ glabel doorDoCalc /* f08f1f4: 24050001 */ addiu $a1,$zero,0x1 /* f08f1f8: 56600051 */ bnezl $s3,.L0f08f340 /* f08f1fc: 8e1000bc */ lw $s0,0xbc($s0) -/* f08f200: 0c0093ac */ jal func00024eb0 +/* f08f200: 0c0093ac */ jal cdGetObstacle /* f08f204: 00000000 */ nop /* f08f208: 1040004a */ beqz $v0,.L0f08f334 /* f08f20c: 00000000 */ nop @@ -49020,7 +49020,7 @@ glabel var7f1ab214 /* f09188c: 27a401f0 */ addiu $a0,$sp,0x1f0 /* f091890: 0c0093af */ jal func00024ebc /* f091894: 24055fa2 */ addiu $a1,$zero,0x5fa2 -/* f091898: 0c0093ac */ jal func00024eb0 +/* f091898: 0c0093ac */ jal cdGetObstacle /* f09189c: 00000000 */ nop /* f0918a0: afa201d8 */ sw $v0,0x1d8($sp) .L0f0918a4: diff --git a/src/include/constants.h b/src/include/constants.h index 212263f92..694af1ddd 100644 --- a/src/include/constants.h +++ b/src/include/constants.h @@ -465,7 +465,7 @@ #define CHRHFLAG_08000000 0x08000000 // Globals, Villa and G5 #define CHRHFLAG_10000000 0x10000000 // Related to invincible flag #define CHRHFLAG_CLOAKED 0x20000000 -#define CHRHFLAG_40000000 0x40000000 // Air Base and AF1 +#define CHRHFLAG_ANTICANNOTPUSH 0x40000000 #define CHRHFLAG_PSYCHOSISED 0x80000000 // chr->hidden2 @@ -501,7 +501,7 @@ #define CHRCFLAG_00200000 0x00200000 // Unset by cmd 00fd #define CHRCFLAG_00400000 0x00400000 // Not used in scripts #define CHRCFLAG_UNPLAYABLE 0x00800000 -#define CHRCFLAG_01000000 0x01000000 // Typically set on allies during init +#define CHRCFLAG_PUSHABLE 0x01000000 // Typically set on allies during init #define CHRCFLAG_02000000 0x02000000 // can be unset by cmd0168 #define CHRCFLAG_KEEPCORPSEKO 0x04000000 #define CHRCFLAG_CONSIDER_DODGE 0x08000000 @@ -524,6 +524,11 @@ #define CMD_END 0x0004 #define CMD_PRINT 0x00b5 +// Collision detection +#define CDRESULT_ERROR -1 +#define CDRESULT_COLLISION 0 +#define CDRESULT_NOCOLLISION 1 + #define COLOR_00_GREEN 0x00 #define COLOR_02_WHITE 0x02 #define COLOR_03_RED 0x03 @@ -2500,7 +2505,7 @@ #define OBJTYPE_GLASS 0x2a #define OBJTYPE_SAFE 0x2b #define OBJTYPE_SAFEITEM 0x2c -#define OBJTYPE_2D 0x2d +#define OBJTYPE_TANK 0x2d #define OBJTYPE_CAMERA2 0x2e #define OBJTYPE_TINTEDGLASS 0x2f #define OBJTYPE_LIFT 0x30 @@ -2639,6 +2644,8 @@ #define PROJECTILEFLAG_00000001 0x00000001 #define PROJECTILEFLAG_00000080 0x00000080 #define PROJECTILEFLAG_00000800 0x00000800 +#define PROJECTILEFLAG_00001000 0x00001000 +#define PROJECTILEFLAG_00002000 0x00002000 #define PROJECTILEFLAG_00004000 0x00004000 #define PROJECTILEFLAG_FREE 0x80000000 diff --git a/src/include/game/bondeyespy.h b/src/include/game/bondeyespy.h index 2a293001a..b1a31f5ae 100644 --- a/src/include/game/bondeyespy.h +++ b/src/include/game/bondeyespy.h @@ -10,7 +10,7 @@ bool func0f0cf728(struct coord *vel); s32 func0f0cf890(struct coord *arg0, struct coord *arg1, struct coord *arg2, struct coord *arg3, struct coord *arg4); s32 func0f0cf9f8(struct coord *arg0, struct coord *arg1, struct coord *arg2); s32 func0f0cfafc(struct coord *arg0, struct coord *arg1, struct coord *arg2); -bool func0f0cfdd0(struct coord *vel, struct coord *arg1, struct coord *arg2); +s32 func0f0cfdd0(struct coord *vel, struct coord *arg1, struct coord *arg2); void eyespyCalculateVerticalMovement(void); bool eyespyTryLaunch(void); void func0f0d0928(bool arg0); diff --git a/src/include/game/bondwalk.h b/src/include/game/bondwalk.h index e0ae3764a..72f2a1be8 100644 --- a/src/include/game/bondwalk.h +++ b/src/include/game/bondwalk.h @@ -9,8 +9,8 @@ void currentPlayerAdjustCrouchPos(s32 value); void func0f0c3b38(struct coord *param_1, struct defaultobj *obj); bool currentPlayerHasGapToCeiling(f32 y); bool bwalkCalculateNewPosition(struct coord *vel, f32 rotateamount, bool apply, f32 extrawidth, s32 arg4); -bool func0f0c4250(struct coord *delta, f32 arg1, bool arg2, f32 arg3, s32 arg4); -bool func0f0c4764(struct coord *delta, struct coord *arg1, struct coord *arg2, s32 arg3); +bool func0f0c4250(struct coord *delta, f32 rotateamount, bool apply, f32 extrawidth, s32 arg4); +s32 func0f0c4764(struct coord *delta, struct coord *arg1, struct coord *arg2, s32 arg3); s32 func0f0c47d0(struct coord *a, struct coord *b, struct coord *c, struct coord *d, struct coord *e, s32 arg6); s32 func0f0c494c(struct coord *a, struct coord *b, struct coord *c, s32 arg3); s32 func0f0c4a5c(struct coord *a, struct coord *b, struct coord *c, s32 arg3); diff --git a/src/include/game/chr/chr.h b/src/include/game/chr/chr.h index 5aedf1400..441459e8b 100644 --- a/src/include/game/chr/chr.h +++ b/src/include/game/chr/chr.h @@ -6,7 +6,7 @@ void func0f01e250(void); void chrSetChrnum(struct chrdata *chr, s16 chrnum); void chrDeregister(s32 chrnum); -u32 func0f01e7f4(void); +void func0f01e7f4(struct chrdata *chr, struct coord *pos, s16 *rooms, s32 arg3); bool func0f01f264(struct chrdata *chr, struct coord *pos, s16 *room, f32 arg3, bool arg4); void func0f01f378(void); s32 getNumFreeChrSlots(void); diff --git a/src/include/game/chr/chraction.h b/src/include/game/chr/chraction.h index 039d2e4a6..fe8a4c668 100644 --- a/src/include/game/chr/chraction.h +++ b/src/include/game/chr/chraction.h @@ -49,7 +49,7 @@ u32 func0f0338e0(void); void chrSetShield(struct chrdata *chr, f32 shield); u32 func0f034080(void); void func0f034124(struct chrdata *chr, f32 arg1, struct coord *coord, u8 *arg3, struct prop *prop); -u32 func0f03417c(void); +void func0f03417c(struct chrdata *chr, f32 arg1, struct coord *coord, u32 arg3, struct prop *prop); void func0f0341dc(struct chrdata *chr, f32 arg1, struct coord *coord, struct hand *hand, struct prop *prop, u32 arg5, struct prop *prop2, s32 arg7, s32 arg8, s32 arg9, u32 arg10); void func0f034330(struct chrdata *chr, f32 arg1, struct coord *vector, u8 *arg3, struct prop *prop, s32 arg5); u32 func0f034410(void); diff --git a/src/include/game/propobj.h b/src/include/game/propobj.h index 4b2b34d7d..9014da824 100644 --- a/src/include/game/propobj.h +++ b/src/include/game/propobj.h @@ -158,7 +158,7 @@ void func0f072adc(struct hoverbikeobj *hoverbike, f32 arg1, f32 arg2, f32 arg3); u32 func0f0732d4(void); u32 func0f073478(void); u32 func0f073ae8(void); -u32 func0f073c6c(struct defaultobj *obj, bool *arg1); +s32 func0f073c6c(struct defaultobj *obj, bool *arg1); void doorTick(struct prop *doorprop); void doorUpdatePortalIfWindowed(struct prop *door, s32 playercount); u32 func0f077448(void); diff --git a/src/include/lib/lib_233c0.h b/src/include/lib/lib_233c0.h index 5b0b45608..3c8c41fc9 100644 --- a/src/include/lib/lib_233c0.h +++ b/src/include/lib/lib_233c0.h @@ -26,7 +26,7 @@ u32 func00024e40(void); void func00024e4c(struct coord *arg0, struct coord *arg1, u32 line, char *file); f32 func00024e98(void); u32 func00024ea4(void); -struct prop *func00024eb0(void); +struct prop *cdGetObstacle(void); void func00024ebc(struct coord *pos, u32 line, char *file); u32 func00024ee8(void); u32 func00024f10(void); diff --git a/src/include/types.h b/src/include/types.h index b58c80738..32fd8d97d 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -1059,6 +1059,9 @@ struct chrdata { /*0x364*/ u32 unk364; }; +// This appears to be misnamed. Not only is it projectiles such as grenades and +// crossbow bolts, but objects being pushed like couches also have this struct. +// So I guess it denotes a generic moving object? struct projectile { /*0x000*/ u32 flags; /*0x004*/ struct coord unk004; // distance moved in last tick @@ -2736,7 +2739,7 @@ struct player { /*0x1a9c*/ Mtxf bondentermtx; /*0x1adc*/ struct coord bondenteraim; /*0x1ae8*/ f32 bondonground; - /*0x1aec*/ struct prop *unk1aec; + /*0x1aec*/ struct prop *tank; /*0x1af0*/ struct prop *unk1af0; /*0x1af4*/ u32 unk1af4; /*0x1af8*/ s32 walkinitmove; diff --git a/src/lib/lib_233c0.c b/src/lib/lib_233c0.c index bd86f5af8..50b80d831 100644 --- a/src/lib/lib_233c0.c +++ b/src/lib/lib_233c0.c @@ -1934,7 +1934,7 @@ glabel func00024ea4 ); GLOBAL_ASM( -glabel func00024eb0 +glabel cdGetObstacle /* 24eb0: 3c02800a */ lui $v0,%hi(var8009a8d4) /* 24eb4: 03e00008 */ jr $ra /* 24eb8: 8c42a8d4 */ lw $v0,%lo(var8009a8d4)($v0) @@ -8303,12 +8303,12 @@ s32 func0002a9f0(struct coord *origpos, struct coord *dstpos, f32 width, s16 *ds u32 stack[104]; s32 sp44; struct coord dist; - s32 result = 1; + s32 result = CDRESULT_NOCOLLISION; func00028df0(dstpos, width, dstrooms, arg4, 4, arg5, ymax, ymin, &sp44, 20); if (sp44) { - result = 0; + result = CDRESULT_COLLISION; dist.x = dstpos->x - origpos->x; dist.y = dstpos->y - origpos->y; @@ -11536,7 +11536,7 @@ s32 func0002d95c(struct coord *arg0, s16 *arg1, struct coord *arg2, s16 *arg3, f result = func0002d3b0(arg0, arg2, sp5c, arg5, 4, 0, arg6, arg7, arg8); - if (result == 0) { + if (result == CDRESULT_COLLISION) { sp40.x = arg2->x - arg0->x; sp40.y = arg2->y - arg0->y; sp40.z = arg2->z - arg0->z;