Rename some propobj functions

This commit is contained in:
Ryan Dwyer 2021-11-27 23:14:49 +10:00
parent 28c837c487
commit 1c69db05b5
7 changed files with 42 additions and 38 deletions

View File

@ -2069,7 +2069,7 @@ bool aiIfWeaponThrown(void)
{
u8 *cmd = g_Vars.ailist + g_Vars.aioffset;
if (weaponFindThrown(cmd[2])) {
if (weaponFindLanded(cmd[2])) {
g_Vars.aioffset = chraiGoToLabel(g_Vars.ailist, g_Vars.aioffset, cmd[3]);
} else {
g_Vars.aioffset += 4;

View File

@ -1001,7 +1001,7 @@ u32 propobjHandlePickupByAibot(struct prop *prop, struct chrdata *chr)
s32 i;
#if PIRACYCHECKS
{
u32 *ptr = (u32 *)&func0f08e2ac;
u32 *ptr = (u32 *)&doorFinishClose;
u32 *end = (u32 *)&doorSetMode;
u32 checksum = 0;

View File

@ -35109,7 +35109,7 @@ void liftTick(struct prop *prop)
cdGetPropsOnPlatform(prop, propnums, ARRAYCOUNT(propnums));
if (lift->dist == 0 && lift->speed == 0) {
func0f08d784(lift->soundtype, lift->base.prop);
doorPlayOpeningSound(lift->soundtype, lift->base.prop);
if (obj->flags & OBJFLAG_LIFT_TRIGGERDISABLE) {
obj->flags &= ~OBJFLAG_LIFT_TRIGGERDISABLE;
@ -35161,7 +35161,7 @@ void liftTick(struct prop *prop)
lift->speed = 0;
lift->levelcur = lift->levelaim;
func0f08dd44(lift->soundtype, lift->base.prop);
doorPlayOpenedSound(lift->soundtype, lift->base.prop);
if (obj->flags & OBJFLAG_LIFT_TRIGGERDISABLE) {
obj->flags &= ~OBJFLAG_LIFT_TRIGGERDISABLE;
@ -68368,7 +68368,7 @@ void playerActivateRemoteMineDetonator(s32 playernum)
bgunStartDetonateAnimation(playernum);
}
struct weaponobj *func0f08aa70(s32 weaponnum, struct prop *prop)
struct weaponobj *weaponFindChildByWeaponNum(s32 weaponnum, struct prop *prop)
{
struct weaponobj *weapon;
struct prop *child;
@ -68380,7 +68380,7 @@ struct weaponobj *func0f08aa70(s32 weaponnum, struct prop *prop)
child = prop->child;
while (child) {
weapon = func0f08aa70(weaponnum, child);
weapon = weaponFindChildByWeaponNum(weaponnum, child);
if (weapon) {
return weapon;
@ -68392,12 +68392,12 @@ struct weaponobj *func0f08aa70(s32 weaponnum, struct prop *prop)
return NULL;
}
struct weaponobj *weaponFindThrown(s32 weaponnum)
struct weaponobj *weaponFindLanded(s32 weaponnum)
{
struct prop *prop = g_Vars.activeprops;
while (prop) {
struct weaponobj *weapon = func0f08aa70(weaponnum, prop);
struct weaponobj *weapon = weaponFindChildByWeaponNum(weaponnum, prop);
if (weapon && (weapon->base.hidden & OBJHFLAG_AIRBORNE) == 0) {
return weapon;
@ -71122,7 +71122,7 @@ glabel var7f1aaf78
/* f08d780: 27bd0080 */ addiu $sp,$sp,0x80
);
void func0f08d784(s32 soundtype, struct prop *prop)
void doorPlayOpeningSound(s32 soundtype, struct prop *prop)
{
s32 sound1 = 0;
s32 sound2 = 0;
@ -71199,7 +71199,7 @@ void func0f08d784(s32 soundtype, struct prop *prop)
/**
* This is identical to the function above but with less cases.
*/
void func0f08daa8(s32 soundtype, struct prop *prop)
void doorPlayClosingSound(s32 soundtype, struct prop *prop)
{
s32 sound1 = 0;
s32 sound2 = 0;
@ -71260,7 +71260,7 @@ void func0f08daa8(s32 soundtype, struct prop *prop)
}
}
void func0f08dd44(s32 soundtype, struct prop *prop)
void doorPlayOpenedSound(s32 soundtype, struct prop *prop)
{
s32 sound = 0;
@ -71313,7 +71313,7 @@ void func0f08dd44(s32 soundtype, struct prop *prop)
}
}
void func0f08df10(s32 soundtype, struct prop *prop)
void doorPlayClosedSound(s32 soundtype, struct prop *prop)
{
s32 sound = 0;
@ -71367,12 +71367,12 @@ void func0f08df10(s32 soundtype, struct prop *prop)
* Play the door open sound, activate the door's portal,
* and configure the laser fade properties if it's a laser.
*/
void doorPrepareForOpen(struct doorobj *door)
void doorStartOpen(struct doorobj *door)
{
door->base.flags &= ~OBJFLAG_DOOR_KEEPOPEN;
door->base.hidden |= OBJHFLAG_00000200;
func0f08d784(door->soundtype, door->base.prop);
doorPlayOpeningSound(door->soundtype, door->base.prop);
doorActivatePortal(door);
if (door->doortype == DOORTYPE_8) {
@ -71397,11 +71397,11 @@ void doorPrepareForOpen(struct doorobj *door)
* Play the door close sound and configure the
* laser fade properties if it's a laser.
*/
void doorPrepareForClose(struct doorobj *door)
void doorStartClose(struct doorobj *door)
{
door->base.flags &= ~OBJFLAG_DOOR_KEEPOPEN;
func0f08daa8(door->soundtype, door->base.prop);
doorPlayClosingSound(door->soundtype, door->base.prop);
door->fadetime60 = door->doortype == DOORTYPE_LASER ? PALDOWN(60) : 0;
@ -71417,9 +71417,9 @@ u32 decodeXorAaaaaaaa(u32 value)
}
#endif
void func0f08e224(struct doorobj *door)
void doorFinishOpen(struct doorobj *door)
{
func0f08dd44(door->soundtype, door->base.prop);
doorPlayOpenedSound(door->soundtype, door->base.prop);
if (door->doortype == DOORTYPE_8) {
func0f0685e4(door->base.prop);
@ -71437,12 +71437,12 @@ void func0f08e224(struct doorobj *door)
extern s32 osCicId;
void func0f08e2ac(struct doorobj *door)
void doorFinishClose(struct doorobj *door)
{
bool pass = true;
struct doorobj *loopdoor;
func0f08df10(door->soundtype, door->base.prop);
doorPlayClosedSound(door->soundtype, door->base.prop);
loopdoor = door;
@ -71491,13 +71491,13 @@ void doorSetMode(struct doorobj *door, s32 newmode)
{
if (newmode == DOORMODE_OPENING) {
if (door->mode == DOORMODE_IDLE || door->mode == DOORMODE_WAITING) {
doorPrepareForOpen(door);
doorStartOpen(door);
}
door->mode = newmode;
} else if (newmode == DOORMODE_CLOSING) {
if (door->mode == DOORMODE_IDLE && door->frac > 0) {
doorPrepareForClose(door);
doorStartClose(door);
}
if ((door->mode != DOORMODE_IDLE && door->mode != DOORMODE_WAITING) || door->frac > 0) {
@ -71977,7 +71977,7 @@ bool doorCalcIntendedFrac(struct doorobj *door)
}
}
func0f08df10(door->soundtype, door->base.prop);
doorPlayClosedSound(door->soundtype, door->base.prop);
}
}
@ -72129,7 +72129,7 @@ void doorsCalcFrac(struct doorobj *door)
loopdoor->fracspeed = 0;
loopdoor->lastopen60 = g_Vars.lvframe60;
func0f08e224(loopdoor);
doorFinishOpen(loopdoor);
}
} else {
if (loopdoor->mode == DOORMODE_CLOSING && loopdoor->frac <= 0) {
@ -72137,7 +72137,7 @@ void doorsCalcFrac(struct doorobj *door)
loopdoor->fracspeed = 0;
loopdoor->lastopen60 = 0;
func0f08e2ac(loopdoor);
doorFinishClose(loopdoor);
}
}

View File

@ -2283,6 +2283,7 @@
#define MODELTYPE_CLASSICGUN 0x07
#define MODELTYPE_CASING 0x08
#define MODELTYPE_CHR 0x09
#define MODELTYPE_0A 0x0a
#define MODELTYPE_0B 0x0b
#define MODELTYPE_0C 0x0c
#define MODELTYPE_HEAD 0x0d

View File

@ -272,8 +272,8 @@ struct hatobj *func0f08a38c(bool arg0, bool arg1, struct modelfiledata *filedata
struct ammocrateobj *ammocrateAllocate(void);
u32 func0f08a88c(void);
void playerActivateRemoteMineDetonator(s32 playernum);
struct weaponobj *func0f08aa70(s32 weaponnum, struct prop *prop);
struct weaponobj *weaponFindThrown(s32 weaponnum);
struct weaponobj *weaponFindChildByWeaponNum(s32 weaponnum, struct prop *prop);
struct weaponobj *weaponFindLanded(s32 weaponnum);
void weaponRegisterProxy(struct weaponobj *weapon);
void weaponUnregisterProxy(struct weaponobj *weapon);
void coordTriggerProxies(struct coord *pos, bool arg1);
@ -310,15 +310,15 @@ void func0f08d460(struct doorobj *door);
void doorActivatePortal(struct doorobj *door);
void doorDeactivatePortal(struct doorobj *door);
struct prop *func0f08d540(struct doorobj *door, struct coord *pos, f32 *matrix, s16 *rooms, struct coord *coord, struct coord *centre);
void func0f08d784(s32 soundtype, struct prop *prop);
void func0f08daa8(s32 soundtype, struct prop *prop);
void func0f08dd44(s32 soundtype, struct prop *prop);
void func0f08df10(s32 soundtype, struct prop *prop);
void doorPrepareForOpen(struct doorobj *door);
void doorPrepareForClose(struct doorobj *door);
void doorPlayOpeningSound(s32 soundtype, struct prop *prop);
void doorPlayClosingSound(s32 soundtype, struct prop *prop);
void doorPlayOpenedSound(s32 soundtype, struct prop *prop);
void doorPlayClosedSound(s32 soundtype, struct prop *prop);
void doorStartOpen(struct doorobj *door);
void doorStartClose(struct doorobj *door);
u32 decodeXorAaaaaaaa(u32 value);
void func0f08e224(struct doorobj *door);
void func0f08e2ac(struct doorobj *door);
void doorFinishOpen(struct doorobj *door);
void doorFinishClose(struct doorobj *door);
void doorSetMode(struct doorobj *door, s32 newmode);
void doorsRequestMode(struct doorobj *door, s32 newmode);
s32 doorIsClosed(struct doorobj *door);

View File

@ -63,6 +63,11 @@ bool map_get_function_rompos(char *funcname, uint32_t *start, uint32_t *end)
// Jump to RAM address
ptr = strstr(line, "0x");
if (ptr == NULL) {
continue;
}
segramaddr = strtoul(ptr, NULL, 16);
// Jump to length
@ -84,8 +89,6 @@ bool map_get_function_rompos(char *funcname, uint32_t *start, uint32_t *end)
}
}
fprintf(stderr, "Unable to find function \"%s\" in linker map\n", funcname);
return false;
}

View File

@ -157,7 +157,7 @@ void piracy_patch(void)
// algorithm, patch function, sum function
patch(algo01, "__scHandleTasks", "bootPhase1");
patch(algo02, "cheatMenuHandleDialog", "__scHandleTasks");
patch(algo03, "propobjHandlePickupByAibot", "func0f08e2ac");
patch(algo03, "propobjHandlePickupByAibot", "doorFinishClose");
patch(algo04, "chrUncloak", "propobjHandlePickupByAibot");
patch(algo05, "chrsCheckForNoise", "__scHandleRetrace");
patch(algo06, "lvInit", "lvGetSlowMotionType");