Skip to content

Commit 7648db0

Browse files
committed
Regression fix attempt
1 parent 25994f9 commit 7648db0

File tree

1 file changed

+74
-64
lines changed

1 file changed

+74
-64
lines changed

src/SB/Game/zNPCTypeTiki.cpp

Lines changed: 74 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -517,73 +517,87 @@ S32 zNPCTiki::SetCarryState(en_NPC_CARRY_STATE cs)
517517
return 0;
518518
}
519519

520-
if (cs != zNPCCARRY_THROW)
520+
if (cs == zNPCCARRY_THROW)
521521
{
522-
if (cs >= zNPCCARRY_THROW)
522+
return 0;
523+
}
524+
525+
if (cs >= zNPCCARRY_THROW)
526+
{
527+
if (cs < 4)
523528
{
524-
if (cs < 4)
529+
if (this->numChildren == 0)
525530
{
526-
if (this->numChildren == 0)
527-
{
528-
return 1;
529-
}
531+
return 1;
532+
}
530533

531-
for (S32 i = 0; i < 4; i++)
532-
{
533-
if (this->children[i] != NULL && this->children[i]->bound.box.box.lower.y <
534-
0.2f + this->bound.box.box.upper.y)
535-
{
536-
return 0;
537-
}
538-
}
534+
if (this->children[0] != NULL &&
535+
this->children[0]->bound.box.box.lower.y < 0.2f + this->bound.box.box.upper.y)
536+
{
537+
return 0;
538+
}
539539

540-
return 1;
540+
if (this->children[1] != NULL &&
541+
this->children[1]->bound.box.box.lower.y < 0.2f + this->bound.box.box.upper.y)
542+
{
543+
return 0;
541544
}
542545

543-
return 1;
544-
}
546+
if (this->children[2] != NULL &&
547+
this->children[2]->bound.box.box.lower.y < 0.2f + this->bound.box.box.upper.y)
548+
{
549+
return 0;
550+
}
551+
552+
if (this->children[3] != NULL &&
553+
this->children[3]->bound.box.box.lower.y < 0.2f + this->bound.box.box.upper.y)
554+
{
555+
return 0;
556+
}
545557

546-
if (cs != zNPCCARRY_NONE)
547-
{
548-
this->tikiFlag |= 0x10;
549-
this->landHt = FLOAT_MIN;
550-
RemoveFromFamily();
551558
return 1;
552559
}
560+
561+
return 0;
553562
}
554563

555-
if ((this->tikiFlag & 0x10))
564+
if (cs != zNPCCARRY_NONE)
556565
{
557-
this->tikiFlag &= ~0x10;
566+
this->tikiFlag |= 0x10;
567+
this->landHt = FLOAT_MIN;
568+
RemoveFromFamily();
569+
return 1;
570+
}
558571

559-
if (this->frame != NULL)
560-
{
561-
this->frame->mat.up.x = 0.0f;
562-
this->frame->mat.up.y = 1.0f;
563-
this->frame->mat.up.z = 0.0f;
564-
}
572+
if ((this->tikiFlag & 0x10) == 0)
573+
{
574+
return 0;
575+
}
565576

566-
this->model->Mat->up.x = 0.0f;
567-
this->model->Mat->up.y = 1.0f;
568-
this->model->Mat->up.z = 0.0f;
577+
this->tikiFlag &= ~0x10;
569578

570-
if (this->SelfType() == NPC_TYPE_TIKI_STONE)
571-
{
572-
this->tikiFlag |= 0x25;
573-
this->bound.type = XBOUND_TYPE_BOX;
574-
}
575-
else
576-
{
577-
this->Damage(DMGTYP_SIDE, 0, NULL);
578-
}
579-
return 1;
579+
if (this->frame != NULL)
580+
{
581+
this->frame->mat.up.x = 0.0f;
582+
this->frame->mat.up.y = 1.0f;
583+
this->frame->mat.up.z = 0.0f;
584+
}
585+
586+
this->model->Mat->up.x = 0.0f;
587+
this->model->Mat->up.y = 1.0f;
588+
this->model->Mat->up.z = 0.0f;
589+
590+
if (this->SelfType() == NPC_TYPE_TIKI_STONE)
591+
{
592+
this->tikiFlag |= 0x25;
593+
this->bound.type = XBOUND_TYPE_BOX;
580594
}
581595
else
582596
{
583-
return 0;
597+
this->Damage(DMGTYP_SIDE, 0, NULL);
584598
}
585599

586-
return 0;
600+
return 1;
587601
}
588602

589603
void zNPCTiki::SelfSetup()
@@ -1744,10 +1758,6 @@ static void loveyTikiRender(xEnt* ent)
17441758
xVec3 center;
17451759
xVec3 shadVec;
17461760

1747-
S32 alphaTooLow = 0;
1748-
S32 skipModelRender = 0;
1749-
S32 __frame_pad[8];
1750-
17511761
if (model == NULL)
17521762
return;
17531763

@@ -1765,25 +1775,23 @@ static void loveyTikiRender(xEnt* ent)
17651775
}
17661776

17671777
cache.polyCount = 0;
1778+
}
17681779

1769-
if (factor > 0.0f)
1770-
{
1771-
if (factor > 1.0f)
1772-
factor = 1.0f;
1780+
if (factor > 0.0f)
1781+
{
1782+
if (factor > 1.0f)
1783+
factor = 1.0f;
17731784

1774-
xVec3Copy(&center, (xVec3*)&model->Mat->pos);
1775-
center.y += sLoveyIconOffset;
1785+
xVec3Copy(&center, (xVec3*)&model->Mat->pos);
1786+
center.y += sLoveyIconOffset;
17761787

1777-
NPCC_RenderProjTextureFaceCamera(sHelmetRast, factor, &center, 0.7f,
1778-
sLoveyIconDist + sLoveyIconOffset, &cache, 1, ent);
1779-
}
1780-
}
1781-
else
1782-
{
1783-
return;
1788+
NPCC_RenderProjTextureFaceCamera(sHelmetRast, factor, &center, 0.7f,
1789+
sLoveyIconDist + sLoveyIconOffset, &cache, 1, ent);
17841790
}
17851791

1786-
alphaTooLow = 0;
1792+
S32 alphaTooLow = 0;
1793+
S32 skipModelRender = 0;
1794+
17871795
center.x = model->Mat->pos.x;
17881796
center.y = model->Mat->pos.y - 10.0f;
17891797
center.z = model->Mat->pos.z;
@@ -1810,7 +1818,9 @@ static void loveyTikiRender(xEnt* ent)
18101818
{
18111819
model->Alpha += 3.0f * globals.update_dt;
18121820
if (model->Alpha > 1.0f)
1821+
{
18131822
model->Alpha = 1.0f;
1823+
}
18141824
}
18151825

18161826
for (xModelInstance* curr = model->Next; curr != NULL; curr = curr->Next)

0 commit comments

Comments
 (0)