Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/SB/Core/x/xHud.h
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ namespace xhud

bool linear_motive_update(widget& w, motive& m, F32);
bool accelerate_motive_update(widget& w, motive& m, F32);
bool delay_motive_update(widget& w, motive& m, F32);

xModelInstance* load_model(U32);
}; // namespace xhud
Expand Down
136 changes: 130 additions & 6 deletions src/SB/Game/zCombo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ struct widget_chunk : xBase

/* .bss */
static xVec3 sUnderCamPos;
static xtextbox * sHideText[5];
static ztextbox* sHideText[5];

/* .sbss */
static widget_chunk* comboHUD;
static zUIFont* sHideUIF[1];
static zUIFont* sHideUIF;
static S32 comboPending;
static S32 comboLastCounter;
static S32 comboCounter;
Expand All @@ -46,7 +46,14 @@ static F32 comboTimer;
static F32 comboMaxTime = 1.0f;
static F32 comboDisplayTime = 2.0f;

extern zComboReward comboReward[16];
static zComboReward comboReward[16] = {
{ 0, "", {}, 0, NULL }, { 0, "", {}, 0, NULL }, { 2, "", {}, 0, NULL },
{ 3, "", {}, 0, NULL }, { 3, "", {}, 0, NULL }, { 5, "", {}, 0, NULL },
{ 10, "", {}, 0, NULL }, { 15, "", {}, 0, NULL }, { 20, "", {}, 0, NULL },
{ 25, "", {}, 0, NULL }, { 30, "", {}, 0, NULL }, { 40, "", {}, 0, NULL },
{ 50, "", {}, 0, NULL }, { 60, "", {}, 0, NULL }, { 75, "", {}, 0, NULL },
{ 100, "", {}, 0, NULL },
};

void fillCombo(zComboReward* reward)
{
Expand Down Expand Up @@ -85,17 +92,17 @@ void fillCombo(zComboReward* reward)
reward->rewardNum = j;
}

void zCombo_Add(S32 arg0)
void zCombo_Add(S32 arg0)
{
if (comboTimer < 0.0f)
if (comboTimer < 0.0f)
{
comboTimer = comboMaxTime;
comboPending = arg0 - 1;
return;
}
comboTimer = comboMaxTime;
comboCounter += arg0;
if ((S32) comboPending != 0)
if ((S32)comboPending != 0)
{
comboCounter += comboPending;
comboPending = 0;
Expand Down Expand Up @@ -217,6 +224,123 @@ void zCombo_HideImmediately()
}
}

void zCombo_Update(F32 dt)
{
F32 temp_f0;
S32 var_r31;
S32 var_r28;
zComboReward* temp_r5;
zComboReward* temp_r3;
zComboReward* temp_r0;

xVec3Copy(&sUnderCamPos, &globals.camera.mat.pos);

xVec3AddScaled(&sUnderCamPos, &globals.camera.mat.up, -3.0f);

var_r31 = comboCounter;
if (comboCounter >= 0x10)
{
var_r31 = 0xf;
}

temp_r3 = comboReward;
temp_r5 = &temp_r3[var_r31];
if (comboLastCounter != comboCounter && temp_r5->reward != 0)
{
if (comboHUD != NULL)
{
strcpy(comboHUD->w.text, xTextAssetGetText(temp_r5->textAsset));
comboHUD->w.show();
}
comboLastCounter = comboCounter;
}

var_r28 = 0;
do
{
if (sHideText[var_r28] != NULL && sHideText[var_r28]->visible())
{
// null-terminating character
comboHUD->w.text[0] = '\x00';
break;
}

var_r28 += 1;
} while (var_r28 < 5);

if (sHideUIF != NULL && xEntIsVisible(sHideUIF))
{
// null-terminating character
comboHUD->w.text[0] = '\x00';
}

if (comboTimer >= 0.0f)
{
temp_f0 = comboTimer - dt;
comboTimer = temp_f0;

temp_r0 = &comboReward[0];

if (comboTimer < 0.0f && temp_r0->reward > 0)
{
zEntPickup_SpawnNRewards(comboReward->rewardList, comboReward->rewardNum, &sUnderCamPos);

switch (var_r31)
{
case 5:
zEntPlayer_SNDPlayStreamRandom(0, 1, ePlayerStreamSnd_Combo1, ePlayerStreamSnd_Combo2,
0.1f);
break;
case 6:
case 7:
zEntPlayer_SNDPlayStreamRandom(0, 2, ePlayerStreamSnd_Combo1, ePlayerStreamSnd_Combo2,
0.1f);
break;
case 8:
case 9:
zEntPlayer_SNDPlayStreamRandom(0, 3, ePlayerStreamSnd_Combo1, ePlayerStreamSnd_Combo2,
0.1f);
break;
case 10:
zEntPlayer_SNDPlayStreamRandom(0, 4, ePlayerStreamSnd_Combo1, ePlayerStreamSnd_Combo2,
0.1f);
break;
case 11:
case 12:
zEntPlayer_SNDPlayStreamRandom(0, 5, ePlayerStreamSnd_Combo1, ePlayerStreamSnd_Combo2,
0.1f);
zEntPlayer_SNDPlayStreamRandom(6, 50, ePlayerStreamSnd_Combo1, ePlayerStreamSnd_Combo5,
0.1f);
break;
case 13:
zEntPlayer_SNDPlayStreamRandom(0, 10, ePlayerStreamSnd_BigCombo1,
ePlayerStreamSnd_BigCombo2, 0.1f);
zEntPlayer_SNDPlayStream(11, 100, ePlayerStreamSnd_BigCombo1, 0x0);
break;
case 14:
zEntPlayer_SNDPlayStreamRandom(0, 10, ePlayerStreamSnd_BigCombo1,
ePlayerStreamSnd_BigCombo2, 0.1f);
zEntPlayer_SNDPlayStream(21, 100, ePlayerStreamSnd_BigCombo1, 0x0);
break;
case 15:
zEntPlayer_SNDPlayStream(0, 100, ePlayerStreamSnd_BigCombo2, 0x0);
break;
}

if (comboHUD != NULL)
{
comboHUD->w.add_motive(xhud::motive(NULL, comboDisplayTime, (F32)0.0f, (F32)0.0f,
xhud::delay_motive_update, (void*)zComboHideMessage));
}

comboTimer = -1.0f;
comboCounter = 0;
comboLastCounter = 0;
}

}
}

bool ztextbox::visible()
{
return this->flag.visible;
Expand Down
1 change: 1 addition & 0 deletions src/SB/Game/zCombo.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <types.h>
#include "xFont.h"
#include "xHud.h"
#include "zEntPickup.h"

void zCombo_Setup();
void zCombo_Add(int);
Expand Down