Advertisement
fig02

EnTest_Update

Apr 22nd, 2021 (edited)
601
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 4.83 KB | None | 0 0
  1. void EnTest_Update(Actor* thisx, GlobalContext* globalCtx) {
  2.     EnTest* this = THIS;
  3.     f32 oldWeight;
  4.     u32 floorProperty;
  5.     s32 pad;
  6.  
  7.     func_808634F8(this, globalCtx);
  8.  
  9.     if (this->actor.colChkInfo.damageEffect != 6) {
  10.         Actor_MoveForward(&this->actor);
  11.         Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 75.0f, 30.0f, 30.0f, 0x1D);
  12.  
  13.         if (this->actor.params != 1) {
  14.             goto label_1;
  15.         }
  16.  
  17.         if (this->actor.world.pos.y <= this->actor.home.pos.y) {
  18.             this->actor.world.pos.y = this->actor.home.pos.y;
  19.             this->actor.velocity.y = 0.0f;
  20.         }
  21.  
  22.         if (this->actor.floorHeight <= this->actor.home.pos.y) {
  23.             this->actor.floorHeight = this->actor.home.pos.y;
  24.         }
  25.  
  26.     label_2:
  27.         this->actionFunc(this, globalCtx);
  28.  
  29.         switch (this->unk_7DE) {
  30.             {
  31.             label_1:
  32.                 if (!(this->actor.bgCheckFlags & 2)) {
  33.                     goto label_2;
  34.                 }
  35.  
  36.                 floorProperty = func_80041EA4(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId);
  37.  
  38.                 if ((floorProperty != 5) && (floorProperty != 0xC)) {
  39.                     if (func_80041D4C(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId) != 9) {
  40.                         goto label_2;
  41.                     }
  42.                 }
  43.  
  44.                 Actor_Kill(&this->actor);
  45.                 return;
  46.             }
  47.  
  48.             case 0:
  49.                 break;
  50.  
  51.             case 1:
  52.                 Animation_Change(&this->skelAnime_4A8, &D_06001C20, 2.0f, 0.0f, Animation_GetLastFrame(&D_06001C20), 2,
  53.                                  2.0f);
  54.                 AnimationContext_SetCopyTrue(globalCtx, this->skelAnime_188.limbCount, this->skelAnime_188.jointTable,
  55.                                              this->skelAnime_4A8.jointTable, D_80864510);
  56.                 this->unk_7DE++;
  57.                 break;
  58.                
  59.             case 2:
  60.                 SkelAnime_Update(&this->skelAnime_4A8);
  61.                 SkelAnime_CopyFrameTableTrue(&this->skelAnime_188, this->skelAnime_188.jointTable,
  62.                                              this->skelAnime_4A8.jointTable, D_80864510);
  63.                 break;
  64.  
  65.             case 3:
  66.                 this->unk_7DE++;
  67.                 this->skelAnime_4A8.morphWeight = 4.0f;
  68.                 // fallthrough
  69.             case 4:
  70.                 oldWeight = this->skelAnime_4A8.morphWeight;
  71.                 this->skelAnime_4A8.morphWeight = this->skelAnime_4A8.morphWeight - 1.0f;
  72.  
  73.                 if (this->skelAnime_4A8.morphWeight <= 0.0f) {
  74.                     this->unk_7DE = 0;
  75.                 }
  76.  
  77.                 SkelAnime_InterpFrameTable(this->skelAnime_188.limbCount, this->skelAnime_4A8.jointTable,
  78.                                            this->skelAnime_4A8.jointTable, this->skelAnime_188.jointTable,
  79.                                            1.0f - (this->skelAnime_4A8.morphWeight / oldWeight));
  80.                 SkelAnime_CopyFrameTableTrue(&this->skelAnime_188, this->skelAnime_188.jointTable,
  81.                                              this->skelAnime_4A8.jointTable, D_80864510);
  82.                 break;
  83.         }
  84.  
  85.         if ((this->actor.colorFilterTimer == 0) && (this->actor.colChkInfo.health != 0)) {
  86.             if ((this->unk_7C8 != 0x10) && (this->unk_7C8 != 0x17)) {
  87.                 func_80863460(this, globalCtx);
  88.             } else {
  89.                 Math_SmoothStepToS(&this->unk_7D2, 0, 1, 0x3E8, 0);
  90.             }
  91.         }
  92.     }
  93.  
  94.     Collider_UpdateCylinder(this, &this->collider);
  95.  
  96.     this->actor.focus.pos = this->actor.world.pos;
  97.     this->actor.focus.pos.y += 45.0f;
  98.  
  99.     if ((this->actor.colChkInfo.health > 0) || (this->actor.colorFilterTimer != 0)) {
  100.         CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider);
  101.  
  102.         if ((this->unk_7C8 >= 0xA) &&
  103.             ((this->actor.colorFilterTimer == 0) || (!(this->actor.colorFilterParams & 0x4000)))) {
  104.             CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider);
  105.         }
  106.  
  107.         if (this->unk_7DE != 0) {
  108.             CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->shieldCollider);
  109.         }
  110.     }
  111.  
  112.     if (this->atOn > 0) {
  113.         if (!(this->swordCollider.base.atFlags & 4)) {
  114.             CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->swordCollider);
  115.         } else {
  116.             this->swordCollider.base.atFlags &= ~4;
  117.             func_80863240(this);
  118.         }
  119.     }
  120.  
  121.     if (this->actor.params == 0) {
  122.         if (globalCtx->actorCtx.unk_03 != 0) {
  123.             this->actor.flags |= 0x81;
  124.             this->actor.shape.shadowDraw = ActorShadow_DrawFeet;
  125.         } else {
  126.             this->actor.flags &= ~0x81;
  127.             this->actor.shape.shadowDraw = NULL;
  128.         }
  129.     }
  130. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement