mirror of
https://github.com/zeldaret/mm.git
synced 2026-07-09 05:43:18 -04:00
z_player_lib: Part 1 (#688)
* fix some symbols and file splits * PLAYER_STATE macros * Move over a few functions * AP functions and update struct * another small bunch * Add player_lib prototypes * A few more functions * Some fixes and add stuff to actorfixer * format * bss * Elliptic's review * Engineer's review * Some renames and cleanups * bss * A bit of cleaning up * Player_DrawZoraShield * format * actorfixer, bss and format * Forgot to merge master again * Rename some LinkGoron dlists * PlayerMeleeWeaponAnimation enum * format * actorfixer, bss and format * more bss * actorfixer * format * actorfixer and format * bss * Update src/code/z_player_lib.c Co-authored-by: EllipticEllipsis <73679967+EllipticEllipsis@users.noreply.github.com> * sEnvironmentTextTriggers * Update include/z64save.h Co-authored-by: EllipticEllipsis <73679967+EllipticEllipsis@users.noreply.github.com> * Update src/code/z_player_lib.c Co-authored-by: EllipticEllipsis <73679967+EllipticEllipsis@users.noreply.github.com> * Update src/code/z_player_lib.c Co-authored-by: EllipticEllipsis <73679967+EllipticEllipsis@users.noreply.github.com> * Update src/code/z_player_lib.c Co-authored-by: EllipticEllipsis <73679967+EllipticEllipsis@users.noreply.github.com> * breman mask march comment * fix * fixes * bss * RESPAWN_MODE_RETURN * review Co-authored-by: Derek Hensley <hensley.derek58@gmail.com> * format * Engineer's review Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * Update src/code/z_player_lib.c Co-authored-by: Derek Hensley <hensley.derek58@gmail.com> * review Co-authored-by: EllipticEllipsis <73679967+EllipticEllipsis@users.noreply.github.com> * Update include/z64player.h Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * review Co-authored-by: EllipticEllipsis <elliptic.ellipsis@gmail.com> Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * format * unused mwas * fixes Co-authored-by: Derek Hensley <hensley.derek58@gmail.com> Co-authored-by: EllipticEllipsis <73679967+EllipticEllipsis@users.noreply.github.com> Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> Co-authored-by: EllipticEllipsis <elliptic.ellipsis@gmail.com>
This commit is contained in:
@@ -481,8 +481,8 @@ s32 Inventory_GetBtnBItem(PlayState* play) {
|
||||
return ITEM_NONE;
|
||||
} else if (CUR_FORM_EQUIP(EQUIP_SLOT_B) == ITEM_NONE) {
|
||||
if (play->interfaceCtx.unk_21C != 0) {
|
||||
if (play->interfaceCtx.unk_21E != 0) {
|
||||
return play->interfaceCtx.unk_21E;
|
||||
if (play->interfaceCtx.bButtonDoAction != 0) {
|
||||
return play->interfaceCtx.bButtonDoAction;
|
||||
}
|
||||
}
|
||||
return ITEM_NONE;
|
||||
|
||||
+5
-6
@@ -1856,8 +1856,7 @@ s32 Actor_ProcessTalkRequest(Actor* actor, GameState* gameState) {
|
||||
s32 func_800B8500(Actor* actor, PlayState* play, f32 xzRange, f32 yRange, s32 exchangeItemId) {
|
||||
Player* player = GET_PLAYER(play);
|
||||
|
||||
if ((player->actor.flags & ACTOR_FLAG_100) ||
|
||||
((exchangeItemId > EXCH_ITEM_NONE) && Player_InCsMode(&play->state)) ||
|
||||
if ((player->actor.flags & ACTOR_FLAG_100) || ((exchangeItemId > EXCH_ITEM_NONE) && Player_InCsMode(play)) ||
|
||||
(!actor->isTargeted &&
|
||||
((fabsf(actor->playerHeightRel) > fabsf(yRange)) || ((actor->xzDistToPlayer > player->targetActorDistance)) ||
|
||||
(xzRange < actor->xzDistToPlayer)))) {
|
||||
@@ -1933,7 +1932,7 @@ s32 func_800B8718(Actor* actor, GameState* gameState) {
|
||||
s32 func_800B874C(Actor* actor, PlayState* play, f32 xzRange, f32 yRange) {
|
||||
Player* player = GET_PLAYER(play);
|
||||
|
||||
if ((player->actor.flags & ACTOR_FLAG_20000000) || Player_InCsMode(&play->state) ||
|
||||
if ((player->actor.flags & ACTOR_FLAG_20000000) || Player_InCsMode(play) ||
|
||||
(yRange < fabsf(actor->playerHeightRel)) || ((player->unk_A94 < actor->xzDistToPlayer)) ||
|
||||
(xzRange < actor->xzDistToPlayer)) {
|
||||
return false;
|
||||
@@ -2205,8 +2204,8 @@ void func_800B9098(Actor* actor) {
|
||||
actor->audioFlags |= 0x40;
|
||||
}
|
||||
|
||||
s32 func_800B90AC(PlayState* play, Actor* actor, CollisionPoly* polygon, s32 index, s32 arg4) {
|
||||
if (func_800C99D4(&play->colCtx, polygon, index) == 8) {
|
||||
s32 func_800B90AC(PlayState* play, Actor* actor, CollisionPoly* polygon, s32 bgId, s32 arg4) {
|
||||
if (func_800C99D4(&play->colCtx, polygon, bgId) == 8) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -4352,7 +4351,7 @@ s32 func_800BE184(PlayState* play, Actor* actor, f32 xzDist, s16 arg3, s16 arg4,
|
||||
s16 phi_v0 = BINANG_SUB(BINANG_ROT180(actor->yawTowardsPlayer), player->actor.shape.rot.y);
|
||||
s16 temp_t0 = actor->yawTowardsPlayer - arg5;
|
||||
|
||||
if ((actor->xzDistToPlayer <= xzDist) && (player->swordState != 0)) {
|
||||
if ((actor->xzDistToPlayer <= xzDist) && (player->meleeWeaponState != 0)) {
|
||||
if ((arg4 >= ABS_ALT(phi_v0)) && (arg3 >= ABS_ALT(temp_t0))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
+1
-1
@@ -1454,7 +1454,7 @@ void func_800EDA04(PlayState* play, CutsceneContext* csCtx) {
|
||||
}
|
||||
|
||||
void func_800EDA84(PlayState* play, CutsceneContext* csCtx) {
|
||||
if ((gSaveContext.cutsceneTrigger != 0) && (csCtx->state == CS_STATE_0) && !Player_InCsMode(&play->state)) {
|
||||
if ((gSaveContext.cutsceneTrigger != 0) && (csCtx->state == CS_STATE_0) && !Player_InCsMode(play)) {
|
||||
gSaveContext.save.cutscene = 0xFFFD;
|
||||
}
|
||||
|
||||
|
||||
@@ -119,7 +119,7 @@ void FireObj_UpdateStateTransitions(PlayState* play, FireObj* fire) {
|
||||
FireObj_SetState(fire, fire->dynamicSizeStep, FIRE_STATE_3);
|
||||
}
|
||||
if ((fire->flags & 2) && (player->itemActionParam == PLAYER_AP_STICK)) {
|
||||
Math_Vec3f_Diff(&player->swordInfo[0].tip, &fire->position, &dist);
|
||||
Math_Vec3f_Diff(&player->meleeWeaponInfo[0].tip, &fire->position, &dist);
|
||||
if (Math3D_LengthSquared(&dist) < 400.0f) {
|
||||
sp40 = true;
|
||||
}
|
||||
|
||||
@@ -398,7 +398,7 @@ void LifeMeter_UpdateSizeAndBeep(PlayState* play) {
|
||||
if (interfaceCtx->lifeSizeChange <= 0) {
|
||||
interfaceCtx->lifeSizeChange = 0;
|
||||
interfaceCtx->lifeSizeChangeDirection = 0;
|
||||
if (!Player_InCsMode(&play->state) && (play->pauseCtx.state == 0) && (play->pauseCtx.debugState == 0) &&
|
||||
if (!Player_InCsMode(play) && (play->pauseCtx.state == 0) && (play->pauseCtx.debugState == 0) &&
|
||||
LifeMeter_IsCritical() && !Play_InCsMode(play)) {
|
||||
play_sound(NA_SE_SY_HITPOINT_ALARM);
|
||||
}
|
||||
|
||||
+6
-6
@@ -59,7 +59,7 @@
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_Update.s")
|
||||
|
||||
s32 Play_InCsMode(PlayState* this) {
|
||||
return (this->csCtx.state != 0) || Player_InCsMode(&this->state);
|
||||
return (this->csCtx.state != 0) || Player_InCsMode(this);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_80169100.s")
|
||||
@@ -209,10 +209,10 @@ void func_80169ECC(PlayState* this) {
|
||||
void func_80169EFC(GameState* thisx) {
|
||||
PlayState* this = (PlayState*)thisx;
|
||||
|
||||
gSaveContext.respawn[RESTART_MODE_DOWN].tempSwitchFlags = this->actorCtx.flags.switches[2];
|
||||
gSaveContext.respawn[RESTART_MODE_DOWN].unk_18 = this->actorCtx.flags.collectible[1];
|
||||
gSaveContext.respawn[RESTART_MODE_DOWN].tempCollectFlags = this->actorCtx.flags.collectible[2];
|
||||
this->nextEntranceIndex = gSaveContext.respawn[RESTART_MODE_DOWN].entranceIndex;
|
||||
gSaveContext.respawn[RESPAWN_MODE_DOWN].tempSwitchFlags = this->actorCtx.flags.switches[2];
|
||||
gSaveContext.respawn[RESPAWN_MODE_DOWN].unk_18 = this->actorCtx.flags.collectible[1];
|
||||
gSaveContext.respawn[RESPAWN_MODE_DOWN].tempCollectFlags = this->actorCtx.flags.collectible[2];
|
||||
this->nextEntranceIndex = gSaveContext.respawn[RESPAWN_MODE_DOWN].entranceIndex;
|
||||
gSaveContext.respawnFlag = 1;
|
||||
func_80169ECC(this);
|
||||
this->sceneLoadFlag = 0x14;
|
||||
@@ -224,7 +224,7 @@ void func_80169EFC(GameState* thisx) {
|
||||
void func_80169F78(GameState* thisx) {
|
||||
PlayState* this = (PlayState*)thisx;
|
||||
|
||||
this->nextEntranceIndex = gSaveContext.respawn[RESTART_MODE_TOP].entranceIndex;
|
||||
this->nextEntranceIndex = gSaveContext.respawn[RESPAWN_MODE_TOP].entranceIndex;
|
||||
gSaveContext.respawnFlag = -1;
|
||||
func_80169ECC(this);
|
||||
this->sceneLoadFlag = 0x14;
|
||||
|
||||
+1079
-74
File diff suppressed because it is too large
Load Diff
+8
-8
@@ -4,12 +4,12 @@ s32 Object_Spawn(ObjectContext* objectCtx, s16 id) {
|
||||
size_t size;
|
||||
|
||||
objectCtx->status[objectCtx->num].id = id;
|
||||
size = objectFileTable[id].vromEnd - objectFileTable[id].vromStart;
|
||||
size = gObjectTable[id].vromEnd - gObjectTable[id].vromStart;
|
||||
|
||||
if (1) {}
|
||||
|
||||
if (size != 0) {
|
||||
DmaMgr_SendRequest0(objectCtx->status[objectCtx->num].segment, objectFileTable[id].vromStart, size);
|
||||
DmaMgr_SendRequest0(objectCtx->status[objectCtx->num].segment, gObjectTable[id].vromStart, size);
|
||||
}
|
||||
|
||||
if (objectCtx->num < OBJECT_EXCHANGE_BANK_MAX - 1) {
|
||||
@@ -66,7 +66,7 @@ void Object_UpdateBank(ObjectContext* objectCtx) {
|
||||
s32 id = -status->id;
|
||||
|
||||
if (status->dmaReq.vromAddr == 0) {
|
||||
objectFile = &objectFileTable[id];
|
||||
objectFile = &gObjectTable[id];
|
||||
size = objectFile->vromEnd - objectFile->vromStart;
|
||||
|
||||
if (size == 0) {
|
||||
@@ -112,13 +112,13 @@ void Object_LoadAll(ObjectContext* objectCtx) {
|
||||
|
||||
for (i = 0; i < objectCtx->num; i++) {
|
||||
id = objectCtx->status[i].id;
|
||||
vromSize = objectFileTable[id].vromEnd - objectFileTable[id].vromStart;
|
||||
vromSize = gObjectTable[id].vromEnd - gObjectTable[id].vromStart;
|
||||
|
||||
if (vromSize == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
DmaMgr_SendRequest0(objectCtx->status[i].segment, objectFileTable[id].vromStart, vromSize);
|
||||
DmaMgr_SendRequest0(objectCtx->status[i].segment, gObjectTable[id].vromStart, vromSize);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,7 +130,7 @@ void* func_8012F73C(ObjectContext* objectCtx, s32 iParm2, s16 id) {
|
||||
objectCtx->status[iParm2].id = -id;
|
||||
objectCtx->status[iParm2].dmaReq.vromAddr = 0;
|
||||
|
||||
fileTableEntry = &objectFileTable[id];
|
||||
fileTableEntry = &gObjectTable[id];
|
||||
vromSize = fileTableEntry->vromEnd - fileTableEntry->vromStart;
|
||||
|
||||
// TODO: UB to cast void to u32
|
||||
@@ -149,7 +149,7 @@ void Scene_HeaderCmdSpawnList(PlayState* play, SceneCmd* cmd) {
|
||||
play->linkActorEntry =
|
||||
(ActorEntry*)Lib_SegmentedToVirtual(cmd->spawnList.segment) + play->setupEntranceList[play->curSpawn].spawn;
|
||||
if ((play->linkActorEntry->params & 0x0F00) >> 8 == 0x0C ||
|
||||
(gSaveContext.respawnFlag == 0x02 && gSaveContext.respawn[RESTART_MODE_RETURN].playerParams == 0x0CFF)) {
|
||||
(gSaveContext.respawnFlag == 0x02 && gSaveContext.respawn[RESPAWN_MODE_RETURN].playerParams == 0x0CFF)) {
|
||||
// Skull Kid Object
|
||||
Object_Spawn(&play->objectCtx, OBJECT_STK);
|
||||
return;
|
||||
@@ -159,7 +159,7 @@ void Scene_HeaderCmdSpawnList(PlayState* play, SceneCmd* cmd) {
|
||||
nextObject = play->objectCtx.status[play->objectCtx.num].segment;
|
||||
play->objectCtx.num = loadedCount;
|
||||
play->objectCtx.spawnedObjectCount = loadedCount;
|
||||
playerObjectId = gLinkFormObjectIndexes[(void)0, gSaveContext.save.playerForm];
|
||||
playerObjectId = gPlayerFormObjectIndices[(void)0, gSaveContext.save.playerForm];
|
||||
gActorOverlayTable[0].initInfo->objectId = playerObjectId;
|
||||
Object_Spawn(&play->objectCtx, playerObjectId);
|
||||
|
||||
|
||||
@@ -596,7 +596,7 @@ ItemEquips sSaveDefaultItemEquips = {
|
||||
{ ITEM_SWORD_KOKIRI, ITEM_NONE, ITEM_NONE, ITEM_NONE },
|
||||
{ ITEM_SWORD_KOKIRI, ITEM_NONE, ITEM_NONE, ITEM_NONE },
|
||||
{ ITEM_SWORD_KOKIRI, ITEM_NONE, ITEM_NONE, ITEM_NONE },
|
||||
{ ITEM_UNK_FD, ITEM_NONE, ITEM_NONE, ITEM_NONE },
|
||||
{ ITEM_FD, ITEM_NONE, ITEM_NONE, ITEM_NONE },
|
||||
},
|
||||
{
|
||||
{ SLOT_OCARINA, SLOT_NONE, SLOT_NONE, SLOT_NONE },
|
||||
|
||||
Reference in New Issue
Block a user