10#ifndef SUPER_BLOCK_GAMEFLAG
11 #error SUPER_BLOCK_GAMEFLAG is not defined!
15#ifndef SUPER_BLOCK_MAPVAR
16 #error SUPER_BLOCK_MAPVAR is not defined!
25#define EVT_MAKE_SUPER_BLOCK(args...) \
26 Call(MakeEntity, Ref(Entity_SuperBlock), args, MAKE_ENTITY_END)\
27 Set(SUPER_BLOCK_MAPVAR, LVar0)\
28 Call(AssignBlockFlag, SUPER_BLOCK_GAMEFLAG)\
29 Call(AssignScript, Ref(N(SuperBlock_OnHit)))
34#define SUPER_BLOCK_NUM_ORBS 3
36s32 N(SuperBlock_CantUpgradeMessages)[2] = {
37 MSG_Menus_00F0, MSG_Menus_00F1
40s16 N(SuperBlock_PartnerIDs)[8] = {
51s32 N(SuperBlock_UpgradeDescMessages)[8][2] = {
52 { MSG_Menus_00E0, MSG_Menus_00E1 },
53 { MSG_Menus_00E2, MSG_Menus_00E3 },
54 { MSG_Menus_00E4, MSG_Menus_00E5 },
55 { MSG_Menus_00E6, MSG_Menus_00E7 },
56 { MSG_Menus_00E8, MSG_Menus_00E9 },
57 { MSG_Menus_00EA, MSG_Menus_00EB },
58 { MSG_Menus_00EC, MSG_Menus_00ED },
59 { MSG_Menus_00EE, MSG_Menus_00EF }
63 140.0f, 180.0f, 220.0f
66API_CALLABLE(N(SuperBlock_SetOverride40)) {
71API_CALLABLE(N(SuperBlock_ClearOverride40)) {
76API_CALLABLE(N(SuperBlock_HideBlockContent)) {
81API_CALLABLE(N(SuperBlock_GetPartnerRank)) {
85 s32 evt_var = *args++;
105API_CALLABLE(N(SuperBlock_CountEligiblePartners)) {
107 s16 var = script->varTable[12] >= 0;
110 script->varTable[0] = -1;
114 script->varTable[0] = 1;
122API_CALLABLE(N(SuperBlock_ShowSelectPartnerMenu)) {
126 s32 canUpgradePartner;
134 script->functionTempPtr[2] = popupMenu;
135 hasUltraStone = script->varTable[12] >= 0;
139 for (i = 0; i <
ARRAY_COUNT(N(SuperBlock_PartnerIDs)); i++) {
140 partnerID = N(SuperBlock_PartnerIDs)[i];
142 popupMenu->
userIndex[entryIndex] = partnerID;
145 if (canUpgradePartner >= 0) {
147 popupMenu->
enabled[entryIndex] = TRUE;
148 popupMenu->
descMsg[entryIndex] = N(SuperBlock_UpgradeDescMessages)[i][canUpgradePartner];
151 popupMenu->
enabled[entryIndex] = FALSE;
152 popupMenu->
descMsg[entryIndex] = N(SuperBlock_CantUpgradeMessages)[hasUltraStone];
163 script->functionTemp[0] = 0;
167 popupMenu = script->functionTempPtr[2];
168 if (script->functionTemp[0] == 0) {
169 script->functionTemp[1] = popupMenu->
result;
177 script->functionTemp[0]++;
178 if (script->functionTemp[0] < 15) {
185 script->varTable[1] = popupMenu->
userIndex[script->functionTemp[1] - 1];
187 script->varTable[0] = -1;
194API_CALLABLE(N(SuperBlock_SwitchToPartner)) {
199API_CALLABLE(N(SuperBlock_LoadCurrentPartnerName)) {
204API_CALLABLE(N(SuperBlock_StartGlowEffect)) {
205 Bytecode* args = script->ptrReadPos;
208 s32 effectPtrOutVar = *args++;
215API_CALLABLE(N(SuperBlock_EndGlowEffect)) {
222API_CALLABLE(N(SuperBlock_GatherEnergyFX)) {
225 fx_radial_shimmer(4, entity->
pos.
x, entity->
pos.
y + 12.5f, entity->
pos.
z, 1.0f, 75);
229API_CALLABLE(N(SuperBlock_RadiateFaintEnergyFX)) {
232 fx_radial_shimmer(9, npc->
pos.
x, npc->
pos.
y + 12.5f, npc->
pos.
z, 1.0f, 30);
251API_CALLABLE(N(SuperBlock_AnimateEnergyOrbs)) {
252 Bytecode* args = script->ptrReadPos;
255 f32 sinTheta, cosTheta;
272 userData->
posZ[i] = t1;
273 userData->
posY[i] = t1;
274 userData->
posX[i] = t1;
298 switch (userData->scatterState) {
302 x = userData->posY[i] = 0.0f;
303 add_vec2D_polar(&x, &userData->posY[i], t1, N(SuperBlock_UpgradeOrbAngles)[i]);
304 userData->posX[i] = cosTheta * x;
305 userData->posZ[i] = sinTheta * x;
308 userData->scatterStateTime++;
309 if (userData->scatterStateTime >= (s32)(21 *
DT)) {
310 userData->scatterState = 1;
311 userData->scatterStateTime = 0;
317 x = userData->posY[i] = 0.0f;
318 add_vec2D_polar(&x, &userData->posY[i], t1, N(SuperBlock_UpgradeOrbAngles)[i]);
319 userData->posX[i] = cosTheta * x;
320 userData->posZ[i] = sinTheta * x;
323 userData->scatterStateTime++;
324 if (userData->scatterStateTime > (s32)(15 *
DT)) {
325 userData->scatterStateTime = 15 *
DT;
326 userData->scatterState = 2;
330 userData->scatterStateTime++;
331 if (userData->scatterStateTime > (s32)(30 *
DT)) {
340 switch (userData->gatherState) {
342 userData->gatherStateTime++;
343 if (userData->gatherStateTime > (s32)(15 *
DT)) {
344 userData->gatherState = 1;
345 userData->gatherStateTime = 0;
355 userData->gatherStateTime++;
356 if (userData->gatherStateTime > (s32)(20 *
DT)) {
357 userData->gatherState = 2;
358 userData->gatherStateTime = 0;
364 userData->orbEffects[i]->data.motionBlurFlame->pos.x = userData->posX[i];
365 userData->orbEffects[i]->data.motionBlurFlame->pos.y = userData->posY[i];
366 userData->orbEffects[i]->data.motionBlurFlame->pos.z = userData->posZ[i];
372API_CALLABLE(N(SuperBlock_WhiteScreenFlash)) {
373 Bytecode* args = script->ptrReadPos;
379 script->functionTemp[0] = 0;
380 script->functionTemp[1] = 0;
384 switch (script->functionTemp[0]) {
386 if (script->functionTemp[1] == 255) {
387 script->functionTemp[0] = 1;
388 script->functionTemp[2] = 0;
390 script->functionTemp[1] += script->varTable[0];
391 if (script->functionTemp[1] > 255) {
392 script->functionTemp[1] = 255;
397 script->functionTemp[2]++;
398 if (script->functionTemp[2] >= 2) {
399 script->functionTemp[0] = 2;
404 if (script->functionTemp[1] == 0) {
407 script->functionTemp[1] -= script->varTable[1];
408 if (script->functionTemp[1] < 0) {
409 script->functionTemp[1] = 0;
419API_CALLABLE(N(SuperBlock_PartnerSparkles2)) {
425API_CALLABLE(N(SuperBlock_PartnerSparkles4)) {
431API_CALLABLE(N(SuperBlock_WaitForPlayerToLand)) {
432 script->varTable[0] = FALSE;
434 script->varTable[0] = TRUE;
439EvtScript N(SuperBlock_ShowUpgradeEffects) = {
442 Call(N(SuperBlock_GatherEnergyFX), SUPER_BLOCK_MAPVAR)
446 Call(N(SuperBlock_WhiteScreenFlash), 70, 70)
449 Call(N(SuperBlock_WhiteScreenFlash), 50, 50)
453 Call(N(SuperBlock_HideBlockContent), SUPER_BLOCK_MAPVAR)
457 Call(N(SuperBlock_RadiateFaintEnergyFX))
458 Call(N(SuperBlock_PartnerSparkles2))
460 Call(N(SuperBlock_PartnerSparkles4))
462 Call(N(SuperBlock_PartnerSparkles2))
465 Call(N(SuperBlock_AnimateEnergyOrbs), SUPER_BLOCK_MAPVAR)
472 IfEq(SUPER_BLOCK_GAMEFLAG, 1)
479 Call(N(SuperBlock_WaitForPlayerToLand))
484 Call(N(SuperBlock_SetOverride40))
488 Call(N(SuperBlock_StartGlowEffect), SUPER_BLOCK_MAPVAR,
LVar9)
490 Call(N(SuperBlock_CountEligiblePartners))
498 Call(N(SuperBlock_ClearOverride40))
507 Call(N(SuperBlock_ShowSelectPartnerMenu))
513 Call(N(SuperBlock_ClearOverride40))
521 Call(N(SuperBlock_SwitchToPartner),
LVarB)
534 Call(N(SuperBlock_ClearOverride40))
537 ExecWait(N(SuperBlock_ShowUpgradeEffects))
539 Set(SUPER_BLOCK_GAMEFLAG, 1)
541 Call(N(SuperBlock_LoadCurrentPartnerName))
550 Call(N(SuperBlock_ClearOverride40))
PartnerPopupProperties gPartnerPopupProperties[]
void create_standard_popup_menu(PopupMenu *popup)
#define SUPER_BLOCK_NUM_ORBS
s32 N SuperBlock_get_partner_rank(s32 idx, s16 maxLevel)
EffectInstance * orbEffects[3]
#define general_heap_malloc
@ FX_INSTANCE_FLAG_DISMISS
@ POPUP_MENU_UPGRADE_PARTNER
@ GLOBAL_OVERRIDES_CANT_PICK_UP_ITEMS
@ NPC_FLAG_IGNORE_PLAYER_COLLISION
Entity * get_entity_by_index(s32 index)
s32 evt_get_variable(Evt *script, Bytecode var)
f32 update_lerp(s32 easing, f32 start, f32 end, s32 elapsed, s32 duration)
void hide_popup_menu(void)
s32 evt_set_variable(Evt *script, Bytecode var, s32 value)
void set_screen_overlay_params_front(u8, f32)
void destroy_popup_menu(void)
void sin_cos_deg(f32 rad, f32 *outSinTheta, f32 *outCosTheta)
void switch_to_partner(s32 arg0)
void set_screen_overlay_color(s32, u8, u8, u8)
void set_message_text_var(s32 msgID, s32 index)
void add_vec2D_polar(f32 *x, f32 *y, f32 r, f32 theta)
void entity_upgrade_block_hide_content(s32)
void * heap_malloc(s32 size)
HudScript * wDisabledPartnerHudScripts[]
HudScript * wPartnerHudScripts[]
Npc * get_npc_safe(s32 npcID)
@ GF_Tutorial_SuperBlock
has learned about super blocks
ApiStatus PlaySound(Evt *script, b32 isInitialCall)
ApiStatus ModifyGlobalOverrideFlags(Evt *script, b32 isInitialCall)
ApiStatus DisablePartnerAI(Evt *script, b32 isInitialCall)
ApiStatus IsStartingConversation(Evt *script, b32 isInitialCall)
ApiStatus DisablePlayerInput(Evt *script, b32 isInitialCall)
Disables player and partner input, and disables the status menu.
ApiStatus GetCurrentPartnerID(Evt *script, b32 isInitialCall)
ApiStatus EnablePartnerAI(Evt *script, b32 isInitialCall)
ApiStatus ShowChoice(Evt *script, b32 isInitialCall)
ApiStatus CloseMessage(Evt *script, b32 isInitialCall)
ApiStatus SetNpcFlagBits(Evt *script, b32 isInitialCall)
ApiStatus func_802CF56C(Evt *script, b32 isInitialCall)
ApiStatus ShowMessageAtScreenPos(Evt *script, b32 isInitialCall)
ApiStatus FindItem(Evt *script, b32 isInitialCall)
#define Else
Marks the end of an if statement and the start of the else block.
#define Set(VAR, INT_VALUE)
Sets the given variable to a given value casted to an integer.
#define IfNe(LVAR, RVAR)
Marks the beginning of an if statement that only executes if LVAR != RVAR.
#define End
Signals the end of EVT script data. A script missing this will likely crash on load.
#define EndIf
Marks the end of an if statement or an else block.
#define ExecWait(EVT_SOURCE)
Launches a new child thread.
#define Thread
Marks the start of a thread block.
#define EndThread
Marks the end of a thread block.
#define Wait(NUM_FRAMES)
Blocks for the given number of frames.
#define IfEq(LVAR, RVAR)
Marks the beginning of an if statement that only executes if LVAR == RVAR.
#define Call(FUNC, ARGS...)
Calls a given C EVT API function with any number of arguments.
#define Return
Kills the current EVT thread.
PartnerStatus gPartnerStatus