z_player_lib: Part 2 (#938)

* preparations

* import data

* PLAYER_STATE1

* PLAYER_STATE2

* PLAYER_STATE3

* import bss

* format stuff

* bss cleanup

* more cleaning and some naming

* face

* cleaning up link human object a bit

* Remove PHYSICAL_TO_VIRTUAL2

* Update src/code/z_player_lib.c

Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com>

* review

Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com>

* format

* /* CAT */

Co-authored-by: Isghj <42048411+isghj5@users.noreply.github.com>

* naming some stuff on objects

* format

* invert flags endian

* review

Co-authored-by: EllipticEllipsis <elliptic.ellipsis@gmail.com>

* format

* drawmask

Co-authored-by: Isghj <42048411+isghj5@users.noreply.github.com>

* naming

* another round of human object naming

* enum renames

* sActionModelGroups and use enum as types

* PlayerAnimType

* PLAYER_MODELTYPE_

* determined ranges of PlayerModelType

* name PLAYER_MODELGROUP_DEFAULT

* format

* sheath

* dlist groups placeholder namse

* PLAYER_MODELGROUP_BOTTLE

* Some fierce deity naming

* Right hands

* zora skel dlists

* deku limb dlists

* left hands

* name most modelgroups

* more hand naming

* regs as dec

* fix in horse

* Use BUTTON_ITEM_EQUIP macro

* review

Co-authored-by: EllipticEllipsis <elliptic.ellipsis@gmail.com>

* reformat D_801AED58

* Sword sheaths

* swords and shields

* Update src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c

Co-authored-by: EllipticEllipsis <elliptic.ellipsis@gmail.com>

* playerForm on Player_DrawImpl

* fomat

* Update src/code/z_player_lib.c

Co-authored-by: Derek Hensley <hensley.derek58@gmail.com>

* Update assets/xml/objects/gameplay_keep.xml

Co-authored-by: Derek Hensley <hensley.derek58@gmail.com>

* review

Co-authored-by: Derek Hensley <hensley.derek58@gmail.com>

* VIRTUAL_TO_PHYSICAL(SEGMENTED_TO_VIRTUAL(gEffBubble1Tex))

Co-authored-by: Derek Hensley <hensley.derek58@gmail.com>

* singular limb enum names

* fix bss

* Update src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c

Co-authored-by: EllipticEllipsis <elliptic.ellipsis@gmail.com>

* review

Co-authored-by: EllipticEllipsis <elliptic.ellipsis@gmail.com>

* name goron shielding limbs

* name limb

* Update src/code/z_player_lib.c

Co-authored-by: EllipticEllipsis <elliptic.ellipsis@gmail.com>

* bss

* bss

* format

* namefixer

* bss

* bss

* bss

* bss

* format

* bss

* review

Co-authored-by: EllipticEllipsis <elliptic.ellipsis@gmail.com>

* fix bss

Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com>
Co-authored-by: Isghj <42048411+isghj5@users.noreply.github.com>
Co-authored-by: EllipticEllipsis <elliptic.ellipsis@gmail.com>
Co-authored-by: Derek Hensley <hensley.derek58@gmail.com>
This commit is contained in:
Anghelo Carvajal
2022-10-15 19:12:01 -03:00
committed by GitHub
parent 638f5062cb
commit bd373940ac
139 changed files with 2323 additions and 1061 deletions
+56 -25
View File
@@ -172,7 +172,7 @@ void ActorShadow_DrawFeet(Actor* actor, Lights* mapper, PlayState* play) {
u8 shadowAlpha = actor->shape.shadowAlpha;
f32 alphaRatio;
if ((actor->id == ACTOR_PLAYER) && (((Player*)actor)->stateFlags3 & 0x8000)) {
if ((actor->id == ACTOR_PLAYER) && (((Player*)actor)->stateFlags3 & PLAYER_STATE3_8000)) {
f32 prevScaleZ = actor->scale.z;
actor->scale.z += 0.03f * fabsf(Math_CosS(((Player*)actor)->unk_AAA));
@@ -469,7 +469,8 @@ void Actor_TargetContextInit(TargetContext* targetCtx, Actor* actor, PlayState*
void Actor_DrawZTarget(TargetContext* targetCtx, PlayState* play) {
Player* player = GET_PLAYER(play);
if (!(player->stateFlags1 & 0x300006C2)) {
if (!(player->stateFlags1 & (PLAYER_STATE1_2 | PLAYER_STATE1_40 | PLAYER_STATE1_80 | PLAYER_STATE1_200 |
PLAYER_STATE1_400 | PLAYER_STATE1_10000000 | PLAYER_STATE1_20000000))) {
Actor* actor = targetCtx->targetedActor;
OPEN_DISPS(play->state.gfxCtx);
@@ -519,7 +520,7 @@ void Actor_DrawZTarget(TargetContext* targetCtx, PlayState* play) {
Target_SetPos(targetCtx, targetCtx->unk4C, projectedPos.x, projectedPos.y, projectedPos.z);
if ((!(player->stateFlags1 & 0x40)) || (actor != player->unk_730)) {
if ((!(player->stateFlags1 & PLAYER_STATE1_40)) || (actor != player->unk_730)) {
OVERLAY_DISP = Gfx_CallSetupDL(OVERLAY_DISP, 0x39);
for (spB0 = 0, spAC = targetCtx->unk4C; spB0 < spB8; spB0++, spAC = (spAC + 1) % 3) {
@@ -1291,7 +1292,7 @@ void func_800B6F20(PlayState* play, Input* input, f32 magnitude, s16 baseYaw) {
f32 Player_GetHeight(Player* player) {
f32 extraHeight;
if (player->stateFlags1 & 0x800000) {
if (player->stateFlags1 & PLAYER_STATE1_800000) {
extraHeight = 32.0f;
} else {
extraHeight = 0.0f;
@@ -1302,8 +1303,7 @@ f32 Player_GetHeight(Player* player) {
case PLAYER_FORM_FIERCE_DEITY:
return extraHeight + 124.0f;
case PLAYER_FORM_GORON:
// (player->stateFlags3 & 0x1000): being curled?
return extraHeight + ((player->stateFlags3 & 0x1000) ? 34.0f : 80.0f);
return extraHeight + ((player->stateFlags3 & PLAYER_STATE3_1000) ? 34.0f : 80.0f);
case PLAYER_FORM_ZORA:
return extraHeight + 68.0f;
case PLAYER_FORM_DEKU:
@@ -1314,9 +1314,9 @@ f32 Player_GetHeight(Player* player) {
}
f32 Player_GetRunSpeedLimit(Player* player) {
if (player->stateFlags1 & 0x800000) {
if (player->stateFlags1 & PLAYER_STATE1_800000) {
return 15.0f;
} else if (player->stateFlags1 & 0x8000000) {
} else if (player->stateFlags1 & PLAYER_STATE1_8000000) {
return (R_RUN_SPEED_LIMIT / 100.0f) * 0.6f;
} else {
return R_RUN_SPEED_LIMIT / 100.0f;
@@ -1324,7 +1324,7 @@ f32 Player_GetRunSpeedLimit(Player* player) {
}
s32 func_800B7118(Player* player) {
return player->stateFlags1 & 0x8;
return player->stateFlags1 & PLAYER_STATE1_8;
}
s32 func_800B7128(Player* player) {
@@ -1334,7 +1334,7 @@ s32 func_800B7128(Player* player) {
s32 func_800B715C(PlayState* play) {
Player* player = GET_PLAYER(play);
return player->stateFlags2 & 0x8;
return player->stateFlags2 & PLAYER_STATE2_8;
}
void Actor_SetCameraHorseSetting(PlayState* play, Player* player) {
@@ -1349,12 +1349,12 @@ void Actor_SetCameraHorseSetting(PlayState* play, Player* player) {
void Actor_MountHorse(PlayState* play, Player* player, Actor* horse) {
player->rideActor = horse;
player->stateFlags1 |= 0x800000;
player->stateFlags1 |= PLAYER_STATE1_800000;
horse->child = &player->actor;
}
s32 func_800B7200(Player* player) {
return (player->stateFlags1 & 0x20000080) || (player->csMode != 0);
return (player->stateFlags1 & (PLAYER_STATE1_20000000 | PLAYER_STATE1_80)) || (player->csMode != 0);
}
void func_800B722C(GameState* gameState, Player* player) {
@@ -1999,13 +1999,16 @@ s32 Actor_HasParent(Actor* actor, PlayState* play) {
s32 Actor_PickUp(Actor* actor, PlayState* play, s32 getItemId, f32 xzRange, f32 yRange) {
Player* player = GET_PLAYER(play);
if (!(player->stateFlags1 & 0x3C7080) && Player_GetExplosiveHeld(player) < 0) {
if (!(player->stateFlags1 &
(PLAYER_STATE1_80 | PLAYER_STATE1_1000 | PLAYER_STATE1_2000 | PLAYER_STATE1_4000 | PLAYER_STATE1_40000 |
PLAYER_STATE1_80000 | PLAYER_STATE1_100000 | PLAYER_STATE1_200000)) &&
Player_GetExplosiveHeld(player) < 0) {
if ((actor->xzDistToPlayer <= xzRange) && (fabsf(actor->playerHeightRel) <= fabsf(yRange))) {
if ((getItemId == GI_MASK_CIRCUS_LEADER || getItemId == GI_PENDANT_OF_MEMORIES ||
getItemId == GI_DEED_LAND ||
((player->heldActor != NULL || actor == player->targetActor) &&
(getItemId > GI_NONE && getItemId < GI_MAX))) ||
!(player->stateFlags1 & 0x20000800)) {
!(player->stateFlags1 & (PLAYER_STATE1_800 | PLAYER_STATE1_20000000))) {
s16 yawDiff = actor->yawTowardsPlayer - player->actor.shape.rot.y;
s32 absYawDiff = ABS_ALT(yawDiff);
@@ -2081,7 +2084,9 @@ s32 Actor_HasRider(PlayState* play, Actor* horse) {
s32 Actor_SetRideActor(PlayState* play, Actor* horse, s32 mountSide) {
Player* player = GET_PLAYER(play);
if (!(player->stateFlags1 & 0x003C7880)) {
if (!(player->stateFlags1 &
(PLAYER_STATE1_80 | PLAYER_STATE1_800 | PLAYER_STATE1_1000 | PLAYER_STATE1_2000 | PLAYER_STATE1_4000 |
PLAYER_STATE1_40000 | PLAYER_STATE1_80000 | PLAYER_STATE1_100000 | PLAYER_STATE1_200000))) {
player->rideActor = horse;
player->mountSide = mountSide;
ActorCutscene_SetIntentToPlay(0x7C);
@@ -2353,7 +2358,7 @@ Actor* Actor_UpdateActor(UpdateActor_Params* params) {
if (((params->unk_08) && !(actor->flags & params->unk_08)) ||
((tmp = (params->unk_08 == 0)) &&
(!(actor->flags & ACTOR_FLAG_100000) ||
((actor->category == ACTORCAT_EXPLOSIVES) && (params->player->stateFlags1 & 0x200))) &&
((actor->category == ACTORCAT_EXPLOSIVES) && (params->player->stateFlags1 & PLAYER_STATE1_200))) &&
(params->unkC != 0) && (actor != params->unk10) && ((actor != params->player->heldActor)) &&
(actor->parent != &params->player->actor))) {
CollisionCheck_ResetDamage(&actor->colChkInfo);
@@ -2395,9 +2400,35 @@ Actor* Actor_UpdateActor(UpdateActor_Params* params) {
return nextActor;
}
u32 D_801AED58[] = {
0x100002C2, 0x100002C2, 0x00000200, 0x100006C2, 0x00000282, 0x300002C2,
0x10000282, 0x00000002, 0x300002C2, 0x100006C2, 0x00000002, 0x100002C2,
u32 D_801AED58[ACTORCAT_MAX] = {
/* ACTORCAT_SWITCH */
PLAYER_STATE1_2 | PLAYER_STATE1_40 | PLAYER_STATE1_80 | PLAYER_STATE1_200 | PLAYER_STATE1_10000000,
/* ACTORCAT_BG */
PLAYER_STATE1_2 | PLAYER_STATE1_40 | PLAYER_STATE1_80 | PLAYER_STATE1_200 | PLAYER_STATE1_10000000,
/* ACTORCAT_PLAYER */
PLAYER_STATE1_200,
/* ACTORCAT_EXPLOSIVES */
PLAYER_STATE1_2 | PLAYER_STATE1_40 | PLAYER_STATE1_80 | PLAYER_STATE1_200 | PLAYER_STATE1_400 |
PLAYER_STATE1_10000000,
/* ACTORCAT_NPC */
PLAYER_STATE1_2 | PLAYER_STATE1_80 | PLAYER_STATE1_200,
/* ACTORCAT_ENEMY */
PLAYER_STATE1_2 | PLAYER_STATE1_40 | PLAYER_STATE1_80 | PLAYER_STATE1_200 | PLAYER_STATE1_10000000 |
PLAYER_STATE1_20000000,
/* ACTORCAT_PROP */
PLAYER_STATE1_2 | PLAYER_STATE1_80 | PLAYER_STATE1_200 | PLAYER_STATE1_10000000,
/* ACTORCAT_ITEMACTION */
PLAYER_STATE1_2,
/* ACTORCAT_MISC */
PLAYER_STATE1_2 | PLAYER_STATE1_40 | PLAYER_STATE1_80 | PLAYER_STATE1_200 | PLAYER_STATE1_10000000 |
PLAYER_STATE1_20000000,
/* ACTORCAT_BOSS */
PLAYER_STATE1_2 | PLAYER_STATE1_40 | PLAYER_STATE1_80 | PLAYER_STATE1_200 | PLAYER_STATE1_400 |
PLAYER_STATE1_10000000,
/* ACTORCAT_DOOR */
PLAYER_STATE1_2,
/* ACTORCAT_CHEST */
PLAYER_STATE1_2 | PLAYER_STATE1_40 | PLAYER_STATE1_80 | PLAYER_STATE1_200 | PLAYER_STATE1_10000000,
};
void Actor_UpdateAll(PlayState* play, ActorContext* actorCtx) {
@@ -2427,13 +2458,13 @@ void Actor_UpdateAll(PlayState* play, ActorContext* actorCtx) {
tmp = D_801AED58;
if (player->stateFlags2 & 0x8000000) {
if (player->stateFlags2 & PLAYER_STATE2_8000000) {
params.unk_08 = 0x2000000;
} else {
params.unk_08 = 0;
}
if ((player->stateFlags1 & 0x40) && ((player->actor.textId & 0xFF00) != 0x1900)) {
if ((player->stateFlags1 & PLAYER_STATE1_40) && ((player->actor.textId & 0xFF00) != 0x1900)) {
params.unk10 = player->targetActor;
} else {
params.unk10 = NULL;
@@ -2486,7 +2517,7 @@ void Actor_UpdateAll(PlayState* play, ActorContext* actorCtx) {
}
}
if (!(player->stateFlags1 & 2)) {
if (!(player->stateFlags1 & PLAYER_STATE1_2)) {
func_800B5814(&actorCtx->targetContext, player, actor, &play->state);
}
@@ -2835,7 +2866,7 @@ void Actor_DrawAll(PlayState* play, ActorContext* actorCtx) {
if (play->actorCtx.lensActive) {
Math_StepToC(&play->actorCtx.lensMaskSize, LENS_MASK_ACTIVE_SIZE, 20);
if (GET_PLAYER(play)->stateFlags2 & 0x8000000) {
if (GET_PLAYER(play)->stateFlags2 & PLAYER_STATE2_8000000) {
Actor_DeactivateLens(play);
}
} else {
@@ -3658,7 +3689,7 @@ s16 Actor_TestFloorInDirection(Actor* actor, PlayState* play, f32 distance, s16
s32 Actor_IsTargeted(PlayState* play, Actor* actor) {
Player* player = GET_PLAYER(play);
if ((player->stateFlags3 & 0x80000000) && actor->isTargeted) {
if ((player->stateFlags3 & PLAYER_STATE3_80000000) && actor->isTargeted) {
return true;
}
@@ -3671,7 +3702,7 @@ s32 Actor_IsTargeted(PlayState* play, Actor* actor) {
s32 Actor_OtherIsTargeted(PlayState* play, Actor* actor) {
Player* player = GET_PLAYER(play);
if ((player->stateFlags3 & 0x80000000) && !actor->isTargeted) {
if ((player->stateFlags3 & PLAYER_STATE3_80000000) && !actor->isTargeted) {
return true;
}
+1
View File
@@ -1,3 +1,4 @@
#include "prevent_bss_reordering.h"
#include "global.h"
Vec3f D_801EDE00;
+3 -2
View File
@@ -1,3 +1,4 @@
#include "prevent_bss_reordering.h"
#include "global.h"
#include "z64quake.h"
#include "z64rumble.h"
@@ -270,10 +271,10 @@ void Cutscene_Command_Misc(PlayState* play, CutsceneContext* csCtx, CsCmdBase* c
gSaveContext.save.playerForm = PLAYER_FORM_DEKU;
break;
case 0x17:
player->stateFlags2 |= 0x4000000;
player->stateFlags2 |= PLAYER_STATE2_4000000;
break;
case 0x18:
player->stateFlags2 &= ~0x4000000;
player->stateFlags2 &= ~PLAYER_STATE2_4000000;
break;
case 0x19:
sCutsceneStoredPlayerForm = gSaveContext.save.playerForm;
+1 -1
View File
@@ -487,7 +487,7 @@ void EnItem00_Update(Actor* thisx, PlayState* play) {
EnItem00* this = THIS;
s32 pad;
Player* player = GET_PLAYER(play);
s32 sp38 = player->stateFlags3 & 0x1000;
s32 sp38 = player->stateFlags3 & PLAYER_STATE3_1000;
s32 getItemId = GI_NONE;
s32 params;
+1 -1
View File
@@ -79,7 +79,7 @@ void KaleidoSetup_Update(PlayState* play) {
if (!Play_InCsMode(play) || ((msgCtx->msgMode != 0) && (msgCtx->currentTextId == 0xFF))) {
if ((play->unk_1887C < 2) && (gSaveContext.magicState != MAGIC_STATE_STEP_CAPACITY) &&
(gSaveContext.magicState != MAGIC_STATE_FILL)) {
if (!(gSaveContext.eventInf[1] & 0x80) && !(player->stateFlags1 & 0x20)) {
if (!(gSaveContext.eventInf[1] & 0x80) && !(player->stateFlags1 & PLAYER_STATE1_20)) {
if (!(play->actorCtx.flags & ACTORCTX_FLAG_1) &&
!(play->actorCtx.flags & ACTORCTX_FLAG_2)) {
if ((play->actorCtx.unk268 == 0) && CHECK_BTN_ALL(input->press.button, BTN_START)) {
+1252 -104
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -2,7 +2,7 @@
* File: z_shrink_window.c
* Description: Draws black top/bottom/side borders on the viewing window (e.g. Z-targeting, talking to NPC)
*/
#include "prevent_bss_reordering.h"
#include "global.h"
#include "z64shrink_window.h"