Bring over some player documentation from decomp (#3380)

* Document static variables

* Document enums and structs

* Document some functions

* Document more functions

* actionParam to itemAction and fix build

* Document some local variables and a define

* General cleanup

* Use PlayerMeleeWeaponAnimation enum when appropiate

* Document some function parameters and local variables

* Document some of player struct
This commit is contained in:
Pepe20129
2023-11-26 17:54:54 +01:00
committed by GitHub
parent d0d1d9c487
commit 5b81964ea5
15 changed files with 1916 additions and 1562 deletions
+8 -8
View File
@@ -1426,27 +1426,27 @@ void Actor_MountHorse(PlayState* play, Player* player, Actor* horse) {
}
s32 func_8002DEEC(Player* player) {
return (player->stateFlags1 & 0x20000080) || (player->csMode != 0);
return (player->stateFlags1 & 0x20000080) || (player->csAction != 0);
}
void func_8002DF18(PlayState* play, Player* player) {
func_8006DC68(play, player);
}
s32 func_8002DF38(PlayState* play, Actor* actor, u8 csMode) {
s32 func_8002DF38(PlayState* play, Actor* actor, u8 csAction) {
Player* player = GET_PLAYER(play);
player->csMode = csMode;
player->unk_448 = actor;
player->csAction = csAction;
player->csActor = actor;
player->doorBgCamIndex = 0;
return true;
}
s32 func_8002DF54(PlayState* play, Actor* actor, u8 csMode) {
s32 func_8002DF54(PlayState* play, Actor* actor, u8 csAction) {
Player* player = GET_PLAYER(play);
func_8002DF38(play, actor, csMode);
func_8002DF38(play, actor, csAction);
player->doorBgCamIndex = 1;
return true;
@@ -2121,8 +2121,8 @@ void func_8002F5C4(Actor* actorA, Actor* actorB, PlayState* play) {
void func_8002F5F0(Actor* actor, PlayState* play) {
Player* player = GET_PLAYER(play);
if (actor->xyzDistToPlayerSq < player->unk_6A4) {
player->unk_6A4 = actor->xyzDistToPlayerSq;
if (actor->xyzDistToPlayerSq < player->closestSecretDistSq) {
player->closestSecretDistSq = actor->xyzDistToPlayerSq;
}
}
+2 -2
View File
@@ -4521,7 +4521,7 @@ s32 Camera_Subj4(Camera* camera) {
if ((anim->unk_28 < temp_f16) && !anim->unk_2E) {
player = camera->player;
anim->unk_2E = true;
func_800F4010(&player->actor.projectedPos, player->unk_89E + 0x8B0, 4.0f);
func_800F4010(&player->actor.projectedPos, player->floorSfxOffset + 0x8B0, 4.0f);
} else if (anim->unk_28 > temp_f16) {
anim->unk_2E = false;
}
@@ -7732,7 +7732,7 @@ void Camera_Finish(Camera* camera) {
player->actor.freezeTimer = 0;
player->stateFlags1 &= ~0x20000000;
if (player->csMode != 0) {
if (player->csAction != 0) {
func_8002DF54(camera->play, &player->actor, 7);
osSyncPrintf("camera: player demo end!!\n");
}
+4 -4
View File
@@ -573,7 +573,7 @@ uint8_t Player_IsCustomLinkModel() {
}
s32 Player_InBlockingCsMode(PlayState* play, Player* this) {
return (this->stateFlags1 & 0x20000080) || (this->csMode != 0) || (play->transitionTrigger == TRANS_TRIGGER_START) ||
return (this->stateFlags1 & 0x20000080) || (this->csAction != 0) || (play->transitionTrigger == TRANS_TRIGGER_START) ||
(this->stateFlags1 & 1) || (this->stateFlags3 & 0x80) ||
((gSaveContext.magicState != MAGIC_STATE_IDLE) && (Player_ActionToMagicSpell(this, this->itemAction) >= 0));
}
@@ -668,7 +668,7 @@ void func_8008EC70(Player* this) {
}
void Player_SetEquipmentData(PlayState* play, Player* this) {
if (this->csMode != 0x56) {
if (this->csAction != 0x56) {
this->currentShield = SHIELD_EQUIP_TO_PLAYER(CUR_EQUIP_VALUE(EQUIP_TYPE_SHIELD));
this->currentTunic = TUNIC_EQUIP_TO_PLAYER(CUR_EQUIP_VALUE(EQUIP_TYPE_TUNIC));
this->currentBoots = BOOTS_EQUIP_TO_PLAYER(CUR_EQUIP_VALUE(EQUIP_TYPE_BOOTS));
@@ -893,8 +893,8 @@ s32 Player_GetEnvironmentalHazard(PlayState* play) {
if (play->roomCtx.curRoom.behaviorType2 == ROOM_BEHAVIOR_TYPE2_3) { // Room is hot
var = 0;
} else if ((this->unk_840 > 80) &&
((this->currentBoots == PLAYER_BOOTS_IRON) || (this->unk_840 >= 300))) { // Deep underwater
} else if ((this->underwaterTimer > 80) &&
((this->currentBoots == PLAYER_BOOTS_IRON) || (this->underwaterTimer >= 300))) { // Deep underwater
var = ((this->currentBoots == PLAYER_BOOTS_IRON) && (this->actor.bgCheckFlags & 1)) ? 1 : 3;
} else if (this->stateFlags1 & 0x8000000) { // Swimming
var = 2;
@@ -438,8 +438,8 @@ void func_808809E4(BgHakaTrap* this, PlayState* play, s16 arg2) {
if ((fabsf(sp18.x) < 70.0f) && (fabsf(sp18.y) < 100.0f) && (sp18.z < 500.0f) &&
(GET_PLAYER(play)->currentBoots != PLAYER_BOOTS_IRON)) {
player->windSpeed = ((500.0f - sp18.z) * 0.06f + 5.0f) * arg2 * (1.0f / 0x3A00) * (2.0f / 3.0f);
player->windDirection = this->dyna.actor.shape.rot.y;
player->pushedSpeed = ((500.0f - sp18.z) * 0.06f + 5.0f) * arg2 * (1.0f / 0x3A00) * (2.0f / 3.0f);
player->pushedYaw = this->dyna.actor.shape.rot.y;
}
}
@@ -970,7 +970,7 @@ void BossDodongo_Update(Actor* thisx, PlayState* play2) {
magmaScale = ((s16)(Rand_ZeroOne() * 50)) - 50;
}
if (player2->csMode >= 10) {
if (player2->csAction >= 10) {
phi_s0_3 = -1;
}
@@ -854,7 +854,7 @@ void BossMo_Tentacle(BossMo* this, PlayState* play) {
if (&this->actor == player->actor.parent) {
player->unk_850 = 0x65;
player->actor.parent = NULL;
player->csMode = 0;
player->csAction = 0;
if (this->timers[0] == 0) {
func_8002F6D4(play, &this->actor, 20.0f, this->actor.shape.rot.y + 0x8000, 10.0f, 0);
}
@@ -884,7 +884,7 @@ void BossMo_Tentacle(BossMo* this, PlayState* play) {
if (&this->actor == player->actor.parent) {
player->unk_850 = 0x65;
player->actor.parent = NULL;
player->csMode = 0;
player->csAction = 0;
}
Math_ApproachF(&this->tentRippleSize, 0.15f, 0.5f, 0.01);
if (this->meltIndex < 41) {
@@ -1806,7 +1806,7 @@ void BossMo_CoreCollisionCheck(BossMo* this, PlayState* play) {
if (player->actor.parent != NULL) {
player->unk_850 = 0x65;
player->actor.parent = NULL;
player->csMode = 0;
player->csAction = 0;
}
} else {
this->actor.colChkInfo.health = 1;
@@ -1825,7 +1825,7 @@ void BossMo_CoreCollisionCheck(BossMo* this, PlayState* play) {
if (player->actor.parent == &sMorphaTent1->actor) {
player->unk_850 = 0x65;
player->actor.parent = NULL;
player->csMode = 0;
player->csAction = 0;
}
}
this->work[MO_TENT_ACTION_STATE] = MO_CORE_STUNNED;
@@ -248,7 +248,7 @@ void EnEncount1_SpawnStalchildOrWolfos(EnEncount1* this, PlayState* play) {
while ((this->curNumSpawn < this->maxCurSpawns && this->totalNumSpawn < this->maxTotalSpawns) ||
(CVarGetInteger("gRandomizedEnemies", 0) && enemyCount < 15)) {
if (play->sceneNum == SCENE_HYRULE_FIELD) {
if ((player->unk_89E == 0) || (player->actor.floorBgId != BGCHECK_SCENE) ||
if ((player->floorSfxOffset == 0) || (player->actor.floorBgId != BGCHECK_SCENE) ||
!(player->actor.bgCheckFlags & 1) || (player->stateFlags1 & 0x08000000)) {
this->fieldSpawnTimer = 60;
@@ -21,7 +21,7 @@ void EnPartner_Draw(Actor* thisx, PlayState* play);
void EnPartner_SpawnSparkles(EnPartner* this, PlayState* play, s32 sparkleLife);
void func_808328EC(Player* this, u16 sfxId);
void func_808429B4(PlayState* play, s32 speed, s32 y, s32 countdown);
void Player_RequestQuake(PlayState* play, s32 speed, s32 y, s32 countdown);
s32 spawn_boomerang_ivan(EnPartner* this, PlayState* play);
static InitChainEntry sInitChain[] = {
@@ -278,7 +278,7 @@ void UseHammer(Actor* thisx, PlayState* play, u8 started) {
static Vec3f zeroVec = { 0.0f, 0.0f, 0.0f };
Vec3f shockwavePos = this->actor.world.pos;
func_808429B4(play, 27767, 7, 20);
Player_RequestQuake(play, 27767, 7, 20);
Player_PlaySfx(&this->actor, NA_SE_IT_HAMMER_HIT);
EffectSsBlast_SpawnWhiteShockwave(play, &shockwavePos, &zeroVec, &zeroVec);
@@ -164,8 +164,8 @@ void func_80AFBE8C(EnSiofuki* this, PlayState* play) {
Math_ApproachF(&this->appliedSpeed, this->targetAppliedSpeed, 1.0f, 0.1f);
}
player->windDirection = this->appliedYaw;
player->windSpeed = this->appliedSpeed;
player->pushedYaw = this->appliedYaw;
player->pushedSpeed = this->appliedSpeed;
}
} else {
if (this->applySpeed) {
@@ -92,11 +92,11 @@ void EnStream_SuckPlayer(EnStream* this, PlayState* play) {
if (func_80B0B81C(&this->actor.world.pos, &player->actor.world.pos, &posDifference, this->actor.scale.y) != 0) {
xzDist = sqrtf(SQ(posDifference.x) + SQ(posDifference.z));
yDistWithOffset = player->actor.world.pos.y - (this->actor.world.pos.y - 90.0f);
player->windDirection = Math_FAtan2F(-posDifference.x, -posDifference.z) * (0x8000 / M_PI);
player->pushedYaw = Math_FAtan2F(-posDifference.x, -posDifference.z) * (0x8000 / M_PI);
if (xzDist > 3.0f) {
Math_SmoothStepToF(&player->windSpeed, 3.0f, 0.5f, xzDist, 0.0f);
Math_SmoothStepToF(&player->pushedSpeed, 3.0f, 0.5f, xzDist, 0.0f);
} else {
player->windSpeed = 0.0f;
player->pushedSpeed = 0.0f;
Math_SmoothStepToF(&player->actor.world.pos.x, this->actor.world.pos.x, 0.5f, 3.0f, 0.0f);
Math_SmoothStepToF(&player->actor.world.pos.z, this->actor.world.pos.z, 0.5f, 3.0f, 0.0f);
}
@@ -602,8 +602,8 @@ void EnTorch2_Update(Actor* thisx, PlayState* play2) {
// Handles Dark Link being damaged
if ((this->actor.colChkInfo.health == 0) && sDeathFlag) {
this->csMode = 0x18;
this->unk_448 = &player->actor;
this->csAction = 0x18;
this->csActor = &player->actor;
this->doorBgCamIndex = 1;
sDeathFlag = false;
}
File diff suppressed because it is too large Load Diff