diff options
| author | mzxrules <mzxrules@gmail.com> | 2021-01-08 06:12:58 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-01-08 06:12:58 -0500 |
| commit | 3cef03f5ff9c0341544afec9636bd0581f87d0cc (patch) | |
| tree | 91ff5c72cadc5c647b52c285f9432f9f40e327dd /src/code/z_en_a_keep.c | |
| parent | 209f0d21b87fa01c033a943fd8c862cb46b31315 (diff) | |
z_bgcheck.c, 800430A0.c, 80043480.c (#256)
* beginning of migrating changes
* got matching
* changed order a bit
* clean up bgcheck
* fix conflict
* fix conflict again
* first stab at identifying types, some oks
* Clean up most bad structs/pointer math, move relevant structs to z64bgcheck.h, get some OKs
* more OKs, z_bgcheck.bss migration, update some sys_math3d.c args
* couple more OKs
* pushing some OKs
* fix compilation issues
* code_800430A0.c OK, more files decomp'd
* 8003A3E0 big OK :)
* Decomp most of func_8003C614, decomp helper funcs
* Decomp SurfaceType, CamData, and WaterBox property related functions
* more OKs, big OK in 8003C078
* more OKs, more progress, move a function definition in z_collision_check to functions.h
* more clean-ups, more OKs, dyn_vtx is now defined as u8*
* 8003A5B8, 8003A7D8, 8003C614, 8003DD6C OK, document function args better
* data migrated, more OKs
* 80041240 OK, func_8003B3C8 and func_8003BB18 disassembled
* func_80040284, 800409A8 non_matching, add IS_ZERO macro
* All asm files have C representations, some big OKs, lots of minor tweaks
* More OKs, non-matching code cleanup
* 8003FBF4 and 80040BE4 OK, improve codegen for most functions
* format z_bgcheck.c
* fix warnings, compile errors on NON_MATCHING
* func_8003EE80 is now NON_MATCHING
* begin documenting some functions
* formatting
* more documentation, func_8003A95C OK
* fix PHYSICAL_TO_VIRTUAL changes
* fix var rename
* More documentation, functions 80040E40, 80041648 OK, change types to not be compatible with ZAP
* func_8004239C ok, more NON_MATCHING improvements, more documentation
* Implement most suggested changes
* Convert comments to slower comments
* /**
* Implement ZAP2 changes
* my anti-virus ate my format.sh results
* Rename a couple hundred functions, fix minor stuff
* rename var so that clang formats correctly
* run format.sh
* implement Petrie's matches/suggestions
* format
* matches
* and the asm
* slight error
* Add SSList
* two more matches
* stuff
* implement code changes
* clean up Petrie's matchings
Co-authored-by: Arthur <arthurtilly413@gmail.com>
Co-authored-by: fig02 <fig02srl@gmail.com>
Co-authored-by: petrie911 <pmontag@DESKTOP-LG8A167.localdomain>
Diffstat (limited to 'src/code/z_en_a_keep.c')
| -rw-r--r-- | src/code/z_en_a_keep.c | 37 |
1 files changed, 20 insertions, 17 deletions
diff --git a/src/code/z_en_a_keep.c b/src/code/z_en_a_keep.c index 81c1b9395..64b18aea3 100644 --- a/src/code/z_en_a_keep.c +++ b/src/code/z_en_a_keep.c @@ -39,8 +39,14 @@ static ColliderCylinderInit sCylinderInit = { { 25, 60, 0, { 0, 0, 0 } }, }; -static UNK_PTR D_8011546C[] = { - 0x040394B0, 0x040394B0, 0x0403A120, 0x0403A480, 0x0403A7F0, 0x06000730, +extern CollisionHeader D_040394B0; +extern CollisionHeader D_0403A120; +extern CollisionHeader D_0403A480; +extern CollisionHeader D_0403A7F0; +extern CollisionHeader D_06000730; + +static CollisionHeader* D_8011546C[] = { + &D_040394B0, &D_040394B0, &D_0403A120, &D_0403A480, &D_0403A7F0, &D_06000730, }; static Gfx* D_80115484[] = { @@ -53,7 +59,7 @@ void EnAObj_SetupAction(EnAObj* this, EnAObjActionFunc actionFunc) { } void EnAObj_Init(Actor* thisx, GlobalContext* globalCtx) { - u32 sp34 = 0; + CollisionHeader* colHeader = NULL; s32 pad; EnAObj* this = THIS; f32 sp28; @@ -91,35 +97,35 @@ void EnAObj_Init(Actor* thisx, GlobalContext* globalCtx) { ActorShape_Init(&thisx->shape, 0.0f, ActorShadow_DrawFunc_Circle, sp28); thisx->posRot2.pos = thisx->posRot.pos; - this->dyna.dynaPolyId = -1; + this->dyna.bgId = BGACTOR_NEG_ONE; this->dyna.unk_160 = 0; - this->dyna.unk_15C = 0; + this->dyna.unk_15C = DPM_UNK; thisx->uncullZoneDownward = 1200.0f; thisx->uncullZoneScale = 200.0f; switch (thisx->params) { case A_OBJ_BLOCK_LARGE: case A_OBJ_BLOCK_HUGE: - this->dyna.dynaPolyId = 1; + this->dyna.bgId = 1; Actor_ChangeType(globalCtx, &globalCtx->actorCtx, thisx, ACTORTYPE_BG); func_8001D5C8(this, thisx->params); break; case A_OBJ_BLOCK_SMALL_ROT: case A_OBJ_BLOCK_LARGE_ROT: - this->dyna.dynaPolyId = 3; + this->dyna.bgId = 3; Actor_ChangeType(globalCtx, &globalCtx->actorCtx, thisx, ACTORTYPE_BG); func_8001D310(this, thisx->params); break; case A_OBJ_UNKNOWN_6: // clang-format off - thisx->flags |= 0x1; this->dyna.dynaPolyId = 5; this->unk_178 = 10.0f; + thisx->flags |= 0x1; this->dyna.bgId = 5; this->unk_178 = 10.0f; // clang-format on thisx->gravity = -2.0f; func_8001D234(this, thisx->params); break; case A_OBJ_GRASS_CLUMP: case A_OBJ_TREE_STUMP: - this->dyna.dynaPolyId = 0; + this->dyna.bgId = 0; func_8001D234(this, thisx->params); break; case A_OBJ_SIGNPOST_OBLONG: @@ -149,16 +155,16 @@ void EnAObj_Init(Actor* thisx, GlobalContext* globalCtx) { thisx->colChkInfo.mass = 0xFF; } - if (this->dyna.dynaPolyId != -1) { - DynaPolyInfo_Alloc(D_8011546C[this->dyna.dynaPolyId], &sp34); - this->dyna.dynaPolyId = DynaPolyInfo_RegisterActor(globalCtx, &globalCtx->colCtx.dyna, thisx, sp34); + if (this->dyna.bgId != BGACTOR_NEG_ONE) { + CollisionHeader_GetVirtual(D_8011546C[this->dyna.bgId], &colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, thisx, colHeader); } } void EnAObj_Destroy(Actor* thisx, GlobalContext* globalCtx) { EnAObj* this = THIS; - DynaPolyInfo_Free(globalCtx, &globalCtx->colCtx.dyna, this->dyna.dynaPolyId); + DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); switch (this->dyna.actor.params) { case A_OBJ_SIGNPOST_OBLONG: @@ -277,10 +283,7 @@ void func_8001D5C8(EnAObj* this, s16 params) { void func_8001D608(EnAObj* this, GlobalContext* globalCtx) { this->dyna.actor.speedXZ += this->dyna.unk_150; this->dyna.actor.posRot.rot.y = this->dyna.unk_158; - - this->dyna.actor.speedXZ = (this->dyna.actor.speedXZ < -2.5f) - ? -2.5f - : ((this->dyna.actor.speedXZ > 2.5f) ? 2.5f : this->dyna.actor.speedXZ); + this->dyna.actor.speedXZ = CLAMP(this->dyna.actor.speedXZ, -2.5f, 2.5f); Math_SmoothStepToF(&this->dyna.actor.speedXZ, 0.0f, 1.0f, 1.0f, 0.0f); |
